aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandroid-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com>2022-04-19 13:59:21 +0000
committerandroid-autoroll <android-autoroll@skia-public.iam.gserviceaccount.com>2022-04-19 13:59:21 +0000
commitb88e2d0a426107550540819af7e8b7b81f70a4ca (patch)
tree74dd99a9dba828b0e772de72ebef474525e6fa80
parent9389240843c01a34e7b75e2ba2eb696b57805f96 (diff)
parentc0a055bfb780981c5e57d4fd05dc841ba5811297 (diff)
downloadswiftshader-b88e2d0a426107550540819af7e8b7b81f70a4ca.tar.gz
Roll SwiftShader from 103a69bd6c82 to c0a055bfb780 (1 revision)
https://swiftshader.googlesource.com/SwiftShader.git/+log/103a69bd6c82..c0a055bfb780 Please enable autosubmit on changes if possible when approving them. If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/swiftshader-android Please CC swiftshader-eng@google.com on the revert to ensure that a human is aware of the problem. To file a bug in SwiftShader: https://bugs.chromium.org/p/swiftshader/issues/entry To report a problem with the AutoRoller itself, please file a bug: https://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md Test: Presubmit checks will test this change. Exempt-From-Owner-Approval: The autoroll bot does not require owner approval. Bug: b/147516027 Change-Id: I47456e35073c41fb35a3b060f2d6f79ac9568749
-rw-r--r--CMakeLists.txt3
-rw-r--r--README.md2
-rw-r--r--docs/Index.md2
-rw-r--r--docs/Regres.md4
-rw-r--r--include/EGL/egl.h303
-rw-r--r--include/EGL/eglext.h1318
-rw-r--r--include/EGL/eglplatform.h158
-rw-r--r--include/GL/glcorearb.h5703
-rw-r--r--include/GL/glext.h12571
-rw-r--r--include/GL/glxext.h953
-rw-r--r--include/GL/wglext.h850
-rw-r--r--include/GLES/gl.h590
-rw-r--r--include/GLES/glext.h973
-rw-r--r--include/GLES/glplatform.h38
-rw-r--r--include/GLES2/gl2.h675
-rw-r--r--include/GLES2/gl2ext.h3619
-rw-r--r--include/GLES2/gl2platform.h38
-rw-r--r--include/GLES3/gl3.h1211
-rw-r--r--include/GLES3/gl3platform.h38
-rw-r--r--include/KHR/khrplatform.h282
-rw-r--r--src/Common/BUILD.gn42
-rw-r--r--src/Common/CPUID.cpp301
-rw-r--r--src/Common/CPUID.hpp137
-rw-r--r--src/Common/Configurator.cpp255
-rw-r--r--src/Common/Configurator.hpp66
-rw-r--r--src/Common/Debug.cpp39
-rw-r--r--src/Common/Debug.hpp58
-rw-r--r--src/Common/DebugAndroid.cpp53
-rw-r--r--src/Common/DebugAndroid.hpp99
-rw-r--r--src/Common/GrallocAndroid.cpp274
-rw-r--r--src/Common/GrallocAndroid.hpp60
-rw-r--r--src/Common/Half.cpp94
-rw-r--r--src/Common/Half.hpp94
-rw-r--r--src/Common/Math.cpp49
-rw-r--r--src/Common/Math.hpp405
-rw-r--r--src/Common/Memory.cpp141
-rw-r--r--src/Common/Memory.hpp32
-rw-r--r--src/Common/MutexLock.hpp199
-rw-r--r--src/Common/RecursiveLock.hpp72
-rw-r--r--src/Common/Resource.cpp184
-rw-r--r--src/Common/Resource.hpp112
-rw-r--r--src/Common/SharedLibrary.cpp52
-rw-r--r--src/Common/SharedLibrary.hpp137
-rw-r--r--src/Common/Socket.cpp110
-rw-r--r--src/Common/Socket.hpp49
-rw-r--r--src/Common/Thread.cpp91
-rw-r--r--src/Common/Thread.hpp338
-rw-r--r--src/Common/Timer.cpp97
-rw-r--r--src/Common/Timer.hpp37
-rw-r--r--src/Common/Types.hpp156
-rw-r--r--src/Common/Version.h24
-rw-r--r--src/Main/Config.cpp82
-rw-r--r--src/Main/Config.hpp103
-rw-r--r--src/Main/FrameBuffer.cpp634
-rw-r--r--src/Main/FrameBuffer.hpp108
-rw-r--r--src/Main/FrameBufferAndroid.cpp196
-rw-r--r--src/Main/FrameBufferAndroid.hpp50
-rw-r--r--src/Main/FrameBufferDD.cpp510
-rw-r--r--src/Main/FrameBufferDD.hpp69
-rw-r--r--src/Main/FrameBufferFactoryOzone.cpp33
-rw-r--r--src/Main/FrameBufferGDI.cpp162
-rw-r--r--src/Main/FrameBufferGDI.hpp56
-rw-r--r--src/Main/FrameBufferOSX.hpp49
-rw-r--r--src/Main/FrameBufferOSX.mm103
-rw-r--r--src/Main/FrameBufferOzone.cpp49
-rw-r--r--src/Main/FrameBufferOzone.hpp40
-rw-r--r--src/Main/FrameBufferWin.cpp78
-rw-r--r--src/Main/FrameBufferWin.hpp59
-rw-r--r--src/Main/FrameBufferX11.cpp199
-rw-r--r--src/Main/FrameBufferX11.hpp52
-rw-r--r--src/Main/SwiftConfig.cpp824
-rw-r--r--src/Main/SwiftConfig.hpp116
-rw-r--r--src/Main/libX11.cpp80
-rw-r--r--src/Main/libX11.hpp65
-rw-r--r--src/OpenGL/common/Image.cpp1709
-rw-r--r--src/OpenGL/common/Image.hpp369
-rw-r--r--src/OpenGL/common/MatrixStack.cpp217
-rw-r--r--src/OpenGL/common/MatrixStack.hpp59
-rw-r--r--src/OpenGL/common/NameSpace.hpp128
-rw-r--r--src/OpenGL/common/Object.cpp103
-rw-r--r--src/OpenGL/common/Object.hpp111
-rw-r--r--src/OpenGL/common/Surface.hpp52
-rw-r--r--src/OpenGL/common/debug.cpp69
-rw-r--r--src/OpenGL/common/debug.h104
-rw-r--r--src/OpenGL/compiler/AnalyzeCallDepth.cpp265
-rw-r--r--src/OpenGL/compiler/AnalyzeCallDepth.h64
-rw-r--r--src/OpenGL/compiler/BaseTypes.h474
-rw-r--r--src/OpenGL/compiler/Common.h85
-rw-r--r--src/OpenGL/compiler/Compiler.cpp274
-rw-r--r--src/OpenGL/compiler/Compiler.h130
-rw-r--r--src/OpenGL/compiler/ConstantUnion.h402
-rw-r--r--src/OpenGL/compiler/Diagnostics.cpp85
-rw-r--r--src/OpenGL/compiler/Diagnostics.h59
-rw-r--r--src/OpenGL/compiler/DirectiveHandler.cpp175
-rw-r--r--src/OpenGL/compiler/DirectiveHandler.h57
-rw-r--r--src/OpenGL/compiler/ExtensionBehavior.h45
-rw-r--r--src/OpenGL/compiler/InfoSink.cpp69
-rw-r--r--src/OpenGL/compiler/InfoSink.h124
-rw-r--r--src/OpenGL/compiler/Initialize.cpp534
-rw-r--r--src/OpenGL/compiler/Initialize.h31
-rw-r--r--src/OpenGL/compiler/InitializeGlobals.h21
-rw-r--r--src/OpenGL/compiler/InitializeParseContext.cpp48
-rw-r--r--src/OpenGL/compiler/InitializeParseContext.h25
-rw-r--r--src/OpenGL/compiler/IntermTraverse.cpp340
-rw-r--r--src/OpenGL/compiler/Intermediate.cpp2123
-rw-r--r--src/OpenGL/compiler/MMap.h64
-rw-r--r--src/OpenGL/compiler/OutputASM.cpp4076
-rw-r--r--src/OpenGL/compiler/OutputASM.h402
-rw-r--r--src/OpenGL/compiler/ParseHelper.cpp3765
-rw-r--r--src/OpenGL/compiler/ParseHelper.h281
-rw-r--r--src/OpenGL/compiler/PoolAlloc.cpp337
-rw-r--r--src/OpenGL/compiler/PoolAlloc.h314
-rw-r--r--src/OpenGL/compiler/Pragma.h27
-rw-r--r--src/OpenGL/compiler/SymbolTable.cpp284
-rw-r--r--src/OpenGL/compiler/SymbolTable.h534
-rw-r--r--src/OpenGL/compiler/TranslatorASM.cpp31
-rw-r--r--src/OpenGL/compiler/TranslatorASM.h38
-rw-r--r--src/OpenGL/compiler/Types.h673
-rw-r--r--src/OpenGL/compiler/ValidateLimitations.cpp505
-rw-r--r--src/OpenGL/compiler/ValidateLimitations.h67
-rw-r--r--src/OpenGL/compiler/ValidateSwitch.cpp208
-rw-r--r--src/OpenGL/compiler/ValidateSwitch.h61
-rw-r--r--src/OpenGL/compiler/debug.cpp44
-rw-r--r--src/OpenGL/compiler/debug.h66
-rw-r--r--src/OpenGL/compiler/generate_parser.sh37
-rw-r--r--src/OpenGL/compiler/glslang.h24
-rw-r--r--src/OpenGL/compiler/glslang.l589
-rw-r--r--src/OpenGL/compiler/glslang.y1630
-rw-r--r--src/OpenGL/compiler/glslang_lex.cpp3822
-rw-r--r--src/OpenGL/compiler/glslang_tab.cpp5112
-rw-r--r--src/OpenGL/compiler/glslang_tab.h248
-rw-r--r--src/OpenGL/compiler/intermOut.cpp483
-rw-r--r--src/OpenGL/compiler/intermediate.h758
-rw-r--r--src/OpenGL/compiler/localintermediate.h64
-rw-r--r--src/OpenGL/compiler/osinclude.h73
-rw-r--r--src/OpenGL/compiler/ossource_posix.cpp72
-rw-r--r--src/OpenGL/compiler/ossource_win.cpp65
-rw-r--r--src/OpenGL/compiler/parseConst.cpp251
-rw-r--r--src/OpenGL/compiler/preprocessor/BUILD.gn44
-rw-r--r--src/OpenGL/compiler/preprocessor/DiagnosticsBase.cpp163
-rw-r--r--src/OpenGL/compiler/preprocessor/DiagnosticsBase.h107
-rw-r--r--src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp24
-rw-r--r--src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.h51
-rw-r--r--src/OpenGL/compiler/preprocessor/DirectiveParser.cpp1013
-rw-r--r--src/OpenGL/compiler/preprocessor/DirectiveParser.h97
-rw-r--r--src/OpenGL/compiler/preprocessor/ExpressionParser.cpp2056
-rw-r--r--src/OpenGL/compiler/preprocessor/ExpressionParser.h49
-rw-r--r--src/OpenGL/compiler/preprocessor/ExpressionParser.y479
-rw-r--r--src/OpenGL/compiler/preprocessor/Input.cpp137
-rw-r--r--src/OpenGL/compiler/preprocessor/Input.h63
-rw-r--r--src/OpenGL/compiler/preprocessor/Lexer.cpp24
-rw-r--r--src/OpenGL/compiler/preprocessor/Lexer.h33
-rw-r--r--src/OpenGL/compiler/preprocessor/Macro.cpp52
-rw-r--r--src/OpenGL/compiler/preprocessor/Macro.h57
-rw-r--r--src/OpenGL/compiler/preprocessor/MacroExpander.cpp538
-rw-r--r--src/OpenGL/compiler/preprocessor/MacroExpander.h92
-rw-r--r--src/OpenGL/compiler/preprocessor/Preprocessor.cpp112
-rw-r--r--src/OpenGL/compiler/preprocessor/Preprocessor.h70
-rw-r--r--src/OpenGL/compiler/preprocessor/SourceLocation.h46
-rw-r--r--src/OpenGL/compiler/preprocessor/Token.cpp91
-rw-r--r--src/OpenGL/compiler/preprocessor/Token.h116
-rw-r--r--src/OpenGL/compiler/preprocessor/Tokenizer.cpp3082
-rw-r--r--src/OpenGL/compiler/preprocessor/Tokenizer.h67
-rw-r--r--src/OpenGL/compiler/preprocessor/Tokenizer.l400
-rw-r--r--src/OpenGL/compiler/preprocessor/generate_parser.sh36
-rw-r--r--src/OpenGL/compiler/preprocessor/length_limits.h29
-rw-r--r--src/OpenGL/compiler/preprocessor/numeric_lex.h70
-rw-r--r--src/OpenGL/compiler/preprocessor/pp_utils.h26
-rw-r--r--src/OpenGL/compiler/util.cpp42
-rw-r--r--src/OpenGL/compiler/util.h40
-rw-r--r--src/OpenGL/libEGL/Config.cpp467
-rw-r--r--src/OpenGL/libEGL/Config.h106
-rw-r--r--src/OpenGL/libEGL/Context.hpp55
-rw-r--r--src/OpenGL/libEGL/Display.cpp871
-rw-r--r--src/OpenGL/libEGL/Display.h117
-rw-r--r--src/OpenGL/libEGL/OSXUtils.hpp29
-rw-r--r--src/OpenGL/libEGL/OSXUtils.mm50
-rw-r--r--src/OpenGL/libEGL/Surface.cpp455
-rw-r--r--src/OpenGL/libEGL/Surface.hpp155
-rw-r--r--src/OpenGL/libEGL/Sync.hpp53
-rw-r--r--src/OpenGL/libEGL/Texture.hpp53
-rw-r--r--src/OpenGL/libEGL/libEGL.cpp1622
-rw-r--r--src/OpenGL/libEGL/libEGL.def49
-rw-r--r--src/OpenGL/libEGL/libEGL.hpp141
-rw-r--r--src/OpenGL/libEGL/libEGL.rc139
-rw-r--r--src/OpenGL/libEGL/libEGL_deprecated.def49
-rw-r--r--src/OpenGL/libEGL/libEGL_deprecated.exports64
-rw-r--r--src/OpenGL/libEGL/libEGL_deprecated.lds65
-rw-r--r--src/OpenGL/libEGL/main.cpp723
-rw-r--r--src/OpenGL/libEGL/main.h80
-rw-r--r--src/OpenGL/libEGL/resource.h17
-rw-r--r--src/OpenGL/libGLESv2/Buffer.cpp118
-rw-r--r--src/OpenGL/libGLESv2/Buffer.h90
-rw-r--r--src/OpenGL/libGLESv2/Context.cpp4588
-rw-r--r--src/OpenGL/libGLESv2/Context.h773
-rw-r--r--src/OpenGL/libGLESv2/Device.cpp1061
-rw-r--r--src/OpenGL/libGLESv2/Device.hpp114
-rw-r--r--src/OpenGL/libGLESv2/Fence.cpp173
-rw-r--r--src/OpenGL/libGLESv2/Fence.h64
-rw-r--r--src/OpenGL/libGLESv2/Framebuffer.cpp722
-rw-r--r--src/OpenGL/libGLESv2/Framebuffer.h124
-rw-r--r--src/OpenGL/libGLESv2/IndexDataManager.cpp463
-rw-r--r--src/OpenGL/libGLESv2/IndexDataManager.h74
-rw-r--r--src/OpenGL/libGLESv2/Program.cpp3134
-rw-r--r--src/OpenGL/libGLESv2/Program.h333
-rw-r--r--src/OpenGL/libGLESv2/Query.cpp167
-rw-r--r--src/OpenGL/libGLESv2/Query.h52
-rw-r--r--src/OpenGL/libGLESv2/Renderbuffer.cpp662
-rw-r--r--src/OpenGL/libGLESv2/Renderbuffer.h294
-rw-r--r--src/OpenGL/libGLESv2/ResourceManager.cpp354
-rw-r--r--src/OpenGL/libGLESv2/ResourceManager.h108
-rw-r--r--src/OpenGL/libGLESv2/Sampler.h86
-rw-r--r--src/OpenGL/libGLESv2/Shader.cpp482
-rw-r--r--src/OpenGL/libGLESv2/Shader.h137
-rw-r--r--src/OpenGL/libGLESv2/Texture.cpp2068
-rw-r--r--src/OpenGL/libGLESv2/Texture.h417
-rw-r--r--src/OpenGL/libGLESv2/TransformFeedback.cpp120
-rw-r--r--src/OpenGL/libGLESv2/TransformFeedback.h66
-rw-r--r--src/OpenGL/libGLESv2/VertexArray.cpp85
-rw-r--r--src/OpenGL/libGLESv2/VertexArray.h53
-rw-r--r--src/OpenGL/libGLESv2/VertexDataManager.cpp359
-rw-r--r--src/OpenGL/libGLESv2/VertexDataManager.h101
-rw-r--r--src/OpenGL/libGLESv2/entry_points.cpp1754
-rw-r--r--src/OpenGL/libGLESv2/entry_points.h334
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2.cpp6604
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2.def297
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2.hpp327
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2.rc106
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2_deprecated.def297
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2_deprecated.exports302
-rw-r--r--src/OpenGL/libGLESv2/libGLESv2_deprecated.lds303
-rw-r--r--src/OpenGL/libGLESv2/libGLESv3.cpp3841
-rw-r--r--src/OpenGL/libGLESv2/main.cpp147
-rw-r--r--src/OpenGL/libGLESv2/main.h54
-rw-r--r--src/OpenGL/libGLESv2/mathutil.h100
-rw-r--r--src/OpenGL/libGLESv2/resource.h14
-rw-r--r--src/OpenGL/libGLESv2/utilities.cpp2346
-rw-r--r--src/OpenGL/libGLESv2/utilities.h118
-rw-r--r--src/Renderer/Blitter.cpp1483
-rw-r--r--src/Renderer/Blitter.hpp122
-rw-r--r--src/Renderer/Clipper.cpp359
-rw-r--r--src/Renderer/Clipper.hpp77
-rw-r--r--src/Renderer/Color.cpp19
-rw-r--r--src/Renderer/Color.hpp472
-rw-r--r--src/Renderer/Context.cpp1504
-rw-r--r--src/Renderer/Context.hpp540
-rw-r--r--src/Renderer/ETC_Decoder.cpp741
-rw-r--r--src/Renderer/ETC_Decoder.hpp41
-rw-r--r--src/Renderer/LRUCache.hpp169
-rw-r--r--src/Renderer/Matrix.cpp402
-rw-r--r--src/Renderer/Matrix.hpp203
-rw-r--r--src/Renderer/PixelProcessor.cpp1221
-rw-r--r--src/Renderer/PixelProcessor.hpp346
-rw-r--r--src/Renderer/Plane.cpp60
-rw-r--r--src/Renderer/Plane.hpp40
-rw-r--r--src/Renderer/Point.cpp92
-rw-r--r--src/Renderer/Point.hpp139
-rw-r--r--src/Renderer/Polygon.hpp56
-rw-r--r--src/Renderer/Primitive.hpp80
-rw-r--r--src/Renderer/QuadRasterizer.cpp350
-rw-r--r--src/Renderer/QuadRasterizer.hpp65
-rw-r--r--src/Renderer/Rasterizer.hpp40
-rw-r--r--src/Renderer/Renderer.cpp2976
-rw-r--r--src/Renderer/Renderer.hpp516
-rw-r--r--src/Renderer/RoutineCache.hpp30
-rw-r--r--src/Renderer/Sampler.cpp514
-rw-r--r--src/Renderer/Sampler.hpp248
-rw-r--r--src/Renderer/SetupProcessor.cpp246
-rw-r--r--src/Renderer/SetupProcessor.hpp105
-rw-r--r--src/Renderer/Stream.hpp105
-rw-r--r--src/Renderer/Surface.cpp5996
-rw-r--r--src/Renderer/Surface.hpp636
-rw-r--r--src/Renderer/TextureStage.cpp412
-rw-r--r--src/Renderer/TextureStage.hpp198
-rw-r--r--src/Renderer/Triangle.hpp30
-rw-r--r--src/Renderer/Vector.cpp175
-rw-r--r--src/Renderer/Vector.hpp153
-rw-r--r--src/Renderer/Vertex.hpp98
-rw-r--r--src/Renderer/VertexProcessor.cpp1126
-rw-r--r--src/Renderer/VertexProcessor.hpp354
-rw-r--r--src/Shader/Constants.cpp362
-rw-r--r--src/Shader/Constants.hpp113
-rw-r--r--src/Shader/PixelPipeline.cpp1959
-rw-r--r--src/Shader/PixelPipeline.hpp114
-rw-r--r--src/Shader/PixelProgram.cpp1897
-rw-r--r--src/Shader/PixelProgram.hpp153
-rw-r--r--src/Shader/PixelRoutine.cpp2731
-rw-r--r--src/Shader/PixelRoutine.hpp93
-rw-r--r--src/Shader/PixelShader.cpp747
-rw-r--r--src/Shader/PixelShader.hpp63
-rw-r--r--src/Shader/SamplerCore.cpp3034
-rw-r--r--src/Shader/SamplerCore.hpp116
-rw-r--r--src/Shader/SetupRoutine.cpp672
-rw-r--r--src/Shader/SetupRoutine.hpp47
-rw-r--r--src/Shader/Shader.cpp2122
-rw-r--r--src/Shader/Shader.hpp677
-rw-r--r--src/Shader/ShaderCore.cpp2020
-rw-r--r--src/Shader/ShaderCore.hpp415
-rw-r--r--src/Shader/VertexPipeline.cpp953
-rw-r--r--src/Shader/VertexPipeline.hpp45
-rw-r--r--src/Shader/VertexProgram.cpp1671
-rw-r--r--src/Shader/VertexProgram.hpp143
-rw-r--r--src/Shader/VertexRoutine.cpp788
-rw-r--r--src/Shader/VertexRoutine.hpp71
-rw-r--r--src/Shader/VertexShader.cpp331
-rw-r--r--src/Shader/VertexShader.hpp78
-rw-r--r--src/SwiftShader.workspace16
-rw-r--r--tests/regres/cov/import.go7
308 files changed, 6 insertions, 163284 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index deb0c05aa..802c04694 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -856,10 +856,7 @@ if(SWIFTSHADER_BUILD_PVR)
endif()
set(PVR_BUILD_EXAMPLES TRUE CACHE BOOL "Build the PowerVR SDK Examples" FORCE)
- set(PVR_BUILD_OPENGLES_EXAMPLES FALSE CACHE BOOL "Build the OpenGLES PowerVR SDK Examples" FORCE)
set(PVR_BUILD_VULKAN_EXAMPLES TRUE CACHE BOOL "Build the Vulkan PowerVR SDK Examples" FORCE)
- set(PVR_BUILD_OPENCL_EXAMPLES FALSE CACHE BOOL "Build the OpenCL PowerVR SDK Examples" FORCE)
- set(PVR_BUILD_OPENGLES2_EXAMPLES FALSE CACHE BOOL "Only build OpenGL ES 2.0 examples" FORCE)
add_subdirectory(${THIRD_PARTY_DIR}/PowerVR_Examples)
# Samples known to work well
diff --git a/README.md b/README.md
index bd5a9b897..8edb03126 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@ Introduction
SwiftShader is a high-performance CPU-based implementation of the Vulkan graphics API<sup>1</sup><sup>2</sup>. Its goal is to provide hardware independence for advanced 3D graphics.
-> NOTE: SwiftShader's OpenGL ES implementation is no longer supported, and will be removed. The [ANGLE](http://angleproject.org/) project can be used to achieve a layered implementation of OpenGL ES (aka. "SwANGLE").
+> NOTE: The [ANGLE](http://angleproject.org/) project can be used to achieve a layered implementation of OpenGL ES (aka. "SwANGLE").
Building
--------
diff --git a/docs/Index.md b/docs/Index.md
index de2262324..2ec49f5ce 100644
--- a/docs/Index.md
+++ b/docs/Index.md
@@ -1,3 +1,5 @@
+> :warning: **Out of date**
+
SwiftShader Documentation
=========================
diff --git a/docs/Regres.md b/docs/Regres.md
index abe5d932f..c752a726d 100644
--- a/docs/Regres.md
+++ b/docs/Regres.md
@@ -8,10 +8,10 @@ SwiftShader.
Regres provides:
-* [Presubmit testing](#presubmit-testing) - An automatic OpenGL|ES and Vulkan
+* [Presubmit testing](#presubmit-testing) - An automatic Vulkan
dEQP test run for each Gerrit patchset put up for review.
* [Continuous integration testing](#daily-run-continuous-integration-testing) -
- A OpenGL|ES and Vulkan dEQP test run performed against the `master` branch each night. \
+ A Vulkan dEQP test run performed against the `master` branch each night. \
This nightly run also produces code coverage information which can be viewed at
[swiftshader-regres.github.io/swiftshader-coverage](https://swiftshader-regres.github.io/swiftshader-coverage/).
* [Local dEQP test runner](#local-dEQP-test-runner) Provides a local tool for
diff --git a/include/EGL/egl.h b/include/EGL/egl.h
deleted file mode 100644
index c9e8b7c52..000000000
--- a/include/EGL/egl.h
+++ /dev/null
@@ -1,303 +0,0 @@
-#ifndef __egl_h_
-#define __egl_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2017 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.khronos.org/registry/egl
-**
-** Khronos $Git commit SHA1: bae3518c48 $ on $Git commit date: 2018-05-17 10:56:57 -0700 $
-*/
-
-#include <EGL/eglplatform.h>
-
-/* Generated on date 20180517 */
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_VERSION_1_0
-#define EGL_VERSION_1_0 1
-typedef unsigned int EGLBoolean;
-typedef void *EGLDisplay;
-#include <KHR/khrplatform.h>
-#include <EGL/eglplatform.h>
-typedef void *EGLConfig;
-typedef void *EGLSurface;
-typedef void *EGLContext;
-typedef void (*__eglMustCastToProperFunctionPointerType)(void);
-#define EGL_ALPHA_SIZE 0x3021
-#define EGL_BAD_ACCESS 0x3002
-#define EGL_BAD_ALLOC 0x3003
-#define EGL_BAD_ATTRIBUTE 0x3004
-#define EGL_BAD_CONFIG 0x3005
-#define EGL_BAD_CONTEXT 0x3006
-#define EGL_BAD_CURRENT_SURFACE 0x3007
-#define EGL_BAD_DISPLAY 0x3008
-#define EGL_BAD_MATCH 0x3009
-#define EGL_BAD_NATIVE_PIXMAP 0x300A
-#define EGL_BAD_NATIVE_WINDOW 0x300B
-#define EGL_BAD_PARAMETER 0x300C
-#define EGL_BAD_SURFACE 0x300D
-#define EGL_BLUE_SIZE 0x3022
-#define EGL_BUFFER_SIZE 0x3020
-#define EGL_CONFIG_CAVEAT 0x3027
-#define EGL_CONFIG_ID 0x3028
-#define EGL_CORE_NATIVE_ENGINE 0x305B
-#define EGL_DEPTH_SIZE 0x3025
-#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
-#define EGL_DRAW 0x3059
-#define EGL_EXTENSIONS 0x3055
-#define EGL_FALSE 0
-#define EGL_GREEN_SIZE 0x3023
-#define EGL_HEIGHT 0x3056
-#define EGL_LARGEST_PBUFFER 0x3058
-#define EGL_LEVEL 0x3029
-#define EGL_MAX_PBUFFER_HEIGHT 0x302A
-#define EGL_MAX_PBUFFER_PIXELS 0x302B
-#define EGL_MAX_PBUFFER_WIDTH 0x302C
-#define EGL_NATIVE_RENDERABLE 0x302D
-#define EGL_NATIVE_VISUAL_ID 0x302E
-#define EGL_NATIVE_VISUAL_TYPE 0x302F
-#define EGL_NONE 0x3038
-#define EGL_NON_CONFORMANT_CONFIG 0x3051
-#define EGL_NOT_INITIALIZED 0x3001
-#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
-#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
-#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
-#define EGL_PBUFFER_BIT 0x0001
-#define EGL_PIXMAP_BIT 0x0002
-#define EGL_READ 0x305A
-#define EGL_RED_SIZE 0x3024
-#define EGL_SAMPLES 0x3031
-#define EGL_SAMPLE_BUFFERS 0x3032
-#define EGL_SLOW_CONFIG 0x3050
-#define EGL_STENCIL_SIZE 0x3026
-#define EGL_SUCCESS 0x3000
-#define EGL_SURFACE_TYPE 0x3033
-#define EGL_TRANSPARENT_BLUE_VALUE 0x3035
-#define EGL_TRANSPARENT_GREEN_VALUE 0x3036
-#define EGL_TRANSPARENT_RED_VALUE 0x3037
-#define EGL_TRANSPARENT_RGB 0x3052
-#define EGL_TRANSPARENT_TYPE 0x3034
-#define EGL_TRUE 1
-#define EGL_VENDOR 0x3053
-#define EGL_VERSION 0x3054
-#define EGL_WIDTH 0x3057
-#define EGL_WINDOW_BIT 0x0004
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig (EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers (EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext (EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface (EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface (EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface (EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext (EGLDisplay dpy, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib (EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs (EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay (void);
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface (EGLint readdraw);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay (EGLNativeDisplayType display_id);
-EGLAPI EGLint EGLAPIENTRY eglGetError (void);
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress (const char *procname);
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize (EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent (EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext (EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-EGLAPI const char *EGLAPIENTRY eglQueryString (EGLDisplay dpy, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers (EGLDisplay dpy, EGLSurface surface);
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate (EGLDisplay dpy);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative (EGLint engine);
-#endif /* EGL_VERSION_1_0 */
-
-#ifndef EGL_VERSION_1_1
-#define EGL_VERSION_1_1 1
-#define EGL_BACK_BUFFER 0x3084
-#define EGL_BIND_TO_TEXTURE_RGB 0x3039
-#define EGL_BIND_TO_TEXTURE_RGBA 0x303A
-#define EGL_CONTEXT_LOST 0x300E
-#define EGL_MIN_SWAP_INTERVAL 0x303B
-#define EGL_MAX_SWAP_INTERVAL 0x303C
-#define EGL_MIPMAP_TEXTURE 0x3082
-#define EGL_MIPMAP_LEVEL 0x3083
-#define EGL_NO_TEXTURE 0x305C
-#define EGL_TEXTURE_2D 0x305F
-#define EGL_TEXTURE_FORMAT 0x3080
-#define EGL_TEXTURE_RGB 0x305D
-#define EGL_TEXTURE_RGBA 0x305E
-#define EGL_TEXTURE_TARGET 0x3081
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage (EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval (EGLDisplay dpy, EGLint interval);
-#endif /* EGL_VERSION_1_1 */
-
-#ifndef EGL_VERSION_1_2
-#define EGL_VERSION_1_2 1
-typedef unsigned int EGLenum;
-typedef void *EGLClientBuffer;
-#define EGL_ALPHA_FORMAT 0x3088
-#define EGL_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_ALPHA_FORMAT_PRE 0x308C
-#define EGL_ALPHA_MASK_SIZE 0x303E
-#define EGL_BUFFER_PRESERVED 0x3094
-#define EGL_BUFFER_DESTROYED 0x3095
-#define EGL_CLIENT_APIS 0x308D
-#define EGL_COLORSPACE 0x3087
-#define EGL_COLORSPACE_sRGB 0x3089
-#define EGL_COLORSPACE_LINEAR 0x308A
-#define EGL_COLOR_BUFFER_TYPE 0x303F
-#define EGL_CONTEXT_CLIENT_TYPE 0x3097
-#define EGL_DISPLAY_SCALING 10000
-#define EGL_HORIZONTAL_RESOLUTION 0x3090
-#define EGL_LUMINANCE_BUFFER 0x308F
-#define EGL_LUMINANCE_SIZE 0x303D
-#define EGL_OPENGL_ES_BIT 0x0001
-#define EGL_OPENVG_BIT 0x0002
-#define EGL_OPENGL_ES_API 0x30A0
-#define EGL_OPENVG_API 0x30A1
-#define EGL_OPENVG_IMAGE 0x3096
-#define EGL_PIXEL_ASPECT_RATIO 0x3092
-#define EGL_RENDERABLE_TYPE 0x3040
-#define EGL_RENDER_BUFFER 0x3086
-#define EGL_RGB_BUFFER 0x308E
-#define EGL_SINGLE_BUFFER 0x3085
-#define EGL_SWAP_BEHAVIOR 0x3093
-#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
-#define EGL_VERTICAL_RESOLUTION 0x3091
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer (EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread (void);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
-#endif /* EGL_VERSION_1_2 */
-
-#ifndef EGL_VERSION_1_3
-#define EGL_VERSION_1_3 1
-#define EGL_CONFORMANT 0x3042
-#define EGL_CONTEXT_CLIENT_VERSION 0x3098
-#define EGL_MATCH_NATIVE_PIXMAP 0x3041
-#define EGL_OPENGL_ES2_BIT 0x0004
-#define EGL_VG_ALPHA_FORMAT 0x3088
-#define EGL_VG_ALPHA_FORMAT_NONPRE 0x308B
-#define EGL_VG_ALPHA_FORMAT_PRE 0x308C
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT 0x0040
-#define EGL_VG_COLORSPACE 0x3087
-#define EGL_VG_COLORSPACE_sRGB 0x3089
-#define EGL_VG_COLORSPACE_LINEAR 0x308A
-#define EGL_VG_COLORSPACE_LINEAR_BIT 0x0020
-#endif /* EGL_VERSION_1_3 */
-
-#ifndef EGL_VERSION_1_4
-#define EGL_VERSION_1_4 1
-#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
-#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
-#define EGL_MULTISAMPLE_RESOLVE 0x3099
-#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
-#define EGL_MULTISAMPLE_RESOLVE_BOX 0x309B
-#define EGL_OPENGL_API 0x30A2
-#define EGL_OPENGL_BIT 0x0008
-#define EGL_SWAP_BEHAVIOR_PRESERVED_BIT 0x0400
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext (void);
-#endif /* EGL_VERSION_1_4 */
-
-#ifndef EGL_VERSION_1_5
-#define EGL_VERSION_1_5 1
-typedef void *EGLSync;
-typedef intptr_t EGLAttrib;
-typedef khronos_utime_nanoseconds_t EGLTime;
-typedef void *EGLImage;
-#define EGL_CONTEXT_MAJOR_VERSION 0x3098
-#define EGL_CONTEXT_MINOR_VERSION 0x30FB
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY 0x31BD
-#define EGL_NO_RESET_NOTIFICATION 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET 0x31BF
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define EGL_CONTEXT_OPENGL_DEBUG 0x31B0
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE 0x31B1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS 0x31B2
-#define EGL_OPENGL_ES3_BIT 0x00000040
-#define EGL_CL_EVENT_HANDLE 0x309C
-#define EGL_SYNC_CL_EVENT 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE 0x30FF
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE 0x30F0
-#define EGL_SYNC_TYPE 0x30F7
-#define EGL_SYNC_STATUS 0x30F1
-#define EGL_SYNC_CONDITION 0x30F8
-#define EGL_SIGNALED 0x30F2
-#define EGL_UNSIGNALED 0x30F3
-#define EGL_SYNC_FLUSH_COMMANDS_BIT 0x0001
-#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
-#define EGL_TIMEOUT_EXPIRED 0x30F5
-#define EGL_CONDITION_SATISFIED 0x30F6
-#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
-#define EGL_SYNC_FENCE 0x30F9
-#define EGL_GL_COLORSPACE 0x309D
-#define EGL_GL_COLORSPACE_SRGB 0x3089
-#define EGL_GL_COLORSPACE_LINEAR 0x308A
-#define EGL_GL_RENDERBUFFER 0x30B9
-#define EGL_GL_TEXTURE_2D 0x30B1
-#define EGL_GL_TEXTURE_LEVEL 0x30BC
-#define EGL_GL_TEXTURE_3D 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET 0x30BD
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
-#define EGL_IMAGE_PRESERVED 0x30D2
-#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
-EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib (EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value);
-EGLAPI EGLImage EGLAPIENTRY eglCreateImage (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage (EGLDisplay dpy, EGLImage image);
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay (EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags);
-#endif /* EGL_VERSION_1_5 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/EGL/eglext.h b/include/EGL/eglext.h
deleted file mode 100644
index ad4ffd7d8..000000000
--- a/include/EGL/eglext.h
+++ /dev/null
@@ -1,1318 +0,0 @@
-#ifndef __eglext_h_
-#define __eglext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2017 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** http://www.khronos.org/registry/egl
-**
-** Khronos $Git commit SHA1: bae3518c48 $ on $Git commit date: 2018-05-17 10:56:57 -0700 $
-*/
-
-#include <EGL/eglplatform.h>
-
-#define EGL_EGLEXT_VERSION 20180517
-
-/* Generated C header for:
- * API: egl
- * Versions considered: .*
- * Versions emitted: _nomatch_^
- * Default extensions included: egl
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef EGL_KHR_cl_event
-#define EGL_KHR_cl_event 1
-#define EGL_CL_EVENT_HANDLE_KHR 0x309C
-#define EGL_SYNC_CL_EVENT_KHR 0x30FE
-#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
-#endif /* EGL_KHR_cl_event */
-
-#ifndef EGL_KHR_cl_event2
-#define EGL_KHR_cl_event2 1
-typedef void *EGLSyncKHR;
-typedef intptr_t EGLAttribKHR;
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNC64KHRPROC) (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync64KHR (EGLDisplay dpy, EGLenum type, const EGLAttribKHR *attrib_list);
-#endif
-#endif /* EGL_KHR_cl_event2 */
-
-#ifndef EGL_KHR_client_get_all_proc_addresses
-#define EGL_KHR_client_get_all_proc_addresses 1
-#endif /* EGL_KHR_client_get_all_proc_addresses */
-
-#ifndef EGL_KHR_config_attribs
-#define EGL_KHR_config_attribs 1
-#define EGL_CONFORMANT_KHR 0x3042
-#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
-#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
-#endif /* EGL_KHR_config_attribs */
-
-#ifndef EGL_KHR_context_flush_control
-#define EGL_KHR_context_flush_control 1
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_NONE_KHR 0
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x2097
-#define EGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x2098
-#endif /* EGL_KHR_context_flush_control */
-
-#ifndef EGL_KHR_create_context
-#define EGL_KHR_create_context 1
-#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
-#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
-#define EGL_CONTEXT_FLAGS_KHR 0x30FC
-#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
-#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
-#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
-#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
-#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
-#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
-#endif /* EGL_KHR_create_context */
-
-#ifndef EGL_KHR_create_context_no_error
-#define EGL_KHR_create_context_no_error 1
-#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3
-#endif /* EGL_KHR_create_context_no_error */
-
-#ifndef EGL_KHR_debug
-#define EGL_KHR_debug 1
-typedef void *EGLLabelKHR;
-typedef void *EGLObjectKHR;
-typedef void (EGLAPIENTRY *EGLDEBUGPROCKHR)(EGLenum error,const char *command,EGLint messageType,EGLLabelKHR threadLabel,EGLLabelKHR objectLabel,const char* message);
-#define EGL_OBJECT_THREAD_KHR 0x33B0
-#define EGL_OBJECT_DISPLAY_KHR 0x33B1
-#define EGL_OBJECT_CONTEXT_KHR 0x33B2
-#define EGL_OBJECT_SURFACE_KHR 0x33B3
-#define EGL_OBJECT_IMAGE_KHR 0x33B4
-#define EGL_OBJECT_SYNC_KHR 0x33B5
-#define EGL_OBJECT_STREAM_KHR 0x33B6
-#define EGL_DEBUG_MSG_CRITICAL_KHR 0x33B9
-#define EGL_DEBUG_MSG_ERROR_KHR 0x33BA
-#define EGL_DEBUG_MSG_WARN_KHR 0x33BB
-#define EGL_DEBUG_MSG_INFO_KHR 0x33BC
-#define EGL_DEBUG_CALLBACK_KHR 0x33B8
-typedef EGLint (EGLAPIENTRYP PFNEGLDEBUGMESSAGECONTROLKHRPROC) (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEBUGKHRPROC) (EGLint attribute, EGLAttrib *value);
-typedef EGLint (EGLAPIENTRYP PFNEGLLABELOBJECTKHRPROC) (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglDebugMessageControlKHR (EGLDEBUGPROCKHR callback, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDebugKHR (EGLint attribute, EGLAttrib *value);
-EGLAPI EGLint EGLAPIENTRY eglLabelObjectKHR (EGLDisplay display, EGLenum objectType, EGLObjectKHR object, EGLLabelKHR label);
-#endif
-#endif /* EGL_KHR_debug */
-
-#ifndef EGL_KHR_display_reference
-#define EGL_KHR_display_reference 1
-#define EGL_TRACK_REFERENCES_KHR 0x3352
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBKHRPROC) (EGLDisplay dpy, EGLint name, EGLAttrib *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribKHR (EGLDisplay dpy, EGLint name, EGLAttrib *value);
-#endif
-#endif /* EGL_KHR_display_reference */
-
-#ifndef EGL_KHR_fence_sync
-#define EGL_KHR_fence_sync 1
-typedef khronos_utime_nanoseconds_t EGLTimeKHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
-#define EGL_SYNC_CONDITION_KHR 0x30F8
-#define EGL_SYNC_FENCE_KHR 0x30F9
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_fence_sync */
-
-#ifndef EGL_KHR_get_all_proc_addresses
-#define EGL_KHR_get_all_proc_addresses 1
-#endif /* EGL_KHR_get_all_proc_addresses */
-
-#ifndef EGL_KHR_gl_colorspace
-#define EGL_KHR_gl_colorspace 1
-#define EGL_GL_COLORSPACE_KHR 0x309D
-#define EGL_GL_COLORSPACE_SRGB_KHR 0x3089
-#define EGL_GL_COLORSPACE_LINEAR_KHR 0x308A
-#endif /* EGL_KHR_gl_colorspace */
-
-#ifndef EGL_KHR_gl_renderbuffer_image
-#define EGL_KHR_gl_renderbuffer_image 1
-#define EGL_GL_RENDERBUFFER_KHR 0x30B9
-#endif /* EGL_KHR_gl_renderbuffer_image */
-
-#ifndef EGL_KHR_gl_texture_2D_image
-#define EGL_KHR_gl_texture_2D_image 1
-#define EGL_GL_TEXTURE_2D_KHR 0x30B1
-#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
-#endif /* EGL_KHR_gl_texture_2D_image */
-
-#ifndef EGL_KHR_gl_texture_3D_image
-#define EGL_KHR_gl_texture_3D_image 1
-#define EGL_GL_TEXTURE_3D_KHR 0x30B2
-#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
-#endif /* EGL_KHR_gl_texture_3D_image */
-
-#ifndef EGL_KHR_gl_texture_cubemap_image
-#define EGL_KHR_gl_texture_cubemap_image 1
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
-#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
-#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
-#endif /* EGL_KHR_gl_texture_cubemap_image */
-
-#ifndef EGL_KHR_image
-#define EGL_KHR_image 1
-typedef void *EGLImageKHR;
-#define EGL_NATIVE_PIXMAP_KHR 0x30B0
-#define EGL_NO_IMAGE_KHR EGL_CAST(EGLImageKHR,0)
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
-#endif
-#endif /* EGL_KHR_image */
-
-#ifndef EGL_KHR_image_base
-#define EGL_KHR_image_base 1
-#define EGL_IMAGE_PRESERVED_KHR 0x30D2
-#endif /* EGL_KHR_image_base */
-
-#ifndef EGL_KHR_image_pixmap
-#define EGL_KHR_image_pixmap 1
-#endif /* EGL_KHR_image_pixmap */
-
-#ifndef EGL_KHR_lock_surface
-#define EGL_KHR_lock_surface 1
-#define EGL_READ_SURFACE_BIT_KHR 0x0001
-#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
-#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
-#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
-#define EGL_MATCH_FORMAT_KHR 0x3043
-#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
-#define EGL_FORMAT_RGB_565_KHR 0x30C1
-#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
-#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
-#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
-#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
-#define EGL_BITMAP_POINTER_KHR 0x30C6
-#define EGL_BITMAP_PITCH_KHR 0x30C7
-#define EGL_BITMAP_ORIGIN_KHR 0x30C8
-#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
-#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
-#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
-#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
-#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
-#define EGL_LOWER_LEFT_KHR 0x30CE
-#define EGL_UPPER_LEFT_KHR 0x30CF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay dpy, EGLSurface surface);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay dpy, EGLSurface surface, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay dpy, EGLSurface surface);
-#endif
-#endif /* EGL_KHR_lock_surface */
-
-#ifndef EGL_KHR_lock_surface2
-#define EGL_KHR_lock_surface2 1
-#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
-#endif /* EGL_KHR_lock_surface2 */
-
-#ifndef EGL_KHR_lock_surface3
-#define EGL_KHR_lock_surface3 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACE64KHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface64KHR (EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLAttribKHR *value);
-#endif
-#endif /* EGL_KHR_lock_surface3 */
-
-#ifndef EGL_KHR_mutable_render_buffer
-#define EGL_KHR_mutable_render_buffer 1
-#define EGL_MUTABLE_RENDER_BUFFER_BIT_KHR 0x1000
-#endif /* EGL_KHR_mutable_render_buffer */
-
-#ifndef EGL_KHR_no_config_context
-#define EGL_KHR_no_config_context 1
-#define EGL_NO_CONFIG_KHR EGL_CAST(EGLConfig,0)
-#endif /* EGL_KHR_no_config_context */
-
-#ifndef EGL_KHR_partial_update
-#define EGL_KHR_partial_update 1
-#define EGL_BUFFER_AGE_KHR 0x313D
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_partial_update */
-
-#ifndef EGL_KHR_platform_android
-#define EGL_KHR_platform_android 1
-#define EGL_PLATFORM_ANDROID_KHR 0x3141
-#endif /* EGL_KHR_platform_android */
-
-#ifndef EGL_KHR_platform_gbm
-#define EGL_KHR_platform_gbm 1
-#define EGL_PLATFORM_GBM_KHR 0x31D7
-#endif /* EGL_KHR_platform_gbm */
-
-#ifndef EGL_KHR_platform_wayland
-#define EGL_KHR_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_KHR 0x31D8
-#endif /* EGL_KHR_platform_wayland */
-
-#ifndef EGL_KHR_platform_x11
-#define EGL_KHR_platform_x11 1
-#define EGL_PLATFORM_X11_KHR 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_KHR 0x31D6
-#endif /* EGL_KHR_platform_x11 */
-
-#ifndef EGL_KHR_reusable_sync
-#define EGL_KHR_reusable_sync 1
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_STATUS_KHR 0x30F1
-#define EGL_SIGNALED_KHR 0x30F2
-#define EGL_UNSIGNALED_KHR 0x30F3
-#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
-#define EGL_CONDITION_SATISFIED_KHR 0x30F6
-#define EGL_SYNC_TYPE_KHR 0x30F7
-#define EGL_SYNC_REUSABLE_KHR 0x30FA
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
-#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
-#define EGL_NO_SYNC_KHR EGL_CAST(EGLSyncKHR,0)
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_reusable_sync */
-
-#ifndef EGL_KHR_stream
-#define EGL_KHR_stream 1
-typedef void *EGLStreamKHR;
-typedef khronos_uint64_t EGLuint64KHR;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_NO_STREAM_KHR EGL_CAST(EGLStreamKHR,0)
-#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
-#define EGL_PRODUCER_FRAME_KHR 0x3212
-#define EGL_CONSUMER_FRAME_KHR 0x3213
-#define EGL_STREAM_STATE_KHR 0x3214
-#define EGL_STREAM_STATE_CREATED_KHR 0x3215
-#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
-#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
-#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
-#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
-#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
-#define EGL_BAD_STREAM_KHR 0x321B
-#define EGL_BAD_STATE_KHR 0x321C
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_stream */
-
-#ifndef EGL_KHR_stream_attrib
-#define EGL_KHR_stream_attrib 1
-#ifdef KHRONOS_SUPPORT_INT64
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMATTRIBKHRPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamAttribKHR (EGLDisplay dpy, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLAttrib *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_KHR_stream_attrib */
-
-#ifndef EGL_KHR_stream_consumer_gltexture
-#define EGL_KHR_stream_consumer_gltexture 1
-#ifdef EGL_KHR_stream
-#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_consumer_gltexture */
-
-#ifndef EGL_KHR_stream_cross_process_fd
-#define EGL_KHR_stream_cross_process_fd 1
-typedef int EGLNativeFileDescriptorKHR;
-#ifdef EGL_KHR_stream
-#define EGL_NO_FILE_DESCRIPTOR_KHR EGL_CAST(EGLNativeFileDescriptorKHR,-1)
-typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
-EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_cross_process_fd */
-
-#ifndef EGL_KHR_stream_fifo
-#define EGL_KHR_stream_fifo 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
-#define EGL_STREAM_TIME_NOW_KHR 0x31FD
-#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
-#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_fifo */
-
-#ifndef EGL_KHR_stream_producer_aldatalocator
-#define EGL_KHR_stream_producer_aldatalocator 1
-#ifdef EGL_KHR_stream
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_aldatalocator */
-
-#ifndef EGL_KHR_stream_producer_eglsurface
-#define EGL_KHR_stream_producer_eglsurface 1
-#ifdef EGL_KHR_stream
-#define EGL_STREAM_BIT_KHR 0x0800
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
-#endif
-#endif /* EGL_KHR_stream */
-#endif /* EGL_KHR_stream_producer_eglsurface */
-
-#ifndef EGL_KHR_surfaceless_context
-#define EGL_KHR_surfaceless_context 1
-#endif /* EGL_KHR_surfaceless_context */
-
-#ifndef EGL_KHR_swap_buffers_with_damage
-#define EGL_KHR_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_KHR_swap_buffers_with_damage */
-
-#ifndef EGL_KHR_vg_parent_image
-#define EGL_KHR_vg_parent_image 1
-#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
-#endif /* EGL_KHR_vg_parent_image */
-
-#ifndef EGL_KHR_wait_sync
-#define EGL_KHR_wait_sync 1
-typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
-#endif
-#endif /* EGL_KHR_wait_sync */
-
-#ifndef EGL_ANDROID_blob_cache
-#define EGL_ANDROID_blob_cache 1
-typedef khronos_ssize_t EGLsizeiANDROID;
-typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
-typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
-typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
-#endif
-#endif /* EGL_ANDROID_blob_cache */
-
-#ifndef EGL_ANDROID_create_native_client_buffer
-#define EGL_ANDROID_create_native_client_buffer 1
-#define EGL_NATIVE_BUFFER_USAGE_ANDROID 0x3143
-#define EGL_NATIVE_BUFFER_USAGE_PROTECTED_BIT_ANDROID 0x00000001
-#define EGL_NATIVE_BUFFER_USAGE_RENDERBUFFER_BIT_ANDROID 0x00000002
-#define EGL_NATIVE_BUFFER_USAGE_TEXTURE_BIT_ANDROID 0x00000004
-typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLCREATENATIVECLIENTBUFFERANDROIDPROC) (const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLClientBuffer EGLAPIENTRY eglCreateNativeClientBufferANDROID (const EGLint *attrib_list);
-#endif
-#endif /* EGL_ANDROID_create_native_client_buffer */
-
-#ifndef EGL_ANDROID_framebuffer_target
-#define EGL_ANDROID_framebuffer_target 1
-#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
-#endif /* EGL_ANDROID_framebuffer_target */
-
-#ifndef EGL_ANDROID_front_buffer_auto_refresh
-#define EGL_ANDROID_front_buffer_auto_refresh 1
-#define EGL_FRONT_BUFFER_AUTO_REFRESH_ANDROID 0x314C
-#endif /* EGL_ANDROID_front_buffer_auto_refresh */
-
-#ifndef EGL_ANDROID_get_frame_timestamps
-#define EGL_ANDROID_get_frame_timestamps 1
-typedef khronos_stime_nanoseconds_t EGLnsecsANDROID;
-#define EGL_TIMESTAMP_PENDING_ANDROID EGL_CAST(EGLnsecsANDROID,-2)
-#define EGL_TIMESTAMP_INVALID_ANDROID EGL_CAST(EGLnsecsANDROID,-1)
-#define EGL_TIMESTAMPS_ANDROID 0x3430
-#define EGL_COMPOSITE_DEADLINE_ANDROID 0x3431
-#define EGL_COMPOSITE_INTERVAL_ANDROID 0x3432
-#define EGL_COMPOSITE_TO_PRESENT_LATENCY_ANDROID 0x3433
-#define EGL_REQUESTED_PRESENT_TIME_ANDROID 0x3434
-#define EGL_RENDERING_COMPLETE_TIME_ANDROID 0x3435
-#define EGL_COMPOSITION_LATCH_TIME_ANDROID 0x3436
-#define EGL_FIRST_COMPOSITION_START_TIME_ANDROID 0x3437
-#define EGL_LAST_COMPOSITION_START_TIME_ANDROID 0x3438
-#define EGL_FIRST_COMPOSITION_GPU_FINISHED_TIME_ANDROID 0x3439
-#define EGL_DISPLAY_PRESENT_TIME_ANDROID 0x343A
-#define EGL_DEQUEUE_READY_TIME_ANDROID 0x343B
-#define EGL_READS_DONE_TIME_ANDROID 0x343C
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETCOMPOSITORTIMINGANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETNEXTFRAMEIDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSUPPORTEDANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLint timestamp);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETFRAMETIMESTAMPSANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetCompositorTimingANDROID (EGLDisplay dpy, EGLSurface surface, EGLint numTimestamps, const EGLint *names, EGLnsecsANDROID *values);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetNextFrameIdANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR *frameId);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampSupportedANDROID (EGLDisplay dpy, EGLSurface surface, EGLint timestamp);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetFrameTimestampsANDROID (EGLDisplay dpy, EGLSurface surface, EGLuint64KHR frameId, EGLint numTimestamps, const EGLint *timestamps, EGLnsecsANDROID *values);
-#endif
-#endif /* EGL_ANDROID_get_frame_timestamps */
-
-#ifndef EGL_ANDROID_get_native_client_buffer
-#define EGL_ANDROID_get_native_client_buffer 1
-struct AHardwareBuffer;
-typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETNATIVECLIENTBUFFERANDROIDPROC) (const struct AHardwareBuffer *buffer);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLClientBuffer EGLAPIENTRY eglGetNativeClientBufferANDROID (const struct AHardwareBuffer *buffer);
-#endif
-#endif /* EGL_ANDROID_get_native_client_buffer */
-
-#ifndef EGL_ANDROID_image_native_buffer
-#define EGL_ANDROID_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_ANDROID 0x3140
-#endif /* EGL_ANDROID_image_native_buffer */
-
-#ifndef EGL_ANDROID_native_fence_sync
-#define EGL_ANDROID_native_fence_sync 1
-#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
-#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
-#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
-#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
-typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
-#endif
-#endif /* EGL_ANDROID_native_fence_sync */
-
-#ifndef EGL_ANDROID_presentation_time
-#define EGL_ANDROID_presentation_time 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROIDPROC) (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglPresentationTimeANDROID (EGLDisplay dpy, EGLSurface surface, EGLnsecsANDROID time);
-#endif
-#endif /* EGL_ANDROID_presentation_time */
-
-#ifndef EGL_ANDROID_recordable
-#define EGL_ANDROID_recordable 1
-#define EGL_RECORDABLE_ANDROID 0x3142
-#endif /* EGL_ANDROID_recordable */
-
-#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
-#define EGL_ANGLE_d3d_share_handle_client_buffer 1
-#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
-#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
-
-#ifndef EGL_ANGLE_device_d3d
-#define EGL_ANGLE_device_d3d 1
-#define EGL_D3D9_DEVICE_ANGLE 0x33A0
-#define EGL_D3D11_DEVICE_ANGLE 0x33A1
-#endif /* EGL_ANGLE_device_d3d */
-
-#ifndef EGL_ANGLE_query_surface_pointer
-#define EGL_ANGLE_query_surface_pointer 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
-#endif
-#endif /* EGL_ANGLE_query_surface_pointer */
-
-#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
-#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
-#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
-
-#ifndef EGL_ANGLE_window_fixed_size
-#define EGL_ANGLE_window_fixed_size 1
-#define EGL_FIXED_SIZE_ANGLE 0x3201
-#endif /* EGL_ANGLE_window_fixed_size */
-
-#ifndef EGL_ARM_implicit_external_sync
-#define EGL_ARM_implicit_external_sync 1
-#define EGL_SYNC_PRIOR_COMMANDS_IMPLICIT_EXTERNAL_ARM 0x328A
-#endif /* EGL_ARM_implicit_external_sync */
-
-#ifndef EGL_ARM_pixmap_multisample_discard
-#define EGL_ARM_pixmap_multisample_discard 1
-#define EGL_DISCARD_SAMPLES_ARM 0x3286
-#endif /* EGL_ARM_pixmap_multisample_discard */
-
-#ifndef EGL_EXT_bind_to_front
-#define EGL_EXT_bind_to_front 1
-#define EGL_FRONT_BUFFER_EXT 0x3464
-#endif /* EGL_EXT_bind_to_front */
-
-#ifndef EGL_EXT_buffer_age
-#define EGL_EXT_buffer_age 1
-#define EGL_BUFFER_AGE_EXT 0x313D
-#endif /* EGL_EXT_buffer_age */
-
-#ifndef EGL_EXT_client_extensions
-#define EGL_EXT_client_extensions 1
-#endif /* EGL_EXT_client_extensions */
-
-#ifndef EGL_EXT_client_sync
-#define EGL_EXT_client_sync 1
-#define EGL_SYNC_CLIENT_EXT 0x3364
-#define EGL_SYNC_CLIENT_SIGNAL_EXT 0x3365
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCLIENTSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglClientSignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
-#endif
-#endif /* EGL_EXT_client_sync */
-
-#ifndef EGL_EXT_compositor
-#define EGL_EXT_compositor 1
-#define EGL_PRIMARY_COMPOSITOR_CONTEXT_EXT 0x3460
-#define EGL_EXTERNAL_REF_ID_EXT 0x3461
-#define EGL_COMPOSITOR_DROP_NEWEST_FRAME_EXT 0x3462
-#define EGL_COMPOSITOR_KEEP_NEWEST_FRAME_EXT 0x3463
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTLISTEXTPROC) (const EGLint *external_ref_ids, EGLint num_entries);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETCONTEXTATTRIBUTESEXTPROC) (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWLISTEXTPROC) (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETWINDOWATTRIBUTESEXTPROC) (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORBINDTEXWINDOWEXTPROC) (EGLint external_win_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSETSIZEEXTPROC) (EGLint external_win_id, EGLint width, EGLint height);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLCOMPOSITORSWAPPOLICYEXTPROC) (EGLint external_win_id, EGLint policy);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextListEXT (const EGLint *external_ref_ids, EGLint num_entries);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetContextAttributesEXT (EGLint external_ref_id, const EGLint *context_attributes, EGLint num_entries);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowListEXT (EGLint external_ref_id, const EGLint *external_win_ids, EGLint num_entries);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetWindowAttributesEXT (EGLint external_win_id, const EGLint *window_attributes, EGLint num_entries);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorBindTexWindowEXT (EGLint external_win_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSetSizeEXT (EGLint external_win_id, EGLint width, EGLint height);
-EGLAPI EGLBoolean EGLAPIENTRY eglCompositorSwapPolicyEXT (EGLint external_win_id, EGLint policy);
-#endif
-#endif /* EGL_EXT_compositor */
-
-#ifndef EGL_EXT_create_context_robustness
-#define EGL_EXT_create_context_robustness 1
-#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
-#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
-#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
-#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
-#endif /* EGL_EXT_create_context_robustness */
-
-#ifndef EGL_EXT_device_base
-#define EGL_EXT_device_base 1
-typedef void *EGLDeviceEXT;
-#define EGL_NO_DEVICE_EXT EGL_CAST(EGLDeviceEXT,0)
-#define EGL_BAD_DEVICE_EXT 0x322B
-#define EGL_DEVICE_EXT 0x322C
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICEATTRIBEXTPROC) (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYDEVICESTRINGEXTPROC) (EGLDeviceEXT device, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDEVICESEXTPROC) (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBEXTPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT (EGLDeviceEXT device, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryDeviceStringEXT (EGLDeviceEXT device, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDevicesEXT (EGLint max_devices, EGLDeviceEXT *devices, EGLint *num_devices);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-#endif
-#endif /* EGL_EXT_device_base */
-
-#ifndef EGL_EXT_device_drm
-#define EGL_EXT_device_drm 1
-#define EGL_DRM_DEVICE_FILE_EXT 0x3233
-#endif /* EGL_EXT_device_drm */
-
-#ifndef EGL_EXT_device_enumeration
-#define EGL_EXT_device_enumeration 1
-#endif /* EGL_EXT_device_enumeration */
-
-#ifndef EGL_EXT_device_openwf
-#define EGL_EXT_device_openwf 1
-#define EGL_OPENWF_DEVICE_ID_EXT 0x3237
-#endif /* EGL_EXT_device_openwf */
-
-#ifndef EGL_EXT_device_query
-#define EGL_EXT_device_query 1
-#endif /* EGL_EXT_device_query */
-
-#ifndef EGL_EXT_gl_colorspace_bt2020_linear
-#define EGL_EXT_gl_colorspace_bt2020_linear 1
-#define EGL_GL_COLORSPACE_BT2020_LINEAR_EXT 0x333F
-#endif /* EGL_EXT_gl_colorspace_bt2020_linear */
-
-#ifndef EGL_EXT_gl_colorspace_bt2020_pq
-#define EGL_EXT_gl_colorspace_bt2020_pq 1
-#define EGL_GL_COLORSPACE_BT2020_PQ_EXT 0x3340
-#endif /* EGL_EXT_gl_colorspace_bt2020_pq */
-
-#ifndef EGL_EXT_gl_colorspace_display_p3
-#define EGL_EXT_gl_colorspace_display_p3 1
-#define EGL_GL_COLORSPACE_DISPLAY_P3_EXT 0x3363
-#endif /* EGL_EXT_gl_colorspace_display_p3 */
-
-#ifndef EGL_EXT_gl_colorspace_display_p3_linear
-#define EGL_EXT_gl_colorspace_display_p3_linear 1
-#define EGL_GL_COLORSPACE_DISPLAY_P3_LINEAR_EXT 0x3362
-#endif /* EGL_EXT_gl_colorspace_display_p3_linear */
-
-#ifndef EGL_EXT_gl_colorspace_scrgb
-#define EGL_EXT_gl_colorspace_scrgb 1
-#define EGL_GL_COLORSPACE_SCRGB_EXT 0x3351
-#endif /* EGL_EXT_gl_colorspace_scrgb */
-
-#ifndef EGL_EXT_gl_colorspace_scrgb_linear
-#define EGL_EXT_gl_colorspace_scrgb_linear 1
-#define EGL_GL_COLORSPACE_SCRGB_LINEAR_EXT 0x3350
-#endif /* EGL_EXT_gl_colorspace_scrgb_linear */
-
-#ifndef EGL_EXT_image_dma_buf_import
-#define EGL_EXT_image_dma_buf_import 1
-#define EGL_LINUX_DMA_BUF_EXT 0x3270
-#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
-#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
-#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
-#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
-#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
-#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
-#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
-#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
-#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
-#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
-#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
-#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
-#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
-#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
-#define EGL_ITU_REC601_EXT 0x327F
-#define EGL_ITU_REC709_EXT 0x3280
-#define EGL_ITU_REC2020_EXT 0x3281
-#define EGL_YUV_FULL_RANGE_EXT 0x3282
-#define EGL_YUV_NARROW_RANGE_EXT 0x3283
-#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
-#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
-#endif /* EGL_EXT_image_dma_buf_import */
-
-#ifndef EGL_EXT_image_dma_buf_import_modifiers
-#define EGL_EXT_image_dma_buf_import_modifiers 1
-#define EGL_DMA_BUF_PLANE3_FD_EXT 0x3440
-#define EGL_DMA_BUF_PLANE3_OFFSET_EXT 0x3441
-#define EGL_DMA_BUF_PLANE3_PITCH_EXT 0x3442
-#define EGL_DMA_BUF_PLANE0_MODIFIER_LO_EXT 0x3443
-#define EGL_DMA_BUF_PLANE0_MODIFIER_HI_EXT 0x3444
-#define EGL_DMA_BUF_PLANE1_MODIFIER_LO_EXT 0x3445
-#define EGL_DMA_BUF_PLANE1_MODIFIER_HI_EXT 0x3446
-#define EGL_DMA_BUF_PLANE2_MODIFIER_LO_EXT 0x3447
-#define EGL_DMA_BUF_PLANE2_MODIFIER_HI_EXT 0x3448
-#define EGL_DMA_BUF_PLANE3_MODIFIER_LO_EXT 0x3449
-#define EGL_DMA_BUF_PLANE3_MODIFIER_HI_EXT 0x344A
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFFORMATSEXTPROC) (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDMABUFMODIFIERSEXTPROC) (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufFormatsEXT (EGLDisplay dpy, EGLint max_formats, EGLint *formats, EGLint *num_formats);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDmaBufModifiersEXT (EGLDisplay dpy, EGLint format, EGLint max_modifiers, EGLuint64KHR *modifiers, EGLBoolean *external_only, EGLint *num_modifiers);
-#endif
-#endif /* EGL_EXT_image_dma_buf_import_modifiers */
-
-#ifndef EGL_EXT_image_gl_colorspace
-#define EGL_EXT_image_gl_colorspace 1
-#define EGL_GL_COLORSPACE_DEFAULT_EXT 0x314D
-#endif /* EGL_EXT_image_gl_colorspace */
-
-#ifndef EGL_EXT_image_implicit_sync_control
-#define EGL_EXT_image_implicit_sync_control 1
-#define EGL_IMPORT_SYNC_TYPE_EXT 0x3470
-#define EGL_IMPORT_IMPLICIT_SYNC_EXT 0x3471
-#define EGL_IMPORT_EXPLICIT_SYNC_EXT 0x3472
-#endif /* EGL_EXT_image_implicit_sync_control */
-
-#ifndef EGL_EXT_multiview_window
-#define EGL_EXT_multiview_window 1
-#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
-#endif /* EGL_EXT_multiview_window */
-
-#ifndef EGL_EXT_output_base
-#define EGL_EXT_output_base 1
-typedef void *EGLOutputLayerEXT;
-typedef void *EGLOutputPortEXT;
-#define EGL_NO_OUTPUT_LAYER_EXT EGL_CAST(EGLOutputLayerEXT,0)
-#define EGL_NO_OUTPUT_PORT_EXT EGL_CAST(EGLOutputPortEXT,0)
-#define EGL_BAD_OUTPUT_LAYER_EXT 0x322D
-#define EGL_BAD_OUTPUT_PORT_EXT 0x322E
-#define EGL_SWAP_INTERVAL_EXT 0x322F
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTLAYERSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETOUTPUTPORTSEXTPROC) (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTLAYERSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTATTRIBEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-typedef const char *(EGLAPIENTRYP PFNEGLQUERYOUTPUTPORTSTRINGEXTPROC) (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputLayersEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputLayerEXT *layers, EGLint max_layers, EGLint *num_layers);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetOutputPortsEXT (EGLDisplay dpy, const EGLAttrib *attrib_list, EGLOutputPortEXT *ports, EGLint max_ports, EGLint *num_ports);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputLayerAttribEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputLayerStringEXT (EGLDisplay dpy, EGLOutputLayerEXT layer, EGLint name);
-EGLAPI EGLBoolean EGLAPIENTRY eglOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib value);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryOutputPortAttribEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint attribute, EGLAttrib *value);
-EGLAPI const char *EGLAPIENTRY eglQueryOutputPortStringEXT (EGLDisplay dpy, EGLOutputPortEXT port, EGLint name);
-#endif
-#endif /* EGL_EXT_output_base */
-
-#ifndef EGL_EXT_output_drm
-#define EGL_EXT_output_drm 1
-#define EGL_DRM_CRTC_EXT 0x3234
-#define EGL_DRM_PLANE_EXT 0x3235
-#define EGL_DRM_CONNECTOR_EXT 0x3236
-#endif /* EGL_EXT_output_drm */
-
-#ifndef EGL_EXT_output_openwf
-#define EGL_EXT_output_openwf 1
-#define EGL_OPENWF_PIPELINE_ID_EXT 0x3238
-#define EGL_OPENWF_PORT_ID_EXT 0x3239
-#endif /* EGL_EXT_output_openwf */
-
-#ifndef EGL_EXT_pixel_format_float
-#define EGL_EXT_pixel_format_float 1
-#define EGL_COLOR_COMPONENT_TYPE_EXT 0x3339
-#define EGL_COLOR_COMPONENT_TYPE_FIXED_EXT 0x333A
-#define EGL_COLOR_COMPONENT_TYPE_FLOAT_EXT 0x333B
-#endif /* EGL_EXT_pixel_format_float */
-
-#ifndef EGL_EXT_platform_base
-#define EGL_EXT_platform_base 1
-typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-#endif
-#endif /* EGL_EXT_platform_base */
-
-#ifndef EGL_EXT_platform_device
-#define EGL_EXT_platform_device 1
-#define EGL_PLATFORM_DEVICE_EXT 0x313F
-#endif /* EGL_EXT_platform_device */
-
-#ifndef EGL_EXT_platform_wayland
-#define EGL_EXT_platform_wayland 1
-#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
-#endif /* EGL_EXT_platform_wayland */
-
-#ifndef EGL_EXT_platform_x11
-#define EGL_EXT_platform_x11 1
-#define EGL_PLATFORM_X11_EXT 0x31D5
-#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
-#endif /* EGL_EXT_platform_x11 */
-
-#ifndef EGL_EXT_protected_content
-#define EGL_EXT_protected_content 1
-#define EGL_PROTECTED_CONTENT_EXT 0x32C0
-#endif /* EGL_EXT_protected_content */
-
-#ifndef EGL_EXT_protected_surface
-#define EGL_EXT_protected_surface 1
-#endif /* EGL_EXT_protected_surface */
-
-#ifndef EGL_EXT_stream_consumer_egloutput
-#define EGL_EXT_stream_consumer_egloutput 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMEROUTPUTEXTPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerOutputEXT (EGLDisplay dpy, EGLStreamKHR stream, EGLOutputLayerEXT layer);
-#endif
-#endif /* EGL_EXT_stream_consumer_egloutput */
-
-#ifndef EGL_EXT_surface_CTA861_3_metadata
-#define EGL_EXT_surface_CTA861_3_metadata 1
-#define EGL_CTA861_3_MAX_CONTENT_LIGHT_LEVEL_EXT 0x3360
-#define EGL_CTA861_3_MAX_FRAME_AVERAGE_LEVEL_EXT 0x3361
-#endif /* EGL_EXT_surface_CTA861_3_metadata */
-
-#ifndef EGL_EXT_surface_SMPTE2086_metadata
-#define EGL_EXT_surface_SMPTE2086_metadata 1
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_RX_EXT 0x3341
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_RY_EXT 0x3342
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_GX_EXT 0x3343
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_GY_EXT 0x3344
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_BX_EXT 0x3345
-#define EGL_SMPTE2086_DISPLAY_PRIMARY_BY_EXT 0x3346
-#define EGL_SMPTE2086_WHITE_POINT_X_EXT 0x3347
-#define EGL_SMPTE2086_WHITE_POINT_Y_EXT 0x3348
-#define EGL_SMPTE2086_MAX_LUMINANCE_EXT 0x3349
-#define EGL_SMPTE2086_MIN_LUMINANCE_EXT 0x334A
-#define EGL_METADATA_SCALING_EXT 50000
-#endif /* EGL_EXT_surface_SMPTE2086_metadata */
-
-#ifndef EGL_EXT_swap_buffers_with_damage
-#define EGL_EXT_swap_buffers_with_damage 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
-#endif
-#endif /* EGL_EXT_swap_buffers_with_damage */
-
-#ifndef EGL_EXT_sync_reuse
-#define EGL_EXT_sync_reuse 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNSIGNALSYNCEXTPROC) (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglUnsignalSyncEXT (EGLDisplay dpy, EGLSync sync, const EGLAttrib *attrib_list);
-#endif
-#endif /* EGL_EXT_sync_reuse */
-
-#ifndef EGL_EXT_yuv_surface
-#define EGL_EXT_yuv_surface 1
-#define EGL_YUV_ORDER_EXT 0x3301
-#define EGL_YUV_NUMBER_OF_PLANES_EXT 0x3311
-#define EGL_YUV_SUBSAMPLE_EXT 0x3312
-#define EGL_YUV_DEPTH_RANGE_EXT 0x3317
-#define EGL_YUV_CSC_STANDARD_EXT 0x330A
-#define EGL_YUV_PLANE_BPP_EXT 0x331A
-#define EGL_YUV_BUFFER_EXT 0x3300
-#define EGL_YUV_ORDER_YUV_EXT 0x3302
-#define EGL_YUV_ORDER_YVU_EXT 0x3303
-#define EGL_YUV_ORDER_YUYV_EXT 0x3304
-#define EGL_YUV_ORDER_UYVY_EXT 0x3305
-#define EGL_YUV_ORDER_YVYU_EXT 0x3306
-#define EGL_YUV_ORDER_VYUY_EXT 0x3307
-#define EGL_YUV_ORDER_AYUV_EXT 0x3308
-#define EGL_YUV_SUBSAMPLE_4_2_0_EXT 0x3313
-#define EGL_YUV_SUBSAMPLE_4_2_2_EXT 0x3314
-#define EGL_YUV_SUBSAMPLE_4_4_4_EXT 0x3315
-#define EGL_YUV_DEPTH_RANGE_LIMITED_EXT 0x3318
-#define EGL_YUV_DEPTH_RANGE_FULL_EXT 0x3319
-#define EGL_YUV_CSC_STANDARD_601_EXT 0x330B
-#define EGL_YUV_CSC_STANDARD_709_EXT 0x330C
-#define EGL_YUV_CSC_STANDARD_2020_EXT 0x330D
-#define EGL_YUV_PLANE_BPP_0_EXT 0x331B
-#define EGL_YUV_PLANE_BPP_8_EXT 0x331C
-#define EGL_YUV_PLANE_BPP_10_EXT 0x331D
-#endif /* EGL_EXT_yuv_surface */
-
-#ifndef EGL_HI_clientpixmap
-#define EGL_HI_clientpixmap 1
-struct EGLClientPixmapHI {
- void *pData;
- EGLint iWidth;
- EGLint iHeight;
- EGLint iStride;
-};
-#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
-typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
-#endif
-#endif /* EGL_HI_clientpixmap */
-
-#ifndef EGL_HI_colorformats
-#define EGL_HI_colorformats 1
-#define EGL_COLOR_FORMAT_HI 0x8F70
-#define EGL_COLOR_RGB_HI 0x8F71
-#define EGL_COLOR_RGBA_HI 0x8F72
-#define EGL_COLOR_ARGB_HI 0x8F73
-#endif /* EGL_HI_colorformats */
-
-#ifndef EGL_IMG_context_priority
-#define EGL_IMG_context_priority 1
-#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
-#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
-#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
-#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
-#endif /* EGL_IMG_context_priority */
-
-#ifndef EGL_IMG_image_plane_attribs
-#define EGL_IMG_image_plane_attribs 1
-#define EGL_NATIVE_BUFFER_MULTIPLANE_SEPARATE_IMG 0x3105
-#define EGL_NATIVE_BUFFER_PLANE_OFFSET_IMG 0x3106
-#endif /* EGL_IMG_image_plane_attribs */
-
-#ifndef EGL_MESA_drm_image
-#define EGL_MESA_drm_image 1
-#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
-#define EGL_DRM_BUFFER_USE_MESA 0x31D1
-#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
-#define EGL_DRM_BUFFER_MESA 0x31D3
-#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
-#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
-#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
-#define EGL_DRM_BUFFER_USE_CURSOR_MESA 0x00000004
-typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
-#endif
-#endif /* EGL_MESA_drm_image */
-
-#ifndef EGL_MESA_image_dma_buf_export
-#define EGL_MESA_image_dma_buf_export 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEQUERYMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDMABUFIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageQueryMESA (EGLDisplay dpy, EGLImageKHR image, int *fourcc, int *num_planes, EGLuint64KHR *modifiers);
-EGLAPI EGLBoolean EGLAPIENTRY eglExportDMABUFImageMESA (EGLDisplay dpy, EGLImageKHR image, int *fds, EGLint *strides, EGLint *offsets);
-#endif
-#endif /* EGL_MESA_image_dma_buf_export */
-
-#ifndef EGL_MESA_platform_gbm
-#define EGL_MESA_platform_gbm 1
-#define EGL_PLATFORM_GBM_MESA 0x31D7
-#endif /* EGL_MESA_platform_gbm */
-
-#ifndef EGL_MESA_platform_surfaceless
-#define EGL_MESA_platform_surfaceless 1
-#define EGL_PLATFORM_SURFACELESS_MESA 0x31DD
-#endif /* EGL_MESA_platform_surfaceless */
-
-#ifndef EGL_NOK_swap_region
-#define EGL_NOK_swap_region 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGIONNOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegionNOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region */
-
-#ifndef EGL_NOK_swap_region2
-#define EGL_NOK_swap_region2 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSREGION2NOKPROC) (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersRegion2NOK (EGLDisplay dpy, EGLSurface surface, EGLint numRects, const EGLint *rects);
-#endif
-#endif /* EGL_NOK_swap_region2 */
-
-#ifndef EGL_NOK_texture_from_pixmap
-#define EGL_NOK_texture_from_pixmap 1
-#define EGL_Y_INVERTED_NOK 0x307F
-#endif /* EGL_NOK_texture_from_pixmap */
-
-#ifndef EGL_NV_3dvision_surface
-#define EGL_NV_3dvision_surface 1
-#define EGL_AUTO_STEREO_NV 0x3136
-#endif /* EGL_NV_3dvision_surface */
-
-#ifndef EGL_NV_context_priority_realtime
-#define EGL_NV_context_priority_realtime 1
-#define EGL_CONTEXT_PRIORITY_REALTIME_NV 0x3357
-#endif /* EGL_NV_context_priority_realtime */
-
-#ifndef EGL_NV_coverage_sample
-#define EGL_NV_coverage_sample 1
-#define EGL_COVERAGE_BUFFERS_NV 0x30E0
-#define EGL_COVERAGE_SAMPLES_NV 0x30E1
-#endif /* EGL_NV_coverage_sample */
-
-#ifndef EGL_NV_coverage_sample_resolve
-#define EGL_NV_coverage_sample_resolve 1
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
-#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
-#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
-#endif /* EGL_NV_coverage_sample_resolve */
-
-#ifndef EGL_NV_cuda_event
-#define EGL_NV_cuda_event 1
-#define EGL_CUDA_EVENT_HANDLE_NV 0x323B
-#define EGL_SYNC_CUDA_EVENT_NV 0x323C
-#define EGL_SYNC_CUDA_EVENT_COMPLETE_NV 0x323D
-#endif /* EGL_NV_cuda_event */
-
-#ifndef EGL_NV_depth_nonlinear
-#define EGL_NV_depth_nonlinear 1
-#define EGL_DEPTH_ENCODING_NV 0x30E2
-#define EGL_DEPTH_ENCODING_NONE_NV 0
-#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
-#endif /* EGL_NV_depth_nonlinear */
-
-#ifndef EGL_NV_device_cuda
-#define EGL_NV_device_cuda 1
-#define EGL_CUDA_DEVICE_NV 0x323A
-#endif /* EGL_NV_device_cuda */
-
-#ifndef EGL_NV_native_query
-#define EGL_NV_native_query 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
-#endif
-#endif /* EGL_NV_native_query */
-
-#ifndef EGL_NV_post_convert_rounding
-#define EGL_NV_post_convert_rounding 1
-#endif /* EGL_NV_post_convert_rounding */
-
-#ifndef EGL_NV_post_sub_buffer
-#define EGL_NV_post_sub_buffer 1
-#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
-#endif
-#endif /* EGL_NV_post_sub_buffer */
-
-#ifndef EGL_NV_robustness_video_memory_purge
-#define EGL_NV_robustness_video_memory_purge 1
-#define EGL_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x334C
-#endif /* EGL_NV_robustness_video_memory_purge */
-
-#ifndef EGL_NV_stream_consumer_gltexture_yuv
-#define EGL_NV_stream_consumer_gltexture_yuv 1
-#define EGL_YUV_PLANE0_TEXTURE_UNIT_NV 0x332C
-#define EGL_YUV_PLANE1_TEXTURE_UNIT_NV 0x332D
-#define EGL_YUV_PLANE2_TEXTURE_UNIT_NV 0x332E
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALATTRIBSNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalAttribsNV (EGLDisplay dpy, EGLStreamKHR stream, const EGLAttrib *attrib_list);
-#endif
-#endif /* EGL_NV_stream_consumer_gltexture_yuv */
-
-#ifndef EGL_NV_stream_cross_display
-#define EGL_NV_stream_cross_display 1
-#define EGL_STREAM_CROSS_DISPLAY_NV 0x334E
-#endif /* EGL_NV_stream_cross_display */
-
-#ifndef EGL_NV_stream_cross_object
-#define EGL_NV_stream_cross_object 1
-#define EGL_STREAM_CROSS_OBJECT_NV 0x334D
-#endif /* EGL_NV_stream_cross_object */
-
-#ifndef EGL_NV_stream_cross_partition
-#define EGL_NV_stream_cross_partition 1
-#define EGL_STREAM_CROSS_PARTITION_NV 0x323F
-#endif /* EGL_NV_stream_cross_partition */
-
-#ifndef EGL_NV_stream_cross_process
-#define EGL_NV_stream_cross_process 1
-#define EGL_STREAM_CROSS_PROCESS_NV 0x3245
-#endif /* EGL_NV_stream_cross_process */
-
-#ifndef EGL_NV_stream_cross_system
-#define EGL_NV_stream_cross_system 1
-#define EGL_STREAM_CROSS_SYSTEM_NV 0x334F
-#endif /* EGL_NV_stream_cross_system */
-
-#ifndef EGL_NV_stream_fifo_next
-#define EGL_NV_stream_fifo_next 1
-#define EGL_PENDING_FRAME_NV 0x3329
-#define EGL_STREAM_TIME_PENDING_NV 0x332A
-#endif /* EGL_NV_stream_fifo_next */
-
-#ifndef EGL_NV_stream_fifo_synchronous
-#define EGL_NV_stream_fifo_synchronous 1
-#define EGL_STREAM_FIFO_SYNCHRONOUS_NV 0x3336
-#endif /* EGL_NV_stream_fifo_synchronous */
-
-#ifndef EGL_NV_stream_flush
-#define EGL_NV_stream_flush 1
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMFLUSHNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglStreamFlushNV (EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif /* EGL_NV_stream_flush */
-
-#ifndef EGL_NV_stream_frame_limits
-#define EGL_NV_stream_frame_limits 1
-#define EGL_PRODUCER_MAX_FRAME_HINT_NV 0x3337
-#define EGL_CONSUMER_MAX_FRAME_HINT_NV 0x3338
-#endif /* EGL_NV_stream_frame_limits */
-
-#ifndef EGL_NV_stream_metadata
-#define EGL_NV_stream_metadata 1
-#define EGL_MAX_STREAM_METADATA_BLOCKS_NV 0x3250
-#define EGL_MAX_STREAM_METADATA_BLOCK_SIZE_NV 0x3251
-#define EGL_MAX_STREAM_METADATA_TOTAL_SIZE_NV 0x3252
-#define EGL_PRODUCER_METADATA_NV 0x3253
-#define EGL_CONSUMER_METADATA_NV 0x3254
-#define EGL_PENDING_METADATA_NV 0x3328
-#define EGL_METADATA0_SIZE_NV 0x3255
-#define EGL_METADATA1_SIZE_NV 0x3256
-#define EGL_METADATA2_SIZE_NV 0x3257
-#define EGL_METADATA3_SIZE_NV 0x3258
-#define EGL_METADATA0_TYPE_NV 0x3259
-#define EGL_METADATA1_TYPE_NV 0x325A
-#define EGL_METADATA2_TYPE_NV 0x325B
-#define EGL_METADATA3_TYPE_NV 0x325C
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYDISPLAYATTRIBNVPROC) (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMMETADATANVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryDisplayAttribNV (EGLDisplay dpy, EGLint attribute, EGLAttrib *value);
-EGLAPI EGLBoolean EGLAPIENTRY eglSetStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLint n, EGLint offset, EGLint size, const void *data);
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamMetadataNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum name, EGLint n, EGLint offset, EGLint size, void *data);
-#endif
-#endif /* EGL_NV_stream_metadata */
-
-#ifndef EGL_NV_stream_remote
-#define EGL_NV_stream_remote 1
-#define EGL_STREAM_STATE_INITIALIZING_NV 0x3240
-#define EGL_STREAM_TYPE_NV 0x3241
-#define EGL_STREAM_PROTOCOL_NV 0x3242
-#define EGL_STREAM_ENDPOINT_NV 0x3243
-#define EGL_STREAM_LOCAL_NV 0x3244
-#define EGL_STREAM_PRODUCER_NV 0x3247
-#define EGL_STREAM_CONSUMER_NV 0x3248
-#define EGL_STREAM_PROTOCOL_FD_NV 0x3246
-#endif /* EGL_NV_stream_remote */
-
-#ifndef EGL_NV_stream_reset
-#define EGL_NV_stream_reset 1
-#define EGL_SUPPORT_RESET_NV 0x3334
-#define EGL_SUPPORT_REUSE_NV 0x3335
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLRESETSTREAMNVPROC) (EGLDisplay dpy, EGLStreamKHR stream);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLBoolean EGLAPIENTRY eglResetStreamNV (EGLDisplay dpy, EGLStreamKHR stream);
-#endif
-#endif /* EGL_NV_stream_reset */
-
-#ifndef EGL_NV_stream_socket
-#define EGL_NV_stream_socket 1
-#define EGL_STREAM_PROTOCOL_SOCKET_NV 0x324B
-#define EGL_SOCKET_HANDLE_NV 0x324C
-#define EGL_SOCKET_TYPE_NV 0x324D
-#endif /* EGL_NV_stream_socket */
-
-#ifndef EGL_NV_stream_socket_inet
-#define EGL_NV_stream_socket_inet 1
-#define EGL_SOCKET_TYPE_INET_NV 0x324F
-#endif /* EGL_NV_stream_socket_inet */
-
-#ifndef EGL_NV_stream_socket_unix
-#define EGL_NV_stream_socket_unix 1
-#define EGL_SOCKET_TYPE_UNIX_NV 0x324E
-#endif /* EGL_NV_stream_socket_unix */
-
-#ifndef EGL_NV_stream_sync
-#define EGL_NV_stream_sync 1
-#define EGL_SYNC_NEW_FRAME_NV 0x321F
-typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
-#endif
-#endif /* EGL_NV_stream_sync */
-
-#ifndef EGL_NV_sync
-#define EGL_NV_sync 1
-typedef void *EGLSyncNV;
-typedef khronos_utime_nanoseconds_t EGLTimeNV;
-#ifdef KHRONOS_SUPPORT_INT64
-#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
-#define EGL_SYNC_STATUS_NV 0x30E7
-#define EGL_SIGNALED_NV 0x30E8
-#define EGL_UNSIGNALED_NV 0x30E9
-#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
-#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
-#define EGL_ALREADY_SIGNALED_NV 0x30EA
-#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
-#define EGL_CONDITION_SATISFIED_NV 0x30EC
-#define EGL_SYNC_TYPE_NV 0x30ED
-#define EGL_SYNC_CONDITION_NV 0x30EE
-#define EGL_SYNC_FENCE_NV 0x30EF
-#define EGL_NO_SYNC_NV EGL_CAST(EGLSyncNV,0)
-typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
-typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
-typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
-EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
-EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_sync */
-
-#ifndef EGL_NV_system_time
-#define EGL_NV_system_time 1
-typedef khronos_utime_nanoseconds_t EGLuint64NV;
-#ifdef KHRONOS_SUPPORT_INT64
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
-typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
-#ifdef EGL_EGLEXT_PROTOTYPES
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
-EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
-#endif
-#endif /* KHRONOS_SUPPORT_INT64 */
-#endif /* EGL_NV_system_time */
-
-#ifndef EGL_TIZEN_image_native_buffer
-#define EGL_TIZEN_image_native_buffer 1
-#define EGL_NATIVE_BUFFER_TIZEN 0x32A0
-#endif /* EGL_TIZEN_image_native_buffer */
-
-#ifndef EGL_TIZEN_image_native_surface
-#define EGL_TIZEN_image_native_surface 1
-#define EGL_NATIVE_SURFACE_TIZEN 0x32A1
-#endif /* EGL_TIZEN_image_native_surface */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/EGL/eglplatform.h b/include/EGL/eglplatform.h
deleted file mode 100644
index 97c31e27a..000000000
--- a/include/EGL/eglplatform.h
+++ /dev/null
@@ -1,158 +0,0 @@
-#ifndef __eglplatform_h_
-#define __eglplatform_h_
-
-/*
-** Copyright (c) 2007-2016 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Platform-specific types and definitions for egl.h
- * $Revision: 30994 $ on $Date: 2015-04-30 13:36:48 -0700 (Thu, 30 Apr 2015) $
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * You are encouraged to submit all modifications to the Khronos group so that
- * they can be included in future versions of this file. Please submit changes
- * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla)
- * by filing a bug against product "EGL" component "Registry".
- */
-
-#include <KHR/khrplatform.h>
-
-/* Macros used in EGL function prototype declarations.
- *
- * EGL functions should be prototyped as:
- *
- * EGLAPI return-type EGLAPIENTRY eglFunction(arguments);
- * typedef return-type (EXPAPIENTRYP PFNEGLFUNCTIONPROC) (arguments);
- *
- * KHRONOS_APICALL and KHRONOS_APIENTRY are defined in KHR/khrplatform.h
- */
-
-#ifndef EGLAPI
-#define EGLAPI KHRONOS_APICALL
-#endif
-
-#ifndef EGLAPIENTRY
-#define EGLAPIENTRY KHRONOS_APIENTRY
-#endif
-#define EGLAPIENTRYP EGLAPIENTRY*
-
-/* The types NativeDisplayType, NativeWindowType, and NativePixmapType
- * are aliases of window-system-dependent types, such as X Display * or
- * Windows Device Context. They must be defined in platform-specific
- * code below. The EGL-prefixed versions of Native*Type are the same
- * types, renamed in EGL 1.3 so all types in the API start with "EGL".
- *
- * Khronos STRONGLY RECOMMENDS that you use the default definitions
- * provided below, since these changes affect both binary and source
- * portability of applications using EGL running on different EGL
- * implementations.
- */
-
-#if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-
-typedef HDC EGLNativeDisplayType;
-typedef HBITMAP EGLNativePixmapType;
-typedef HWND EGLNativeWindowType;
-
-#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
-
-typedef int EGLNativeDisplayType;
-typedef void *EGLNativeWindowType;
-typedef void *EGLNativePixmapType;
-
-#elif defined(WL_EGL_PLATFORM)
-
-typedef struct wl_display *EGLNativeDisplayType;
-typedef struct wl_egl_pixmap *EGLNativePixmapType;
-typedef struct wl_egl_window *EGLNativeWindowType;
-
-#elif defined(__GBM__)
-
-typedef struct gbm_device *EGLNativeDisplayType;
-typedef struct gbm_bo *EGLNativePixmapType;
-typedef void *EGLNativeWindowType;
-
-#elif defined(__ANDROID__) || defined(ANDROID)
-
-struct ANativeWindow;
-struct egl_native_pixmap_t;
-
-typedef struct ANativeWindow* EGLNativeWindowType;
-typedef struct egl_native_pixmap_t* EGLNativePixmapType;
-typedef void* EGLNativeDisplayType;
-
-#elif defined(USE_OZONE)
-
-typedef intptr_t EGLNativeDisplayType;
-typedef intptr_t EGLNativeWindowType;
-typedef intptr_t EGLNativePixmapType;
-
-#elif defined(__unix__)
-
-/* X11 (tentative) */
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-typedef Display *EGLNativeDisplayType;
-typedef Pixmap EGLNativePixmapType;
-typedef Window EGLNativeWindowType;
-
-#elif defined(__HAIKU__)
-
-#include <kernel/image.h>
-
-typedef void *EGLNativeDisplayType;
-typedef khronos_uintptr_t EGLNativePixmapType;
-typedef khronos_uintptr_t EGLNativeWindowType;
-
-#else
-#error "Platform not recognized"
-#endif
-
-/* EGL 1.2 types, renamed for consistency in EGL 1.3 */
-typedef EGLNativeDisplayType NativeDisplayType;
-typedef EGLNativePixmapType NativePixmapType;
-typedef EGLNativeWindowType NativeWindowType;
-
-
-/* Define EGLint. This must be a signed integral type large enough to contain
- * all legal attribute names and values passed into and out of EGL, whether
- * their type is boolean, bitmask, enumerant (symbolic constant), integer,
- * handle, or other. While in general a 32-bit integer will suffice, if
- * handles are 64 bit types, then EGLint should be defined as a signed 64-bit
- * integer type.
- */
-typedef khronos_int32_t EGLint;
-
-
-/* C++ / C typecast macros for special EGL handle values */
-#if defined(__cplusplus)
-#define EGL_CAST(type, value) (static_cast<type>(value))
-#else
-#define EGL_CAST(type, value) ((type) (value))
-#endif
-
-#endif /* __eglplatform_h */
diff --git a/include/GL/glcorearb.h b/include/GL/glcorearb.h
deleted file mode 100644
index ff3e9a85c..000000000
--- a/include/GL/glcorearb.h
+++ /dev/null
@@ -1,5703 +0,0 @@
-#ifndef __gl_glcorearb_h_
-#define __gl_glcorearb_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-/* glcorearb.h is for use with OpenGL core profile implementations.
-** It should should be placed in the same directory as gl.h and
-** included as <GL/glcorearb.h>.
-**
-** glcorearb.h includes only APIs in the latest OpenGL core profile
-** implementation together with APIs in newer ARB extensions which
-** can be supported by the core profile. It does not, and never will
-** include functionality removed from the core profile, such as
-** fixed-function vertex and fragment processing.
-**
-** Do not #include both <GL/glcorearb.h> and either of <GL/gl.h> or
-** <GL/glext.h> in the same source file.
-*/
-
-/* Generated C header for:
- * API: gl
- * Profile: core
- * Versions considered: .*
- * Versions emitted: .*
- * Default extensions included: glcore
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_VERSION_1_0
-#define GL_VERSION_1_0 1
-typedef void GLvoid;
-typedef unsigned int GLenum;
-typedef float GLfloat;
-typedef int GLint;
-typedef int GLsizei;
-typedef unsigned int GLbitfield;
-typedef double GLdouble;
-typedef unsigned int GLuint;
-typedef unsigned char GLboolean;
-typedef unsigned char GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_QUADS 0x0007
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_NONE 0
-#define GL_FRONT_LEFT 0x0400
-#define GL_FRONT_RIGHT 0x0401
-#define GL_BACK_LEFT 0x0402
-#define GL_BACK_RIGHT 0x0403
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_LEFT 0x0406
-#define GL_RIGHT 0x0407
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_RANGE 0x0B12
-#define GL_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_LINE_WIDTH 0x0B21
-#define GL_LINE_WIDTH_RANGE 0x0B22
-#define GL_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_POLYGON_MODE 0x0B40
-#define GL_POLYGON_SMOOTH 0x0B41
-#define GL_CULL_FACE 0x0B44
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_TEST 0x0B71
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_TEST 0x0B90
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_VIEWPORT 0x0BA2
-#define GL_DITHER 0x0BD0
-#define GL_BLEND_DST 0x0BE0
-#define GL_BLEND_SRC 0x0BE1
-#define GL_BLEND 0x0BE2
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_DRAW_BUFFER 0x0C01
-#define GL_READ_BUFFER 0x0C02
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_DOUBLEBUFFER 0x0C32
-#define GL_STEREO 0x0C33
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_POLYGON_SMOOTH_HINT 0x0C53
-#define GL_UNPACK_SWAP_BYTES 0x0CF0
-#define GL_UNPACK_LSB_FIRST 0x0CF1
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_SWAP_BYTES 0x0D00
-#define GL_PACK_LSB_FIRST 0x0D01
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_TEXTURE_1D 0x0DE0
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_TEXTURE_WIDTH 0x1000
-#define GL_TEXTURE_HEIGHT 0x1001
-#define GL_TEXTURE_BORDER_COLOR 0x1004
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-#define GL_TEXTURE 0x1702
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_STENCIL_INDEX 0x1901
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_RED 0x1903
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_POINT 0x1B00
-#define GL_LINE 0x1B01
-#define GL_FILL 0x1B02
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_REPEAT 0x2901
-typedef void (APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
-typedef void (APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
-typedef void (APIENTRYP PFNGLPOINTSIZEPROC) (GLfloat size);
-typedef void (APIENTRYP PFNGLPOLYGONMODEPROC) (GLenum face, GLenum mode);
-typedef void (APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXIMAGE1DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLDRAWBUFFERPROC) (GLenum buf);
-typedef void (APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
-typedef void (APIENTRYP PFNGLCLEARDEPTHPROC) (GLdouble depth);
-typedef void (APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
-typedef void (APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-typedef void (APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
-typedef void (APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
-typedef void (APIENTRYP PFNGLENABLEPROC) (GLenum cap);
-typedef void (APIENTRYP PFNGLFINISHPROC) (void);
-typedef void (APIENTRYP PFNGLFLUSHPROC) (void);
-typedef void (APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
-typedef void (APIENTRYP PFNGLLOGICOPPROC) (GLenum opcode);
-typedef void (APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
-typedef void (APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
-typedef void (APIENTRYP PFNGLPIXELSTOREFPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
-typedef void (APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETDOUBLEVPROC) (GLenum pname, GLdouble *data);
-typedef GLenum (APIENTRYP PFNGLGETERRORPROC) (void);
-typedef void (APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
-typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
-typedef void (APIENTRYP PFNGLGETTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERFVPROC) (GLenum target, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERIVPROC) (GLenum target, GLint level, GLenum pname, GLint *params);
-typedef GLboolean (APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
-typedef void (APIENTRYP PFNGLDEPTHRANGEPROC) (GLdouble n, GLdouble f);
-typedef void (APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCullFace (GLenum mode);
-GLAPI void APIENTRY glFrontFace (GLenum mode);
-GLAPI void APIENTRY glHint (GLenum target, GLenum mode);
-GLAPI void APIENTRY glLineWidth (GLfloat width);
-GLAPI void APIENTRY glPointSize (GLfloat size);
-GLAPI void APIENTRY glPolygonMode (GLenum face, GLenum mode);
-GLAPI void APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTexImage1D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glDrawBuffer (GLenum buf);
-GLAPI void APIENTRY glClear (GLbitfield mask);
-GLAPI void APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void APIENTRY glClearStencil (GLint s);
-GLAPI void APIENTRY glClearDepth (GLdouble depth);
-GLAPI void APIENTRY glStencilMask (GLuint mask);
-GLAPI void APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GLAPI void APIENTRY glDepthMask (GLboolean flag);
-GLAPI void APIENTRY glDisable (GLenum cap);
-GLAPI void APIENTRY glEnable (GLenum cap);
-GLAPI void APIENTRY glFinish (void);
-GLAPI void APIENTRY glFlush (void);
-GLAPI void APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GLAPI void APIENTRY glLogicOp (GLenum opcode);
-GLAPI void APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GLAPI void APIENTRY glDepthFunc (GLenum func);
-GLAPI void APIENTRY glPixelStoref (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPixelStorei (GLenum pname, GLint param);
-GLAPI void APIENTRY glReadBuffer (GLenum src);
-GLAPI void APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-GLAPI void APIENTRY glGetDoublev (GLenum pname, GLdouble *data);
-GLAPI GLenum APIENTRY glGetError (void);
-GLAPI void APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
-GLAPI void APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-GLAPI const GLubyte *APIENTRY glGetString (GLenum name);
-GLAPI void APIENTRY glGetTexImage (GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI GLboolean APIENTRY glIsEnabled (GLenum cap);
-GLAPI void APIENTRY glDepthRange (GLdouble n, GLdouble f);
-GLAPI void APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_VERSION_1_0 */
-
-#ifndef GL_VERSION_1_1
-#define GL_VERSION_1_1 1
-typedef float GLclampf;
-typedef double GLclampd;
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_POINT 0x2A01
-#define GL_POLYGON_OFFSET_LINE 0x2A02
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_1D 0x8068
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_TEXTURE_INTERNAL_FORMAT 0x1003
-#define GL_TEXTURE_RED_SIZE 0x805C
-#define GL_TEXTURE_GREEN_SIZE 0x805D
-#define GL_TEXTURE_BLUE_SIZE 0x805E
-#define GL_TEXTURE_ALPHA_SIZE 0x805F
-#define GL_DOUBLE 0x140A
-#define GL_PROXY_TEXTURE_1D 0x8063
-#define GL_PROXY_TEXTURE_2D 0x8064
-#define GL_R3_G3_B2 0x2A10
-#define GL_RGB4 0x804F
-#define GL_RGB5 0x8050
-#define GL_RGB8 0x8051
-#define GL_RGB10 0x8052
-#define GL_RGB12 0x8053
-#define GL_RGB16 0x8054
-#define GL_RGBA2 0x8055
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_RGBA12 0x805A
-#define GL_RGBA16 0x805B
-#define GL_VERTEX_ARRAY 0x8074
-typedef void (APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
-typedef void (APIENTRYP PFNGLGETPOINTERVPROC) (GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
-typedef void (APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GLAPI void APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
-GLAPI void APIENTRY glGetPointerv (GLenum pname, void **params);
-GLAPI void APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GLAPI void APIENTRY glCopyTexImage1D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glBindTexture (GLenum target, GLuint texture);
-GLAPI void APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GLAPI void APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GLAPI GLboolean APIENTRY glIsTexture (GLuint texture);
-#endif
-#endif /* GL_VERSION_1_1 */
-
-#ifndef GL_VERSION_1_2
-#define GL_VERSION_1_2 1
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_VERSION_1_2 */
-
-#ifndef GL_VERSION_1_3
-#define GL_VERSION_1_3 1
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_CLAMP_TO_BORDER 0x812D
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTexture (GLenum texture);
-GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
-GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img);
-#endif
-#endif /* GL_VERSION_1_3 */
-
-#ifndef GL_VERSION_1_4
-#define GL_VERSION_1_4 1
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_DEPTH_COMPONENT32 0x81A7
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_BLEND_COLOR 0x8005
-#define GL_BLEND_EQUATION 0x8009
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_FUNC_ADD 0x8006
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
-GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
-GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
-GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
-GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void APIENTRY glBlendEquation (GLenum mode);
-#endif
-#endif /* GL_VERSION_1_4 */
-
-#ifndef GL_VERSION_1_5
-#define GL_VERSION_1_5 1
-#include <KHR/khrplatform.h>
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_QUERY_COUNTER_BITS 0x8864
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_READ_ONLY 0x88B8
-#define GL_WRITE_ONLY 0x88B9
-#define GL_READ_WRITE 0x88BA
-#define GL_BUFFER_ACCESS 0x88BB
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_DRAW 0x88E4
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_SAMPLES_PASSED 0x8914
-#define GL_SRC1_ALPHA 0x8589
-typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
-typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
-GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
-GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
-GLAPI void APIENTRY glEndQuery (GLenum target);
-GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
-GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access);
-GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
-GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_VERSION_1_5 */
-
-#ifndef GL_VERSION_2_0
-#define GL_VERSION_2_0 1
-typedef char GLchar;
-typedef short GLshort;
-typedef signed char GLbyte;
-typedef unsigned short GLushort;
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_MAX_VARYING_FLOATS 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_1D 0x8B5D
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_SAMPLER_1D_SHADOW 0x8B61
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_DELETE_STATUS 0x8B80
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
-#define GL_LOWER_LEFT 0x8CA1
-#define GL_UPPER_LEFT 0x8CA2
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
-typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
-GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
-GLAPI void APIENTRY glCompileShader (GLuint shader);
-GLAPI GLuint APIENTRY glCreateProgram (void);
-GLAPI GLuint APIENTRY glCreateShader (GLenum type);
-GLAPI void APIENTRY glDeleteProgram (GLuint program);
-GLAPI void APIENTRY glDeleteShader (GLuint shader);
-GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
-GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
-GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
-GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
-GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
-GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
-GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
-GLAPI void APIENTRY glLinkProgram (GLuint program);
-GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-GLAPI void APIENTRY glUseProgram (GLuint program);
-GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
-GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
-GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glValidateProgram (GLuint program);
-GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
-GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
-GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
-GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_VERSION_2_0 */
-
-#ifndef GL_VERSION_2_1
-#define GL_VERSION_2_1 1
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB_ALPHA 0x8C42
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_COMPRESSED_SRGB 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_VERSION_2_1 */
-
-#ifndef GL_VERSION_3_0
-#define GL_VERSION_3_0 1
-typedef unsigned short GLhalf;
-#define GL_COMPARE_REF_TO_TEXTURE 0x884E
-#define GL_CLIP_DISTANCE0 0x3000
-#define GL_CLIP_DISTANCE1 0x3001
-#define GL_CLIP_DISTANCE2 0x3002
-#define GL_CLIP_DISTANCE3 0x3003
-#define GL_CLIP_DISTANCE4 0x3004
-#define GL_CLIP_DISTANCE5 0x3005
-#define GL_CLIP_DISTANCE6 0x3006
-#define GL_CLIP_DISTANCE7 0x3007
-#define GL_MAX_CLIP_DISTANCES 0x0D32
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_CONTEXT_FLAGS 0x821E
-#define GL_COMPRESSED_RED 0x8225
-#define GL_COMPRESSED_RG 0x8226
-#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_CLAMP_READ_COLOR 0x891C
-#define GL_FIXED_ONLY 0x891D
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#define GL_TEXTURE_1D_ARRAY 0x8C18
-#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
-#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TEXTURE_SHARED_SIZE 0x8C3F
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_PRIMITIVES_GENERATED 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_GREEN_INTEGER 0x8D95
-#define GL_BLUE_INTEGER 0x8D96
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_BGR_INTEGER 0x8D9A
-#define GL_BGRA_INTEGER 0x8D9B
-#define GL_SAMPLER_1D_ARRAY 0x8DC0
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_1D 0x8DC9
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_QUERY_WAIT 0x8E13
-#define GL_QUERY_NO_WAIT 0x8E14
-#define GL_QUERY_BY_REGION_WAIT 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE 0x88F1
-#define GL_TEXTURE_RED_TYPE 0x8C10
-#define GL_TEXTURE_GREEN_TYPE 0x8C11
-#define GL_TEXTURE_BLUE_TYPE 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE 0x8C13
-#define GL_TEXTURE_DEPTH_TYPE 0x8C16
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_COLOR_ATTACHMENT16 0x8CF0
-#define GL_COLOR_ATTACHMENT17 0x8CF1
-#define GL_COLOR_ATTACHMENT18 0x8CF2
-#define GL_COLOR_ATTACHMENT19 0x8CF3
-#define GL_COLOR_ATTACHMENT20 0x8CF4
-#define GL_COLOR_ATTACHMENT21 0x8CF5
-#define GL_COLOR_ATTACHMENT22 0x8CF6
-#define GL_COLOR_ATTACHMENT23 0x8CF7
-#define GL_COLOR_ATTACHMENT24 0x8CF8
-#define GL_COLOR_ATTACHMENT25 0x8CF9
-#define GL_COLOR_ATTACHMENT26 0x8CFA
-#define GL_COLOR_ATTACHMENT27 0x8CFB
-#define GL_COLOR_ATTACHMENT28 0x8CFC
-#define GL_COLOR_ATTACHMENT29 0x8CFD
-#define GL_COLOR_ATTACHMENT30 0x8CFE
-#define GL_COLOR_ATTACHMENT31 0x8CFF
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_STENCIL_INDEX1 0x8D46
-#define GL_STENCIL_INDEX4 0x8D47
-#define GL_STENCIL_INDEX8 0x8D48
-#define GL_STENCIL_INDEX16 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-#define GL_FRAMEBUFFER_SRGB 0x8DB9
-#define GL_HALF_FLOAT 0x140B
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-#define GL_COMPRESSED_RED_RGTC1 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
-#define GL_COMPRESSED_RG_RGTC2 0x8DBD
-#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_R16 0x822A
-#define GL_RG8 0x822B
-#define GL_RG16 0x822C
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
-typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
-typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
-typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
-typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
-typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
-typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
-typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
-GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
-GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
-GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
-GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
-GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
-GLAPI void APIENTRY glEndTransformFeedback (void);
-GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
-GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
-GLAPI void APIENTRY glEndConditionalRender (void);
-GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
-GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
-GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
-GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
-GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
-GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
-GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
-GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
-GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
-GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
-GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
-GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
-GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
-GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
-GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
-GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
-GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGenerateMipmap (GLenum target);
-GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glBindVertexArray (GLuint array);
-GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
-GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
-GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
-#endif
-#endif /* GL_VERSION_3_0 */
-
-#ifndef GL_VERSION_3_1
-#define GL_VERSION_3_1 1
-#define GL_SAMPLER_2D_RECT 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
-#define GL_SAMPLER_BUFFER 0x8DC2
-#define GL_INT_SAMPLER_2D_RECT 0x8DCD
-#define GL_INT_SAMPLER_BUFFER 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
-#define GL_TEXTURE_BUFFER 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_R16_SNORM 0x8F98
-#define GL_RG16_SNORM 0x8F99
-#define GL_RGB16_SNORM 0x8F9A
-#define GL_RGBA16_SNORM 0x8F9B
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART 0x8F9D
-#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
-typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
-GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
-GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
-GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-#endif
-#endif /* GL_VERSION_3_1 */
-
-#ifndef GL_VERSION_3_2
-#define GL_VERSION_3_2 1
-typedef struct __GLsync *GLsync;
-#ifndef GLEXT_64_TYPES_DEFINED
-/* This code block is duplicated in glxext.h, so must be protected */
-#define GLEXT_64_TYPES_DEFINED
-/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
-/* (as used in the GL_EXT_timer_query extension). */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#include <inttypes.h>
-#elif defined(__sun__) || defined(__digital__)
-#include <inttypes.h>
-#if defined(__STDC__)
-#if defined(__arch64__) || defined(_LP64)
-typedef long int int64_t;
-typedef unsigned long int uint64_t;
-#else
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#endif /* __arch64__ */
-#endif /* __STDC__ */
-#elif defined( __VMS ) || defined(__sgi)
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
-#elif defined(__UNIXOS2__) || defined(__SOL64__)
-typedef long int int32_t;
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#elif defined(_WIN32) && defined(__GNUC__)
-#include <stdint.h>
-#elif defined(_WIN32)
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#else
-/* Fallback if nothing above works */
-#include <inttypes.h>
-#endif
-#endif
-typedef uint64_t GLuint64;
-typedef int64_t GLint64;
-#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
-#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define GL_LINES_ADJACENCY 0x000A
-#define GL_LINE_STRIP_ADJACENCY 0x000B
-#define GL_TRIANGLES_ADJACENCY 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
-#define GL_PROGRAM_POINT_SIZE 0x8642
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
-#define GL_GEOMETRY_SHADER 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT 0x8916
-#define GL_GEOMETRY_INPUT_TYPE 0x8917
-#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_CONTEXT_PROFILE_MASK 0x9126
-#define GL_DEPTH_CLAMP 0x864F
-#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
-#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION 0x8E4E
-#define GL_PROVOKING_VERTEX 0x8E4F
-#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_SAMPLE_POSITION 0x8E50
-#define GL_SAMPLE_MASK 0x8E51
-#define GL_SAMPLE_MASK_VALUE 0x8E52
-#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
-#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
-#define GL_TEXTURE_SAMPLES 0x9106
-#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
-#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
-#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
-#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
-#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
-#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
-#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
-#define GL_MAX_INTEGER_SAMPLES 0x9110
-typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
-typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
-typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
-typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
-typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
-typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
-typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
-GLAPI void APIENTRY glProvokingVertex (GLenum mode);
-GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
-GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
-GLAPI void APIENTRY glDeleteSync (GLsync sync);
-GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
-GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
-GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
-GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
-#endif
-#endif /* GL_VERSION_3_2 */
-
-#ifndef GL_VERSION_3_3
-#define GL_VERSION_3_3 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_SRC1_COLOR 0x88F9
-#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
-#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
-#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-#define GL_SAMPLER_BINDING 0x8919
-#define GL_RGB10_A2UI 0x906F
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
-#define GL_TIME_ELAPSED 0x88BF
-#define GL_TIMESTAMP 0x8E28
-#define GL_INT_2_10_10_10_REV 0x8D9F
-typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
-typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
-typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
-typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
-GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
-GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
-GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
-GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
-GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
-GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
-GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
-GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
-GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
-GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-#endif
-#endif /* GL_VERSION_3_3 */
-
-#ifndef GL_VERSION_4_0
-#define GL_VERSION_4_0 1
-#define GL_SAMPLE_SHADING 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
-#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
-#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
-#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
-#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
-#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
-#define GL_MAX_VERTEX_STREAMS 0x8E71
-#define GL_DOUBLE_VEC2 0x8FFC
-#define GL_DOUBLE_VEC3 0x8FFD
-#define GL_DOUBLE_VEC4 0x8FFE
-#define GL_DOUBLE_MAT2 0x8F46
-#define GL_DOUBLE_MAT3 0x8F47
-#define GL_DOUBLE_MAT4 0x8F48
-#define GL_DOUBLE_MAT2x3 0x8F49
-#define GL_DOUBLE_MAT2x4 0x8F4A
-#define GL_DOUBLE_MAT3x2 0x8F4B
-#define GL_DOUBLE_MAT3x4 0x8F4C
-#define GL_DOUBLE_MAT4x2 0x8F4D
-#define GL_DOUBLE_MAT4x3 0x8F4E
-#define GL_ACTIVE_SUBROUTINES 0x8DE5
-#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
-#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
-#define GL_MAX_SUBROUTINES 0x8DE7
-#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
-#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
-#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
-#define GL_PATCHES 0x000E
-#define GL_PATCH_VERTICES 0x8E72
-#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
-#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
-#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
-#define GL_TESS_GEN_MODE 0x8E76
-#define GL_TESS_GEN_SPACING 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
-#define GL_TESS_GEN_POINT_MODE 0x8E79
-#define GL_ISOLINES 0x8E7A
-#define GL_FRACTIONAL_ODD 0x8E7B
-#define GL_FRACTIONAL_EVEN 0x8E7C
-#define GL_MAX_PATCH_VERTICES 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
-#define GL_TESS_EVALUATION_SHADER 0x8E87
-#define GL_TESS_CONTROL_SHADER 0x8E88
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
-typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
-typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
-typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
-typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
-typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
-typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
-typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
-typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
-typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
-typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMinSampleShading (GLfloat value);
-GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
-GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
-GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
-GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
-GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
-GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
-GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
-GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
-GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
-GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
-GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
-GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
-GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
-GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
-GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
-GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
-GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
-GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
-GLAPI void APIENTRY glPauseTransformFeedback (void);
-GLAPI void APIENTRY glResumeTransformFeedback (void);
-GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
-GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
-GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
-GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
-GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
-#endif
-#endif /* GL_VERSION_4_0 */
-
-#ifndef GL_VERSION_4_1
-#define GL_VERSION_4_1 1
-#define GL_FIXED 0x140C
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_RGB565 0x8D62
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-#define GL_VERTEX_SHADER_BIT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT 0x00000002
-#define GL_GEOMETRY_SHADER_BIT 0x00000004
-#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
-#define GL_ALL_SHADER_BITS 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE 0x8258
-#define GL_ACTIVE_PROGRAM 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING 0x825A
-#define GL_MAX_VIEWPORTS 0x825B
-#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
-#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
-#define GL_LAYER_PROVOKING_VERTEX 0x825E
-#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
-#define GL_UNDEFINED_VERTEX 0x8260
-typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
-typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
-typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
-typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
-typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
-typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f);
-typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReleaseShaderCompiler (void);
-GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f);
-GLAPI void APIENTRY glClearDepthf (GLfloat d);
-GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
-GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
-GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
-GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
-GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
-GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
-GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
-GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
-GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
-GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
-GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
-GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
-GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
-GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
-GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
-GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f);
-GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
-GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
-#endif
-#endif /* GL_VERSION_4_1 */
-
-#ifndef GL_VERSION_4_2
-#define GL_VERSION_4_2 1
-#define GL_COPY_READ_BUFFER_BINDING 0x8F36
-#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
-#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
-#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
-#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
-#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
-#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
-#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
-#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
-#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
-#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
-#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
-#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
-#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
-#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
-#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
-#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
-#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
-#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
-#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
-#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
-#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
-#define GL_COMMAND_BARRIER_BIT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
-#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
-#define GL_MAX_IMAGE_UNITS 0x8F38
-#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
-#define GL_IMAGE_BINDING_NAME 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED 0x8F3C
-#define GL_IMAGE_BINDING_LAYER 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS 0x8F3E
-#define GL_IMAGE_1D 0x904C
-#define GL_IMAGE_2D 0x904D
-#define GL_IMAGE_3D 0x904E
-#define GL_IMAGE_2D_RECT 0x904F
-#define GL_IMAGE_CUBE 0x9050
-#define GL_IMAGE_BUFFER 0x9051
-#define GL_IMAGE_1D_ARRAY 0x9052
-#define GL_IMAGE_2D_ARRAY 0x9053
-#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
-#define GL_IMAGE_2D_MULTISAMPLE 0x9055
-#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
-#define GL_INT_IMAGE_1D 0x9057
-#define GL_INT_IMAGE_2D 0x9058
-#define GL_INT_IMAGE_3D 0x9059
-#define GL_INT_IMAGE_2D_RECT 0x905A
-#define GL_INT_IMAGE_CUBE 0x905B
-#define GL_INT_IMAGE_BUFFER 0x905C
-#define GL_INT_IMAGE_1D_ARRAY 0x905D
-#define GL_INT_IMAGE_2D_ARRAY 0x905E
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
-#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
-#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
-#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
-#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
-#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
-#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
-#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
-#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
-#define GL_MAX_IMAGE_SAMPLES 0x906D
-#define GL_IMAGE_BINDING_FORMAT 0x906E
-#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
-#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
-#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
-#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
-#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
-typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
-GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
-GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount);
-GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
-#endif
-#endif /* GL_VERSION_4_2 */
-
-#ifndef GL_VERSION_4_3
-#define GL_VERSION_4_3 1
-typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9
-#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_COMPUTE_SHADER 0x91B9
-#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
-#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
-#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
-#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
-#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
-#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
-#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
-#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
-#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
-#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
-#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
-#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
-#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
-#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
-#define GL_COMPUTE_SHADER_BIT 0x00000020
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
-#define GL_DEBUG_SOURCE_API 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION 0x824A
-#define GL_DEBUG_SOURCE_OTHER 0x824B
-#define GL_DEBUG_TYPE_ERROR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
-#define GL_DEBUG_TYPE_OTHER 0x8251
-#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES 0x9145
-#define GL_DEBUG_SEVERITY_HIGH 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
-#define GL_DEBUG_SEVERITY_LOW 0x9148
-#define GL_DEBUG_TYPE_MARKER 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
-#define GL_BUFFER 0x82E0
-#define GL_SHADER 0x82E1
-#define GL_PROGRAM 0x82E2
-#define GL_QUERY 0x82E3
-#define GL_PROGRAM_PIPELINE 0x82E4
-#define GL_SAMPLER 0x82E6
-#define GL_MAX_LABEL_LENGTH 0x82E8
-#define GL_DEBUG_OUTPUT 0x92E0
-#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
-#define GL_MAX_UNIFORM_LOCATIONS 0x826E
-#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
-#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
-#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
-#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
-#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
-#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
-#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
-#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
-#define GL_INTERNALFORMAT_SUPPORTED 0x826F
-#define GL_INTERNALFORMAT_PREFERRED 0x8270
-#define GL_INTERNALFORMAT_RED_SIZE 0x8271
-#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272
-#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273
-#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274
-#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275
-#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276
-#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277
-#define GL_INTERNALFORMAT_RED_TYPE 0x8278
-#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279
-#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A
-#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B
-#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C
-#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D
-#define GL_MAX_WIDTH 0x827E
-#define GL_MAX_HEIGHT 0x827F
-#define GL_MAX_DEPTH 0x8280
-#define GL_MAX_LAYERS 0x8281
-#define GL_MAX_COMBINED_DIMENSIONS 0x8282
-#define GL_COLOR_COMPONENTS 0x8283
-#define GL_DEPTH_COMPONENTS 0x8284
-#define GL_STENCIL_COMPONENTS 0x8285
-#define GL_COLOR_RENDERABLE 0x8286
-#define GL_DEPTH_RENDERABLE 0x8287
-#define GL_STENCIL_RENDERABLE 0x8288
-#define GL_FRAMEBUFFER_RENDERABLE 0x8289
-#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
-#define GL_FRAMEBUFFER_BLEND 0x828B
-#define GL_READ_PIXELS 0x828C
-#define GL_READ_PIXELS_FORMAT 0x828D
-#define GL_READ_PIXELS_TYPE 0x828E
-#define GL_TEXTURE_IMAGE_FORMAT 0x828F
-#define GL_TEXTURE_IMAGE_TYPE 0x8290
-#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291
-#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292
-#define GL_MIPMAP 0x8293
-#define GL_MANUAL_GENERATE_MIPMAP 0x8294
-#define GL_AUTO_GENERATE_MIPMAP 0x8295
-#define GL_COLOR_ENCODING 0x8296
-#define GL_SRGB_READ 0x8297
-#define GL_SRGB_WRITE 0x8298
-#define GL_FILTER 0x829A
-#define GL_VERTEX_TEXTURE 0x829B
-#define GL_TESS_CONTROL_TEXTURE 0x829C
-#define GL_TESS_EVALUATION_TEXTURE 0x829D
-#define GL_GEOMETRY_TEXTURE 0x829E
-#define GL_FRAGMENT_TEXTURE 0x829F
-#define GL_COMPUTE_TEXTURE 0x82A0
-#define GL_TEXTURE_SHADOW 0x82A1
-#define GL_TEXTURE_GATHER 0x82A2
-#define GL_TEXTURE_GATHER_SHADOW 0x82A3
-#define GL_SHADER_IMAGE_LOAD 0x82A4
-#define GL_SHADER_IMAGE_STORE 0x82A5
-#define GL_SHADER_IMAGE_ATOMIC 0x82A6
-#define GL_IMAGE_TEXEL_SIZE 0x82A7
-#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8
-#define GL_IMAGE_PIXEL_FORMAT 0x82A9
-#define GL_IMAGE_PIXEL_TYPE 0x82AA
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
-#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
-#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
-#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3
-#define GL_CLEAR_BUFFER 0x82B4
-#define GL_TEXTURE_VIEW 0x82B5
-#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6
-#define GL_FULL_SUPPORT 0x82B7
-#define GL_CAVEAT_SUPPORT 0x82B8
-#define GL_IMAGE_CLASS_4_X_32 0x82B9
-#define GL_IMAGE_CLASS_2_X_32 0x82BA
-#define GL_IMAGE_CLASS_1_X_32 0x82BB
-#define GL_IMAGE_CLASS_4_X_16 0x82BC
-#define GL_IMAGE_CLASS_2_X_16 0x82BD
-#define GL_IMAGE_CLASS_1_X_16 0x82BE
-#define GL_IMAGE_CLASS_4_X_8 0x82BF
-#define GL_IMAGE_CLASS_2_X_8 0x82C0
-#define GL_IMAGE_CLASS_1_X_8 0x82C1
-#define GL_IMAGE_CLASS_11_11_10 0x82C2
-#define GL_IMAGE_CLASS_10_10_10_2 0x82C3
-#define GL_VIEW_CLASS_128_BITS 0x82C4
-#define GL_VIEW_CLASS_96_BITS 0x82C5
-#define GL_VIEW_CLASS_64_BITS 0x82C6
-#define GL_VIEW_CLASS_48_BITS 0x82C7
-#define GL_VIEW_CLASS_32_BITS 0x82C8
-#define GL_VIEW_CLASS_24_BITS 0x82C9
-#define GL_VIEW_CLASS_16_BITS 0x82CA
-#define GL_VIEW_CLASS_8_BITS 0x82CB
-#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC
-#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD
-#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE
-#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF
-#define GL_VIEW_CLASS_RGTC1_RED 0x82D0
-#define GL_VIEW_CLASS_RGTC2_RG 0x82D1
-#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
-#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
-#define GL_UNIFORM 0x92E1
-#define GL_UNIFORM_BLOCK 0x92E2
-#define GL_PROGRAM_INPUT 0x92E3
-#define GL_PROGRAM_OUTPUT 0x92E4
-#define GL_BUFFER_VARIABLE 0x92E5
-#define GL_SHADER_STORAGE_BLOCK 0x92E6
-#define GL_VERTEX_SUBROUTINE 0x92E8
-#define GL_TESS_CONTROL_SUBROUTINE 0x92E9
-#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA
-#define GL_GEOMETRY_SUBROUTINE 0x92EB
-#define GL_FRAGMENT_SUBROUTINE 0x92EC
-#define GL_COMPUTE_SUBROUTINE 0x92ED
-#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE
-#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
-#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
-#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1
-#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2
-#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3
-#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
-#define GL_ACTIVE_RESOURCES 0x92F5
-#define GL_MAX_NAME_LENGTH 0x92F6
-#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
-#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
-#define GL_NAME_LENGTH 0x92F9
-#define GL_TYPE 0x92FA
-#define GL_ARRAY_SIZE 0x92FB
-#define GL_OFFSET 0x92FC
-#define GL_BLOCK_INDEX 0x92FD
-#define GL_ARRAY_STRIDE 0x92FE
-#define GL_MATRIX_STRIDE 0x92FF
-#define GL_IS_ROW_MAJOR 0x9300
-#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
-#define GL_BUFFER_BINDING 0x9302
-#define GL_BUFFER_DATA_SIZE 0x9303
-#define GL_NUM_ACTIVE_VARIABLES 0x9304
-#define GL_ACTIVE_VARIABLES 0x9305
-#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
-#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
-#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
-#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
-#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
-#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
-#define GL_LOCATION 0x930E
-#define GL_LOCATION_INDEX 0x930F
-#define GL_IS_PER_PATCH 0x92E7
-#define GL_SHADER_STORAGE_BUFFER 0x90D2
-#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
-#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
-#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
-#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
-#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
-#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
-#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
-#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
-#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
-#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
-#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
-#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
-#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
-#define GL_TEXTURE_BUFFER_OFFSET 0x919D
-#define GL_TEXTURE_BUFFER_SIZE 0x919E
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
-#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-#define GL_VERTEX_ATTRIB_BINDING 0x82D4
-#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
-#define GL_VERTEX_BINDING_DIVISOR 0x82D6
-#define GL_VERTEX_BINDING_OFFSET 0x82D7
-#define GL_VERTEX_BINDING_STRIDE 0x82D8
-#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
-#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
-#define GL_VERTEX_BINDING_BUFFER 0x8F4F
-typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
-typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
-typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
-typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
-typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
-typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
-typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
-typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);
-GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
-GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);
-GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);
-GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
-GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
-GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
-GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
-GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-GLAPI void APIENTRY glPopDebugGroup (void);
-GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_VERSION_4_3 */
-
-#ifndef GL_VERSION_4_4
-#define GL_VERSION_4_4 1
-#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
-#define GL_TEXTURE_BUFFER_BINDING 0x8C2A
-#define GL_MAP_PERSISTENT_BIT 0x0040
-#define GL_MAP_COHERENT_BIT 0x0080
-#define GL_DYNAMIC_STORAGE_BIT 0x0100
-#define GL_CLIENT_STORAGE_BIT 0x0200
-#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
-#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F
-#define GL_BUFFER_STORAGE_FLAGS 0x8220
-#define GL_CLEAR_TEXTURE 0x9365
-#define GL_LOCATION_COMPONENT 0x934A
-#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
-#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
-#define GL_QUERY_BUFFER 0x9192
-#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
-#define GL_QUERY_BUFFER_BINDING 0x9193
-#define GL_QUERY_RESULT_NO_WAIT 0x9194
-#define GL_MIRROR_CLAMP_TO_EDGE 0x8743
-typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
-typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
-typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers);
-typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
-typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
-GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
-GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures);
-GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers);
-GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures);
-GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-#endif
-#endif /* GL_VERSION_4_4 */
-
-#ifndef GL_VERSION_4_5
-#define GL_VERSION_4_5 1
-#define GL_CONTEXT_LOST 0x0507
-#define GL_NEGATIVE_ONE_TO_ONE 0x935E
-#define GL_ZERO_TO_ONE 0x935F
-#define GL_CLIP_ORIGIN 0x935C
-#define GL_CLIP_DEPTH_MODE 0x935D
-#define GL_QUERY_WAIT_INVERTED 0x8E17
-#define GL_QUERY_NO_WAIT_INVERTED 0x8E18
-#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19
-#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A
-#define GL_MAX_CULL_DISTANCES 0x82F9
-#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA
-#define GL_TEXTURE_TARGET 0x1006
-#define GL_QUERY_TARGET 0x82EA
-#define GL_GUILTY_CONTEXT_RESET 0x8253
-#define GL_INNOCENT_CONTEXT_RESET 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET 0x8252
-#define GL_NO_RESET_NOTIFICATION 0x8261
-#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004
-#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB
-#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC
-typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth);
-typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
-typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src);
-typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
-typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture);
-typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture);
-typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
-typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers);
-typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
-typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
-typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
-typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void);
-typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth);
-GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param);
-GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
-GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers);
-GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access);
-GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer);
-GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params);
-GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers);
-GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param);
-GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf);
-GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src);
-GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
-GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
-GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
-GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target);
-GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures);
-GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param);
-GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param);
-GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture);
-GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture);
-GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays);
-GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer);
-GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
-GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers);
-GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines);
-GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
-GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
-GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void);
-GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GLAPI void APIENTRY glTextureBarrier (void);
-#endif
-#endif /* GL_VERSION_4_5 */
-
-#ifndef GL_VERSION_4_6
-#define GL_VERSION_4_6 1
-#define GL_SHADER_BINARY_FORMAT_SPIR_V 0x9551
-#define GL_SPIR_V_BINARY 0x9552
-#define GL_PARAMETER_BUFFER 0x80EE
-#define GL_PARAMETER_BUFFER_BINDING 0x80EF
-#define GL_CONTEXT_FLAG_NO_ERROR_BIT 0x00000008
-#define GL_VERTICES_SUBMITTED 0x82EE
-#define GL_PRIMITIVES_SUBMITTED 0x82EF
-#define GL_VERTEX_SHADER_INVOCATIONS 0x82F0
-#define GL_TESS_CONTROL_SHADER_PATCHES 0x82F1
-#define GL_TESS_EVALUATION_SHADER_INVOCATIONS 0x82F2
-#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED 0x82F3
-#define GL_FRAGMENT_SHADER_INVOCATIONS 0x82F4
-#define GL_COMPUTE_SHADER_INVOCATIONS 0x82F5
-#define GL_CLIPPING_INPUT_PRIMITIVES 0x82F6
-#define GL_CLIPPING_OUTPUT_PRIMITIVES 0x82F7
-#define GL_POLYGON_OFFSET_CLAMP 0x8E1B
-#define GL_SPIR_V_EXTENSIONS 0x9553
-#define GL_NUM_SPIR_V_EXTENSIONS 0x9554
-#define GL_TEXTURE_MAX_ANISOTROPY 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY 0x84FF
-#define GL_TRANSFORM_FEEDBACK_OVERFLOW 0x82EC
-#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW 0x82ED
-typedef void (APIENTRYP PFNGLSPECIALIZESHADERPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpecializeShader (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-GLAPI void APIENTRY glMultiDrawArraysIndirectCount (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirectCount (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glPolygonOffsetClamp (GLfloat factor, GLfloat units, GLfloat clamp);
-#endif
-#endif /* GL_VERSION_4_6 */
-
-#ifndef GL_ARB_ES2_compatibility
-#define GL_ARB_ES2_compatibility 1
-#endif /* GL_ARB_ES2_compatibility */
-
-#ifndef GL_ARB_ES3_1_compatibility
-#define GL_ARB_ES3_1_compatibility 1
-#endif /* GL_ARB_ES3_1_compatibility */
-
-#ifndef GL_ARB_ES3_2_compatibility
-#define GL_ARB_ES3_2_compatibility 1
-#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE
-#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381
-#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382
-typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#endif
-#endif /* GL_ARB_ES3_2_compatibility */
-
-#ifndef GL_ARB_ES3_compatibility
-#define GL_ARB_ES3_compatibility 1
-#endif /* GL_ARB_ES3_compatibility */
-
-#ifndef GL_ARB_arrays_of_arrays
-#define GL_ARB_arrays_of_arrays 1
-#endif /* GL_ARB_arrays_of_arrays */
-
-#ifndef GL_ARB_base_instance
-#define GL_ARB_base_instance 1
-#endif /* GL_ARB_base_instance */
-
-#ifndef GL_ARB_bindless_texture
-#define GL_ARB_bindless_texture 1
-typedef uint64_t GLuint64EXT;
-#define GL_UNSIGNED_INT64_ARB 0x140F
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture);
-GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler);
-GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle);
-GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access);
-GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value);
-GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value);
-GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle);
-GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x);
-GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params);
-#endif
-#endif /* GL_ARB_bindless_texture */
-
-#ifndef GL_ARB_blend_func_extended
-#define GL_ARB_blend_func_extended 1
-#endif /* GL_ARB_blend_func_extended */
-
-#ifndef GL_ARB_buffer_storage
-#define GL_ARB_buffer_storage 1
-#endif /* GL_ARB_buffer_storage */
-
-#ifndef GL_ARB_cl_event
-#define GL_ARB_cl_event 1
-struct _cl_context;
-struct _cl_event;
-#define GL_SYNC_CL_EVENT_ARB 0x8240
-#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241
-typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
-#endif
-#endif /* GL_ARB_cl_event */
-
-#ifndef GL_ARB_clear_buffer_object
-#define GL_ARB_clear_buffer_object 1
-#endif /* GL_ARB_clear_buffer_object */
-
-#ifndef GL_ARB_clear_texture
-#define GL_ARB_clear_texture 1
-#endif /* GL_ARB_clear_texture */
-
-#ifndef GL_ARB_clip_control
-#define GL_ARB_clip_control 1
-#endif /* GL_ARB_clip_control */
-
-#ifndef GL_ARB_compressed_texture_pixel_storage
-#define GL_ARB_compressed_texture_pixel_storage 1
-#endif /* GL_ARB_compressed_texture_pixel_storage */
-
-#ifndef GL_ARB_compute_shader
-#define GL_ARB_compute_shader 1
-#endif /* GL_ARB_compute_shader */
-
-#ifndef GL_ARB_compute_variable_group_size
-#define GL_ARB_compute_variable_group_size 1
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344
-#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345
-#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
-#endif
-#endif /* GL_ARB_compute_variable_group_size */
-
-#ifndef GL_ARB_conditional_render_inverted
-#define GL_ARB_conditional_render_inverted 1
-#endif /* GL_ARB_conditional_render_inverted */
-
-#ifndef GL_ARB_conservative_depth
-#define GL_ARB_conservative_depth 1
-#endif /* GL_ARB_conservative_depth */
-
-#ifndef GL_ARB_copy_buffer
-#define GL_ARB_copy_buffer 1
-#endif /* GL_ARB_copy_buffer */
-
-#ifndef GL_ARB_copy_image
-#define GL_ARB_copy_image 1
-#endif /* GL_ARB_copy_image */
-
-#ifndef GL_ARB_cull_distance
-#define GL_ARB_cull_distance 1
-#endif /* GL_ARB_cull_distance */
-
-#ifndef GL_ARB_debug_output
-#define GL_ARB_debug_output 1
-typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
-#define GL_DEBUG_SOURCE_API_ARB 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
-#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
-#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
-#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
-#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
-typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam);
-GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-#endif
-#endif /* GL_ARB_debug_output */
-
-#ifndef GL_ARB_depth_buffer_float
-#define GL_ARB_depth_buffer_float 1
-#endif /* GL_ARB_depth_buffer_float */
-
-#ifndef GL_ARB_depth_clamp
-#define GL_ARB_depth_clamp 1
-#endif /* GL_ARB_depth_clamp */
-
-#ifndef GL_ARB_derivative_control
-#define GL_ARB_derivative_control 1
-#endif /* GL_ARB_derivative_control */
-
-#ifndef GL_ARB_direct_state_access
-#define GL_ARB_direct_state_access 1
-#endif /* GL_ARB_direct_state_access */
-
-#ifndef GL_ARB_draw_buffers_blend
-#define GL_ARB_draw_buffers_blend 1
-typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
-GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
-GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-#endif /* GL_ARB_draw_buffers_blend */
-
-#ifndef GL_ARB_draw_elements_base_vertex
-#define GL_ARB_draw_elements_base_vertex 1
-#endif /* GL_ARB_draw_elements_base_vertex */
-
-#ifndef GL_ARB_draw_indirect
-#define GL_ARB_draw_indirect 1
-#endif /* GL_ARB_draw_indirect */
-
-#ifndef GL_ARB_draw_instanced
-#define GL_ARB_draw_instanced 1
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_ARB_draw_instanced */
-
-#ifndef GL_ARB_enhanced_layouts
-#define GL_ARB_enhanced_layouts 1
-#endif /* GL_ARB_enhanced_layouts */
-
-#ifndef GL_ARB_explicit_attrib_location
-#define GL_ARB_explicit_attrib_location 1
-#endif /* GL_ARB_explicit_attrib_location */
-
-#ifndef GL_ARB_explicit_uniform_location
-#define GL_ARB_explicit_uniform_location 1
-#endif /* GL_ARB_explicit_uniform_location */
-
-#ifndef GL_ARB_fragment_coord_conventions
-#define GL_ARB_fragment_coord_conventions 1
-#endif /* GL_ARB_fragment_coord_conventions */
-
-#ifndef GL_ARB_fragment_layer_viewport
-#define GL_ARB_fragment_layer_viewport 1
-#endif /* GL_ARB_fragment_layer_viewport */
-
-#ifndef GL_ARB_fragment_shader_interlock
-#define GL_ARB_fragment_shader_interlock 1
-#endif /* GL_ARB_fragment_shader_interlock */
-
-#ifndef GL_ARB_framebuffer_no_attachments
-#define GL_ARB_framebuffer_no_attachments 1
-#endif /* GL_ARB_framebuffer_no_attachments */
-
-#ifndef GL_ARB_framebuffer_object
-#define GL_ARB_framebuffer_object 1
-#endif /* GL_ARB_framebuffer_object */
-
-#ifndef GL_ARB_framebuffer_sRGB
-#define GL_ARB_framebuffer_sRGB 1
-#endif /* GL_ARB_framebuffer_sRGB */
-
-#ifndef GL_ARB_geometry_shader4
-#define GL_ARB_geometry_shader4 1
-#define GL_LINES_ADJACENCY_ARB 0x000A
-#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B
-#define GL_TRIANGLES_ADJACENCY_ARB 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D
-#define GL_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
-#define GL_GEOMETRY_SHADER_ARB 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA
-#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB
-#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC
-#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
-#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);
-GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#endif
-#endif /* GL_ARB_geometry_shader4 */
-
-#ifndef GL_ARB_get_program_binary
-#define GL_ARB_get_program_binary 1
-#endif /* GL_ARB_get_program_binary */
-
-#ifndef GL_ARB_get_texture_sub_image
-#define GL_ARB_get_texture_sub_image 1
-#endif /* GL_ARB_get_texture_sub_image */
-
-#ifndef GL_ARB_gl_spirv
-#define GL_ARB_gl_spirv 1
-#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551
-#define GL_SPIR_V_BINARY_ARB 0x9552
-typedef void (APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpecializeShaderARB (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-#endif
-#endif /* GL_ARB_gl_spirv */
-
-#ifndef GL_ARB_gpu_shader5
-#define GL_ARB_gpu_shader5 1
-#endif /* GL_ARB_gpu_shader5 */
-
-#ifndef GL_ARB_gpu_shader_fp64
-#define GL_ARB_gpu_shader_fp64 1
-#endif /* GL_ARB_gpu_shader_fp64 */
-
-#ifndef GL_ARB_gpu_shader_int64
-#define GL_ARB_gpu_shader_int64 1
-#define GL_INT64_ARB 0x140E
-#define GL_INT64_VEC2_ARB 0x8FE9
-#define GL_INT64_VEC3_ARB 0x8FEA
-#define GL_INT64_VEC4_ARB 0x8FEB
-#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
-typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x);
-typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y);
-typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z);
-typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x);
-GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y);
-GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z);
-GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x);
-GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y);
-GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params);
-GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params);
-GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
-GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
-GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x);
-GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y);
-GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
-GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x);
-GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y);
-GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-#endif
-#endif /* GL_ARB_gpu_shader_int64 */
-
-#ifndef GL_ARB_half_float_vertex
-#define GL_ARB_half_float_vertex 1
-#endif /* GL_ARB_half_float_vertex */
-
-#ifndef GL_ARB_imaging
-#define GL_ARB_imaging 1
-#endif /* GL_ARB_imaging */
-
-#ifndef GL_ARB_indirect_parameters
-#define GL_ARB_indirect_parameters 1
-#define GL_PARAMETER_BUFFER_ARB 0x80EE
-#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-#endif
-#endif /* GL_ARB_indirect_parameters */
-
-#ifndef GL_ARB_instanced_arrays
-#define GL_ARB_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
-typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_ARB_instanced_arrays */
-
-#ifndef GL_ARB_internalformat_query
-#define GL_ARB_internalformat_query 1
-#endif /* GL_ARB_internalformat_query */
-
-#ifndef GL_ARB_internalformat_query2
-#define GL_ARB_internalformat_query2 1
-#define GL_SRGB_DECODE_ARB 0x8299
-#endif /* GL_ARB_internalformat_query2 */
-
-#ifndef GL_ARB_invalidate_subdata
-#define GL_ARB_invalidate_subdata 1
-#endif /* GL_ARB_invalidate_subdata */
-
-#ifndef GL_ARB_map_buffer_alignment
-#define GL_ARB_map_buffer_alignment 1
-#endif /* GL_ARB_map_buffer_alignment */
-
-#ifndef GL_ARB_map_buffer_range
-#define GL_ARB_map_buffer_range 1
-#endif /* GL_ARB_map_buffer_range */
-
-#ifndef GL_ARB_multi_bind
-#define GL_ARB_multi_bind 1
-#endif /* GL_ARB_multi_bind */
-
-#ifndef GL_ARB_multi_draw_indirect
-#define GL_ARB_multi_draw_indirect 1
-#endif /* GL_ARB_multi_draw_indirect */
-
-#ifndef GL_ARB_occlusion_query2
-#define GL_ARB_occlusion_query2 1
-#endif /* GL_ARB_occlusion_query2 */
-
-#ifndef GL_ARB_parallel_shader_compile
-#define GL_ARB_parallel_shader_compile 1
-#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0
-#define GL_COMPLETION_STATUS_ARB 0x91B1
-typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count);
-#endif
-#endif /* GL_ARB_parallel_shader_compile */
-
-#ifndef GL_ARB_pipeline_statistics_query
-#define GL_ARB_pipeline_statistics_query 1
-#define GL_VERTICES_SUBMITTED_ARB 0x82EE
-#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF
-#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0
-#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1
-#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2
-#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3
-#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4
-#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5
-#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6
-#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7
-#endif /* GL_ARB_pipeline_statistics_query */
-
-#ifndef GL_ARB_pixel_buffer_object
-#define GL_ARB_pixel_buffer_object 1
-#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
-#endif /* GL_ARB_pixel_buffer_object */
-
-#ifndef GL_ARB_polygon_offset_clamp
-#define GL_ARB_polygon_offset_clamp 1
-#endif /* GL_ARB_polygon_offset_clamp */
-
-#ifndef GL_ARB_post_depth_coverage
-#define GL_ARB_post_depth_coverage 1
-#endif /* GL_ARB_post_depth_coverage */
-
-#ifndef GL_ARB_program_interface_query
-#define GL_ARB_program_interface_query 1
-#endif /* GL_ARB_program_interface_query */
-
-#ifndef GL_ARB_provoking_vertex
-#define GL_ARB_provoking_vertex 1
-#endif /* GL_ARB_provoking_vertex */
-
-#ifndef GL_ARB_query_buffer_object
-#define GL_ARB_query_buffer_object 1
-#endif /* GL_ARB_query_buffer_object */
-
-#ifndef GL_ARB_robust_buffer_access_behavior
-#define GL_ARB_robust_buffer_access_behavior 1
-#endif /* GL_ARB_robust_buffer_access_behavior */
-
-#ifndef GL_ARB_robustness
-#define GL_ARB_robustness 1
-#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
-typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
-typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
-typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img);
-typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
-GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
-GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img);
-GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-#endif
-#endif /* GL_ARB_robustness */
-
-#ifndef GL_ARB_robustness_isolation
-#define GL_ARB_robustness_isolation 1
-#endif /* GL_ARB_robustness_isolation */
-
-#ifndef GL_ARB_sample_locations
-#define GL_ARB_sample_locations 1
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340
-#define GL_SAMPLE_LOCATION_ARB 0x8E50
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343
-typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glEvaluateDepthValuesARB (void);
-#endif
-#endif /* GL_ARB_sample_locations */
-
-#ifndef GL_ARB_sample_shading
-#define GL_ARB_sample_shading 1
-#define GL_SAMPLE_SHADING_ARB 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37
-typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
-#endif
-#endif /* GL_ARB_sample_shading */
-
-#ifndef GL_ARB_sampler_objects
-#define GL_ARB_sampler_objects 1
-#endif /* GL_ARB_sampler_objects */
-
-#ifndef GL_ARB_seamless_cube_map
-#define GL_ARB_seamless_cube_map 1
-#endif /* GL_ARB_seamless_cube_map */
-
-#ifndef GL_ARB_seamless_cubemap_per_texture
-#define GL_ARB_seamless_cubemap_per_texture 1
-#endif /* GL_ARB_seamless_cubemap_per_texture */
-
-#ifndef GL_ARB_separate_shader_objects
-#define GL_ARB_separate_shader_objects 1
-#endif /* GL_ARB_separate_shader_objects */
-
-#ifndef GL_ARB_shader_atomic_counter_ops
-#define GL_ARB_shader_atomic_counter_ops 1
-#endif /* GL_ARB_shader_atomic_counter_ops */
-
-#ifndef GL_ARB_shader_atomic_counters
-#define GL_ARB_shader_atomic_counters 1
-#endif /* GL_ARB_shader_atomic_counters */
-
-#ifndef GL_ARB_shader_ballot
-#define GL_ARB_shader_ballot 1
-#endif /* GL_ARB_shader_ballot */
-
-#ifndef GL_ARB_shader_bit_encoding
-#define GL_ARB_shader_bit_encoding 1
-#endif /* GL_ARB_shader_bit_encoding */
-
-#ifndef GL_ARB_shader_clock
-#define GL_ARB_shader_clock 1
-#endif /* GL_ARB_shader_clock */
-
-#ifndef GL_ARB_shader_draw_parameters
-#define GL_ARB_shader_draw_parameters 1
-#endif /* GL_ARB_shader_draw_parameters */
-
-#ifndef GL_ARB_shader_group_vote
-#define GL_ARB_shader_group_vote 1
-#endif /* GL_ARB_shader_group_vote */
-
-#ifndef GL_ARB_shader_image_load_store
-#define GL_ARB_shader_image_load_store 1
-#endif /* GL_ARB_shader_image_load_store */
-
-#ifndef GL_ARB_shader_image_size
-#define GL_ARB_shader_image_size 1
-#endif /* GL_ARB_shader_image_size */
-
-#ifndef GL_ARB_shader_precision
-#define GL_ARB_shader_precision 1
-#endif /* GL_ARB_shader_precision */
-
-#ifndef GL_ARB_shader_stencil_export
-#define GL_ARB_shader_stencil_export 1
-#endif /* GL_ARB_shader_stencil_export */
-
-#ifndef GL_ARB_shader_storage_buffer_object
-#define GL_ARB_shader_storage_buffer_object 1
-#endif /* GL_ARB_shader_storage_buffer_object */
-
-#ifndef GL_ARB_shader_subroutine
-#define GL_ARB_shader_subroutine 1
-#endif /* GL_ARB_shader_subroutine */
-
-#ifndef GL_ARB_shader_texture_image_samples
-#define GL_ARB_shader_texture_image_samples 1
-#endif /* GL_ARB_shader_texture_image_samples */
-
-#ifndef GL_ARB_shader_viewport_layer_array
-#define GL_ARB_shader_viewport_layer_array 1
-#endif /* GL_ARB_shader_viewport_layer_array */
-
-#ifndef GL_ARB_shading_language_420pack
-#define GL_ARB_shading_language_420pack 1
-#endif /* GL_ARB_shading_language_420pack */
-
-#ifndef GL_ARB_shading_language_include
-#define GL_ARB_shading_language_include 1
-#define GL_SHADER_INCLUDE_ARB 0x8DAE
-#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9
-#define GL_NAMED_STRING_TYPE_ARB 0x8DEA
-typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
-typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
-typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
-typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
-typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
-GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
-GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
-GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
-GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
-GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
-#endif
-#endif /* GL_ARB_shading_language_include */
-
-#ifndef GL_ARB_shading_language_packing
-#define GL_ARB_shading_language_packing 1
-#endif /* GL_ARB_shading_language_packing */
-
-#ifndef GL_ARB_sparse_buffer
-#define GL_ARB_sparse_buffer 1
-#define GL_SPARSE_STORAGE_BIT_ARB 0x0400
-#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8
-typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit);
-GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-#endif
-#endif /* GL_ARB_sparse_buffer */
-
-#ifndef GL_ARB_sparse_texture
-#define GL_ARB_sparse_texture 1
-#define GL_TEXTURE_SPARSE_ARB 0x91A6
-#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7
-#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA
-#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8
-#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197
-#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A
-#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9
-typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#endif
-#endif /* GL_ARB_sparse_texture */
-
-#ifndef GL_ARB_sparse_texture2
-#define GL_ARB_sparse_texture2 1
-#endif /* GL_ARB_sparse_texture2 */
-
-#ifndef GL_ARB_sparse_texture_clamp
-#define GL_ARB_sparse_texture_clamp 1
-#endif /* GL_ARB_sparse_texture_clamp */
-
-#ifndef GL_ARB_spirv_extensions
-#define GL_ARB_spirv_extensions 1
-#endif /* GL_ARB_spirv_extensions */
-
-#ifndef GL_ARB_stencil_texturing
-#define GL_ARB_stencil_texturing 1
-#endif /* GL_ARB_stencil_texturing */
-
-#ifndef GL_ARB_sync
-#define GL_ARB_sync 1
-#endif /* GL_ARB_sync */
-
-#ifndef GL_ARB_tessellation_shader
-#define GL_ARB_tessellation_shader 1
-#endif /* GL_ARB_tessellation_shader */
-
-#ifndef GL_ARB_texture_barrier
-#define GL_ARB_texture_barrier 1
-#endif /* GL_ARB_texture_barrier */
-
-#ifndef GL_ARB_texture_border_clamp
-#define GL_ARB_texture_border_clamp 1
-#define GL_CLAMP_TO_BORDER_ARB 0x812D
-#endif /* GL_ARB_texture_border_clamp */
-
-#ifndef GL_ARB_texture_buffer_object
-#define GL_ARB_texture_buffer_object 1
-#define GL_TEXTURE_BUFFER_ARB 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
-typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);
-#endif
-#endif /* GL_ARB_texture_buffer_object */
-
-#ifndef GL_ARB_texture_buffer_object_rgb32
-#define GL_ARB_texture_buffer_object_rgb32 1
-#endif /* GL_ARB_texture_buffer_object_rgb32 */
-
-#ifndef GL_ARB_texture_buffer_range
-#define GL_ARB_texture_buffer_range 1
-#endif /* GL_ARB_texture_buffer_range */
-
-#ifndef GL_ARB_texture_compression_bptc
-#define GL_ARB_texture_compression_bptc 1
-#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
-#endif /* GL_ARB_texture_compression_bptc */
-
-#ifndef GL_ARB_texture_compression_rgtc
-#define GL_ARB_texture_compression_rgtc 1
-#endif /* GL_ARB_texture_compression_rgtc */
-
-#ifndef GL_ARB_texture_cube_map_array
-#define GL_ARB_texture_cube_map_array 1
-#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
-#endif /* GL_ARB_texture_cube_map_array */
-
-#ifndef GL_ARB_texture_filter_anisotropic
-#define GL_ARB_texture_filter_anisotropic 1
-#endif /* GL_ARB_texture_filter_anisotropic */
-
-#ifndef GL_ARB_texture_filter_minmax
-#define GL_ARB_texture_filter_minmax 1
-#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366
-#define GL_WEIGHTED_AVERAGE_ARB 0x9367
-#endif /* GL_ARB_texture_filter_minmax */
-
-#ifndef GL_ARB_texture_gather
-#define GL_ARB_texture_gather 1
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
-#endif /* GL_ARB_texture_gather */
-
-#ifndef GL_ARB_texture_mirror_clamp_to_edge
-#define GL_ARB_texture_mirror_clamp_to_edge 1
-#endif /* GL_ARB_texture_mirror_clamp_to_edge */
-
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_ARB_texture_mirrored_repeat 1
-#define GL_MIRRORED_REPEAT_ARB 0x8370
-#endif /* GL_ARB_texture_mirrored_repeat */
-
-#ifndef GL_ARB_texture_multisample
-#define GL_ARB_texture_multisample 1
-#endif /* GL_ARB_texture_multisample */
-
-#ifndef GL_ARB_texture_non_power_of_two
-#define GL_ARB_texture_non_power_of_two 1
-#endif /* GL_ARB_texture_non_power_of_two */
-
-#ifndef GL_ARB_texture_query_levels
-#define GL_ARB_texture_query_levels 1
-#endif /* GL_ARB_texture_query_levels */
-
-#ifndef GL_ARB_texture_query_lod
-#define GL_ARB_texture_query_lod 1
-#endif /* GL_ARB_texture_query_lod */
-
-#ifndef GL_ARB_texture_rg
-#define GL_ARB_texture_rg 1
-#endif /* GL_ARB_texture_rg */
-
-#ifndef GL_ARB_texture_rgb10_a2ui
-#define GL_ARB_texture_rgb10_a2ui 1
-#endif /* GL_ARB_texture_rgb10_a2ui */
-
-#ifndef GL_ARB_texture_stencil8
-#define GL_ARB_texture_stencil8 1
-#endif /* GL_ARB_texture_stencil8 */
-
-#ifndef GL_ARB_texture_storage
-#define GL_ARB_texture_storage 1
-#endif /* GL_ARB_texture_storage */
-
-#ifndef GL_ARB_texture_storage_multisample
-#define GL_ARB_texture_storage_multisample 1
-#endif /* GL_ARB_texture_storage_multisample */
-
-#ifndef GL_ARB_texture_swizzle
-#define GL_ARB_texture_swizzle 1
-#endif /* GL_ARB_texture_swizzle */
-
-#ifndef GL_ARB_texture_view
-#define GL_ARB_texture_view 1
-#endif /* GL_ARB_texture_view */
-
-#ifndef GL_ARB_timer_query
-#define GL_ARB_timer_query 1
-#endif /* GL_ARB_timer_query */
-
-#ifndef GL_ARB_transform_feedback2
-#define GL_ARB_transform_feedback2 1
-#endif /* GL_ARB_transform_feedback2 */
-
-#ifndef GL_ARB_transform_feedback3
-#define GL_ARB_transform_feedback3 1
-#endif /* GL_ARB_transform_feedback3 */
-
-#ifndef GL_ARB_transform_feedback_instanced
-#define GL_ARB_transform_feedback_instanced 1
-#endif /* GL_ARB_transform_feedback_instanced */
-
-#ifndef GL_ARB_transform_feedback_overflow_query
-#define GL_ARB_transform_feedback_overflow_query 1
-#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC
-#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED
-#endif /* GL_ARB_transform_feedback_overflow_query */
-
-#ifndef GL_ARB_uniform_buffer_object
-#define GL_ARB_uniform_buffer_object 1
-#endif /* GL_ARB_uniform_buffer_object */
-
-#ifndef GL_ARB_vertex_array_bgra
-#define GL_ARB_vertex_array_bgra 1
-#endif /* GL_ARB_vertex_array_bgra */
-
-#ifndef GL_ARB_vertex_array_object
-#define GL_ARB_vertex_array_object 1
-#endif /* GL_ARB_vertex_array_object */
-
-#ifndef GL_ARB_vertex_attrib_64bit
-#define GL_ARB_vertex_attrib_64bit 1
-#endif /* GL_ARB_vertex_attrib_64bit */
-
-#ifndef GL_ARB_vertex_attrib_binding
-#define GL_ARB_vertex_attrib_binding 1
-#endif /* GL_ARB_vertex_attrib_binding */
-
-#ifndef GL_ARB_vertex_type_10f_11f_11f_rev
-#define GL_ARB_vertex_type_10f_11f_11f_rev 1
-#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
-
-#ifndef GL_ARB_vertex_type_2_10_10_10_rev
-#define GL_ARB_vertex_type_2_10_10_10_rev 1
-#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
-
-#ifndef GL_ARB_viewport_array
-#define GL_ARB_viewport_array 1
-#endif /* GL_ARB_viewport_array */
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#define GL_HSL_HUE_KHR 0x92AD
-#define GL_HSL_SATURATION_KHR 0x92AE
-#define GL_HSL_COLOR_KHR 0x92AF
-#define GL_HSL_LUMINOSITY_KHR 0x92B0
-typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendBarrierKHR (void);
-#endif
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifndef GL_KHR_blend_equation_advanced_coherent
-#define GL_KHR_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-#ifndef GL_KHR_context_flush_control
-#define GL_KHR_context_flush_control 1
-#endif /* GL_KHR_context_flush_control */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-#endif /* GL_KHR_debug */
-
-#ifndef GL_KHR_no_error
-#define GL_KHR_no_error 1
-#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
-#endif /* GL_KHR_no_error */
-
-#ifndef GL_KHR_parallel_shader_compile
-#define GL_KHR_parallel_shader_compile 1
-#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0
-#define GL_COMPLETION_STATUS_KHR 0x91B1
-typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count);
-#endif
-#endif /* GL_KHR_parallel_shader_compile */
-
-#ifndef GL_KHR_robust_buffer_access_behavior
-#define GL_KHR_robust_buffer_access_behavior 1
-#endif /* GL_KHR_robust_buffer_access_behavior */
-
-#ifndef GL_KHR_robustness
-#define GL_KHR_robustness 1
-#define GL_CONTEXT_ROBUST_ACCESS 0x90F3
-#endif /* GL_KHR_robustness */
-
-#ifndef GL_KHR_texture_compression_astc_hdr
-#define GL_KHR_texture_compression_astc_hdr 1
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-#ifndef GL_KHR_texture_compression_astc_sliced_3d
-#define GL_KHR_texture_compression_astc_sliced_3d 1
-#endif /* GL_KHR_texture_compression_astc_sliced_3d */
-
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
-typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
-GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
-GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);
-GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-#endif /* GL_AMD_performance_monitor */
-
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#define GL_RGB_RAW_422_APPLE 0x8A51
-#endif /* GL_APPLE_rgb_422 */
-
-#ifndef GL_EXT_EGL_image_storage
-#define GL_EXT_EGL_image_storage 1
-typedef void *GLeglImageOES;
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-GLAPI void APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#endif
-#endif /* GL_EXT_EGL_image_storage */
-
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_EXT_debug_label */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GLAPI void APIENTRY glPopGroupMarkerEXT (void);
-#endif
-#endif /* GL_EXT_debug_marker */
-
-#ifndef GL_EXT_direct_state_access
-#define GL_EXT_direct_state_access 1
-#define GL_PROGRAM_MATRIX_EXT 0x8E2D
-#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E
-#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
-typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
-typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);
-typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data);
-typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
-typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);
-typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
-typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
-typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
-GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI void APIENTRY glMatrixPopEXT (GLenum mode);
-GLAPI void APIENTRY glMatrixPushEXT (GLenum mode);
-GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);
-GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);
-GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);
-GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
-GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
-GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
-GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);
-GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);
-GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data);
-GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);
-GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);
-GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);
-GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);
-GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);
-GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img);
-GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img);
-GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);
-GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);
-GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params);
-GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
-GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
-GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
-GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);
-GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params);
-GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string);
-GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);
-GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);
-GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);
-GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);
-GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);
-GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
-GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array);
-GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array);
-GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param);
-GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param);
-GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);
-GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
-GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor);
-#endif
-#endif /* GL_EXT_direct_state_access */
-
-#ifndef GL_EXT_draw_instanced
-#define GL_EXT_draw_instanced 1
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_draw_instanced */
-
-#ifndef GL_EXT_polygon_offset_clamp
-#define GL_EXT_polygon_offset_clamp 1
-#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
-#endif
-#endif /* GL_EXT_polygon_offset_clamp */
-
-#ifndef GL_EXT_post_depth_coverage
-#define GL_EXT_post_depth_coverage 1
-#endif /* GL_EXT_post_depth_coverage */
-
-#ifndef GL_EXT_raster_multisample
-#define GL_EXT_raster_multisample 1
-#define GL_RASTER_MULTISAMPLE_EXT 0x9327
-#define GL_RASTER_SAMPLES_EXT 0x9328
-#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
-#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
-#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
-#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
-typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations);
-#endif
-#endif /* GL_EXT_raster_multisample */
-
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
-typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
-typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);
-GLAPI void APIENTRY glActiveProgramEXT (GLuint program);
-GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);
-#endif
-#endif /* GL_EXT_separate_shader_objects */
-
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_EXT_shader_framebuffer_fetch 1
-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
-#endif /* GL_EXT_shader_framebuffer_fetch */
-
-#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent
-#define GL_EXT_shader_framebuffer_fetch_non_coherent 1
-typedef void (APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferFetchBarrierEXT (void);
-#endif
-#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */
-
-#ifndef GL_EXT_shader_integer_mix
-#define GL_EXT_shader_integer_mix 1
-#endif /* GL_EXT_shader_integer_mix */
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_EXT_texture_compression_s3tc 1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-#endif /* GL_EXT_texture_compression_s3tc */
-
-#ifndef GL_EXT_texture_filter_minmax
-#define GL_EXT_texture_filter_minmax 1
-#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366
-#define GL_WEIGHTED_AVERAGE_EXT 0x9367
-#endif /* GL_EXT_texture_filter_minmax */
-
-#ifndef GL_EXT_texture_sRGB_decode
-#define GL_EXT_texture_sRGB_decode 1
-#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
-#define GL_DECODE_EXT 0x8A49
-#define GL_SKIP_DECODE_EXT 0x8A4A
-#endif /* GL_EXT_texture_sRGB_decode */
-
-#ifndef GL_EXT_window_rectangles
-#define GL_EXT_window_rectangles 1
-#define GL_INCLUSIVE_EXT 0x8F10
-#define GL_EXCLUSIVE_EXT 0x8F11
-#define GL_WINDOW_RECTANGLE_EXT 0x8F12
-#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
-#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
-#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
-typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
-#endif
-#endif /* GL_EXT_window_rectangles */
-
-#ifndef GL_INTEL_blackhole_render
-#define GL_INTEL_blackhole_render 1
-#define GL_BLACKHOLE_RENDER_INTEL 0x83FC
-#endif /* GL_INTEL_blackhole_render */
-
-#ifndef GL_INTEL_conservative_rasterization
-#define GL_INTEL_conservative_rasterization 1
-#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
-#endif /* GL_INTEL_conservative_rasterization */
-
-#ifndef GL_INTEL_framebuffer_CMAA
-#define GL_INTEL_framebuffer_CMAA 1
-typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
-#endif
-#endif /* GL_INTEL_framebuffer_CMAA */
-
-#ifndef GL_INTEL_performance_query
-#define GL_INTEL_performance_query 1
-#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
-#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
-#define GL_PERFQUERY_WAIT_INTEL 0x83FB
-#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
-#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
-#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
-#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
-#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
-#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
-#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
-#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
-#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
-#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
-#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
-#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
-#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
-#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
-#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
-#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
-#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
-typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
-typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
-typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
-typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
-typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
-GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
-GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
-GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
-GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#endif
-#endif /* GL_INTEL_performance_query */
-
-#ifndef GL_NV_bindless_multi_draw_indirect
-#define GL_NV_bindless_multi_draw_indirect 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-#endif
-#endif /* GL_NV_bindless_multi_draw_indirect */
-
-#ifndef GL_NV_bindless_multi_draw_indirect_count
-#define GL_NV_bindless_multi_draw_indirect_count 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-#endif
-#endif /* GL_NV_bindless_multi_draw_indirect_count */
-
-#ifndef GL_NV_bindless_texture
-#define GL_NV_bindless_texture 1
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture);
-GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
-GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
-GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
-GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
-GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
-GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
-GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
-GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
-GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
-#endif
-#endif /* GL_NV_bindless_texture */
-
-#ifndef GL_NV_blend_equation_advanced
-#define GL_NV_blend_equation_advanced 1
-#define GL_BLEND_OVERLAP_NV 0x9281
-#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
-#define GL_BLUE_NV 0x1905
-#define GL_COLORBURN_NV 0x929A
-#define GL_COLORDODGE_NV 0x9299
-#define GL_CONJOINT_NV 0x9284
-#define GL_CONTRAST_NV 0x92A1
-#define GL_DARKEN_NV 0x9297
-#define GL_DIFFERENCE_NV 0x929E
-#define GL_DISJOINT_NV 0x9283
-#define GL_DST_ATOP_NV 0x928F
-#define GL_DST_IN_NV 0x928B
-#define GL_DST_NV 0x9287
-#define GL_DST_OUT_NV 0x928D
-#define GL_DST_OVER_NV 0x9289
-#define GL_EXCLUSION_NV 0x92A0
-#define GL_GREEN_NV 0x1904
-#define GL_HARDLIGHT_NV 0x929B
-#define GL_HARDMIX_NV 0x92A9
-#define GL_HSL_COLOR_NV 0x92AF
-#define GL_HSL_HUE_NV 0x92AD
-#define GL_HSL_LUMINOSITY_NV 0x92B0
-#define GL_HSL_SATURATION_NV 0x92AE
-#define GL_INVERT_OVG_NV 0x92B4
-#define GL_INVERT_RGB_NV 0x92A3
-#define GL_LIGHTEN_NV 0x9298
-#define GL_LINEARBURN_NV 0x92A5
-#define GL_LINEARDODGE_NV 0x92A4
-#define GL_LINEARLIGHT_NV 0x92A7
-#define GL_MINUS_CLAMPED_NV 0x92B3
-#define GL_MINUS_NV 0x929F
-#define GL_MULTIPLY_NV 0x9294
-#define GL_OVERLAY_NV 0x9296
-#define GL_PINLIGHT_NV 0x92A8
-#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
-#define GL_PLUS_CLAMPED_NV 0x92B1
-#define GL_PLUS_DARKER_NV 0x9292
-#define GL_PLUS_NV 0x9291
-#define GL_RED_NV 0x1903
-#define GL_SCREEN_NV 0x9295
-#define GL_SOFTLIGHT_NV 0x929C
-#define GL_SRC_ATOP_NV 0x928E
-#define GL_SRC_IN_NV 0x928A
-#define GL_SRC_NV 0x9286
-#define GL_SRC_OUT_NV 0x928C
-#define GL_SRC_OVER_NV 0x9288
-#define GL_UNCORRELATED_NV 0x9282
-#define GL_VIVIDLIGHT_NV 0x92A6
-#define GL_XOR_NV 0x1506
-typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
-GLAPI void APIENTRY glBlendBarrierNV (void);
-#endif
-#endif /* GL_NV_blend_equation_advanced */
-
-#ifndef GL_NV_blend_equation_advanced_coherent
-#define GL_NV_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-#ifndef GL_NV_blend_minmax_factor
-#define GL_NV_blend_minmax_factor 1
-#define GL_FACTOR_MIN_AMD 0x901C
-#define GL_FACTOR_MAX_AMD 0x901D
-#endif /* GL_NV_blend_minmax_factor */
-
-#ifndef GL_NV_clip_space_w_scaling
-#define GL_NV_clip_space_w_scaling 1
-#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
-#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
-#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
-typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#endif
-#endif /* GL_NV_clip_space_w_scaling */
-
-#ifndef GL_NV_command_list
-#define GL_NV_command_list 1
-#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000
-#define GL_NOP_COMMAND_NV 0x0001
-#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002
-#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003
-#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004
-#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005
-#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006
-#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007
-#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008
-#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009
-#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A
-#define GL_BLEND_COLOR_COMMAND_NV 0x000B
-#define GL_STENCIL_REF_COMMAND_NV 0x000C
-#define GL_LINE_WIDTH_COMMAND_NV 0x000D
-#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E
-#define GL_ALPHA_REF_COMMAND_NV 0x000F
-#define GL_VIEWPORT_COMMAND_NV 0x0010
-#define GL_SCISSOR_COMMAND_NV 0x0011
-#define GL_FRONT_FACE_COMMAND_NV 0x0012
-typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states);
-typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states);
-typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state);
-typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode);
-typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size);
-typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists);
-typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists);
-typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list);
-typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments);
-typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list);
-typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states);
-GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states);
-GLAPI GLboolean APIENTRY glIsStateNV (GLuint state);
-GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode);
-GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size);
-GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype);
-GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count);
-GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count);
-GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists);
-GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists);
-GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list);
-GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments);
-GLAPI void APIENTRY glCompileCommandListNV (GLuint list);
-GLAPI void APIENTRY glCallCommandListNV (GLuint list);
-#endif
-#endif /* GL_NV_command_list */
-
-#ifndef GL_NV_conditional_render
-#define GL_NV_conditional_render 1
-#define GL_QUERY_WAIT_NV 0x8E13
-#define GL_QUERY_NO_WAIT_NV 0x8E14
-#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
-typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
-GLAPI void APIENTRY glEndConditionalRenderNV (void);
-#endif
-#endif /* GL_NV_conditional_render */
-
-#ifndef GL_NV_conservative_raster
-#define GL_NV_conservative_raster 1
-#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
-#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
-#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
-#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
-typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
-#endif
-#endif /* GL_NV_conservative_raster */
-
-#ifndef GL_NV_conservative_raster_dilate
-#define GL_NV_conservative_raster_dilate 1
-#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379
-#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A
-#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B
-typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value);
-#endif
-#endif /* GL_NV_conservative_raster_dilate */
-
-#ifndef GL_NV_conservative_raster_pre_snap
-#define GL_NV_conservative_raster_pre_snap 1
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550
-#endif /* GL_NV_conservative_raster_pre_snap */
-
-#ifndef GL_NV_conservative_raster_pre_snap_triangles
-#define GL_NV_conservative_raster_pre_snap_triangles 1
-#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
-#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
-typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
-#endif
-#endif /* GL_NV_conservative_raster_pre_snap_triangles */
-
-#ifndef GL_NV_conservative_raster_underestimation
-#define GL_NV_conservative_raster_underestimation 1
-#endif /* GL_NV_conservative_raster_underestimation */
-
-#ifndef GL_NV_draw_vulkan_image
-#define GL_NV_draw_vulkan_image 1
-typedef void (APIENTRY *GLVULKANPROCNV)(void);
-typedef void (APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-typedef GLVULKANPROCNV (APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
-typedef void (APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-GLAPI GLVULKANPROCNV APIENTRY glGetVkProcAddrNV (const GLchar *name);
-GLAPI void APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
-GLAPI void APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
-GLAPI void APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
-#endif
-#endif /* GL_NV_draw_vulkan_image */
-
-#ifndef GL_NV_fill_rectangle
-#define GL_NV_fill_rectangle 1
-#define GL_FILL_RECTANGLE_NV 0x933C
-#endif /* GL_NV_fill_rectangle */
-
-#ifndef GL_NV_fragment_coverage_to_color
-#define GL_NV_fragment_coverage_to_color 1
-#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
-#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
-typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color);
-#endif
-#endif /* GL_NV_fragment_coverage_to_color */
-
-#ifndef GL_NV_fragment_shader_interlock
-#define GL_NV_fragment_shader_interlock 1
-#endif /* GL_NV_fragment_shader_interlock */
-
-#ifndef GL_NV_framebuffer_mixed_samples
-#define GL_NV_framebuffer_mixed_samples 1
-#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
-#define GL_COLOR_SAMPLES_NV 0x8E20
-#define GL_DEPTH_SAMPLES_NV 0x932D
-#define GL_STENCIL_SAMPLES_NV 0x932E
-#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
-#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
-#define GL_COVERAGE_MODULATION_NV 0x9332
-#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
-typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v);
-typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v);
-GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v);
-GLAPI void APIENTRY glCoverageModulationNV (GLenum components);
-#endif
-#endif /* GL_NV_framebuffer_mixed_samples */
-
-#ifndef GL_NV_framebuffer_multisample_coverage
-#define GL_NV_framebuffer_multisample_coverage 1
-#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
-#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
-#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
-#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_NV_framebuffer_multisample_coverage */
-
-#ifndef GL_NV_geometry_shader_passthrough
-#define GL_NV_geometry_shader_passthrough 1
-#endif /* GL_NV_geometry_shader_passthrough */
-
-#ifndef GL_NV_gpu_shader5
-#define GL_NV_gpu_shader5 1
-typedef int64_t GLint64EXT;
-#define GL_INT64_NV 0x140E
-#define GL_UNSIGNED_INT64_NV 0x140F
-#define GL_INT8_NV 0x8FE0
-#define GL_INT8_VEC2_NV 0x8FE1
-#define GL_INT8_VEC3_NV 0x8FE2
-#define GL_INT8_VEC4_NV 0x8FE3
-#define GL_INT16_NV 0x8FE4
-#define GL_INT16_VEC2_NV 0x8FE5
-#define GL_INT16_VEC3_NV 0x8FE6
-#define GL_INT16_VEC4_NV 0x8FE7
-#define GL_INT64_VEC2_NV 0x8FE9
-#define GL_INT64_VEC3_NV 0x8FEA
-#define GL_INT64_VEC4_NV 0x8FEB
-#define GL_UNSIGNED_INT8_NV 0x8FEC
-#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
-#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
-#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
-#define GL_UNSIGNED_INT16_NV 0x8FF0
-#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
-#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
-#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
-#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
-#define GL_FLOAT16_NV 0x8FF8
-#define GL_FLOAT16_VEC2_NV 0x8FF9
-#define GL_FLOAT16_VEC3_NV 0x8FFA
-#define GL_FLOAT16_VEC4_NV 0x8FFB
-typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
-typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
-GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
-GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
-GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
-GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
-GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#endif
-#endif /* GL_NV_gpu_shader5 */
-
-#ifndef GL_NV_internalformat_sample_query
-#define GL_NV_internalformat_sample_query 1
-#define GL_MULTISAMPLES_NV 0x9371
-#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
-#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
-#define GL_CONFORMANT_NV 0x9374
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_NV_internalformat_sample_query */
-
-#ifndef GL_NV_path_rendering
-#define GL_NV_path_rendering 1
-#define GL_PATH_FORMAT_SVG_NV 0x9070
-#define GL_PATH_FORMAT_PS_NV 0x9071
-#define GL_STANDARD_FONT_NAME_NV 0x9072
-#define GL_SYSTEM_FONT_NAME_NV 0x9073
-#define GL_FILE_NAME_NV 0x9074
-#define GL_PATH_STROKE_WIDTH_NV 0x9075
-#define GL_PATH_END_CAPS_NV 0x9076
-#define GL_PATH_INITIAL_END_CAP_NV 0x9077
-#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
-#define GL_PATH_JOIN_STYLE_NV 0x9079
-#define GL_PATH_MITER_LIMIT_NV 0x907A
-#define GL_PATH_DASH_CAPS_NV 0x907B
-#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
-#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
-#define GL_PATH_DASH_OFFSET_NV 0x907E
-#define GL_PATH_CLIENT_LENGTH_NV 0x907F
-#define GL_PATH_FILL_MODE_NV 0x9080
-#define GL_PATH_FILL_MASK_NV 0x9081
-#define GL_PATH_FILL_COVER_MODE_NV 0x9082
-#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
-#define GL_PATH_STROKE_MASK_NV 0x9084
-#define GL_COUNT_UP_NV 0x9088
-#define GL_COUNT_DOWN_NV 0x9089
-#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
-#define GL_CONVEX_HULL_NV 0x908B
-#define GL_BOUNDING_BOX_NV 0x908D
-#define GL_TRANSLATE_X_NV 0x908E
-#define GL_TRANSLATE_Y_NV 0x908F
-#define GL_TRANSLATE_2D_NV 0x9090
-#define GL_TRANSLATE_3D_NV 0x9091
-#define GL_AFFINE_2D_NV 0x9092
-#define GL_AFFINE_3D_NV 0x9094
-#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
-#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
-#define GL_UTF8_NV 0x909A
-#define GL_UTF16_NV 0x909B
-#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
-#define GL_PATH_COMMAND_COUNT_NV 0x909D
-#define GL_PATH_COORD_COUNT_NV 0x909E
-#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
-#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
-#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
-#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
-#define GL_SQUARE_NV 0x90A3
-#define GL_ROUND_NV 0x90A4
-#define GL_TRIANGULAR_NV 0x90A5
-#define GL_BEVEL_NV 0x90A6
-#define GL_MITER_REVERT_NV 0x90A7
-#define GL_MITER_TRUNCATE_NV 0x90A8
-#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
-#define GL_USE_MISSING_GLYPH_NV 0x90AA
-#define GL_PATH_ERROR_POSITION_NV 0x90AB
-#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
-#define GL_ADJACENT_PAIRS_NV 0x90AE
-#define GL_FIRST_TO_REST_NV 0x90AF
-#define GL_PATH_GEN_MODE_NV 0x90B0
-#define GL_PATH_GEN_COEFF_NV 0x90B1
-#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
-#define GL_PATH_STENCIL_FUNC_NV 0x90B7
-#define GL_PATH_STENCIL_REF_NV 0x90B8
-#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
-#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
-#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
-#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
-#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
-#define GL_MOVE_TO_RESETS_NV 0x90B5
-#define GL_MOVE_TO_CONTINUES_NV 0x90B6
-#define GL_CLOSE_PATH_NV 0x00
-#define GL_MOVE_TO_NV 0x02
-#define GL_RELATIVE_MOVE_TO_NV 0x03
-#define GL_LINE_TO_NV 0x04
-#define GL_RELATIVE_LINE_TO_NV 0x05
-#define GL_HORIZONTAL_LINE_TO_NV 0x06
-#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
-#define GL_VERTICAL_LINE_TO_NV 0x08
-#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
-#define GL_QUADRATIC_CURVE_TO_NV 0x0A
-#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
-#define GL_CUBIC_CURVE_TO_NV 0x0C
-#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
-#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
-#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
-#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
-#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
-#define GL_SMALL_CCW_ARC_TO_NV 0x12
-#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
-#define GL_SMALL_CW_ARC_TO_NV 0x14
-#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
-#define GL_LARGE_CCW_ARC_TO_NV 0x16
-#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
-#define GL_LARGE_CW_ARC_TO_NV 0x18
-#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
-#define GL_RESTART_PATH_NV 0xF0
-#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
-#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
-#define GL_RECT_NV 0xF6
-#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
-#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
-#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
-#define GL_ARC_TO_NV 0xFE
-#define GL_RELATIVE_ARC_TO_NV 0xFF
-#define GL_BOLD_BIT_NV 0x01
-#define GL_ITALIC_BIT_NV 0x02
-#define GL_GLYPH_WIDTH_BIT_NV 0x01
-#define GL_GLYPH_HEIGHT_BIT_NV 0x02
-#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
-#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
-#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
-#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
-#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
-#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
-#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
-#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
-#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
-#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
-#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
-#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
-#define GL_FONT_ASCENDER_BIT_NV 0x00200000
-#define GL_FONT_DESCENDER_BIT_NV 0x00400000
-#define GL_FONT_HEIGHT_BIT_NV 0x00800000
-#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
-#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
-#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
-#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
-#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
-#define GL_ROUNDED_RECT_NV 0xE8
-#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
-#define GL_ROUNDED_RECT2_NV 0xEA
-#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
-#define GL_ROUNDED_RECT4_NV 0xEC
-#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
-#define GL_ROUNDED_RECT8_NV 0xEE
-#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
-#define GL_RELATIVE_RECT_NV 0xF7
-#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
-#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
-#define GL_FONT_UNAVAILABLE_NV 0x936A
-#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
-#define GL_CONIC_CURVE_TO_NV 0x1A
-#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
-#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
-#define GL_STANDARD_FONT_FORMAT_NV 0x936C
-#define GL_PATH_PROJECTION_NV 0x1701
-#define GL_PATH_MODELVIEW_NV 0x1700
-#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
-#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
-#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
-#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
-#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
-#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
-#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
-#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
-#define GL_FRAGMENT_INPUT_NV 0x936D
-typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
-typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
-typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
-typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
-typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
-typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
-typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
-typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
-typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
-typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
-typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
-typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
-typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
-typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
-typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
-typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range);
-GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
-GLAPI GLboolean APIENTRY glIsPathNV (GLuint path);
-GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
-GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
-GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
-GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
-GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
-GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
-GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
-GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
-GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
-GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func);
-GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
-GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
-GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
-GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
-GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
-GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
-GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
-GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
-GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
-GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-#endif
-#endif /* GL_NV_path_rendering */
-
-#ifndef GL_NV_path_rendering_shared_edge
-#define GL_NV_path_rendering_shared_edge 1
-#define GL_SHARED_EDGE_NV 0xC0
-#endif /* GL_NV_path_rendering_shared_edge */
-
-#ifndef GL_NV_sample_locations
-#define GL_NV_sample_locations 1
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
-#define GL_SAMPLE_LOCATION_NV 0x8E50
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
-typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glResolveDepthValuesNV (void);
-#endif
-#endif /* GL_NV_sample_locations */
-
-#ifndef GL_NV_sample_mask_override_coverage
-#define GL_NV_sample_mask_override_coverage 1
-#endif /* GL_NV_sample_mask_override_coverage */
-
-#ifndef GL_NV_shader_atomic_counters
-#define GL_NV_shader_atomic_counters 1
-#endif /* GL_NV_shader_atomic_counters */
-
-#ifndef GL_NV_shader_atomic_float
-#define GL_NV_shader_atomic_float 1
-#endif /* GL_NV_shader_atomic_float */
-
-#ifndef GL_NV_shader_atomic_float64
-#define GL_NV_shader_atomic_float64 1
-#endif /* GL_NV_shader_atomic_float64 */
-
-#ifndef GL_NV_shader_atomic_fp16_vector
-#define GL_NV_shader_atomic_fp16_vector 1
-#endif /* GL_NV_shader_atomic_fp16_vector */
-
-#ifndef GL_NV_shader_atomic_int64
-#define GL_NV_shader_atomic_int64 1
-#endif /* GL_NV_shader_atomic_int64 */
-
-#ifndef GL_NV_shader_buffer_load
-#define GL_NV_shader_buffer_load 1
-#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
-#define GL_GPU_ADDRESS_NV 0x8F34
-#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
-typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
-typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
-typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
-typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
-typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);
-GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);
-GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);
-GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);
-GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);
-GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);
-GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);
-GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);
-GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);
-GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);
-GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#endif
-#endif /* GL_NV_shader_buffer_load */
-
-#ifndef GL_NV_shader_buffer_store
-#define GL_NV_shader_buffer_store 1
-#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010
-#endif /* GL_NV_shader_buffer_store */
-
-#ifndef GL_NV_shader_thread_group
-#define GL_NV_shader_thread_group 1
-#define GL_WARP_SIZE_NV 0x9339
-#define GL_WARPS_PER_SM_NV 0x933A
-#define GL_SM_COUNT_NV 0x933B
-#endif /* GL_NV_shader_thread_group */
-
-#ifndef GL_NV_shader_thread_shuffle
-#define GL_NV_shader_thread_shuffle 1
-#endif /* GL_NV_shader_thread_shuffle */
-
-#ifndef GL_NV_stereo_view_rendering
-#define GL_NV_stereo_view_rendering 1
-#endif /* GL_NV_stereo_view_rendering */
-
-#ifndef GL_NV_texture_barrier
-#define GL_NV_texture_barrier 1
-typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureBarrierNV (void);
-#endif
-#endif /* GL_NV_texture_barrier */
-
-#ifndef GL_NV_texture_rectangle_compressed
-#define GL_NV_texture_rectangle_compressed 1
-#endif /* GL_NV_texture_rectangle_compressed */
-
-#ifndef GL_NV_uniform_buffer_unified_memory
-#define GL_NV_uniform_buffer_unified_memory 1
-#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E
-#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F
-#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370
-#endif /* GL_NV_uniform_buffer_unified_memory */
-
-#ifndef GL_NV_vertex_attrib_integer_64bit
-#define GL_NV_vertex_attrib_integer_64bit 1
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);
-GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);
-GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);
-GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
-#endif
-#endif /* GL_NV_vertex_attrib_integer_64bit */
-
-#ifndef GL_NV_vertex_buffer_unified_memory
-#define GL_NV_vertex_buffer_unified_memory 1
-#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
-#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
-#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
-#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
-#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
-#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
-#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
-#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
-#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
-#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
-#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
-#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
-#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
-#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
-#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
-#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
-#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
-#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
-#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
-#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
-#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
-#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
-#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
-#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
-#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
-typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
-GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);
-GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);
-#endif
-#endif /* GL_NV_vertex_buffer_unified_memory */
-
-#ifndef GL_NV_viewport_array2
-#define GL_NV_viewport_array2 1
-#endif /* GL_NV_viewport_array2 */
-
-#ifndef GL_NV_viewport_swizzle
-#define GL_NV_viewport_swizzle 1
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
-#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
-#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
-#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
-#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
-typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#endif
-#endif /* GL_NV_viewport_swizzle */
-
-#ifndef GL_OVR_multiview
-#define GL_OVR_multiview 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
-#define GL_MAX_VIEWS_OVR 0x9631
-#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#endif
-#endif /* GL_OVR_multiview */
-
-#ifndef GL_OVR_multiview2
-#define GL_OVR_multiview2 1
-#endif /* GL_OVR_multiview2 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GL/glext.h b/include/GL/glext.h
deleted file mode 100644
index acf881bff..000000000
--- a/include/GL/glext.h
+++ /dev/null
@@ -1,12571 +0,0 @@
-#ifndef __gl_glext_h_
-#define __gl_glext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#ifndef WIN32_LEAN_AND_MEAN
-#define WIN32_LEAN_AND_MEAN 1
-#endif
-#include <windows.h>
-#endif
-
-#ifndef APIENTRY
-#define APIENTRY
-#endif
-#ifndef APIENTRYP
-#define APIENTRYP APIENTRY *
-#endif
-#ifndef GLAPI
-#define GLAPI extern
-#endif
-
-#define GL_GLEXT_VERSION 20180525
-
-/* Generated C header for:
- * API: gl
- * Profile: compatibility
- * Versions considered: .*
- * Versions emitted: 1\.[2-9]|[234]\.[0-9]
- * Default extensions included: gl
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_VERSION_1_2
-#define GL_VERSION_1_2 1
-#define GL_UNSIGNED_BYTE_3_3_2 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2 0x8036
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_PACK_SKIP_IMAGES 0x806B
-#define GL_PACK_IMAGE_HEIGHT 0x806C
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_PROXY_TEXTURE_3D 0x8070
-#define GL_TEXTURE_DEPTH 0x8071
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_BYTE_2_3_3_REV 0x8362
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_UNSIGNED_SHORT_5_6_5_REV 0x8364
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV 0x8366
-#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_BGR 0x80E0
-#define GL_BGRA 0x80E1
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_SMOOTH_POINT_SIZE_GRANULARITY 0x0B13
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_SMOOTH_LINE_WIDTH_GRANULARITY 0x0B23
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_LIGHT_MODEL_COLOR_CONTROL 0x81F8
-#define GL_SINGLE_COLOR 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR 0x81FA
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-GLAPI void APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_VERSION_1_2 */
-
-#ifndef GL_VERSION_1_3
-#define GL_VERSION_1_3 1
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_COMPRESSED_RGB 0x84ED
-#define GL_COMPRESSED_RGBA 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE 0x86A0
-#define GL_TEXTURE_COMPRESSED 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_CLAMP_TO_BORDER 0x812D
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_TRANSPOSE_MODELVIEW_MATRIX 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX 0x84E6
-#define GL_MULTISAMPLE_BIT 0x20000000
-#define GL_NORMAL_MAP 0x8511
-#define GL_REFLECTION_MAP 0x8512
-#define GL_COMPRESSED_ALPHA 0x84E9
-#define GL_COMPRESSED_LUMINANCE 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA 0x84EB
-#define GL_COMPRESSED_INTENSITY 0x84EC
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_SOURCE0_RGB 0x8580
-#define GL_SOURCE1_RGB 0x8581
-#define GL_SOURCE2_RGB 0x8582
-#define GL_SOURCE0_ALPHA 0x8588
-#define GL_SOURCE1_ALPHA 0x8589
-#define GL_SOURCE2_ALPHA 0x858A
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_SUBTRACT 0x84E7
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-typedef void (APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint level, void *img);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDPROC) (const GLdouble *m);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTexture (GLenum texture);
-GLAPI void APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
-GLAPI void APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage1D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage1D (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glGetCompressedTexImage (GLenum target, GLint level, void *img);
-GLAPI void APIENTRY glClientActiveTexture (GLenum texture);
-GLAPI void APIENTRY glMultiTexCoord1d (GLenum target, GLdouble s);
-GLAPI void APIENTRY glMultiTexCoord1dv (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord1f (GLenum target, GLfloat s);
-GLAPI void APIENTRY glMultiTexCoord1fv (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord1i (GLenum target, GLint s);
-GLAPI void APIENTRY glMultiTexCoord1iv (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord1s (GLenum target, GLshort s);
-GLAPI void APIENTRY glMultiTexCoord1sv (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord2d (GLenum target, GLdouble s, GLdouble t);
-GLAPI void APIENTRY glMultiTexCoord2dv (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord2f (GLenum target, GLfloat s, GLfloat t);
-GLAPI void APIENTRY glMultiTexCoord2fv (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord2i (GLenum target, GLint s, GLint t);
-GLAPI void APIENTRY glMultiTexCoord2iv (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord2s (GLenum target, GLshort s, GLshort t);
-GLAPI void APIENTRY glMultiTexCoord2sv (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord3d (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-GLAPI void APIENTRY glMultiTexCoord3dv (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord3f (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-GLAPI void APIENTRY glMultiTexCoord3fv (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord3i (GLenum target, GLint s, GLint t, GLint r);
-GLAPI void APIENTRY glMultiTexCoord3iv (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord3s (GLenum target, GLshort s, GLshort t, GLshort r);
-GLAPI void APIENTRY glMultiTexCoord3sv (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord4d (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-GLAPI void APIENTRY glMultiTexCoord4dv (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void APIENTRY glMultiTexCoord4fv (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord4i (GLenum target, GLint s, GLint t, GLint r, GLint q);
-GLAPI void APIENTRY glMultiTexCoord4iv (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord4s (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-GLAPI void APIENTRY glMultiTexCoord4sv (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glLoadTransposeMatrixf (const GLfloat *m);
-GLAPI void APIENTRY glLoadTransposeMatrixd (const GLdouble *m);
-GLAPI void APIENTRY glMultTransposeMatrixf (const GLfloat *m);
-GLAPI void APIENTRY glMultTransposeMatrixd (const GLdouble *m);
-#endif
-#endif /* GL_VERSION_1_3 */
-
-#ifndef GL_VERSION_1_4
-#define GL_VERSION_1_4 1
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_DEPTH_COMPONENT32 0x81A7
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_LOD_BIAS 0x8501
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_TEXTURE_DEPTH_SIZE 0x884A
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_FOG_COORDINATE_SOURCE 0x8450
-#define GL_FOG_COORDINATE 0x8451
-#define GL_FRAGMENT_DEPTH 0x8452
-#define GL_CURRENT_FOG_COORDINATE 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER 0x8456
-#define GL_FOG_COORDINATE_ARRAY 0x8457
-#define GL_COLOR_SUM 0x8458
-#define GL_CURRENT_SECONDARY_COLOR 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER 0x845D
-#define GL_SECONDARY_COLOR_ARRAY 0x845E
-#define GL_TEXTURE_FILTER_CONTROL 0x8500
-#define GL_DEPTH_TEXTURE_MODE 0x884B
-#define GL_COMPARE_R_TO_TEXTURE 0x884E
-#define GL_BLEND_COLOR 0x8005
-#define GL_BLEND_EQUATION 0x8009
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_FUNC_ADD 0x8006
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLFOGCOORDFPROC) (GLfloat coord);
-typedef void (APIENTRYP PFNGLFOGCOORDFVPROC) (const GLfloat *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDPROC) (GLdouble coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDVPROC) (const GLdouble *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTERPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IPROC) (GLint red, GLint green, GLint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVPROC) (const GLubyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVPROC) (const GLuint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVPROC) (const GLushort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GLAPI void APIENTRY glMultiDrawArrays (GLenum mode, const GLint *first, const GLsizei *count, GLsizei drawcount);
-GLAPI void APIENTRY glMultiDrawElements (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount);
-GLAPI void APIENTRY glPointParameterf (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glPointParameteri (GLenum pname, GLint param);
-GLAPI void APIENTRY glPointParameteriv (GLenum pname, const GLint *params);
-GLAPI void APIENTRY glFogCoordf (GLfloat coord);
-GLAPI void APIENTRY glFogCoordfv (const GLfloat *coord);
-GLAPI void APIENTRY glFogCoordd (GLdouble coord);
-GLAPI void APIENTRY glFogCoorddv (const GLdouble *coord);
-GLAPI void APIENTRY glFogCoordPointer (GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glSecondaryColor3b (GLbyte red, GLbyte green, GLbyte blue);
-GLAPI void APIENTRY glSecondaryColor3bv (const GLbyte *v);
-GLAPI void APIENTRY glSecondaryColor3d (GLdouble red, GLdouble green, GLdouble blue);
-GLAPI void APIENTRY glSecondaryColor3dv (const GLdouble *v);
-GLAPI void APIENTRY glSecondaryColor3f (GLfloat red, GLfloat green, GLfloat blue);
-GLAPI void APIENTRY glSecondaryColor3fv (const GLfloat *v);
-GLAPI void APIENTRY glSecondaryColor3i (GLint red, GLint green, GLint blue);
-GLAPI void APIENTRY glSecondaryColor3iv (const GLint *v);
-GLAPI void APIENTRY glSecondaryColor3s (GLshort red, GLshort green, GLshort blue);
-GLAPI void APIENTRY glSecondaryColor3sv (const GLshort *v);
-GLAPI void APIENTRY glSecondaryColor3ub (GLubyte red, GLubyte green, GLubyte blue);
-GLAPI void APIENTRY glSecondaryColor3ubv (const GLubyte *v);
-GLAPI void APIENTRY glSecondaryColor3ui (GLuint red, GLuint green, GLuint blue);
-GLAPI void APIENTRY glSecondaryColor3uiv (const GLuint *v);
-GLAPI void APIENTRY glSecondaryColor3us (GLushort red, GLushort green, GLushort blue);
-GLAPI void APIENTRY glSecondaryColor3usv (const GLushort *v);
-GLAPI void APIENTRY glSecondaryColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glWindowPos2d (GLdouble x, GLdouble y);
-GLAPI void APIENTRY glWindowPos2dv (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos2f (GLfloat x, GLfloat y);
-GLAPI void APIENTRY glWindowPos2fv (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos2i (GLint x, GLint y);
-GLAPI void APIENTRY glWindowPos2iv (const GLint *v);
-GLAPI void APIENTRY glWindowPos2s (GLshort x, GLshort y);
-GLAPI void APIENTRY glWindowPos2sv (const GLshort *v);
-GLAPI void APIENTRY glWindowPos3d (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glWindowPos3dv (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos3f (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glWindowPos3fv (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos3i (GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glWindowPos3iv (const GLint *v);
-GLAPI void APIENTRY glWindowPos3s (GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glWindowPos3sv (const GLshort *v);
-GLAPI void APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GLAPI void APIENTRY glBlendEquation (GLenum mode);
-#endif
-#endif /* GL_VERSION_1_4 */
-
-#ifndef GL_VERSION_1_5
-#define GL_VERSION_1_5 1
-#include <KHR/khrplatform.h>
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_QUERY_COUNTER_BITS 0x8864
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_READ_ONLY 0x88B8
-#define GL_WRITE_ONLY 0x88B9
-#define GL_READ_WRITE 0x88BA
-#define GL_BUFFER_ACCESS 0x88BB
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_DRAW 0x88E4
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_SAMPLES_PASSED 0x8914
-#define GL_SRC1_ALPHA 0x8589
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING 0x889E
-#define GL_FOG_COORD_SRC 0x8450
-#define GL_FOG_COORD 0x8451
-#define GL_CURRENT_FOG_COORD 0x8453
-#define GL_FOG_COORD_ARRAY_TYPE 0x8454
-#define GL_FOG_COORD_ARRAY_STRIDE 0x8455
-#define GL_FOG_COORD_ARRAY_POINTER 0x8456
-#define GL_FOG_COORD_ARRAY 0x8457
-#define GL_FOG_COORD_ARRAY_BUFFER_BINDING 0x889D
-#define GL_SRC0_RGB 0x8580
-#define GL_SRC1_RGB 0x8581
-#define GL_SRC2_RGB 0x8582
-#define GL_SRC0_ALPHA 0x8588
-#define GL_SRC2_ALPHA 0x858A
-typedef void (APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISQUERYPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
-typedef void *(APIENTRYP PFNGLMAPBUFFERPROC) (GLenum target, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueries (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
-GLAPI GLboolean APIENTRY glIsQuery (GLuint id);
-GLAPI void APIENTRY glBeginQuery (GLenum target, GLuint id);
-GLAPI void APIENTRY glEndQuery (GLenum target);
-GLAPI void APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectiv (GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GLAPI void APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GLAPI void APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GLAPI GLboolean APIENTRY glIsBuffer (GLuint buffer);
-GLAPI void APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glGetBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void *APIENTRY glMapBuffer (GLenum target, GLenum access);
-GLAPI GLboolean APIENTRY glUnmapBuffer (GLenum target);
-GLAPI void APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_VERSION_1_5 */
-
-#ifndef GL_VERSION_2_0
-#define GL_VERSION_2_0 1
-typedef char GLchar;
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_VERTEX_PROGRAM_POINT_SIZE 0x8642
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_MAX_VARYING_FLOATS 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_1D 0x8B5D
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_SAMPLER_1D_SHADOW 0x8B61
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_DELETE_STATUS 0x8B80
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_POINT_SPRITE_COORD_ORIGIN 0x8CA0
-#define GL_LOWER_LEFT 0x8CA1
-#define GL_UPPER_LEFT 0x8CA2
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VERTEX_PROGRAM_TWO_SIDE 0x8643
-#define GL_POINT_SPRITE 0x8861
-#define GL_COORD_REPLACE 0x8862
-#define GL_MAX_TEXTURE_COORDS 0x8871
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
-typedef void (APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef GLuint (APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
-typedef void (APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-typedef void (APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GLAPI void APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GLAPI void APIENTRY glAttachShader (GLuint program, GLuint shader);
-GLAPI void APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
-GLAPI void APIENTRY glCompileShader (GLuint shader);
-GLAPI GLuint APIENTRY glCreateProgram (void);
-GLAPI GLuint APIENTRY glCreateShader (GLenum type);
-GLAPI void APIENTRY glDeleteProgram (GLuint program);
-GLAPI void APIENTRY glDeleteShader (GLuint shader);
-GLAPI void APIENTRY glDetachShader (GLuint program, GLuint shader);
-GLAPI void APIENTRY glDisableVertexAttribArray (GLuint index);
-GLAPI void APIENTRY glEnableVertexAttribArray (GLuint index);
-GLAPI void APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-GLAPI GLint APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-GLAPI GLint APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
-GLAPI void APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribdv (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
-GLAPI GLboolean APIENTRY glIsProgram (GLuint program);
-GLAPI GLboolean APIENTRY glIsShader (GLuint shader);
-GLAPI void APIENTRY glLinkProgram (GLuint program);
-GLAPI void APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-GLAPI void APIENTRY glUseProgram (GLuint program);
-GLAPI void APIENTRY glUniform1f (GLint location, GLfloat v0);
-GLAPI void APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glUniform1i (GLint location, GLint v0);
-GLAPI void APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glValidateProgram (GLuint program);
-GLAPI void APIENTRY glVertexAttrib1d (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttrib1dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
-GLAPI void APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib1s (GLuint index, GLshort x);
-GLAPI void APIENTRY glVertexAttrib1sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib2d (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttrib2dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib2s (GLuint index, GLshort x, GLshort y);
-GLAPI void APIENTRY glVertexAttrib2sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttrib3dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib3s (GLuint index, GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glVertexAttrib3sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4Nbv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4Niv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4Nsv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4Nub (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-GLAPI void APIENTRY glVertexAttrib4Nubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4Nuiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4Nusv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttrib4bv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttrib4dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib4iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4s (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glVertexAttrib4sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4ubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4usv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_VERSION_2_0 */
-
-#ifndef GL_VERSION_2_1
-#define GL_VERSION_2_1 1
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB_ALPHA 0x8C42
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_COMPRESSED_SRGB 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA 0x8C49
-#define GL_CURRENT_RASTER_SECONDARY_COLOR 0x845F
-#define GL_SLUMINANCE_ALPHA 0x8C44
-#define GL_SLUMINANCE8_ALPHA8 0x8C45
-#define GL_SLUMINANCE 0x8C46
-#define GL_SLUMINANCE8 0x8C47
-#define GL_COMPRESSED_SLUMINANCE 0x8C4A
-#define GL_COMPRESSED_SLUMINANCE_ALPHA 0x8C4B
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_VERSION_2_1 */
-
-#ifndef GL_VERSION_3_0
-#define GL_VERSION_3_0 1
-typedef unsigned short GLhalf;
-#define GL_COMPARE_REF_TO_TEXTURE 0x884E
-#define GL_CLIP_DISTANCE0 0x3000
-#define GL_CLIP_DISTANCE1 0x3001
-#define GL_CLIP_DISTANCE2 0x3002
-#define GL_CLIP_DISTANCE3 0x3003
-#define GL_CLIP_DISTANCE4 0x3004
-#define GL_CLIP_DISTANCE5 0x3005
-#define GL_CLIP_DISTANCE6 0x3006
-#define GL_CLIP_DISTANCE7 0x3007
-#define GL_MAX_CLIP_DISTANCES 0x0D32
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_CONTEXT_FLAGS 0x821E
-#define GL_COMPRESSED_RED 0x8225
-#define GL_COMPRESSED_RG 0x8226
-#define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x00000001
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_CLAMP_READ_COLOR 0x891C
-#define GL_FIXED_ONLY 0x891D
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#define GL_TEXTURE_1D_ARRAY 0x8C18
-#define GL_PROXY_TEXTURE_1D_ARRAY 0x8C19
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_PROXY_TEXTURE_2D_ARRAY 0x8C1B
-#define GL_TEXTURE_BINDING_1D_ARRAY 0x8C1C
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TEXTURE_SHARED_SIZE 0x8C3F
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_PRIMITIVES_GENERATED 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_GREEN_INTEGER 0x8D95
-#define GL_BLUE_INTEGER 0x8D96
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_BGR_INTEGER 0x8D9A
-#define GL_BGRA_INTEGER 0x8D9B
-#define GL_SAMPLER_1D_ARRAY 0x8DC0
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_1D_ARRAY_SHADOW 0x8DC3
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_1D 0x8DC9
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_1D_ARRAY 0x8DCE
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_1D 0x8DD1
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY 0x8DD6
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_QUERY_WAIT 0x8E13
-#define GL_QUERY_NO_WAIT 0x8E14
-#define GL_QUERY_BY_REGION_WAIT 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT 0x8E16
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE 0x88F1
-#define GL_TEXTURE_RED_TYPE 0x8C10
-#define GL_TEXTURE_GREEN_TYPE 0x8C11
-#define GL_TEXTURE_BLUE_TYPE 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE 0x8C13
-#define GL_TEXTURE_DEPTH_TYPE 0x8C16
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_COLOR_ATTACHMENT16 0x8CF0
-#define GL_COLOR_ATTACHMENT17 0x8CF1
-#define GL_COLOR_ATTACHMENT18 0x8CF2
-#define GL_COLOR_ATTACHMENT19 0x8CF3
-#define GL_COLOR_ATTACHMENT20 0x8CF4
-#define GL_COLOR_ATTACHMENT21 0x8CF5
-#define GL_COLOR_ATTACHMENT22 0x8CF6
-#define GL_COLOR_ATTACHMENT23 0x8CF7
-#define GL_COLOR_ATTACHMENT24 0x8CF8
-#define GL_COLOR_ATTACHMENT25 0x8CF9
-#define GL_COLOR_ATTACHMENT26 0x8CFA
-#define GL_COLOR_ATTACHMENT27 0x8CFB
-#define GL_COLOR_ATTACHMENT28 0x8CFC
-#define GL_COLOR_ATTACHMENT29 0x8CFD
-#define GL_COLOR_ATTACHMENT30 0x8CFE
-#define GL_COLOR_ATTACHMENT31 0x8CFF
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_STENCIL_INDEX1 0x8D46
-#define GL_STENCIL_INDEX4 0x8D47
-#define GL_STENCIL_INDEX8 0x8D48
-#define GL_STENCIL_INDEX16 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-#define GL_INDEX 0x8222
-#define GL_TEXTURE_LUMINANCE_TYPE 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE 0x8C15
-#define GL_FRAMEBUFFER_SRGB 0x8DB9
-#define GL_HALF_FLOAT 0x140B
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-#define GL_COMPRESSED_RED_RGTC1 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1 0x8DBC
-#define GL_COMPRESSED_RG_RGTC2 0x8DBD
-#define GL_COMPRESSED_SIGNED_RG_RGTC2 0x8DBE
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_R16 0x822A
-#define GL_RG8 0x822B
-#define GL_RG16 0x822C
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-#define GL_CLAMP_VERTEX_COLOR 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR 0x891B
-#define GL_ALPHA_INTEGER 0x8D97
-typedef void (APIENTRYP PFNGLCOLORMASKIPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef void (APIENTRYP PFNGLGETBOOLEANI_VPROC) (GLenum target, GLuint index, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
-typedef void (APIENTRYP PFNGLENABLEIPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEIPROC) (GLenum target, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISENABLEDIPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
-typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLCLAMPCOLORPROC) (GLenum target, GLenum clamp);
-typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERPROC) (GLuint id, GLenum mode);
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERPROC) (void);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IPROC) (GLuint index, GLint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IPROC) (GLuint index, GLint x, GLint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IPROC) (GLuint index, GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIPROC) (GLuint index, GLuint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIPROC) (GLuint index, GLuint x, GLuint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONPROC) (GLuint program, GLuint color, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-typedef void (APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-typedef const GLubyte *(APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
-typedef void (APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
-typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void *(APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
-typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
-typedef void (APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorMaski (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-GLAPI void APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data);
-GLAPI void APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
-GLAPI void APIENTRY glEnablei (GLenum target, GLuint index);
-GLAPI void APIENTRY glDisablei (GLenum target, GLuint index);
-GLAPI GLboolean APIENTRY glIsEnabledi (GLenum target, GLuint index);
-GLAPI void APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
-GLAPI void APIENTRY glEndTransformFeedback (void);
-GLAPI void APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GLAPI void APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glClampColor (GLenum target, GLenum clamp);
-GLAPI void APIENTRY glBeginConditionalRender (GLuint id, GLenum mode);
-GLAPI void APIENTRY glEndConditionalRender (void);
-GLAPI void APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glVertexAttribI1i (GLuint index, GLint x);
-GLAPI void APIENTRY glVertexAttribI2i (GLuint index, GLint x, GLint y);
-GLAPI void APIENTRY glVertexAttribI3i (GLuint index, GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glVertexAttribI1ui (GLuint index, GLuint x);
-GLAPI void APIENTRY glVertexAttribI2ui (GLuint index, GLuint x, GLuint y);
-GLAPI void APIENTRY glVertexAttribI3ui (GLuint index, GLuint x, GLuint y, GLuint z);
-GLAPI void APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glVertexAttribI1iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI2iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI3iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI1uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI2uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI3uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4bv (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttribI4sv (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribI4ubv (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttribI4usv (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
-GLAPI void APIENTRY glBindFragDataLocation (GLuint program, GLuint color, const GLchar *name);
-GLAPI GLint APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glUniform1ui (GLint location, GLuint v0);
-GLAPI void APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glTexParameterIiv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTexParameterIuiv (GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetTexParameterIiv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTexParameterIuiv (GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
-GLAPI void APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
-GLAPI void APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GLAPI void APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GLAPI const GLubyte *APIENTRY glGetStringi (GLenum name, GLuint index);
-GLAPI GLboolean APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GLAPI void APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
-GLAPI void APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GLAPI void APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI GLboolean APIENTRY glIsFramebuffer (GLuint framebuffer);
-GLAPI void APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GLAPI void APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
-GLAPI void APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
-GLAPI GLenum APIENTRY glCheckFramebufferStatus (GLenum target);
-GLAPI void APIENTRY glFramebufferTexture1D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture3D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-GLAPI void APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGenerateMipmap (GLenum target);
-GLAPI void APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GLAPI void APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void *APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI void APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glBindVertexArray (GLuint array);
-GLAPI void APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
-GLAPI void APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
-GLAPI GLboolean APIENTRY glIsVertexArray (GLuint array);
-#endif
-#endif /* GL_VERSION_3_0 */
-
-#ifndef GL_VERSION_3_1
-#define GL_VERSION_3_1 1
-#define GL_SAMPLER_2D_RECT 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW 0x8B64
-#define GL_SAMPLER_BUFFER 0x8DC2
-#define GL_INT_SAMPLER_2D_RECT 0x8DCD
-#define GL_INT_SAMPLER_BUFFER 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_2D_RECT 0x8DD5
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER 0x8DD8
-#define GL_TEXTURE_BUFFER 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING 0x8C2D
-#define GL_TEXTURE_RECTANGLE 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE 0x84F8
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_R16_SNORM 0x8F98
-#define GL_RG16_SNORM 0x8F99
-#define GL_RGB16_SNORM 0x8F9A
-#define GL_RGBA16_SNORM 0x8F9B
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART 0x8F9D
-#define GL_PRIMITIVE_RESTART_INDEX 0x8F9E
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS 0x8A2C
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS 0x8A32
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_GEOMETRY_SHADER 0x8A45
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLTEXBUFFERPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMNAMEPROC) (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
-typedef GLuint (APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-typedef void (APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-GLAPI void APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-GLAPI void APIENTRY glTexBuffer (GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glPrimitiveRestartIndex (GLuint index);
-GLAPI void APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-GLAPI void APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetActiveUniformName (GLuint program, GLuint uniformIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformName);
-GLAPI GLuint APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
-GLAPI void APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-GLAPI void APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-#endif
-#endif /* GL_VERSION_3_1 */
-
-#ifndef GL_VERSION_3_2
-#define GL_VERSION_3_2 1
-typedef struct __GLsync *GLsync;
-#ifndef GLEXT_64_TYPES_DEFINED
-/* This code block is duplicated in glxext.h, so must be protected */
-#define GLEXT_64_TYPES_DEFINED
-/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
-/* (as used in the GL_EXT_timer_query extension). */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#include <inttypes.h>
-#elif defined(__sun__) || defined(__digital__)
-#include <inttypes.h>
-#if defined(__STDC__)
-#if defined(__arch64__) || defined(_LP64)
-typedef long int int64_t;
-typedef unsigned long int uint64_t;
-#else
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#endif /* __arch64__ */
-#endif /* __STDC__ */
-#elif defined( __VMS ) || defined(__sgi)
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
-#elif defined(__UNIXOS2__) || defined(__SOL64__)
-typedef long int int32_t;
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#elif defined(_WIN32) && defined(__GNUC__)
-#include <stdint.h>
-#elif defined(_WIN32)
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#else
-/* Fallback if nothing above works */
-#include <inttypes.h>
-#endif
-#endif
-typedef uint64_t GLuint64;
-typedef int64_t GLint64;
-#define GL_CONTEXT_CORE_PROFILE_BIT 0x00000001
-#define GL_CONTEXT_COMPATIBILITY_PROFILE_BIT 0x00000002
-#define GL_LINES_ADJACENCY 0x000A
-#define GL_LINE_STRIP_ADJACENCY 0x000B
-#define GL_TRIANGLES_ADJACENCY 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY 0x000D
-#define GL_PROGRAM_POINT_SIZE 0x8642
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS 0x8DA8
-#define GL_GEOMETRY_SHADER 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT 0x8916
-#define GL_GEOMETRY_INPUT_TYPE 0x8917
-#define GL_GEOMETRY_OUTPUT_TYPE 0x8918
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS 0x8DE1
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS 0x9124
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_CONTEXT_PROFILE_MASK 0x9126
-#define GL_DEPTH_CLAMP 0x864F
-#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION 0x8E4C
-#define GL_FIRST_VERTEX_CONVENTION 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION 0x8E4E
-#define GL_PROVOKING_VERTEX 0x8E4F
-#define GL_TEXTURE_CUBE_MAP_SEAMLESS 0x884F
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_SAMPLE_POSITION 0x8E50
-#define GL_SAMPLE_MASK 0x8E51
-#define GL_SAMPLE_MASK_VALUE 0x8E52
-#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59
-#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE 0x9101
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
-#define GL_PROXY_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9103
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY 0x9105
-#define GL_TEXTURE_SAMPLES 0x9106
-#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107
-#define GL_SAMPLER_2D_MULTISAMPLE 0x9108
-#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A
-#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910B
-#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910C
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY 0x910D
-#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E
-#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F
-#define GL_MAX_INTEGER_SAMPLES 0x9110
-typedef void (APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
-typedef void (APIENTRYP PFNGLPROVOKINGVERTEXPROC) (GLenum mode);
-typedef GLsync (APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
-typedef void (APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
-typedef GLenum (APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
-typedef void (APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-typedef void (APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVPROC) (GLenum pname, GLuint index, GLfloat *val);
-typedef void (APIENTRYP PFNGLSAMPLEMASKIPROC) (GLuint maskNumber, GLbitfield mask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawElementsBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GLAPI void APIENTRY glDrawRangeElementsBaseVertex (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GLAPI void APIENTRY glDrawElementsInstancedBaseVertex (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-GLAPI void APIENTRY glMultiDrawElementsBaseVertex (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei drawcount, const GLint *basevertex);
-GLAPI void APIENTRY glProvokingVertex (GLenum mode);
-GLAPI GLsync APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
-GLAPI GLboolean APIENTRY glIsSync (GLsync sync);
-GLAPI void APIENTRY glDeleteSync (GLsync sync);
-GLAPI GLenum APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GLAPI void APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GLAPI void APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
-GLAPI void APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GLAPI void APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
-GLAPI void APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glFramebufferTexture (GLenum target, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glTexImage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTexImage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val);
-GLAPI void APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask);
-#endif
-#endif /* GL_VERSION_3_2 */
-
-#ifndef GL_VERSION_3_3
-#define GL_VERSION_3_3 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_SRC1_COLOR 0x88F9
-#define GL_ONE_MINUS_SRC1_COLOR 0x88FA
-#define GL_ONE_MINUS_SRC1_ALPHA 0x88FB
-#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS 0x88FC
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-#define GL_SAMPLER_BINDING 0x8919
-#define GL_RGB10_A2UI 0x906F
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_TEXTURE_SWIZZLE_RGBA 0x8E46
-#define GL_TIME_ELAPSED 0x88BF
-#define GL_TIMESTAMP 0x8E28
-#define GL_INT_2_10_10_10_REV 0x8D9F
-typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETFRAGDATAINDEXPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
-typedef void (APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
-typedef GLboolean (APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
-typedef void (APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, const GLuint *param);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIIVPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVPROC) (GLuint sampler, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLQUERYCOUNTERPROC) (GLuint id, GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VPROC) (GLuint id, GLenum pname, GLuint64 *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP1UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP2UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP3UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIPROC) (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBP4UIVPROC) (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXP2UIPROC) (GLenum type, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXP2UIVPROC) (GLenum type, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXP3UIPROC) (GLenum type, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXP3UIVPROC) (GLenum type, const GLuint *value);
-typedef void (APIENTRYP PFNGLVERTEXP4UIPROC) (GLenum type, GLuint value);
-typedef void (APIENTRYP PFNGLVERTEXP4UIVPROC) (GLenum type, const GLuint *value);
-typedef void (APIENTRYP PFNGLTEXCOORDP1UIPROC) (GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP1UIVPROC) (GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP2UIPROC) (GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP2UIVPROC) (GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP3UIPROC) (GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP3UIVPROC) (GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP4UIPROC) (GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLTEXCOORDP4UIVPROC) (GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP1UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP2UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP3UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIPROC) (GLenum texture, GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDP4UIVPROC) (GLenum texture, GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLNORMALP3UIPROC) (GLenum type, GLuint coords);
-typedef void (APIENTRYP PFNGLNORMALP3UIVPROC) (GLenum type, const GLuint *coords);
-typedef void (APIENTRYP PFNGLCOLORP3UIPROC) (GLenum type, GLuint color);
-typedef void (APIENTRYP PFNGLCOLORP3UIVPROC) (GLenum type, const GLuint *color);
-typedef void (APIENTRYP PFNGLCOLORP4UIPROC) (GLenum type, GLuint color);
-typedef void (APIENTRYP PFNGLCOLORP4UIVPROC) (GLenum type, const GLuint *color);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIPROC) (GLenum type, GLuint color);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORP3UIVPROC) (GLenum type, const GLuint *color);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindFragDataLocationIndexed (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-GLAPI GLint APIENTRY glGetFragDataIndex (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
-GLAPI void APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
-GLAPI GLboolean APIENTRY glIsSampler (GLuint sampler);
-GLAPI void APIENTRY glBindSampler (GLuint unit, GLuint sampler);
-GLAPI void APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
-GLAPI void APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
-GLAPI void APIENTRY glSamplerParameterIiv (GLuint sampler, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glSamplerParameterIuiv (GLuint sampler, GLenum pname, const GLuint *param);
-GLAPI void APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSamplerParameterIiv (GLuint sampler, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetSamplerParameterIuiv (GLuint sampler, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glQueryCounter (GLuint id, GLenum target);
-GLAPI void APIENTRY glGetQueryObjecti64v (GLuint id, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glGetQueryObjectui64v (GLuint id, GLenum pname, GLuint64 *params);
-GLAPI void APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
-GLAPI void APIENTRY glVertexAttribP1ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP1uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP2ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP2uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP3ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP3uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexAttribP4ui (GLuint index, GLenum type, GLboolean normalized, GLuint value);
-GLAPI void APIENTRY glVertexAttribP4uiv (GLuint index, GLenum type, GLboolean normalized, const GLuint *value);
-GLAPI void APIENTRY glVertexP2ui (GLenum type, GLuint value);
-GLAPI void APIENTRY glVertexP2uiv (GLenum type, const GLuint *value);
-GLAPI void APIENTRY glVertexP3ui (GLenum type, GLuint value);
-GLAPI void APIENTRY glVertexP3uiv (GLenum type, const GLuint *value);
-GLAPI void APIENTRY glVertexP4ui (GLenum type, GLuint value);
-GLAPI void APIENTRY glVertexP4uiv (GLenum type, const GLuint *value);
-GLAPI void APIENTRY glTexCoordP1ui (GLenum type, GLuint coords);
-GLAPI void APIENTRY glTexCoordP1uiv (GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glTexCoordP2ui (GLenum type, GLuint coords);
-GLAPI void APIENTRY glTexCoordP2uiv (GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glTexCoordP3ui (GLenum type, GLuint coords);
-GLAPI void APIENTRY glTexCoordP3uiv (GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glTexCoordP4ui (GLenum type, GLuint coords);
-GLAPI void APIENTRY glTexCoordP4uiv (GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glMultiTexCoordP1ui (GLenum texture, GLenum type, GLuint coords);
-GLAPI void APIENTRY glMultiTexCoordP1uiv (GLenum texture, GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glMultiTexCoordP2ui (GLenum texture, GLenum type, GLuint coords);
-GLAPI void APIENTRY glMultiTexCoordP2uiv (GLenum texture, GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glMultiTexCoordP3ui (GLenum texture, GLenum type, GLuint coords);
-GLAPI void APIENTRY glMultiTexCoordP3uiv (GLenum texture, GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glMultiTexCoordP4ui (GLenum texture, GLenum type, GLuint coords);
-GLAPI void APIENTRY glMultiTexCoordP4uiv (GLenum texture, GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glNormalP3ui (GLenum type, GLuint coords);
-GLAPI void APIENTRY glNormalP3uiv (GLenum type, const GLuint *coords);
-GLAPI void APIENTRY glColorP3ui (GLenum type, GLuint color);
-GLAPI void APIENTRY glColorP3uiv (GLenum type, const GLuint *color);
-GLAPI void APIENTRY glColorP4ui (GLenum type, GLuint color);
-GLAPI void APIENTRY glColorP4uiv (GLenum type, const GLuint *color);
-GLAPI void APIENTRY glSecondaryColorP3ui (GLenum type, GLuint color);
-GLAPI void APIENTRY glSecondaryColorP3uiv (GLenum type, const GLuint *color);
-#endif
-#endif /* GL_VERSION_3_3 */
-
-#ifndef GL_VERSION_4_0
-#define GL_VERSION_4_0 1
-#define GL_SAMPLE_SHADING 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE 0x8C37
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F
-#define GL_TEXTURE_CUBE_MAP_ARRAY 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY 0x900F
-#define GL_DRAW_INDIRECT_BUFFER 0x8F3F
-#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43
-#define GL_GEOMETRY_SHADER_INVOCATIONS 0x887F
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS 0x8E5A
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET 0x8E5C
-#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS 0x8E5D
-#define GL_MAX_VERTEX_STREAMS 0x8E71
-#define GL_DOUBLE_VEC2 0x8FFC
-#define GL_DOUBLE_VEC3 0x8FFD
-#define GL_DOUBLE_VEC4 0x8FFE
-#define GL_DOUBLE_MAT2 0x8F46
-#define GL_DOUBLE_MAT3 0x8F47
-#define GL_DOUBLE_MAT4 0x8F48
-#define GL_DOUBLE_MAT2x3 0x8F49
-#define GL_DOUBLE_MAT2x4 0x8F4A
-#define GL_DOUBLE_MAT3x2 0x8F4B
-#define GL_DOUBLE_MAT3x4 0x8F4C
-#define GL_DOUBLE_MAT4x2 0x8F4D
-#define GL_DOUBLE_MAT4x3 0x8F4E
-#define GL_ACTIVE_SUBROUTINES 0x8DE5
-#define GL_ACTIVE_SUBROUTINE_UNIFORMS 0x8DE6
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_LOCATIONS 0x8E47
-#define GL_ACTIVE_SUBROUTINE_MAX_LENGTH 0x8E48
-#define GL_ACTIVE_SUBROUTINE_UNIFORM_MAX_LENGTH 0x8E49
-#define GL_MAX_SUBROUTINES 0x8DE7
-#define GL_MAX_SUBROUTINE_UNIFORM_LOCATIONS 0x8DE8
-#define GL_NUM_COMPATIBLE_SUBROUTINES 0x8E4A
-#define GL_COMPATIBLE_SUBROUTINES 0x8E4B
-#define GL_PATCHES 0x000E
-#define GL_PATCH_VERTICES 0x8E72
-#define GL_PATCH_DEFAULT_INNER_LEVEL 0x8E73
-#define GL_PATCH_DEFAULT_OUTER_LEVEL 0x8E74
-#define GL_TESS_CONTROL_OUTPUT_VERTICES 0x8E75
-#define GL_TESS_GEN_MODE 0x8E76
-#define GL_TESS_GEN_SPACING 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER 0x8E78
-#define GL_TESS_GEN_POINT_MODE 0x8E79
-#define GL_ISOLINES 0x8E7A
-#define GL_FRACTIONAL_ODD 0x8E7B
-#define GL_FRACTIONAL_EVEN 0x8E7C
-#define GL_MAX_PATCH_VERTICES 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS 0x8E86
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS 0x8E8A
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS 0x8E1F
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_CONTROL_SHADER 0x84F0
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_TESS_EVALUATION_SHADER 0x84F1
-#define GL_TESS_EVALUATION_SHADER 0x8E87
-#define GL_TESS_CONTROL_SHADER 0x8E88
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-#define GL_MAX_TRANSFORM_FEEDBACK_BUFFERS 0x8E70
-typedef void (APIENTRYP PFNGLMINSAMPLESHADINGPROC) (GLfloat value);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONIPROC) (GLuint buf, GLenum mode);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLBLENDFUNCIPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (APIENTRYP PFNGLDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect);
-typedef void (APIENTRYP PFNGLUNIFORM1DPROC) (GLint location, GLdouble x);
-typedef void (APIENTRYP PFNGLUNIFORM2DPROC) (GLint location, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLUNIFORM3DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLUNIFORM4DPROC) (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLUNIFORM1DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM2DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM3DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORM4DVPROC) (GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3X4DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X2DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4X3DVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMDVPROC) (GLuint program, GLint location, GLdouble *params);
-typedef GLint (APIENTRYP PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC) (GLuint program, GLenum shadertype, const GLchar *name);
-typedef GLuint (APIENTRYP PFNGLGETSUBROUTINEINDEXPROC) (GLuint program, GLenum shadertype, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC) (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVESUBROUTINENAMEPROC) (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLUNIFORMSUBROUTINESUIVPROC) (GLenum shadertype, GLsizei count, const GLuint *indices);
-typedef void (APIENTRYP PFNGLGETUNIFORMSUBROUTINEUIVPROC) (GLenum shadertype, GLint location, GLuint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTAGEIVPROC) (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
-typedef void (APIENTRYP PFNGLPATCHPARAMETERIPROC) (GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLPATCHPARAMETERFVPROC) (GLenum pname, const GLfloat *values);
-typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
-typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKPROC) (GLenum mode, GLuint id);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC) (GLenum mode, GLuint id, GLuint stream);
-typedef void (APIENTRYP PFNGLBEGINQUERYINDEXEDPROC) (GLenum target, GLuint index, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYINDEXEDPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLGETQUERYINDEXEDIVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMinSampleShading (GLfloat value);
-GLAPI void APIENTRY glBlendEquationi (GLuint buf, GLenum mode);
-GLAPI void APIENTRY glBlendEquationSeparatei (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glBlendFunci (GLuint buf, GLenum src, GLenum dst);
-GLAPI void APIENTRY glBlendFuncSeparatei (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GLAPI void APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect);
-GLAPI void APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect);
-GLAPI void APIENTRY glUniform1d (GLint location, GLdouble x);
-GLAPI void APIENTRY glUniform2d (GLint location, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glUniform3d (GLint location, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glUniform4d (GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glUniform1dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform2dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform3dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniform4dv (GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix2x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix3x4dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4x2dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glUniformMatrix4x3dv (GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glGetUniformdv (GLuint program, GLint location, GLdouble *params);
-GLAPI GLint APIENTRY glGetSubroutineUniformLocation (GLuint program, GLenum shadertype, const GLchar *name);
-GLAPI GLuint APIENTRY glGetSubroutineIndex (GLuint program, GLenum shadertype, const GLchar *name);
-GLAPI void APIENTRY glGetActiveSubroutineUniformiv (GLuint program, GLenum shadertype, GLuint index, GLenum pname, GLint *values);
-GLAPI void APIENTRY glGetActiveSubroutineUniformName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glGetActiveSubroutineName (GLuint program, GLenum shadertype, GLuint index, GLsizei bufsize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glUniformSubroutinesuiv (GLenum shadertype, GLsizei count, const GLuint *indices);
-GLAPI void APIENTRY glGetUniformSubroutineuiv (GLenum shadertype, GLint location, GLuint *params);
-GLAPI void APIENTRY glGetProgramStageiv (GLuint program, GLenum shadertype, GLenum pname, GLint *values);
-GLAPI void APIENTRY glPatchParameteri (GLenum pname, GLint value);
-GLAPI void APIENTRY glPatchParameterfv (GLenum pname, const GLfloat *values);
-GLAPI void APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
-GLAPI void APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
-GLAPI void APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
-GLAPI GLboolean APIENTRY glIsTransformFeedback (GLuint id);
-GLAPI void APIENTRY glPauseTransformFeedback (void);
-GLAPI void APIENTRY glResumeTransformFeedback (void);
-GLAPI void APIENTRY glDrawTransformFeedback (GLenum mode, GLuint id);
-GLAPI void APIENTRY glDrawTransformFeedbackStream (GLenum mode, GLuint id, GLuint stream);
-GLAPI void APIENTRY glBeginQueryIndexed (GLenum target, GLuint index, GLuint id);
-GLAPI void APIENTRY glEndQueryIndexed (GLenum target, GLuint index);
-GLAPI void APIENTRY glGetQueryIndexediv (GLenum target, GLuint index, GLenum pname, GLint *params);
-#endif
-#endif /* GL_VERSION_4_0 */
-
-#ifndef GL_VERSION_4_1
-#define GL_VERSION_4_1 1
-#define GL_FIXED 0x140C
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_RGB565 0x8D62
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-#define GL_VERTEX_SHADER_BIT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT 0x00000002
-#define GL_GEOMETRY_SHADER_BIT 0x00000004
-#define GL_TESS_CONTROL_SHADER_BIT 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT 0x00000010
-#define GL_ALL_SHADER_BITS 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE 0x8258
-#define GL_ACTIVE_PROGRAM 0x8259
-#define GL_PROGRAM_PIPELINE_BINDING 0x825A
-#define GL_MAX_VIEWPORTS 0x825B
-#define GL_VIEWPORT_SUBPIXEL_BITS 0x825C
-#define GL_VIEWPORT_BOUNDS_RANGE 0x825D
-#define GL_LAYER_PROVOKING_VERTEX 0x825E
-#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX 0x825F
-#define GL_UNDEFINED_VERTEX 0x8260
-typedef void (APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
-typedef void (APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-typedef void (APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-typedef void (APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
-typedef void (APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
-typedef void (APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-typedef void (APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLUSEPROGRAMSTAGESPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (APIENTRYP PFNGLACTIVESHADERPROGRAMPROC) (GLuint pipeline, GLuint program);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMVPROC) (GLenum type, GLsizei count, const GLchar *const*strings);
-typedef void (APIENTRYP PFNGLBINDPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMPIPELINESPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (APIENTRYP PFNGLGENPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEIVPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IPROC) (GLuint program, GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DPROC) (GLuint program, GLint location, GLdouble v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DPROC) (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEPROC) (GLuint pipeline);
-typedef void (APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLVIEWPORTARRAYVPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-typedef void (APIENTRYP PFNGLVIEWPORTINDEXEDFVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLSCISSORARRAYVPROC) (GLuint first, GLsizei count, const GLint *v);
-typedef void (APIENTRYP PFNGLSCISSORINDEXEDPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLSCISSORINDEXEDVPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLDEPTHRANGEARRAYVPROC) (GLuint first, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLDEPTHRANGEINDEXEDPROC) (GLuint index, GLdouble n, GLdouble f);
-typedef void (APIENTRYP PFNGLGETFLOATI_VPROC) (GLenum target, GLuint index, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETDOUBLEI_VPROC) (GLenum target, GLuint index, GLdouble *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReleaseShaderCompiler (void);
-GLAPI void APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GLAPI void APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-GLAPI void APIENTRY glDepthRangef (GLfloat n, GLfloat f);
-GLAPI void APIENTRY glClearDepthf (GLfloat d);
-GLAPI void APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GLAPI void APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-GLAPI void APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
-GLAPI void APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program);
-GLAPI void APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program);
-GLAPI GLuint APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings);
-GLAPI void APIENTRY glBindProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines);
-GLAPI void APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines);
-GLAPI GLboolean APIENTRY glIsProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params);
-GLAPI void APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0);
-GLAPI void APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0);
-GLAPI void APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform1d (GLuint program, GLint location, GLdouble v0);
-GLAPI void APIENTRY glProgramUniform1dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0);
-GLAPI void APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform2d (GLuint program, GLint location, GLdouble v0, GLdouble v1);
-GLAPI void APIENTRY glProgramUniform2dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform3d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2);
-GLAPI void APIENTRY glProgramUniform3dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform4d (GLuint program, GLint location, GLdouble v0, GLdouble v1, GLdouble v2, GLdouble v3);
-GLAPI void APIENTRY glProgramUniform4dv (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3dv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glValidateProgramPipeline (GLuint pipeline);
-GLAPI void APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GLAPI void APIENTRY glVertexAttribL1d (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttribL2d (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttribL3d (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttribL4d (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttribL1dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL2dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL3dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL4dv (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribLPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribLdv (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glViewportArrayv (GLuint first, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glViewportIndexedf (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-GLAPI void APIENTRY glViewportIndexedfv (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glScissorArrayv (GLuint first, GLsizei count, const GLint *v);
-GLAPI void APIENTRY glScissorIndexed (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glScissorIndexedv (GLuint index, const GLint *v);
-GLAPI void APIENTRY glDepthRangeArrayv (GLuint first, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glDepthRangeIndexed (GLuint index, GLdouble n, GLdouble f);
-GLAPI void APIENTRY glGetFloati_v (GLenum target, GLuint index, GLfloat *data);
-GLAPI void APIENTRY glGetDoublei_v (GLenum target, GLuint index, GLdouble *data);
-#endif
-#endif /* GL_VERSION_4_1 */
-
-#ifndef GL_VERSION_4_2
-#define GL_VERSION_4_2 1
-#define GL_COPY_READ_BUFFER_BINDING 0x8F36
-#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
-#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_UNPACK_COMPRESSED_BLOCK_WIDTH 0x9127
-#define GL_UNPACK_COMPRESSED_BLOCK_HEIGHT 0x9128
-#define GL_UNPACK_COMPRESSED_BLOCK_DEPTH 0x9129
-#define GL_UNPACK_COMPRESSED_BLOCK_SIZE 0x912A
-#define GL_PACK_COMPRESSED_BLOCK_WIDTH 0x912B
-#define GL_PACK_COMPRESSED_BLOCK_HEIGHT 0x912C
-#define GL_PACK_COMPRESSED_BLOCK_DEPTH 0x912D
-#define GL_PACK_COMPRESSED_BLOCK_SIZE 0x912E
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-#define GL_MIN_MAP_BUFFER_ALIGNMENT 0x90BC
-#define GL_ATOMIC_COUNTER_BUFFER 0x92C0
-#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1
-#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2
-#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3
-#define GL_ATOMIC_COUNTER_BUFFER_DATA_SIZE 0x92C4
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTERS 0x92C5
-#define GL_ATOMIC_COUNTER_BUFFER_ACTIVE_ATOMIC_COUNTER_INDICES 0x92C6
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_VERTEX_SHADER 0x92C7
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_CONTROL_SHADER 0x92C8
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_TESS_EVALUATION_SHADER 0x92C9
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_GEOMETRY_SHADER 0x92CA
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_FRAGMENT_SHADER 0x92CB
-#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS 0x92CE
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS 0x92CF
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0
-#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1
-#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS 0x92D4
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS 0x92D5
-#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6
-#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8
-#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC
-#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9
-#define GL_UNIFORM_ATOMIC_COUNTER_BUFFER_INDEX 0x92DA
-#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020
-#define GL_COMMAND_BARRIER_BIT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000
-#define GL_ALL_BARRIER_BITS 0xFFFFFFFF
-#define GL_MAX_IMAGE_UNITS 0x8F38
-#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS 0x8F39
-#define GL_IMAGE_BINDING_NAME 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED 0x8F3C
-#define GL_IMAGE_BINDING_LAYER 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS 0x8F3E
-#define GL_IMAGE_1D 0x904C
-#define GL_IMAGE_2D 0x904D
-#define GL_IMAGE_3D 0x904E
-#define GL_IMAGE_2D_RECT 0x904F
-#define GL_IMAGE_CUBE 0x9050
-#define GL_IMAGE_BUFFER 0x9051
-#define GL_IMAGE_1D_ARRAY 0x9052
-#define GL_IMAGE_2D_ARRAY 0x9053
-#define GL_IMAGE_CUBE_MAP_ARRAY 0x9054
-#define GL_IMAGE_2D_MULTISAMPLE 0x9055
-#define GL_IMAGE_2D_MULTISAMPLE_ARRAY 0x9056
-#define GL_INT_IMAGE_1D 0x9057
-#define GL_INT_IMAGE_2D 0x9058
-#define GL_INT_IMAGE_3D 0x9059
-#define GL_INT_IMAGE_2D_RECT 0x905A
-#define GL_INT_IMAGE_CUBE 0x905B
-#define GL_INT_IMAGE_BUFFER 0x905C
-#define GL_INT_IMAGE_1D_ARRAY 0x905D
-#define GL_INT_IMAGE_2D_ARRAY 0x905E
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY 0x905F
-#define GL_INT_IMAGE_2D_MULTISAMPLE 0x9060
-#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x9061
-#define GL_UNSIGNED_INT_IMAGE_1D 0x9062
-#define GL_UNSIGNED_INT_IMAGE_2D 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D 0x9064
-#define GL_UNSIGNED_INT_IMAGE_2D_RECT 0x9065
-#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066
-#define GL_UNSIGNED_INT_IMAGE_BUFFER 0x9067
-#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY 0x9068
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY 0x906A
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE 0x906B
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY 0x906C
-#define GL_MAX_IMAGE_SAMPLES 0x906D
-#define GL_IMAGE_BINDING_FORMAT 0x906E
-#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8
-#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9
-#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS 0x90CC
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS 0x90CD
-#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE
-#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF
-#define GL_COMPRESSED_RGBA_BPTC_UNORM 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT 0x8E8F
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC) (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREPROC) (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-typedef void (APIENTRYP PFNGLMEMORYBARRIERPROC) (GLbitfield barriers);
-typedef void (APIENTRYP PFNGLTEXSTORAGE1DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC) (GLenum mode, GLuint id, GLsizei instancecount);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC) (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedBaseInstance (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-GLAPI void APIENTRY glDrawElementsInstancedBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-GLAPI void APIENTRY glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-GLAPI void APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetActiveAtomicCounterBufferiv (GLuint program, GLuint bufferIndex, GLenum pname, GLint *params);
-GLAPI void APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format);
-GLAPI void APIENTRY glMemoryBarrier (GLbitfield barriers);
-GLAPI void APIENTRY glTexStorage1D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glDrawTransformFeedbackInstanced (GLenum mode, GLuint id, GLsizei instancecount);
-GLAPI void APIENTRY glDrawTransformFeedbackStreamInstanced (GLenum mode, GLuint id, GLuint stream, GLsizei instancecount);
-#endif
-#endif /* GL_VERSION_4_2 */
-
-#ifndef GL_VERSION_4_3
-#define GL_VERSION_4_3 1
-typedef void (APIENTRY *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_NUM_SHADING_LANGUAGE_VERSIONS 0x82E9
-#define GL_VERTEX_ATTRIB_ARRAY_LONG 0x874E
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_COMPUTE_SHADER 0x91B9
-#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB
-#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC
-#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD
-#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262
-#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263
-#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264
-#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265
-#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266
-#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB
-#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE
-#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF
-#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_COMPUTE_SHADER 0x90EC
-#define GL_ATOMIC_COUNTER_BUFFER_REFERENCED_BY_COMPUTE_SHADER 0x90ED
-#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE
-#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF
-#define GL_COMPUTE_SHADER_BIT 0x00000020
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM 0x8245
-#define GL_DEBUG_SOURCE_API 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION 0x824A
-#define GL_DEBUG_SOURCE_OTHER 0x824B
-#define GL_DEBUG_TYPE_ERROR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE 0x8250
-#define GL_DEBUG_TYPE_OTHER 0x8251
-#define GL_MAX_DEBUG_MESSAGE_LENGTH 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES 0x9145
-#define GL_DEBUG_SEVERITY_HIGH 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM 0x9147
-#define GL_DEBUG_SEVERITY_LOW 0x9148
-#define GL_DEBUG_TYPE_MARKER 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH 0x826D
-#define GL_BUFFER 0x82E0
-#define GL_SHADER 0x82E1
-#define GL_PROGRAM 0x82E2
-#define GL_QUERY 0x82E3
-#define GL_PROGRAM_PIPELINE 0x82E4
-#define GL_SAMPLER 0x82E6
-#define GL_MAX_LABEL_LENGTH 0x82E8
-#define GL_DEBUG_OUTPUT 0x92E0
-#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002
-#define GL_MAX_UNIFORM_LOCATIONS 0x826E
-#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310
-#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS 0x9312
-#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313
-#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314
-#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315
-#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316
-#define GL_MAX_FRAMEBUFFER_LAYERS 0x9317
-#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318
-#define GL_INTERNALFORMAT_SUPPORTED 0x826F
-#define GL_INTERNALFORMAT_PREFERRED 0x8270
-#define GL_INTERNALFORMAT_RED_SIZE 0x8271
-#define GL_INTERNALFORMAT_GREEN_SIZE 0x8272
-#define GL_INTERNALFORMAT_BLUE_SIZE 0x8273
-#define GL_INTERNALFORMAT_ALPHA_SIZE 0x8274
-#define GL_INTERNALFORMAT_DEPTH_SIZE 0x8275
-#define GL_INTERNALFORMAT_STENCIL_SIZE 0x8276
-#define GL_INTERNALFORMAT_SHARED_SIZE 0x8277
-#define GL_INTERNALFORMAT_RED_TYPE 0x8278
-#define GL_INTERNALFORMAT_GREEN_TYPE 0x8279
-#define GL_INTERNALFORMAT_BLUE_TYPE 0x827A
-#define GL_INTERNALFORMAT_ALPHA_TYPE 0x827B
-#define GL_INTERNALFORMAT_DEPTH_TYPE 0x827C
-#define GL_INTERNALFORMAT_STENCIL_TYPE 0x827D
-#define GL_MAX_WIDTH 0x827E
-#define GL_MAX_HEIGHT 0x827F
-#define GL_MAX_DEPTH 0x8280
-#define GL_MAX_LAYERS 0x8281
-#define GL_MAX_COMBINED_DIMENSIONS 0x8282
-#define GL_COLOR_COMPONENTS 0x8283
-#define GL_DEPTH_COMPONENTS 0x8284
-#define GL_STENCIL_COMPONENTS 0x8285
-#define GL_COLOR_RENDERABLE 0x8286
-#define GL_DEPTH_RENDERABLE 0x8287
-#define GL_STENCIL_RENDERABLE 0x8288
-#define GL_FRAMEBUFFER_RENDERABLE 0x8289
-#define GL_FRAMEBUFFER_RENDERABLE_LAYERED 0x828A
-#define GL_FRAMEBUFFER_BLEND 0x828B
-#define GL_READ_PIXELS 0x828C
-#define GL_READ_PIXELS_FORMAT 0x828D
-#define GL_READ_PIXELS_TYPE 0x828E
-#define GL_TEXTURE_IMAGE_FORMAT 0x828F
-#define GL_TEXTURE_IMAGE_TYPE 0x8290
-#define GL_GET_TEXTURE_IMAGE_FORMAT 0x8291
-#define GL_GET_TEXTURE_IMAGE_TYPE 0x8292
-#define GL_MIPMAP 0x8293
-#define GL_MANUAL_GENERATE_MIPMAP 0x8294
-#define GL_AUTO_GENERATE_MIPMAP 0x8295
-#define GL_COLOR_ENCODING 0x8296
-#define GL_SRGB_READ 0x8297
-#define GL_SRGB_WRITE 0x8298
-#define GL_FILTER 0x829A
-#define GL_VERTEX_TEXTURE 0x829B
-#define GL_TESS_CONTROL_TEXTURE 0x829C
-#define GL_TESS_EVALUATION_TEXTURE 0x829D
-#define GL_GEOMETRY_TEXTURE 0x829E
-#define GL_FRAGMENT_TEXTURE 0x829F
-#define GL_COMPUTE_TEXTURE 0x82A0
-#define GL_TEXTURE_SHADOW 0x82A1
-#define GL_TEXTURE_GATHER 0x82A2
-#define GL_TEXTURE_GATHER_SHADOW 0x82A3
-#define GL_SHADER_IMAGE_LOAD 0x82A4
-#define GL_SHADER_IMAGE_STORE 0x82A5
-#define GL_SHADER_IMAGE_ATOMIC 0x82A6
-#define GL_IMAGE_TEXEL_SIZE 0x82A7
-#define GL_IMAGE_COMPATIBILITY_CLASS 0x82A8
-#define GL_IMAGE_PIXEL_FORMAT 0x82A9
-#define GL_IMAGE_PIXEL_TYPE 0x82AA
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_TEST 0x82AC
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_TEST 0x82AD
-#define GL_SIMULTANEOUS_TEXTURE_AND_DEPTH_WRITE 0x82AE
-#define GL_SIMULTANEOUS_TEXTURE_AND_STENCIL_WRITE 0x82AF
-#define GL_TEXTURE_COMPRESSED_BLOCK_WIDTH 0x82B1
-#define GL_TEXTURE_COMPRESSED_BLOCK_HEIGHT 0x82B2
-#define GL_TEXTURE_COMPRESSED_BLOCK_SIZE 0x82B3
-#define GL_CLEAR_BUFFER 0x82B4
-#define GL_TEXTURE_VIEW 0x82B5
-#define GL_VIEW_COMPATIBILITY_CLASS 0x82B6
-#define GL_FULL_SUPPORT 0x82B7
-#define GL_CAVEAT_SUPPORT 0x82B8
-#define GL_IMAGE_CLASS_4_X_32 0x82B9
-#define GL_IMAGE_CLASS_2_X_32 0x82BA
-#define GL_IMAGE_CLASS_1_X_32 0x82BB
-#define GL_IMAGE_CLASS_4_X_16 0x82BC
-#define GL_IMAGE_CLASS_2_X_16 0x82BD
-#define GL_IMAGE_CLASS_1_X_16 0x82BE
-#define GL_IMAGE_CLASS_4_X_8 0x82BF
-#define GL_IMAGE_CLASS_2_X_8 0x82C0
-#define GL_IMAGE_CLASS_1_X_8 0x82C1
-#define GL_IMAGE_CLASS_11_11_10 0x82C2
-#define GL_IMAGE_CLASS_10_10_10_2 0x82C3
-#define GL_VIEW_CLASS_128_BITS 0x82C4
-#define GL_VIEW_CLASS_96_BITS 0x82C5
-#define GL_VIEW_CLASS_64_BITS 0x82C6
-#define GL_VIEW_CLASS_48_BITS 0x82C7
-#define GL_VIEW_CLASS_32_BITS 0x82C8
-#define GL_VIEW_CLASS_24_BITS 0x82C9
-#define GL_VIEW_CLASS_16_BITS 0x82CA
-#define GL_VIEW_CLASS_8_BITS 0x82CB
-#define GL_VIEW_CLASS_S3TC_DXT1_RGB 0x82CC
-#define GL_VIEW_CLASS_S3TC_DXT1_RGBA 0x82CD
-#define GL_VIEW_CLASS_S3TC_DXT3_RGBA 0x82CE
-#define GL_VIEW_CLASS_S3TC_DXT5_RGBA 0x82CF
-#define GL_VIEW_CLASS_RGTC1_RED 0x82D0
-#define GL_VIEW_CLASS_RGTC2_RG 0x82D1
-#define GL_VIEW_CLASS_BPTC_UNORM 0x82D2
-#define GL_VIEW_CLASS_BPTC_FLOAT 0x82D3
-#define GL_UNIFORM 0x92E1
-#define GL_UNIFORM_BLOCK 0x92E2
-#define GL_PROGRAM_INPUT 0x92E3
-#define GL_PROGRAM_OUTPUT 0x92E4
-#define GL_BUFFER_VARIABLE 0x92E5
-#define GL_SHADER_STORAGE_BLOCK 0x92E6
-#define GL_VERTEX_SUBROUTINE 0x92E8
-#define GL_TESS_CONTROL_SUBROUTINE 0x92E9
-#define GL_TESS_EVALUATION_SUBROUTINE 0x92EA
-#define GL_GEOMETRY_SUBROUTINE 0x92EB
-#define GL_FRAGMENT_SUBROUTINE 0x92EC
-#define GL_COMPUTE_SUBROUTINE 0x92ED
-#define GL_VERTEX_SUBROUTINE_UNIFORM 0x92EE
-#define GL_TESS_CONTROL_SUBROUTINE_UNIFORM 0x92EF
-#define GL_TESS_EVALUATION_SUBROUTINE_UNIFORM 0x92F0
-#define GL_GEOMETRY_SUBROUTINE_UNIFORM 0x92F1
-#define GL_FRAGMENT_SUBROUTINE_UNIFORM 0x92F2
-#define GL_COMPUTE_SUBROUTINE_UNIFORM 0x92F3
-#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4
-#define GL_ACTIVE_RESOURCES 0x92F5
-#define GL_MAX_NAME_LENGTH 0x92F6
-#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7
-#define GL_MAX_NUM_COMPATIBLE_SUBROUTINES 0x92F8
-#define GL_NAME_LENGTH 0x92F9
-#define GL_TYPE 0x92FA
-#define GL_ARRAY_SIZE 0x92FB
-#define GL_OFFSET 0x92FC
-#define GL_BLOCK_INDEX 0x92FD
-#define GL_ARRAY_STRIDE 0x92FE
-#define GL_MATRIX_STRIDE 0x92FF
-#define GL_IS_ROW_MAJOR 0x9300
-#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301
-#define GL_BUFFER_BINDING 0x9302
-#define GL_BUFFER_DATA_SIZE 0x9303
-#define GL_NUM_ACTIVE_VARIABLES 0x9304
-#define GL_ACTIVE_VARIABLES 0x9305
-#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER 0x9308
-#define GL_REFERENCED_BY_GEOMETRY_SHADER 0x9309
-#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A
-#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B
-#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C
-#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D
-#define GL_LOCATION 0x930E
-#define GL_LOCATION_INDEX 0x930F
-#define GL_IS_PER_PATCH 0x92E7
-#define GL_SHADER_STORAGE_BUFFER 0x90D2
-#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3
-#define GL_SHADER_STORAGE_BUFFER_START 0x90D4
-#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5
-#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS 0x90D7
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS 0x90D9
-#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA
-#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB
-#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC
-#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD
-#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE
-#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF
-#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000
-#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39
-#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA
-#define GL_TEXTURE_BUFFER_OFFSET 0x919D
-#define GL_TEXTURE_BUFFER_SIZE 0x919E
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT 0x919F
-#define GL_TEXTURE_VIEW_MIN_LEVEL 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS 0x82DE
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-#define GL_VERTEX_ATTRIB_BINDING 0x82D4
-#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5
-#define GL_VERTEX_BINDING_DIVISOR 0x82D6
-#define GL_VERTEX_BINDING_OFFSET 0x82D7
-#define GL_VERTEX_BINDING_STRIDE 0x82D8
-#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9
-#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA
-#define GL_VERTEX_BINDING_BUFFER 0x8F4F
-#define GL_DISPLAY_LIST 0x82E7
-typedef void (APIENTRYP PFNGLCLEARBUFFERDATAPROC) (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARBUFFERSUBDATAPROC) (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEINDIRECTPROC) (GLintptr indirect);
-typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATAPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATI64VPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
-typedef void (APIENTRYP PFNGLINVALIDATETEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLINVALIDATETEXIMAGEPROC) (GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLINVALIDATEBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLINVALIDATEBUFFERDATAPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-typedef void (APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLGETPROGRAMINTERFACEIVPROC) (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
-typedef GLuint (APIENTRYP PFNGLGETPROGRAMRESOURCEINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCENAMEPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEIVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
-typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef void (APIENTRYP PFNGLSHADERSTORAGEBLOCKBINDINGPROC) (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
-typedef void (APIENTRYP PFNGLTEXBUFFERRANGEPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXSTORAGE2DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTUREVIEWPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERPROC) (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATPROC) (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBBINDINGPROC) (GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXBINDINGDIVISORPROC) (GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKPROC) (GLDEBUGPROC callback, const void *userParam);
-typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-typedef void (APIENTRYP PFNGLPUSHDEBUGGROUPPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-typedef void (APIENTRYP PFNGLPOPDEBUGGROUPPROC) (void);
-typedef void (APIENTRYP PFNGLOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTLABELPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (APIENTRYP PFNGLOBJECTPTRLABELPROC) (const void *ptr, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTPTRLABELPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClearBufferData (GLenum target, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearBufferSubData (GLenum target, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z);
-GLAPI void APIENTRY glDispatchComputeIndirect (GLintptr indirect);
-GLAPI void APIENTRY glCopyImageSubData (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-GLAPI void APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetInternalformati64v (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint64 *params);
-GLAPI void APIENTRY glInvalidateTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glInvalidateTexImage (GLuint texture, GLint level);
-GLAPI void APIENTRY glInvalidateBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glInvalidateBufferData (GLuint buffer);
-GLAPI void APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-GLAPI void APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glMultiDrawArraysIndirect (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-GLAPI void APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params);
-GLAPI GLuint APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI void APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name);
-GLAPI void APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params);
-GLAPI GLint APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI GLint APIENTRY glGetProgramResourceLocationIndex (GLuint program, GLenum programInterface, const GLchar *name);
-GLAPI void APIENTRY glShaderStorageBlockBinding (GLuint program, GLuint storageBlockIndex, GLuint storageBlockBinding);
-GLAPI void APIENTRY glTexBufferRange (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTexStorage3DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureView (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-GLAPI void APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribLFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glDebugMessageControl (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GLAPI void APIENTRY glDebugMessageInsert (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GLAPI void APIENTRY glDebugMessageCallback (GLDEBUGPROC callback, const void *userParam);
-GLAPI GLuint APIENTRY glGetDebugMessageLog (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-GLAPI void APIENTRY glPushDebugGroup (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-GLAPI void APIENTRY glPopDebugGroup (void);
-GLAPI void APIENTRY glObjectLabel (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectLabel (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-GLAPI void APIENTRY glObjectPtrLabel (const void *ptr, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectPtrLabel (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_VERSION_4_3 */
-
-#ifndef GL_VERSION_4_4
-#define GL_VERSION_4_4 1
-#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
-#define GL_TEXTURE_BUFFER_BINDING 0x8C2A
-#define GL_MAP_PERSISTENT_BIT 0x0040
-#define GL_MAP_COHERENT_BIT 0x0080
-#define GL_DYNAMIC_STORAGE_BIT 0x0100
-#define GL_CLIENT_STORAGE_BIT 0x0200
-#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT 0x00004000
-#define GL_BUFFER_IMMUTABLE_STORAGE 0x821F
-#define GL_BUFFER_STORAGE_FLAGS 0x8220
-#define GL_CLEAR_TEXTURE 0x9365
-#define GL_LOCATION_COMPONENT 0x934A
-#define GL_TRANSFORM_FEEDBACK_BUFFER_INDEX 0x934B
-#define GL_TRANSFORM_FEEDBACK_BUFFER_STRIDE 0x934C
-#define GL_QUERY_BUFFER 0x9192
-#define GL_QUERY_BUFFER_BARRIER_BIT 0x00008000
-#define GL_QUERY_BUFFER_BINDING 0x9193
-#define GL_QUERY_RESULT_NO_WAIT 0x9194
-#define GL_MIRROR_CLAMP_TO_EDGE 0x8743
-typedef void (APIENTRYP PFNGLBUFFERSTORAGEPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLBINDBUFFERSBASEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLBINDBUFFERSRANGEPROC) (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
-typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
-typedef void (APIENTRYP PFNGLBINDSAMPLERSPROC) (GLuint first, GLsizei count, const GLuint *samplers);
-typedef void (APIENTRYP PFNGLBINDIMAGETEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures);
-typedef void (APIENTRYP PFNGLBINDVERTEXBUFFERSPROC) (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferStorage (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glClearTexImage (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearTexSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glBindBuffersBase (GLenum target, GLuint first, GLsizei count, const GLuint *buffers);
-GLAPI void APIENTRY glBindBuffersRange (GLenum target, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizeiptr *sizes);
-GLAPI void APIENTRY glBindTextures (GLuint first, GLsizei count, const GLuint *textures);
-GLAPI void APIENTRY glBindSamplers (GLuint first, GLsizei count, const GLuint *samplers);
-GLAPI void APIENTRY glBindImageTextures (GLuint first, GLsizei count, const GLuint *textures);
-GLAPI void APIENTRY glBindVertexBuffers (GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-#endif
-#endif /* GL_VERSION_4_4 */
-
-#ifndef GL_VERSION_4_5
-#define GL_VERSION_4_5 1
-#define GL_CONTEXT_LOST 0x0507
-#define GL_NEGATIVE_ONE_TO_ONE 0x935E
-#define GL_ZERO_TO_ONE 0x935F
-#define GL_CLIP_ORIGIN 0x935C
-#define GL_CLIP_DEPTH_MODE 0x935D
-#define GL_QUERY_WAIT_INVERTED 0x8E17
-#define GL_QUERY_NO_WAIT_INVERTED 0x8E18
-#define GL_QUERY_BY_REGION_WAIT_INVERTED 0x8E19
-#define GL_QUERY_BY_REGION_NO_WAIT_INVERTED 0x8E1A
-#define GL_MAX_CULL_DISTANCES 0x82F9
-#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES 0x82FA
-#define GL_TEXTURE_TARGET 0x1006
-#define GL_QUERY_TARGET 0x82EA
-#define GL_GUILTY_CONTEXT_RESET 0x8253
-#define GL_INNOCENT_CONTEXT_RESET 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET 0x8252
-#define GL_NO_RESET_NOTIFICATION 0x8261
-#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT 0x00000004
-#define GL_CONTEXT_RELEASE_BEHAVIOR 0x82FB
-#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82FC
-typedef void (APIENTRYP PFNGLCLIPCONTROLPROC) (GLenum origin, GLenum depth);
-typedef void (APIENTRYP PFNGLCREATETRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC) (GLuint xfb, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC) (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKIVPROC) (GLuint xfb, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint *param);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKI64_VPROC) (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
-typedef void (APIENTRYP PFNGLCREATEBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLCOPYNAMEDBUFFERSUBDATAPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERPROC) (GLuint buffer, GLenum access);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFERPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERI64VPROC) (GLuint buffer, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVPROC) (GLuint buffer, GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (APIENTRYP PFNGLCREATEFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC) (GLuint framebuffer, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC) (GLuint framebuffer, GLenum buf);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC) (GLuint framebuffer, GLenum src);
-typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
-typedef void (APIENTRYP PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC) (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFVPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
-typedef void (APIENTRYP PFNGLCLEARNAMEDFRAMEBUFFERFIPROC) (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-typedef void (APIENTRYP PFNGLBLITNAMEDFRAMEBUFFERPROC) (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC) (GLuint framebuffer, GLenum target);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC) (GLuint framebuffer, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATERENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATETEXTURESPROC) (GLenum target, GLsizei n, GLuint *textures);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERPROC) (GLuint texture, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEPROC) (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DPROC) (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEPROC) (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DPROC) (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFPROC) (GLuint texture, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIPROC) (GLuint texture, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPPROC) (GLuint texture);
-typedef void (APIENTRYP PFNGLBINDTEXTUREUNITPROC) (GLuint unit, GLuint texture);
-typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC) (GLuint texture, GLint level, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVPROC) (GLuint texture, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVPROC) (GLuint texture, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVPROC) (GLuint texture, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVPROC) (GLuint texture, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVPROC) (GLuint texture, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVPROC) (GLuint texture, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCREATEVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLVERTEXARRAYELEMENTBUFFERPROC) (GLuint vaobj, GLuint buffer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBUFFERSPROC) (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBBINDINGPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBIFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYATTRIBLFORMATPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYBINDINGDIVISORPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYIVPROC) (GLuint vaobj, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXEDIVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINDEXED64IVPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
-typedef void (APIENTRYP PFNGLCREATESAMPLERSPROC) (GLsizei n, GLuint *samplers);
-typedef void (APIENTRYP PFNGLCREATEPROGRAMPIPELINESPROC) (GLsizei n, GLuint *pipelines);
-typedef void (APIENTRYP PFNGLCREATEQUERIESPROC) (GLenum target, GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUI64VPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLGETQUERYBUFFEROBJECTUIVPROC) (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-typedef void (APIENTRYP PFNGLMEMORYBARRIERBYREGIONPROC) (GLbitfield barriers);
-typedef void (APIENTRYP PFNGLGETTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
-typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSPROC) (void);
-typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEPROC) (GLenum target, GLint lod, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETNTEXIMAGEPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-typedef void (APIENTRYP PFNGLGETNUNIFORMDVPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMFVPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUIVPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-typedef void (APIENTRYP PFNGLREADNPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (APIENTRYP PFNGLGETNMAPDVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
-typedef void (APIENTRYP PFNGLGETNMAPFVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
-typedef void (APIENTRYP PFNGLGETNMAPIVPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPFVPROC) (GLenum map, GLsizei bufSize, GLfloat *values);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVPROC) (GLenum map, GLsizei bufSize, GLuint *values);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVPROC) (GLenum map, GLsizei bufSize, GLushort *values);
-typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEPROC) (GLsizei bufSize, GLubyte *pattern);
-typedef void (APIENTRYP PFNGLGETNCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
-typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
-typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
-typedef void (APIENTRYP PFNGLGETNHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-typedef void (APIENTRYP PFNGLGETNMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-typedef void (APIENTRYP PFNGLTEXTUREBARRIERPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClipControl (GLenum origin, GLenum depth);
-GLAPI void APIENTRY glCreateTransformFeedbacks (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glTransformFeedbackBufferBase (GLuint xfb, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackBufferRange (GLuint xfb, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glGetTransformFeedbackiv (GLuint xfb, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetTransformFeedbacki_v (GLuint xfb, GLenum pname, GLuint index, GLint *param);
-GLAPI void APIENTRY glGetTransformFeedbacki64_v (GLuint xfb, GLenum pname, GLuint index, GLint64 *param);
-GLAPI void APIENTRY glCreateBuffers (GLsizei n, GLuint *buffers);
-GLAPI void APIENTRY glNamedBufferStorage (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glNamedBufferData (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glCopyNamedBufferSubData (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glClearNamedBufferData (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearNamedBufferSubData (GLuint buffer, GLenum internalformat, GLintptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void *APIENTRY glMapNamedBuffer (GLuint buffer, GLenum access);
-GLAPI void *APIENTRY glMapNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI GLboolean APIENTRY glUnmapNamedBuffer (GLuint buffer);
-GLAPI void APIENTRY glFlushMappedNamedBufferRange (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glGetNamedBufferParameteriv (GLuint buffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedBufferParameteri64v (GLuint buffer, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glGetNamedBufferPointerv (GLuint buffer, GLenum pname, void **params);
-GLAPI void APIENTRY glGetNamedBufferSubData (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void APIENTRY glCreateFramebuffers (GLsizei n, GLuint *framebuffers);
-GLAPI void APIENTRY glNamedFramebufferRenderbuffer (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glNamedFramebufferParameteri (GLuint framebuffer, GLenum pname, GLint param);
-GLAPI void APIENTRY glNamedFramebufferTexture (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTextureLayer (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glNamedFramebufferDrawBuffer (GLuint framebuffer, GLenum buf);
-GLAPI void APIENTRY glNamedFramebufferDrawBuffers (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glNamedFramebufferReadBuffer (GLuint framebuffer, GLenum src);
-GLAPI void APIENTRY glInvalidateNamedFramebufferData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments);
-GLAPI void APIENTRY glInvalidateNamedFramebufferSubData (GLuint framebuffer, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glClearNamedFramebufferiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLint *value);
-GLAPI void APIENTRY glClearNamedFramebufferuiv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLuint *value);
-GLAPI void APIENTRY glClearNamedFramebufferfv (GLuint framebuffer, GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GLAPI void APIENTRY glClearNamedFramebufferfi (GLuint framebuffer, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GLAPI void APIENTRY glBlitNamedFramebuffer (GLuint readFramebuffer, GLuint drawFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GLAPI GLenum APIENTRY glCheckNamedFramebufferStatus (GLuint framebuffer, GLenum target);
-GLAPI void APIENTRY glGetNamedFramebufferParameteriv (GLuint framebuffer, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GLAPI void APIENTRY glNamedRenderbufferStorage (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisample (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetNamedRenderbufferParameteriv (GLuint renderbuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateTextures (GLenum target, GLsizei n, GLuint *textures);
-GLAPI void APIENTRY glTextureBuffer (GLuint texture, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glTextureBufferRange (GLuint texture, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTextureStorage1D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTextureStorage2D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureStorage3D (GLuint texture, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glTextureStorage2DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureStorage3DMultisample (GLuint texture, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCompressedTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCopyTextureSubImage1D (GLuint texture, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTextureSubImage2D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glCopyTextureSubImage3D (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureParameterf (GLuint texture, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTextureParameterfv (GLuint texture, GLenum pname, const GLfloat *param);
-GLAPI void APIENTRY glTextureParameteri (GLuint texture, GLenum pname, GLint param);
-GLAPI void APIENTRY glTextureParameterIiv (GLuint texture, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureParameterIuiv (GLuint texture, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glTextureParameteriv (GLuint texture, GLenum pname, const GLint *param);
-GLAPI void APIENTRY glGenerateTextureMipmap (GLuint texture);
-GLAPI void APIENTRY glBindTextureUnit (GLuint unit, GLuint texture);
-GLAPI void APIENTRY glGetTextureImage (GLuint texture, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetCompressedTextureImage (GLuint texture, GLint level, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetTextureLevelParameterfv (GLuint texture, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureLevelParameteriv (GLuint texture, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterfv (GLuint texture, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureParameterIiv (GLuint texture, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterIuiv (GLuint texture, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glGetTextureParameteriv (GLuint texture, GLenum pname, GLint *params);
-GLAPI void APIENTRY glCreateVertexArrays (GLsizei n, GLuint *arrays);
-GLAPI void APIENTRY glDisableVertexArrayAttrib (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glEnableVertexArrayAttrib (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glVertexArrayElementBuffer (GLuint vaobj, GLuint buffer);
-GLAPI void APIENTRY glVertexArrayVertexBuffer (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexArrayVertexBuffers (GLuint vaobj, GLuint first, GLsizei count, const GLuint *buffers, const GLintptr *offsets, const GLsizei *strides);
-GLAPI void APIENTRY glVertexArrayAttribBinding (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexArrayAttribFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayAttribIFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayAttribLFormat (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayBindingDivisor (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glGetVertexArrayiv (GLuint vaobj, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayIndexediv (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayIndexed64iv (GLuint vaobj, GLuint index, GLenum pname, GLint64 *param);
-GLAPI void APIENTRY glCreateSamplers (GLsizei n, GLuint *samplers);
-GLAPI void APIENTRY glCreateProgramPipelines (GLsizei n, GLuint *pipelines);
-GLAPI void APIENTRY glCreateQueries (GLenum target, GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glGetQueryBufferObjecti64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectui64v (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glGetQueryBufferObjectuiv (GLuint id, GLuint buffer, GLenum pname, GLintptr offset);
-GLAPI void APIENTRY glMemoryBarrierByRegion (GLbitfield barriers);
-GLAPI void APIENTRY glGetTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetCompressedTextureSubImage (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei bufSize, void *pixels);
-GLAPI GLenum APIENTRY glGetGraphicsResetStatus (void);
-GLAPI void APIENTRY glGetnCompressedTexImage (GLenum target, GLint lod, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetnTexImage (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *pixels);
-GLAPI void APIENTRY glGetnUniformdv (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-GLAPI void APIENTRY glGetnUniformfv (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GLAPI void APIENTRY glGetnUniformiv (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetnUniformuiv (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-GLAPI void APIENTRY glReadnPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GLAPI void APIENTRY glGetnMapdv (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
-GLAPI void APIENTRY glGetnMapfv (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
-GLAPI void APIENTRY glGetnMapiv (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
-GLAPI void APIENTRY glGetnPixelMapfv (GLenum map, GLsizei bufSize, GLfloat *values);
-GLAPI void APIENTRY glGetnPixelMapuiv (GLenum map, GLsizei bufSize, GLuint *values);
-GLAPI void APIENTRY glGetnPixelMapusv (GLenum map, GLsizei bufSize, GLushort *values);
-GLAPI void APIENTRY glGetnPolygonStipple (GLsizei bufSize, GLubyte *pattern);
-GLAPI void APIENTRY glGetnColorTable (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
-GLAPI void APIENTRY glGetnConvolutionFilter (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
-GLAPI void APIENTRY glGetnSeparableFilter (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
-GLAPI void APIENTRY glGetnHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-GLAPI void APIENTRY glGetnMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-GLAPI void APIENTRY glTextureBarrier (void);
-#endif
-#endif /* GL_VERSION_4_5 */
-
-#ifndef GL_VERSION_4_6
-#define GL_VERSION_4_6 1
-#define GL_SHADER_BINARY_FORMAT_SPIR_V 0x9551
-#define GL_SPIR_V_BINARY 0x9552
-#define GL_PARAMETER_BUFFER 0x80EE
-#define GL_PARAMETER_BUFFER_BINDING 0x80EF
-#define GL_CONTEXT_FLAG_NO_ERROR_BIT 0x00000008
-#define GL_VERTICES_SUBMITTED 0x82EE
-#define GL_PRIMITIVES_SUBMITTED 0x82EF
-#define GL_VERTEX_SHADER_INVOCATIONS 0x82F0
-#define GL_TESS_CONTROL_SHADER_PATCHES 0x82F1
-#define GL_TESS_EVALUATION_SHADER_INVOCATIONS 0x82F2
-#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED 0x82F3
-#define GL_FRAGMENT_SHADER_INVOCATIONS 0x82F4
-#define GL_COMPUTE_SHADER_INVOCATIONS 0x82F5
-#define GL_CLIPPING_INPUT_PRIMITIVES 0x82F6
-#define GL_CLIPPING_OUTPUT_PRIMITIVES 0x82F7
-#define GL_POLYGON_OFFSET_CLAMP 0x8E1B
-#define GL_SPIR_V_EXTENSIONS 0x9553
-#define GL_NUM_SPIR_V_EXTENSIONS 0x9554
-#define GL_TEXTURE_MAX_ANISOTROPY 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY 0x84FF
-#define GL_TRANSFORM_FEEDBACK_OVERFLOW 0x82EC
-#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW 0x82ED
-typedef void (APIENTRYP PFNGLSPECIALIZESHADERPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpecializeShader (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-GLAPI void APIENTRY glMultiDrawArraysIndirectCount (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirectCount (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glPolygonOffsetClamp (GLfloat factor, GLfloat units, GLfloat clamp);
-#endif
-#endif /* GL_VERSION_4_6 */
-
-#ifndef GL_ARB_ES2_compatibility
-#define GL_ARB_ES2_compatibility 1
-#endif /* GL_ARB_ES2_compatibility */
-
-#ifndef GL_ARB_ES3_1_compatibility
-#define GL_ARB_ES3_1_compatibility 1
-#endif /* GL_ARB_ES3_1_compatibility */
-
-#ifndef GL_ARB_ES3_2_compatibility
-#define GL_ARB_ES3_2_compatibility 1
-#define GL_PRIMITIVE_BOUNDING_BOX_ARB 0x92BE
-#define GL_MULTISAMPLE_LINE_WIDTH_RANGE_ARB 0x9381
-#define GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY_ARB 0x9382
-typedef void (APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXARBPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPrimitiveBoundingBoxARB (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#endif
-#endif /* GL_ARB_ES3_2_compatibility */
-
-#ifndef GL_ARB_ES3_compatibility
-#define GL_ARB_ES3_compatibility 1
-#endif /* GL_ARB_ES3_compatibility */
-
-#ifndef GL_ARB_arrays_of_arrays
-#define GL_ARB_arrays_of_arrays 1
-#endif /* GL_ARB_arrays_of_arrays */
-
-#ifndef GL_ARB_base_instance
-#define GL_ARB_base_instance 1
-#endif /* GL_ARB_base_instance */
-
-#ifndef GL_ARB_bindless_texture
-#define GL_ARB_bindless_texture 1
-typedef uint64_t GLuint64EXT;
-#define GL_UNSIGNED_INT64_ARB 0x140F
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLEARBPROC) (GLuint texture);
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEARBPROC) (GLuint texture, GLuint sampler);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLEARBPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64ARBPROC) (GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64ARBPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTARBPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64ARBPROC) (GLuint index, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VARBPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VARBPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint64 APIENTRY glGetTextureHandleARB (GLuint texture);
-GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleARB (GLuint texture, GLuint sampler);
-GLAPI void APIENTRY glMakeTextureHandleResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glMakeTextureHandleNonResidentARB (GLuint64 handle);
-GLAPI GLuint64 APIENTRY glGetImageHandleARB (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-GLAPI void APIENTRY glMakeImageHandleResidentARB (GLuint64 handle, GLenum access);
-GLAPI void APIENTRY glMakeImageHandleNonResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glUniformHandleui64ARB (GLint location, GLuint64 value);
-GLAPI void APIENTRY glUniformHandleui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniformHandleui64ARB (GLuint program, GLint location, GLuint64 value);
-GLAPI void APIENTRY glProgramUniformHandleui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-GLAPI GLboolean APIENTRY glIsTextureHandleResidentARB (GLuint64 handle);
-GLAPI GLboolean APIENTRY glIsImageHandleResidentARB (GLuint64 handle);
-GLAPI void APIENTRY glVertexAttribL1ui64ARB (GLuint index, GLuint64EXT x);
-GLAPI void APIENTRY glVertexAttribL1ui64vARB (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glGetVertexAttribLui64vARB (GLuint index, GLenum pname, GLuint64EXT *params);
-#endif
-#endif /* GL_ARB_bindless_texture */
-
-#ifndef GL_ARB_blend_func_extended
-#define GL_ARB_blend_func_extended 1
-#endif /* GL_ARB_blend_func_extended */
-
-#ifndef GL_ARB_buffer_storage
-#define GL_ARB_buffer_storage 1
-#endif /* GL_ARB_buffer_storage */
-
-#ifndef GL_ARB_cl_event
-#define GL_ARB_cl_event 1
-struct _cl_context;
-struct _cl_event;
-#define GL_SYNC_CL_EVENT_ARB 0x8240
-#define GL_SYNC_CL_EVENT_COMPLETE_ARB 0x8241
-typedef GLsync (APIENTRYP PFNGLCREATESYNCFROMCLEVENTARBPROC) (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLsync APIENTRY glCreateSyncFromCLeventARB (struct _cl_context *context, struct _cl_event *event, GLbitfield flags);
-#endif
-#endif /* GL_ARB_cl_event */
-
-#ifndef GL_ARB_clear_buffer_object
-#define GL_ARB_clear_buffer_object 1
-#endif /* GL_ARB_clear_buffer_object */
-
-#ifndef GL_ARB_clear_texture
-#define GL_ARB_clear_texture 1
-#endif /* GL_ARB_clear_texture */
-
-#ifndef GL_ARB_clip_control
-#define GL_ARB_clip_control 1
-#endif /* GL_ARB_clip_control */
-
-#ifndef GL_ARB_color_buffer_float
-#define GL_ARB_color_buffer_float 1
-#define GL_RGBA_FLOAT_MODE_ARB 0x8820
-#define GL_CLAMP_VERTEX_COLOR_ARB 0x891A
-#define GL_CLAMP_FRAGMENT_COLOR_ARB 0x891B
-#define GL_CLAMP_READ_COLOR_ARB 0x891C
-#define GL_FIXED_ONLY_ARB 0x891D
-typedef void (APIENTRYP PFNGLCLAMPCOLORARBPROC) (GLenum target, GLenum clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClampColorARB (GLenum target, GLenum clamp);
-#endif
-#endif /* GL_ARB_color_buffer_float */
-
-#ifndef GL_ARB_compatibility
-#define GL_ARB_compatibility 1
-#endif /* GL_ARB_compatibility */
-
-#ifndef GL_ARB_compressed_texture_pixel_storage
-#define GL_ARB_compressed_texture_pixel_storage 1
-#endif /* GL_ARB_compressed_texture_pixel_storage */
-
-#ifndef GL_ARB_compute_shader
-#define GL_ARB_compute_shader 1
-#endif /* GL_ARB_compute_shader */
-
-#ifndef GL_ARB_compute_variable_group_size
-#define GL_ARB_compute_variable_group_size 1
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_INVOCATIONS_ARB 0x9344
-#define GL_MAX_COMPUTE_FIXED_GROUP_INVOCATIONS_ARB 0x90EB
-#define GL_MAX_COMPUTE_VARIABLE_GROUP_SIZE_ARB 0x9345
-#define GL_MAX_COMPUTE_FIXED_GROUP_SIZE_ARB 0x91BF
-typedef void (APIENTRYP PFNGLDISPATCHCOMPUTEGROUPSIZEARBPROC) (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDispatchComputeGroupSizeARB (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z, GLuint group_size_x, GLuint group_size_y, GLuint group_size_z);
-#endif
-#endif /* GL_ARB_compute_variable_group_size */
-
-#ifndef GL_ARB_conditional_render_inverted
-#define GL_ARB_conditional_render_inverted 1
-#endif /* GL_ARB_conditional_render_inverted */
-
-#ifndef GL_ARB_conservative_depth
-#define GL_ARB_conservative_depth 1
-#endif /* GL_ARB_conservative_depth */
-
-#ifndef GL_ARB_copy_buffer
-#define GL_ARB_copy_buffer 1
-#endif /* GL_ARB_copy_buffer */
-
-#ifndef GL_ARB_copy_image
-#define GL_ARB_copy_image 1
-#endif /* GL_ARB_copy_image */
-
-#ifndef GL_ARB_cull_distance
-#define GL_ARB_cull_distance 1
-#endif /* GL_ARB_cull_distance */
-
-#ifndef GL_ARB_debug_output
-#define GL_ARB_debug_output 1
-typedef void (APIENTRY *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_ARB 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_ARB 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_ARB 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_ARB 0x8245
-#define GL_DEBUG_SOURCE_API_ARB 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_ARB 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_ARB 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_ARB 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_ARB 0x824A
-#define GL_DEBUG_SOURCE_OTHER_ARB 0x824B
-#define GL_DEBUG_TYPE_ERROR_ARB 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_ARB 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_ARB 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_ARB 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_ARB 0x8250
-#define GL_DEBUG_TYPE_OTHER_ARB 0x8251
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_ARB 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_ARB 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_ARB 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_ARB 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_ARB 0x9147
-#define GL_DEBUG_SEVERITY_LOW_ARB 0x9148
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECONTROLARBPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTARBPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKARBPROC) (GLDEBUGPROCARB callback, const void *userParam);
-typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGARBPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDebugMessageControlARB (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GLAPI void APIENTRY glDebugMessageInsertARB (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GLAPI void APIENTRY glDebugMessageCallbackARB (GLDEBUGPROCARB callback, const void *userParam);
-GLAPI GLuint APIENTRY glGetDebugMessageLogARB (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-#endif
-#endif /* GL_ARB_debug_output */
-
-#ifndef GL_ARB_depth_buffer_float
-#define GL_ARB_depth_buffer_float 1
-#endif /* GL_ARB_depth_buffer_float */
-
-#ifndef GL_ARB_depth_clamp
-#define GL_ARB_depth_clamp 1
-#endif /* GL_ARB_depth_clamp */
-
-#ifndef GL_ARB_depth_texture
-#define GL_ARB_depth_texture 1
-#define GL_DEPTH_COMPONENT16_ARB 0x81A5
-#define GL_DEPTH_COMPONENT24_ARB 0x81A6
-#define GL_DEPTH_COMPONENT32_ARB 0x81A7
-#define GL_TEXTURE_DEPTH_SIZE_ARB 0x884A
-#define GL_DEPTH_TEXTURE_MODE_ARB 0x884B
-#endif /* GL_ARB_depth_texture */
-
-#ifndef GL_ARB_derivative_control
-#define GL_ARB_derivative_control 1
-#endif /* GL_ARB_derivative_control */
-
-#ifndef GL_ARB_direct_state_access
-#define GL_ARB_direct_state_access 1
-#endif /* GL_ARB_direct_state_access */
-
-#ifndef GL_ARB_draw_buffers
-#define GL_ARB_draw_buffers 1
-#define GL_MAX_DRAW_BUFFERS_ARB 0x8824
-#define GL_DRAW_BUFFER0_ARB 0x8825
-#define GL_DRAW_BUFFER1_ARB 0x8826
-#define GL_DRAW_BUFFER2_ARB 0x8827
-#define GL_DRAW_BUFFER3_ARB 0x8828
-#define GL_DRAW_BUFFER4_ARB 0x8829
-#define GL_DRAW_BUFFER5_ARB 0x882A
-#define GL_DRAW_BUFFER6_ARB 0x882B
-#define GL_DRAW_BUFFER7_ARB 0x882C
-#define GL_DRAW_BUFFER8_ARB 0x882D
-#define GL_DRAW_BUFFER9_ARB 0x882E
-#define GL_DRAW_BUFFER10_ARB 0x882F
-#define GL_DRAW_BUFFER11_ARB 0x8830
-#define GL_DRAW_BUFFER12_ARB 0x8831
-#define GL_DRAW_BUFFER13_ARB 0x8832
-#define GL_DRAW_BUFFER14_ARB 0x8833
-#define GL_DRAW_BUFFER15_ARB 0x8834
-typedef void (APIENTRYP PFNGLDRAWBUFFERSARBPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersARB (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_ARB_draw_buffers */
-
-#ifndef GL_ARB_draw_buffers_blend
-#define GL_ARB_draw_buffers_blend 1
-typedef void (APIENTRYP PFNGLBLENDEQUATIONIARBPROC) (GLuint buf, GLenum mode);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEIARBPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (APIENTRYP PFNGLBLENDFUNCIARBPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEIARBPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationiARB (GLuint buf, GLenum mode);
-GLAPI void APIENTRY glBlendEquationSeparateiARB (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GLAPI void APIENTRY glBlendFunciARB (GLuint buf, GLenum src, GLenum dst);
-GLAPI void APIENTRY glBlendFuncSeparateiARB (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-#endif /* GL_ARB_draw_buffers_blend */
-
-#ifndef GL_ARB_draw_elements_base_vertex
-#define GL_ARB_draw_elements_base_vertex 1
-#endif /* GL_ARB_draw_elements_base_vertex */
-
-#ifndef GL_ARB_draw_indirect
-#define GL_ARB_draw_indirect 1
-#endif /* GL_ARB_draw_indirect */
-
-#ifndef GL_ARB_draw_instanced
-#define GL_ARB_draw_instanced 1
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDARBPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDARBPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedARB (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GLAPI void APIENTRY glDrawElementsInstancedARB (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_ARB_draw_instanced */
-
-#ifndef GL_ARB_enhanced_layouts
-#define GL_ARB_enhanced_layouts 1
-#endif /* GL_ARB_enhanced_layouts */
-
-#ifndef GL_ARB_explicit_attrib_location
-#define GL_ARB_explicit_attrib_location 1
-#endif /* GL_ARB_explicit_attrib_location */
-
-#ifndef GL_ARB_explicit_uniform_location
-#define GL_ARB_explicit_uniform_location 1
-#endif /* GL_ARB_explicit_uniform_location */
-
-#ifndef GL_ARB_fragment_coord_conventions
-#define GL_ARB_fragment_coord_conventions 1
-#endif /* GL_ARB_fragment_coord_conventions */
-
-#ifndef GL_ARB_fragment_layer_viewport
-#define GL_ARB_fragment_layer_viewport 1
-#endif /* GL_ARB_fragment_layer_viewport */
-
-#ifndef GL_ARB_fragment_program
-#define GL_ARB_fragment_program 1
-#define GL_FRAGMENT_PROGRAM_ARB 0x8804
-#define GL_PROGRAM_FORMAT_ASCII_ARB 0x8875
-#define GL_PROGRAM_LENGTH_ARB 0x8627
-#define GL_PROGRAM_FORMAT_ARB 0x8876
-#define GL_PROGRAM_BINDING_ARB 0x8677
-#define GL_PROGRAM_INSTRUCTIONS_ARB 0x88A0
-#define GL_MAX_PROGRAM_INSTRUCTIONS_ARB 0x88A1
-#define GL_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A2
-#define GL_MAX_PROGRAM_NATIVE_INSTRUCTIONS_ARB 0x88A3
-#define GL_PROGRAM_TEMPORARIES_ARB 0x88A4
-#define GL_MAX_PROGRAM_TEMPORARIES_ARB 0x88A5
-#define GL_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A6
-#define GL_MAX_PROGRAM_NATIVE_TEMPORARIES_ARB 0x88A7
-#define GL_PROGRAM_PARAMETERS_ARB 0x88A8
-#define GL_MAX_PROGRAM_PARAMETERS_ARB 0x88A9
-#define GL_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AA
-#define GL_MAX_PROGRAM_NATIVE_PARAMETERS_ARB 0x88AB
-#define GL_PROGRAM_ATTRIBS_ARB 0x88AC
-#define GL_MAX_PROGRAM_ATTRIBS_ARB 0x88AD
-#define GL_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AE
-#define GL_MAX_PROGRAM_NATIVE_ATTRIBS_ARB 0x88AF
-#define GL_MAX_PROGRAM_LOCAL_PARAMETERS_ARB 0x88B4
-#define GL_MAX_PROGRAM_ENV_PARAMETERS_ARB 0x88B5
-#define GL_PROGRAM_UNDER_NATIVE_LIMITS_ARB 0x88B6
-#define GL_PROGRAM_ALU_INSTRUCTIONS_ARB 0x8805
-#define GL_PROGRAM_TEX_INSTRUCTIONS_ARB 0x8806
-#define GL_PROGRAM_TEX_INDIRECTIONS_ARB 0x8807
-#define GL_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x8808
-#define GL_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x8809
-#define GL_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x880A
-#define GL_MAX_PROGRAM_ALU_INSTRUCTIONS_ARB 0x880B
-#define GL_MAX_PROGRAM_TEX_INSTRUCTIONS_ARB 0x880C
-#define GL_MAX_PROGRAM_TEX_INDIRECTIONS_ARB 0x880D
-#define GL_MAX_PROGRAM_NATIVE_ALU_INSTRUCTIONS_ARB 0x880E
-#define GL_MAX_PROGRAM_NATIVE_TEX_INSTRUCTIONS_ARB 0x880F
-#define GL_MAX_PROGRAM_NATIVE_TEX_INDIRECTIONS_ARB 0x8810
-#define GL_PROGRAM_STRING_ARB 0x8628
-#define GL_PROGRAM_ERROR_POSITION_ARB 0x864B
-#define GL_CURRENT_MATRIX_ARB 0x8641
-#define GL_TRANSPOSE_CURRENT_MATRIX_ARB 0x88B7
-#define GL_CURRENT_MATRIX_STACK_DEPTH_ARB 0x8640
-#define GL_MAX_PROGRAM_MATRICES_ARB 0x862F
-#define GL_MAX_PROGRAM_MATRIX_STACK_DEPTH_ARB 0x862E
-#define GL_MAX_TEXTURE_COORDS_ARB 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_ARB 0x8872
-#define GL_PROGRAM_ERROR_STRING_ARB 0x8874
-#define GL_MATRIX0_ARB 0x88C0
-#define GL_MATRIX1_ARB 0x88C1
-#define GL_MATRIX2_ARB 0x88C2
-#define GL_MATRIX3_ARB 0x88C3
-#define GL_MATRIX4_ARB 0x88C4
-#define GL_MATRIX5_ARB 0x88C5
-#define GL_MATRIX6_ARB 0x88C6
-#define GL_MATRIX7_ARB 0x88C7
-#define GL_MATRIX8_ARB 0x88C8
-#define GL_MATRIX9_ARB 0x88C9
-#define GL_MATRIX10_ARB 0x88CA
-#define GL_MATRIX11_ARB 0x88CB
-#define GL_MATRIX12_ARB 0x88CC
-#define GL_MATRIX13_ARB 0x88CD
-#define GL_MATRIX14_ARB 0x88CE
-#define GL_MATRIX15_ARB 0x88CF
-#define GL_MATRIX16_ARB 0x88D0
-#define GL_MATRIX17_ARB 0x88D1
-#define GL_MATRIX18_ARB 0x88D2
-#define GL_MATRIX19_ARB 0x88D3
-#define GL_MATRIX20_ARB 0x88D4
-#define GL_MATRIX21_ARB 0x88D5
-#define GL_MATRIX22_ARB 0x88D6
-#define GL_MATRIX23_ARB 0x88D7
-#define GL_MATRIX24_ARB 0x88D8
-#define GL_MATRIX25_ARB 0x88D9
-#define GL_MATRIX26_ARB 0x88DA
-#define GL_MATRIX27_ARB 0x88DB
-#define GL_MATRIX28_ARB 0x88DC
-#define GL_MATRIX29_ARB 0x88DD
-#define GL_MATRIX30_ARB 0x88DE
-#define GL_MATRIX31_ARB 0x88DF
-typedef void (APIENTRYP PFNGLPROGRAMSTRINGARBPROC) (GLenum target, GLenum format, GLsizei len, const void *string);
-typedef void (APIENTRYP PFNGLBINDPROGRAMARBPROC) (GLenum target, GLuint program);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMSARBPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLGENPROGRAMSARBPROC) (GLsizei n, GLuint *programs);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DARBPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4DVARBPROC) (GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FARBPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETER4FVARBPROC) (GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERDVARBPROC) (GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERFVARBPROC) (GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGARBPROC) (GLenum target, GLenum pname, void *string);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramStringARB (GLenum target, GLenum format, GLsizei len, const void *string);
-GLAPI void APIENTRY glBindProgramARB (GLenum target, GLuint program);
-GLAPI void APIENTRY glDeleteProgramsARB (GLsizei n, const GLuint *programs);
-GLAPI void APIENTRY glGenProgramsARB (GLsizei n, GLuint *programs);
-GLAPI void APIENTRY glProgramEnvParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramEnvParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
-GLAPI void APIENTRY glProgramEnvParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glProgramEnvParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
-GLAPI void APIENTRY glProgramLocalParameter4dARB (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramLocalParameter4dvARB (GLenum target, GLuint index, const GLdouble *params);
-GLAPI void APIENTRY glProgramLocalParameter4fARB (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glProgramLocalParameter4fvARB (GLenum target, GLuint index, const GLfloat *params);
-GLAPI void APIENTRY glGetProgramEnvParameterdvARB (GLenum target, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetProgramEnvParameterfvARB (GLenum target, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetProgramLocalParameterdvARB (GLenum target, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetProgramLocalParameterfvARB (GLenum target, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetProgramivARB (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetProgramStringARB (GLenum target, GLenum pname, void *string);
-GLAPI GLboolean APIENTRY glIsProgramARB (GLuint program);
-#endif
-#endif /* GL_ARB_fragment_program */
-
-#ifndef GL_ARB_fragment_program_shadow
-#define GL_ARB_fragment_program_shadow 1
-#endif /* GL_ARB_fragment_program_shadow */
-
-#ifndef GL_ARB_fragment_shader
-#define GL_ARB_fragment_shader 1
-#define GL_FRAGMENT_SHADER_ARB 0x8B30
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS_ARB 0x8B49
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_ARB 0x8B8B
-#endif /* GL_ARB_fragment_shader */
-
-#ifndef GL_ARB_fragment_shader_interlock
-#define GL_ARB_fragment_shader_interlock 1
-#endif /* GL_ARB_fragment_shader_interlock */
-
-#ifndef GL_ARB_framebuffer_no_attachments
-#define GL_ARB_framebuffer_no_attachments 1
-#endif /* GL_ARB_framebuffer_no_attachments */
-
-#ifndef GL_ARB_framebuffer_object
-#define GL_ARB_framebuffer_object 1
-#endif /* GL_ARB_framebuffer_object */
-
-#ifndef GL_ARB_framebuffer_sRGB
-#define GL_ARB_framebuffer_sRGB 1
-#endif /* GL_ARB_framebuffer_sRGB */
-
-#ifndef GL_ARB_geometry_shader4
-#define GL_ARB_geometry_shader4 1
-#define GL_LINES_ADJACENCY_ARB 0x000A
-#define GL_LINE_STRIP_ADJACENCY_ARB 0x000B
-#define GL_TRIANGLES_ADJACENCY_ARB 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_ARB 0x000D
-#define GL_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_ARB 0x8C29
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_ARB 0x8DA7
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_ARB 0x8DA8
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_ARB 0x8DA9
-#define GL_GEOMETRY_SHADER_ARB 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT_ARB 0x8DDA
-#define GL_GEOMETRY_INPUT_TYPE_ARB 0x8DDB
-#define GL_GEOMETRY_OUTPUT_TYPE_ARB 0x8DDC
-#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_ARB 0x8DDD
-#define GL_MAX_VERTEX_VARYING_COMPONENTS_ARB 0x8DDE
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_ARB 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_ARB 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_ARB 0x8DE1
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIARBPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEARBPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramParameteriARB (GLuint program, GLenum pname, GLint value);
-GLAPI void APIENTRY glFramebufferTextureARB (GLenum target, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTextureLayerARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glFramebufferTextureFaceARB (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#endif
-#endif /* GL_ARB_geometry_shader4 */
-
-#ifndef GL_ARB_get_program_binary
-#define GL_ARB_get_program_binary 1
-#endif /* GL_ARB_get_program_binary */
-
-#ifndef GL_ARB_get_texture_sub_image
-#define GL_ARB_get_texture_sub_image 1
-#endif /* GL_ARB_get_texture_sub_image */
-
-#ifndef GL_ARB_gl_spirv
-#define GL_ARB_gl_spirv 1
-#define GL_SHADER_BINARY_FORMAT_SPIR_V_ARB 0x9551
-#define GL_SPIR_V_BINARY_ARB 0x9552
-typedef void (APIENTRYP PFNGLSPECIALIZESHADERARBPROC) (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpecializeShaderARB (GLuint shader, const GLchar *pEntryPoint, GLuint numSpecializationConstants, const GLuint *pConstantIndex, const GLuint *pConstantValue);
-#endif
-#endif /* GL_ARB_gl_spirv */
-
-#ifndef GL_ARB_gpu_shader5
-#define GL_ARB_gpu_shader5 1
-#endif /* GL_ARB_gpu_shader5 */
-
-#ifndef GL_ARB_gpu_shader_fp64
-#define GL_ARB_gpu_shader_fp64 1
-#endif /* GL_ARB_gpu_shader_fp64 */
-
-#ifndef GL_ARB_gpu_shader_int64
-#define GL_ARB_gpu_shader_int64 1
-#define GL_INT64_ARB 0x140E
-#define GL_INT64_VEC2_ARB 0x8FE9
-#define GL_INT64_VEC3_ARB 0x8FEA
-#define GL_INT64_VEC4_ARB 0x8FEB
-#define GL_UNSIGNED_INT64_VEC2_ARB 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_ARB 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_ARB 0x8FF7
-typedef void (APIENTRYP PFNGLUNIFORM1I64ARBPROC) (GLint location, GLint64 x);
-typedef void (APIENTRYP PFNGLUNIFORM2I64ARBPROC) (GLint location, GLint64 x, GLint64 y);
-typedef void (APIENTRYP PFNGLUNIFORM3I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z);
-typedef void (APIENTRYP PFNGLUNIFORM4I64ARBPROC) (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-typedef void (APIENTRYP PFNGLUNIFORM1I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM2I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM3I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM4I64VARBPROC) (GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64ARBPROC) (GLint location, GLuint64 x);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64ARBPROC) (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64VARBPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMI64VARBPROC) (GLuint program, GLint location, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLuint64 *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUI64VARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64ARBPROC) (GLuint program, GLint location, GLint64 x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64ARBPROC) (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64ARBPROC) (GLuint program, GLint location, GLuint64 x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64ARBPROC) (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VARBPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniform1i64ARB (GLint location, GLint64 x);
-GLAPI void APIENTRY glUniform2i64ARB (GLint location, GLint64 x, GLint64 y);
-GLAPI void APIENTRY glUniform3i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z);
-GLAPI void APIENTRY glUniform4i64ARB (GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-GLAPI void APIENTRY glUniform1i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform2i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform3i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform4i64vARB (GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glUniform1ui64ARB (GLint location, GLuint64 x);
-GLAPI void APIENTRY glUniform2ui64ARB (GLint location, GLuint64 x, GLuint64 y);
-GLAPI void APIENTRY glUniform3ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-GLAPI void APIENTRY glUniform4ui64ARB (GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-GLAPI void APIENTRY glUniform1ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform2ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform3ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glUniform4ui64vARB (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glGetUniformi64vARB (GLuint program, GLint location, GLint64 *params);
-GLAPI void APIENTRY glGetUniformui64vARB (GLuint program, GLint location, GLuint64 *params);
-GLAPI void APIENTRY glGetnUniformi64vARB (GLuint program, GLint location, GLsizei bufSize, GLint64 *params);
-GLAPI void APIENTRY glGetnUniformui64vARB (GLuint program, GLint location, GLsizei bufSize, GLuint64 *params);
-GLAPI void APIENTRY glProgramUniform1i64ARB (GLuint program, GLint location, GLint64 x);
-GLAPI void APIENTRY glProgramUniform2i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y);
-GLAPI void APIENTRY glProgramUniform3i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z);
-GLAPI void APIENTRY glProgramUniform4i64ARB (GLuint program, GLint location, GLint64 x, GLint64 y, GLint64 z, GLint64 w);
-GLAPI void APIENTRY glProgramUniform1i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform2i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform3i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform4i64vARB (GLuint program, GLint location, GLsizei count, const GLint64 *value);
-GLAPI void APIENTRY glProgramUniform1ui64ARB (GLuint program, GLint location, GLuint64 x);
-GLAPI void APIENTRY glProgramUniform2ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y);
-GLAPI void APIENTRY glProgramUniform3ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z);
-GLAPI void APIENTRY glProgramUniform4ui64ARB (GLuint program, GLint location, GLuint64 x, GLuint64 y, GLuint64 z, GLuint64 w);
-GLAPI void APIENTRY glProgramUniform1ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform2ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform3ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniform4ui64vARB (GLuint program, GLint location, GLsizei count, const GLuint64 *value);
-#endif
-#endif /* GL_ARB_gpu_shader_int64 */
-
-#ifndef GL_ARB_half_float_pixel
-#define GL_ARB_half_float_pixel 1
-typedef unsigned short GLhalfARB;
-#define GL_HALF_FLOAT_ARB 0x140B
-#endif /* GL_ARB_half_float_pixel */
-
-#ifndef GL_ARB_half_float_vertex
-#define GL_ARB_half_float_vertex 1
-#endif /* GL_ARB_half_float_vertex */
-
-#ifndef GL_ARB_imaging
-#define GL_ARB_imaging 1
-#define GL_CONVOLUTION_1D 0x8010
-#define GL_CONVOLUTION_2D 0x8011
-#define GL_SEPARABLE_2D 0x8012
-#define GL_CONVOLUTION_BORDER_MODE 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS 0x8015
-#define GL_REDUCE 0x8016
-#define GL_CONVOLUTION_FORMAT 0x8017
-#define GL_CONVOLUTION_WIDTH 0x8018
-#define GL_CONVOLUTION_HEIGHT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS 0x8023
-#define GL_HISTOGRAM 0x8024
-#define GL_PROXY_HISTOGRAM 0x8025
-#define GL_HISTOGRAM_WIDTH 0x8026
-#define GL_HISTOGRAM_FORMAT 0x8027
-#define GL_HISTOGRAM_RED_SIZE 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE 0x802C
-#define GL_HISTOGRAM_SINK 0x802D
-#define GL_MINMAX 0x802E
-#define GL_MINMAX_FORMAT 0x802F
-#define GL_MINMAX_SINK 0x8030
-#define GL_TABLE_TOO_LARGE 0x8031
-#define GL_COLOR_MATRIX 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS 0x80BB
-#define GL_COLOR_TABLE 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE 0x80D2
-#define GL_PROXY_COLOR_TABLE 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE 0x80D5
-#define GL_COLOR_TABLE_SCALE 0x80D6
-#define GL_COLOR_TABLE_BIAS 0x80D7
-#define GL_COLOR_TABLE_FORMAT 0x80D8
-#define GL_COLOR_TABLE_WIDTH 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE 0x80DF
-#define GL_CONSTANT_BORDER 0x8151
-#define GL_REPLICATE_BORDER 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR 0x8154
-typedef void (APIENTRYP PFNGLCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCOLORTABLEPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPROC) (GLenum target, GLenum format, GLenum type, void *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIPROC) (GLenum target, GLenum pname, GLint params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTERPROC) (GLenum target, GLenum format, GLenum type, void *image);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSEPARABLEFILTERPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLHISTOGRAMPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLMINMAXPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLRESETHISTOGRAMPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLRESETMINMAXPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTable (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-GLAPI void APIENTRY glColorTableParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glColorTableParameteriv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glCopyColorTable (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glGetColorTable (GLenum target, GLenum format, GLenum type, void *table);
-GLAPI void APIENTRY glGetColorTableParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetColorTableParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glColorSubTable (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glCopyColorSubTable (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glConvolutionFilter1D (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-GLAPI void APIENTRY glConvolutionFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-GLAPI void APIENTRY glConvolutionParameterf (GLenum target, GLenum pname, GLfloat params);
-GLAPI void APIENTRY glConvolutionParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glConvolutionParameteri (GLenum target, GLenum pname, GLint params);
-GLAPI void APIENTRY glConvolutionParameteriv (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glCopyConvolutionFilter1D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyConvolutionFilter2D (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetConvolutionFilter (GLenum target, GLenum format, GLenum type, void *image);
-GLAPI void APIENTRY glGetConvolutionParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetConvolutionParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSeparableFilter (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-GLAPI void APIENTRY glSeparableFilter2D (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-GLAPI void APIENTRY glGetHistogram (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-GLAPI void APIENTRY glGetHistogramParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetHistogramParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMinmax (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-GLAPI void APIENTRY glGetMinmaxParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMinmaxParameteriv (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glHistogram (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-GLAPI void APIENTRY glMinmax (GLenum target, GLenum internalformat, GLboolean sink);
-GLAPI void APIENTRY glResetHistogram (GLenum target);
-GLAPI void APIENTRY glResetMinmax (GLenum target);
-#endif
-#endif /* GL_ARB_imaging */
-
-#ifndef GL_ARB_indirect_parameters
-#define GL_ARB_indirect_parameters 1
-#define GL_PARAMETER_BUFFER_ARB 0x80EE
-#define GL_PARAMETER_BUFFER_BINDING_ARB 0x80EF
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTCOUNTARBPROC) (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTARBPROC) (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectCountARB (GLenum mode, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirectCountARB (GLenum mode, GLenum type, const void *indirect, GLintptr drawcount, GLsizei maxdrawcount, GLsizei stride);
-#endif
-#endif /* GL_ARB_indirect_parameters */
-
-#ifndef GL_ARB_instanced_arrays
-#define GL_ARB_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ARB 0x88FE
-typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORARBPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribDivisorARB (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_ARB_instanced_arrays */
-
-#ifndef GL_ARB_internalformat_query
-#define GL_ARB_internalformat_query 1
-#endif /* GL_ARB_internalformat_query */
-
-#ifndef GL_ARB_internalformat_query2
-#define GL_ARB_internalformat_query2 1
-#define GL_SRGB_DECODE_ARB 0x8299
-#endif /* GL_ARB_internalformat_query2 */
-
-#ifndef GL_ARB_invalidate_subdata
-#define GL_ARB_invalidate_subdata 1
-#endif /* GL_ARB_invalidate_subdata */
-
-#ifndef GL_ARB_map_buffer_alignment
-#define GL_ARB_map_buffer_alignment 1
-#endif /* GL_ARB_map_buffer_alignment */
-
-#ifndef GL_ARB_map_buffer_range
-#define GL_ARB_map_buffer_range 1
-#endif /* GL_ARB_map_buffer_range */
-
-#ifndef GL_ARB_matrix_palette
-#define GL_ARB_matrix_palette 1
-#define GL_MATRIX_PALETTE_ARB 0x8840
-#define GL_MAX_MATRIX_PALETTE_STACK_DEPTH_ARB 0x8841
-#define GL_MAX_PALETTE_MATRICES_ARB 0x8842
-#define GL_CURRENT_PALETTE_MATRIX_ARB 0x8843
-#define GL_MATRIX_INDEX_ARRAY_ARB 0x8844
-#define GL_CURRENT_MATRIX_INDEX_ARB 0x8845
-#define GL_MATRIX_INDEX_ARRAY_SIZE_ARB 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_ARB 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_ARB 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_ARB 0x8849
-typedef void (APIENTRYP PFNGLCURRENTPALETTEMATRIXARBPROC) (GLint index);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUBVARBPROC) (GLint size, const GLubyte *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUSVARBPROC) (GLint size, const GLushort *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXUIVARBPROC) (GLint size, const GLuint *indices);
-typedef void (APIENTRYP PFNGLMATRIXINDEXPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCurrentPaletteMatrixARB (GLint index);
-GLAPI void APIENTRY glMatrixIndexubvARB (GLint size, const GLubyte *indices);
-GLAPI void APIENTRY glMatrixIndexusvARB (GLint size, const GLushort *indices);
-GLAPI void APIENTRY glMatrixIndexuivARB (GLint size, const GLuint *indices);
-GLAPI void APIENTRY glMatrixIndexPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_ARB_matrix_palette */
-
-#ifndef GL_ARB_multi_bind
-#define GL_ARB_multi_bind 1
-#endif /* GL_ARB_multi_bind */
-
-#ifndef GL_ARB_multi_draw_indirect
-#define GL_ARB_multi_draw_indirect 1
-#endif /* GL_ARB_multi_draw_indirect */
-
-#ifndef GL_ARB_multisample
-#define GL_ARB_multisample 1
-#define GL_MULTISAMPLE_ARB 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE_ARB 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_ARB 0x809F
-#define GL_SAMPLE_COVERAGE_ARB 0x80A0
-#define GL_SAMPLE_BUFFERS_ARB 0x80A8
-#define GL_SAMPLES_ARB 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE_ARB 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT_ARB 0x80AB
-#define GL_MULTISAMPLE_BIT_ARB 0x20000000
-typedef void (APIENTRYP PFNGLSAMPLECOVERAGEARBPROC) (GLfloat value, GLboolean invert);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleCoverageARB (GLfloat value, GLboolean invert);
-#endif
-#endif /* GL_ARB_multisample */
-
-#ifndef GL_ARB_multitexture
-#define GL_ARB_multitexture 1
-#define GL_TEXTURE0_ARB 0x84C0
-#define GL_TEXTURE1_ARB 0x84C1
-#define GL_TEXTURE2_ARB 0x84C2
-#define GL_TEXTURE3_ARB 0x84C3
-#define GL_TEXTURE4_ARB 0x84C4
-#define GL_TEXTURE5_ARB 0x84C5
-#define GL_TEXTURE6_ARB 0x84C6
-#define GL_TEXTURE7_ARB 0x84C7
-#define GL_TEXTURE8_ARB 0x84C8
-#define GL_TEXTURE9_ARB 0x84C9
-#define GL_TEXTURE10_ARB 0x84CA
-#define GL_TEXTURE11_ARB 0x84CB
-#define GL_TEXTURE12_ARB 0x84CC
-#define GL_TEXTURE13_ARB 0x84CD
-#define GL_TEXTURE14_ARB 0x84CE
-#define GL_TEXTURE15_ARB 0x84CF
-#define GL_TEXTURE16_ARB 0x84D0
-#define GL_TEXTURE17_ARB 0x84D1
-#define GL_TEXTURE18_ARB 0x84D2
-#define GL_TEXTURE19_ARB 0x84D3
-#define GL_TEXTURE20_ARB 0x84D4
-#define GL_TEXTURE21_ARB 0x84D5
-#define GL_TEXTURE22_ARB 0x84D6
-#define GL_TEXTURE23_ARB 0x84D7
-#define GL_TEXTURE24_ARB 0x84D8
-#define GL_TEXTURE25_ARB 0x84D9
-#define GL_TEXTURE26_ARB 0x84DA
-#define GL_TEXTURE27_ARB 0x84DB
-#define GL_TEXTURE28_ARB 0x84DC
-#define GL_TEXTURE29_ARB 0x84DD
-#define GL_TEXTURE30_ARB 0x84DE
-#define GL_TEXTURE31_ARB 0x84DF
-#define GL_ACTIVE_TEXTURE_ARB 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
-#define GL_MAX_TEXTURE_UNITS_ARB 0x84E2
-typedef void (APIENTRYP PFNGLACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLCLIENTACTIVETEXTUREARBPROC) (GLenum texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DARBPROC) (GLenum target, GLdouble s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FARBPROC) (GLenum target, GLfloat s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IARBPROC) (GLenum target, GLint s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SARBPROC) (GLenum target, GLshort s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DARBPROC) (GLenum target, GLdouble s, GLdouble t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FARBPROC) (GLenum target, GLfloat s, GLfloat t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IARBPROC) (GLenum target, GLint s, GLint t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SARBPROC) (GLenum target, GLshort s, GLshort t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IARBPROC) (GLenum target, GLint s, GLint t, GLint r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3SVARBPROC) (GLenum target, const GLshort *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DARBPROC) (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4DVARBPROC) (GLenum target, const GLdouble *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FARBPROC) (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4FVARBPROC) (GLenum target, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IARBPROC) (GLenum target, GLint s, GLint t, GLint r, GLint q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4IVARBPROC) (GLenum target, const GLint *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SARBPROC) (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4SVARBPROC) (GLenum target, const GLshort *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveTextureARB (GLenum texture);
-GLAPI void APIENTRY glClientActiveTextureARB (GLenum texture);
-GLAPI void APIENTRY glMultiTexCoord1dARB (GLenum target, GLdouble s);
-GLAPI void APIENTRY glMultiTexCoord1dvARB (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord1fARB (GLenum target, GLfloat s);
-GLAPI void APIENTRY glMultiTexCoord1fvARB (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord1iARB (GLenum target, GLint s);
-GLAPI void APIENTRY glMultiTexCoord1ivARB (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord1sARB (GLenum target, GLshort s);
-GLAPI void APIENTRY glMultiTexCoord1svARB (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord2dARB (GLenum target, GLdouble s, GLdouble t);
-GLAPI void APIENTRY glMultiTexCoord2dvARB (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord2fARB (GLenum target, GLfloat s, GLfloat t);
-GLAPI void APIENTRY glMultiTexCoord2fvARB (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord2iARB (GLenum target, GLint s, GLint t);
-GLAPI void APIENTRY glMultiTexCoord2ivARB (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord2sARB (GLenum target, GLshort s, GLshort t);
-GLAPI void APIENTRY glMultiTexCoord2svARB (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord3dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r);
-GLAPI void APIENTRY glMultiTexCoord3dvARB (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord3fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r);
-GLAPI void APIENTRY glMultiTexCoord3fvARB (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord3iARB (GLenum target, GLint s, GLint t, GLint r);
-GLAPI void APIENTRY glMultiTexCoord3ivARB (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord3sARB (GLenum target, GLshort s, GLshort t, GLshort r);
-GLAPI void APIENTRY glMultiTexCoord3svARB (GLenum target, const GLshort *v);
-GLAPI void APIENTRY glMultiTexCoord4dARB (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q);
-GLAPI void APIENTRY glMultiTexCoord4dvARB (GLenum target, const GLdouble *v);
-GLAPI void APIENTRY glMultiTexCoord4fARB (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GLAPI void APIENTRY glMultiTexCoord4fvARB (GLenum target, const GLfloat *v);
-GLAPI void APIENTRY glMultiTexCoord4iARB (GLenum target, GLint s, GLint t, GLint r, GLint q);
-GLAPI void APIENTRY glMultiTexCoord4ivARB (GLenum target, const GLint *v);
-GLAPI void APIENTRY glMultiTexCoord4sARB (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q);
-GLAPI void APIENTRY glMultiTexCoord4svARB (GLenum target, const GLshort *v);
-#endif
-#endif /* GL_ARB_multitexture */
-
-#ifndef GL_ARB_occlusion_query
-#define GL_ARB_occlusion_query 1
-#define GL_QUERY_COUNTER_BITS_ARB 0x8864
-#define GL_CURRENT_QUERY_ARB 0x8865
-#define GL_QUERY_RESULT_ARB 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_ARB 0x8867
-#define GL_SAMPLES_PASSED_ARB 0x8914
-typedef void (APIENTRYP PFNGLGENQUERIESARBPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEQUERIESARBPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISQUERYARBPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINQUERYARBPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLENDQUERYARBPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETQUERYIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTIVARBPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUIVARBPROC) (GLuint id, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueriesARB (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glDeleteQueriesARB (GLsizei n, const GLuint *ids);
-GLAPI GLboolean APIENTRY glIsQueryARB (GLuint id);
-GLAPI void APIENTRY glBeginQueryARB (GLenum target, GLuint id);
-GLAPI void APIENTRY glEndQueryARB (GLenum target);
-GLAPI void APIENTRY glGetQueryivARB (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectivARB (GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetQueryObjectuivARB (GLuint id, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_ARB_occlusion_query */
-
-#ifndef GL_ARB_occlusion_query2
-#define GL_ARB_occlusion_query2 1
-#endif /* GL_ARB_occlusion_query2 */
-
-#ifndef GL_ARB_parallel_shader_compile
-#define GL_ARB_parallel_shader_compile 1
-#define GL_MAX_SHADER_COMPILER_THREADS_ARB 0x91B0
-#define GL_COMPLETION_STATUS_ARB 0x91B1
-typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSARBPROC) (GLuint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMaxShaderCompilerThreadsARB (GLuint count);
-#endif
-#endif /* GL_ARB_parallel_shader_compile */
-
-#ifndef GL_ARB_pipeline_statistics_query
-#define GL_ARB_pipeline_statistics_query 1
-#define GL_VERTICES_SUBMITTED_ARB 0x82EE
-#define GL_PRIMITIVES_SUBMITTED_ARB 0x82EF
-#define GL_VERTEX_SHADER_INVOCATIONS_ARB 0x82F0
-#define GL_TESS_CONTROL_SHADER_PATCHES_ARB 0x82F1
-#define GL_TESS_EVALUATION_SHADER_INVOCATIONS_ARB 0x82F2
-#define GL_GEOMETRY_SHADER_PRIMITIVES_EMITTED_ARB 0x82F3
-#define GL_FRAGMENT_SHADER_INVOCATIONS_ARB 0x82F4
-#define GL_COMPUTE_SHADER_INVOCATIONS_ARB 0x82F5
-#define GL_CLIPPING_INPUT_PRIMITIVES_ARB 0x82F6
-#define GL_CLIPPING_OUTPUT_PRIMITIVES_ARB 0x82F7
-#endif /* GL_ARB_pipeline_statistics_query */
-
-#ifndef GL_ARB_pixel_buffer_object
-#define GL_ARB_pixel_buffer_object 1
-#define GL_PIXEL_PACK_BUFFER_ARB 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_ARB 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_ARB 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_ARB 0x88EF
-#endif /* GL_ARB_pixel_buffer_object */
-
-#ifndef GL_ARB_point_parameters
-#define GL_ARB_point_parameters 1
-#define GL_POINT_SIZE_MIN_ARB 0x8126
-#define GL_POINT_SIZE_MAX_ARB 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_ARB 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION_ARB 0x8129
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFARBPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVARBPROC) (GLenum pname, const GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfARB (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPointParameterfvARB (GLenum pname, const GLfloat *params);
-#endif
-#endif /* GL_ARB_point_parameters */
-
-#ifndef GL_ARB_point_sprite
-#define GL_ARB_point_sprite 1
-#define GL_POINT_SPRITE_ARB 0x8861
-#define GL_COORD_REPLACE_ARB 0x8862
-#endif /* GL_ARB_point_sprite */
-
-#ifndef GL_ARB_polygon_offset_clamp
-#define GL_ARB_polygon_offset_clamp 1
-#endif /* GL_ARB_polygon_offset_clamp */
-
-#ifndef GL_ARB_post_depth_coverage
-#define GL_ARB_post_depth_coverage 1
-#endif /* GL_ARB_post_depth_coverage */
-
-#ifndef GL_ARB_program_interface_query
-#define GL_ARB_program_interface_query 1
-#endif /* GL_ARB_program_interface_query */
-
-#ifndef GL_ARB_provoking_vertex
-#define GL_ARB_provoking_vertex 1
-#endif /* GL_ARB_provoking_vertex */
-
-#ifndef GL_ARB_query_buffer_object
-#define GL_ARB_query_buffer_object 1
-#endif /* GL_ARB_query_buffer_object */
-
-#ifndef GL_ARB_robust_buffer_access_behavior
-#define GL_ARB_robust_buffer_access_behavior 1
-#endif /* GL_ARB_robust_buffer_access_behavior */
-
-#ifndef GL_ARB_robustness
-#define GL_ARB_robustness 1
-#define GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GL_GUILTY_CONTEXT_RESET_ARB 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_ARB 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_ARB 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GL_NO_RESET_NOTIFICATION_ARB 0x8261
-typedef GLenum (APIENTRYP PFNGLGETGRAPHICSRESETSTATUSARBPROC) (void);
-typedef void (APIENTRYP PFNGLGETNTEXIMAGEARBPROC) (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
-typedef void (APIENTRYP PFNGLREADNPIXELSARBPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (APIENTRYP PFNGLGETNCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint lod, GLsizei bufSize, void *img);
-typedef void (APIENTRYP PFNGLGETNUNIFORMFVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMUIVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-typedef void (APIENTRYP PFNGLGETNUNIFORMDVARBPROC) (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETNMAPDVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
-typedef void (APIENTRYP PFNGLGETNMAPFVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
-typedef void (APIENTRYP PFNGLGETNMAPIVARBPROC) (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPFVARBPROC) (GLenum map, GLsizei bufSize, GLfloat *values);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPUIVARBPROC) (GLenum map, GLsizei bufSize, GLuint *values);
-typedef void (APIENTRYP PFNGLGETNPIXELMAPUSVARBPROC) (GLenum map, GLsizei bufSize, GLushort *values);
-typedef void (APIENTRYP PFNGLGETNPOLYGONSTIPPLEARBPROC) (GLsizei bufSize, GLubyte *pattern);
-typedef void (APIENTRYP PFNGLGETNCOLORTABLEARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
-typedef void (APIENTRYP PFNGLGETNCONVOLUTIONFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
-typedef void (APIENTRYP PFNGLGETNSEPARABLEFILTERARBPROC) (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
-typedef void (APIENTRYP PFNGLGETNHISTOGRAMARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-typedef void (APIENTRYP PFNGLGETNMINMAXARBPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLenum APIENTRY glGetGraphicsResetStatusARB (void);
-GLAPI void APIENTRY glGetnTexImageARB (GLenum target, GLint level, GLenum format, GLenum type, GLsizei bufSize, void *img);
-GLAPI void APIENTRY glReadnPixelsARB (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GLAPI void APIENTRY glGetnCompressedTexImageARB (GLenum target, GLint lod, GLsizei bufSize, void *img);
-GLAPI void APIENTRY glGetnUniformfvARB (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GLAPI void APIENTRY glGetnUniformivARB (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-GLAPI void APIENTRY glGetnUniformuivARB (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-GLAPI void APIENTRY glGetnUniformdvARB (GLuint program, GLint location, GLsizei bufSize, GLdouble *params);
-GLAPI void APIENTRY glGetnMapdvARB (GLenum target, GLenum query, GLsizei bufSize, GLdouble *v);
-GLAPI void APIENTRY glGetnMapfvARB (GLenum target, GLenum query, GLsizei bufSize, GLfloat *v);
-GLAPI void APIENTRY glGetnMapivARB (GLenum target, GLenum query, GLsizei bufSize, GLint *v);
-GLAPI void APIENTRY glGetnPixelMapfvARB (GLenum map, GLsizei bufSize, GLfloat *values);
-GLAPI void APIENTRY glGetnPixelMapuivARB (GLenum map, GLsizei bufSize, GLuint *values);
-GLAPI void APIENTRY glGetnPixelMapusvARB (GLenum map, GLsizei bufSize, GLushort *values);
-GLAPI void APIENTRY glGetnPolygonStippleARB (GLsizei bufSize, GLubyte *pattern);
-GLAPI void APIENTRY glGetnColorTableARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *table);
-GLAPI void APIENTRY glGetnConvolutionFilterARB (GLenum target, GLenum format, GLenum type, GLsizei bufSize, void *image);
-GLAPI void APIENTRY glGetnSeparableFilterARB (GLenum target, GLenum format, GLenum type, GLsizei rowBufSize, void *row, GLsizei columnBufSize, void *column, void *span);
-GLAPI void APIENTRY glGetnHistogramARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-GLAPI void APIENTRY glGetnMinmaxARB (GLenum target, GLboolean reset, GLenum format, GLenum type, GLsizei bufSize, void *values);
-#endif
-#endif /* GL_ARB_robustness */
-
-#ifndef GL_ARB_robustness_isolation
-#define GL_ARB_robustness_isolation 1
-#endif /* GL_ARB_robustness_isolation */
-
-#ifndef GL_ARB_sample_locations
-#define GL_ARB_sample_locations 1
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_ARB 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_ARB 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_ARB 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_ARB 0x9340
-#define GL_SAMPLE_LOCATION_ARB 0x8E50
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_ARB 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_ARB 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_ARB 0x9343
-typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVARBPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLEVALUATEDEPTHVALUESARBPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferSampleLocationsfvARB (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvARB (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glEvaluateDepthValuesARB (void);
-#endif
-#endif /* GL_ARB_sample_locations */
-
-#ifndef GL_ARB_sample_shading
-#define GL_ARB_sample_shading 1
-#define GL_SAMPLE_SHADING_ARB 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE_ARB 0x8C37
-typedef void (APIENTRYP PFNGLMINSAMPLESHADINGARBPROC) (GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMinSampleShadingARB (GLfloat value);
-#endif
-#endif /* GL_ARB_sample_shading */
-
-#ifndef GL_ARB_sampler_objects
-#define GL_ARB_sampler_objects 1
-#endif /* GL_ARB_sampler_objects */
-
-#ifndef GL_ARB_seamless_cube_map
-#define GL_ARB_seamless_cube_map 1
-#endif /* GL_ARB_seamless_cube_map */
-
-#ifndef GL_ARB_seamless_cubemap_per_texture
-#define GL_ARB_seamless_cubemap_per_texture 1
-#endif /* GL_ARB_seamless_cubemap_per_texture */
-
-#ifndef GL_ARB_separate_shader_objects
-#define GL_ARB_separate_shader_objects 1
-#endif /* GL_ARB_separate_shader_objects */
-
-#ifndef GL_ARB_shader_atomic_counter_ops
-#define GL_ARB_shader_atomic_counter_ops 1
-#endif /* GL_ARB_shader_atomic_counter_ops */
-
-#ifndef GL_ARB_shader_atomic_counters
-#define GL_ARB_shader_atomic_counters 1
-#endif /* GL_ARB_shader_atomic_counters */
-
-#ifndef GL_ARB_shader_ballot
-#define GL_ARB_shader_ballot 1
-#endif /* GL_ARB_shader_ballot */
-
-#ifndef GL_ARB_shader_bit_encoding
-#define GL_ARB_shader_bit_encoding 1
-#endif /* GL_ARB_shader_bit_encoding */
-
-#ifndef GL_ARB_shader_clock
-#define GL_ARB_shader_clock 1
-#endif /* GL_ARB_shader_clock */
-
-#ifndef GL_ARB_shader_draw_parameters
-#define GL_ARB_shader_draw_parameters 1
-#endif /* GL_ARB_shader_draw_parameters */
-
-#ifndef GL_ARB_shader_group_vote
-#define GL_ARB_shader_group_vote 1
-#endif /* GL_ARB_shader_group_vote */
-
-#ifndef GL_ARB_shader_image_load_store
-#define GL_ARB_shader_image_load_store 1
-#endif /* GL_ARB_shader_image_load_store */
-
-#ifndef GL_ARB_shader_image_size
-#define GL_ARB_shader_image_size 1
-#endif /* GL_ARB_shader_image_size */
-
-#ifndef GL_ARB_shader_objects
-#define GL_ARB_shader_objects 1
-#ifdef __APPLE__
-typedef void *GLhandleARB;
-#else
-typedef unsigned int GLhandleARB;
-#endif
-typedef char GLcharARB;
-#define GL_PROGRAM_OBJECT_ARB 0x8B40
-#define GL_SHADER_OBJECT_ARB 0x8B48
-#define GL_OBJECT_TYPE_ARB 0x8B4E
-#define GL_OBJECT_SUBTYPE_ARB 0x8B4F
-#define GL_FLOAT_VEC2_ARB 0x8B50
-#define GL_FLOAT_VEC3_ARB 0x8B51
-#define GL_FLOAT_VEC4_ARB 0x8B52
-#define GL_INT_VEC2_ARB 0x8B53
-#define GL_INT_VEC3_ARB 0x8B54
-#define GL_INT_VEC4_ARB 0x8B55
-#define GL_BOOL_ARB 0x8B56
-#define GL_BOOL_VEC2_ARB 0x8B57
-#define GL_BOOL_VEC3_ARB 0x8B58
-#define GL_BOOL_VEC4_ARB 0x8B59
-#define GL_FLOAT_MAT2_ARB 0x8B5A
-#define GL_FLOAT_MAT3_ARB 0x8B5B
-#define GL_FLOAT_MAT4_ARB 0x8B5C
-#define GL_SAMPLER_1D_ARB 0x8B5D
-#define GL_SAMPLER_2D_ARB 0x8B5E
-#define GL_SAMPLER_3D_ARB 0x8B5F
-#define GL_SAMPLER_CUBE_ARB 0x8B60
-#define GL_SAMPLER_1D_SHADOW_ARB 0x8B61
-#define GL_SAMPLER_2D_SHADOW_ARB 0x8B62
-#define GL_SAMPLER_2D_RECT_ARB 0x8B63
-#define GL_SAMPLER_2D_RECT_SHADOW_ARB 0x8B64
-#define GL_OBJECT_DELETE_STATUS_ARB 0x8B80
-#define GL_OBJECT_COMPILE_STATUS_ARB 0x8B81
-#define GL_OBJECT_LINK_STATUS_ARB 0x8B82
-#define GL_OBJECT_VALIDATE_STATUS_ARB 0x8B83
-#define GL_OBJECT_INFO_LOG_LENGTH_ARB 0x8B84
-#define GL_OBJECT_ATTACHED_OBJECTS_ARB 0x8B85
-#define GL_OBJECT_ACTIVE_UNIFORMS_ARB 0x8B86
-#define GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB 0x8B87
-#define GL_OBJECT_SHADER_SOURCE_LENGTH_ARB 0x8B88
-typedef void (APIENTRYP PFNGLDELETEOBJECTARBPROC) (GLhandleARB obj);
-typedef GLhandleARB (APIENTRYP PFNGLGETHANDLEARBPROC) (GLenum pname);
-typedef void (APIENTRYP PFNGLDETACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB attachedObj);
-typedef GLhandleARB (APIENTRYP PFNGLCREATESHADEROBJECTARBPROC) (GLenum shaderType);
-typedef void (APIENTRYP PFNGLSHADERSOURCEARBPROC) (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
-typedef void (APIENTRYP PFNGLCOMPILESHADERARBPROC) (GLhandleARB shaderObj);
-typedef GLhandleARB (APIENTRYP PFNGLCREATEPROGRAMOBJECTARBPROC) (void);
-typedef void (APIENTRYP PFNGLATTACHOBJECTARBPROC) (GLhandleARB containerObj, GLhandleARB obj);
-typedef void (APIENTRYP PFNGLLINKPROGRAMARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLUSEPROGRAMOBJECTARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLVALIDATEPROGRAMARBPROC) (GLhandleARB programObj);
-typedef void (APIENTRYP PFNGLUNIFORM1FARBPROC) (GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLUNIFORM2FARBPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLUNIFORM1IARBPROC) (GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2IARBPROC) (GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4IARBPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM2FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORM1IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4IVARBPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX2FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERFVARBPROC) (GLhandleARB obj, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVARBPROC) (GLhandleARB obj, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETINFOLOGARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
-typedef void (APIENTRYP PFNGLGETATTACHEDOBJECTSARBPROC) (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETACTIVEUNIFORMARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETUNIFORMFVARBPROC) (GLhandleARB programObj, GLint location, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMIVARBPROC) (GLhandleARB programObj, GLint location, GLint *params);
-typedef void (APIENTRYP PFNGLGETSHADERSOURCEARBPROC) (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteObjectARB (GLhandleARB obj);
-GLAPI GLhandleARB APIENTRY glGetHandleARB (GLenum pname);
-GLAPI void APIENTRY glDetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj);
-GLAPI GLhandleARB APIENTRY glCreateShaderObjectARB (GLenum shaderType);
-GLAPI void APIENTRY glShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string, const GLint *length);
-GLAPI void APIENTRY glCompileShaderARB (GLhandleARB shaderObj);
-GLAPI GLhandleARB APIENTRY glCreateProgramObjectARB (void);
-GLAPI void APIENTRY glAttachObjectARB (GLhandleARB containerObj, GLhandleARB obj);
-GLAPI void APIENTRY glLinkProgramARB (GLhandleARB programObj);
-GLAPI void APIENTRY glUseProgramObjectARB (GLhandleARB programObj);
-GLAPI void APIENTRY glValidateProgramARB (GLhandleARB programObj);
-GLAPI void APIENTRY glUniform1fARB (GLint location, GLfloat v0);
-GLAPI void APIENTRY glUniform2fARB (GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glUniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glUniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glUniform1iARB (GLint location, GLint v0);
-GLAPI void APIENTRY glUniform2iARB (GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glUniform3iARB (GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glUniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glUniform1fvARB (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform2fvARB (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform3fvARB (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform4fvARB (GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glUniform1ivARB (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform2ivARB (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform3ivARB (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniform4ivARB (GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glUniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glUniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glGetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog);
-GLAPI void APIENTRY glGetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj);
-GLAPI GLint APIENTRY glGetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name);
-GLAPI void APIENTRY glGetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-GLAPI void APIENTRY glGetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params);
-GLAPI void APIENTRY glGetUniformivARB (GLhandleARB programObj, GLint location, GLint *params);
-GLAPI void APIENTRY glGetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source);
-#endif
-#endif /* GL_ARB_shader_objects */
-
-#ifndef GL_ARB_shader_precision
-#define GL_ARB_shader_precision 1
-#endif /* GL_ARB_shader_precision */
-
-#ifndef GL_ARB_shader_stencil_export
-#define GL_ARB_shader_stencil_export 1
-#endif /* GL_ARB_shader_stencil_export */
-
-#ifndef GL_ARB_shader_storage_buffer_object
-#define GL_ARB_shader_storage_buffer_object 1
-#endif /* GL_ARB_shader_storage_buffer_object */
-
-#ifndef GL_ARB_shader_subroutine
-#define GL_ARB_shader_subroutine 1
-#endif /* GL_ARB_shader_subroutine */
-
-#ifndef GL_ARB_shader_texture_image_samples
-#define GL_ARB_shader_texture_image_samples 1
-#endif /* GL_ARB_shader_texture_image_samples */
-
-#ifndef GL_ARB_shader_texture_lod
-#define GL_ARB_shader_texture_lod 1
-#endif /* GL_ARB_shader_texture_lod */
-
-#ifndef GL_ARB_shader_viewport_layer_array
-#define GL_ARB_shader_viewport_layer_array 1
-#endif /* GL_ARB_shader_viewport_layer_array */
-
-#ifndef GL_ARB_shading_language_100
-#define GL_ARB_shading_language_100 1
-#define GL_SHADING_LANGUAGE_VERSION_ARB 0x8B8C
-#endif /* GL_ARB_shading_language_100 */
-
-#ifndef GL_ARB_shading_language_420pack
-#define GL_ARB_shading_language_420pack 1
-#endif /* GL_ARB_shading_language_420pack */
-
-#ifndef GL_ARB_shading_language_include
-#define GL_ARB_shading_language_include 1
-#define GL_SHADER_INCLUDE_ARB 0x8DAE
-#define GL_NAMED_STRING_LENGTH_ARB 0x8DE9
-#define GL_NAMED_STRING_TYPE_ARB 0x8DEA
-typedef void (APIENTRYP PFNGLNAMEDSTRINGARBPROC) (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
-typedef void (APIENTRYP PFNGLDELETENAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
-typedef void (APIENTRYP PFNGLCOMPILESHADERINCLUDEARBPROC) (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
-typedef GLboolean (APIENTRYP PFNGLISNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETNAMEDSTRINGARBPROC) (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
-typedef void (APIENTRYP PFNGLGETNAMEDSTRINGIVARBPROC) (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glNamedStringARB (GLenum type, GLint namelen, const GLchar *name, GLint stringlen, const GLchar *string);
-GLAPI void APIENTRY glDeleteNamedStringARB (GLint namelen, const GLchar *name);
-GLAPI void APIENTRY glCompileShaderIncludeARB (GLuint shader, GLsizei count, const GLchar *const*path, const GLint *length);
-GLAPI GLboolean APIENTRY glIsNamedStringARB (GLint namelen, const GLchar *name);
-GLAPI void APIENTRY glGetNamedStringARB (GLint namelen, const GLchar *name, GLsizei bufSize, GLint *stringlen, GLchar *string);
-GLAPI void APIENTRY glGetNamedStringivARB (GLint namelen, const GLchar *name, GLenum pname, GLint *params);
-#endif
-#endif /* GL_ARB_shading_language_include */
-
-#ifndef GL_ARB_shading_language_packing
-#define GL_ARB_shading_language_packing 1
-#endif /* GL_ARB_shading_language_packing */
-
-#ifndef GL_ARB_shadow
-#define GL_ARB_shadow 1
-#define GL_TEXTURE_COMPARE_MODE_ARB 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_ARB 0x884D
-#define GL_COMPARE_R_TO_TEXTURE_ARB 0x884E
-#endif /* GL_ARB_shadow */
-
-#ifndef GL_ARB_shadow_ambient
-#define GL_ARB_shadow_ambient 1
-#define GL_TEXTURE_COMPARE_FAIL_VALUE_ARB 0x80BF
-#endif /* GL_ARB_shadow_ambient */
-
-#ifndef GL_ARB_sparse_buffer
-#define GL_ARB_sparse_buffer 1
-#define GL_SPARSE_STORAGE_BIT_ARB 0x0400
-#define GL_SPARSE_BUFFER_PAGE_SIZE_ARB 0x82F8
-typedef void (APIENTRYP PFNGLBUFFERPAGECOMMITMENTARBPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERPAGECOMMITMENTARBPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferPageCommitmentARB (GLenum target, GLintptr offset, GLsizeiptr size, GLboolean commit);
-GLAPI void APIENTRY glNamedBufferPageCommitmentEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-GLAPI void APIENTRY glNamedBufferPageCommitmentARB (GLuint buffer, GLintptr offset, GLsizeiptr size, GLboolean commit);
-#endif
-#endif /* GL_ARB_sparse_buffer */
-
-#ifndef GL_ARB_sparse_texture
-#define GL_ARB_sparse_texture 1
-#define GL_TEXTURE_SPARSE_ARB 0x91A6
-#define GL_VIRTUAL_PAGE_SIZE_INDEX_ARB 0x91A7
-#define GL_NUM_SPARSE_LEVELS_ARB 0x91AA
-#define GL_NUM_VIRTUAL_PAGE_SIZES_ARB 0x91A8
-#define GL_VIRTUAL_PAGE_SIZE_X_ARB 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_ARB 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_ARB 0x9197
-#define GL_MAX_SPARSE_TEXTURE_SIZE_ARB 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_ARB 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_ARB 0x919A
-#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_ARB 0x91A9
-typedef void (APIENTRYP PFNGLTEXPAGECOMMITMENTARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexPageCommitmentARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#endif
-#endif /* GL_ARB_sparse_texture */
-
-#ifndef GL_ARB_sparse_texture2
-#define GL_ARB_sparse_texture2 1
-#endif /* GL_ARB_sparse_texture2 */
-
-#ifndef GL_ARB_sparse_texture_clamp
-#define GL_ARB_sparse_texture_clamp 1
-#endif /* GL_ARB_sparse_texture_clamp */
-
-#ifndef GL_ARB_spirv_extensions
-#define GL_ARB_spirv_extensions 1
-#endif /* GL_ARB_spirv_extensions */
-
-#ifndef GL_ARB_stencil_texturing
-#define GL_ARB_stencil_texturing 1
-#endif /* GL_ARB_stencil_texturing */
-
-#ifndef GL_ARB_sync
-#define GL_ARB_sync 1
-#endif /* GL_ARB_sync */
-
-#ifndef GL_ARB_tessellation_shader
-#define GL_ARB_tessellation_shader 1
-#endif /* GL_ARB_tessellation_shader */
-
-#ifndef GL_ARB_texture_barrier
-#define GL_ARB_texture_barrier 1
-#endif /* GL_ARB_texture_barrier */
-
-#ifndef GL_ARB_texture_border_clamp
-#define GL_ARB_texture_border_clamp 1
-#define GL_CLAMP_TO_BORDER_ARB 0x812D
-#endif /* GL_ARB_texture_border_clamp */
-
-#ifndef GL_ARB_texture_buffer_object
-#define GL_ARB_texture_buffer_object 1
-#define GL_TEXTURE_BUFFER_ARB 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_ARB 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_ARB 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_ARB 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT_ARB 0x8C2E
-typedef void (APIENTRYP PFNGLTEXBUFFERARBPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBufferARB (GLenum target, GLenum internalformat, GLuint buffer);
-#endif
-#endif /* GL_ARB_texture_buffer_object */
-
-#ifndef GL_ARB_texture_buffer_object_rgb32
-#define GL_ARB_texture_buffer_object_rgb32 1
-#endif /* GL_ARB_texture_buffer_object_rgb32 */
-
-#ifndef GL_ARB_texture_buffer_range
-#define GL_ARB_texture_buffer_range 1
-#endif /* GL_ARB_texture_buffer_range */
-
-#ifndef GL_ARB_texture_compression
-#define GL_ARB_texture_compression 1
-#define GL_COMPRESSED_ALPHA_ARB 0x84E9
-#define GL_COMPRESSED_LUMINANCE_ARB 0x84EA
-#define GL_COMPRESSED_LUMINANCE_ALPHA_ARB 0x84EB
-#define GL_COMPRESSED_INTENSITY_ARB 0x84EC
-#define GL_COMPRESSED_RGB_ARB 0x84ED
-#define GL_COMPRESSED_RGBA_ARB 0x84EE
-#define GL_TEXTURE_COMPRESSION_HINT_ARB 0x84EF
-#define GL_TEXTURE_COMPRESSED_IMAGE_SIZE_ARB 0x86A0
-#define GL_TEXTURE_COMPRESSED_ARB 0x86A1
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS_ARB 0x86A3
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXIMAGE1DARBPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DARBPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE1DARBPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXIMAGEARBPROC) (GLenum target, GLint level, void *img);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCompressedTexImage3DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage2DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexImage1DARB (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage3DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage2DARB (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glCompressedTexSubImage1DARB (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *data);
-GLAPI void APIENTRY glGetCompressedTexImageARB (GLenum target, GLint level, void *img);
-#endif
-#endif /* GL_ARB_texture_compression */
-
-#ifndef GL_ARB_texture_compression_bptc
-#define GL_ARB_texture_compression_bptc 1
-#define GL_COMPRESSED_RGBA_BPTC_UNORM_ARB 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB 0x8E8F
-#endif /* GL_ARB_texture_compression_bptc */
-
-#ifndef GL_ARB_texture_compression_rgtc
-#define GL_ARB_texture_compression_rgtc 1
-#endif /* GL_ARB_texture_compression_rgtc */
-
-#ifndef GL_ARB_texture_cube_map
-#define GL_ARB_texture_cube_map 1
-#define GL_NORMAL_MAP_ARB 0x8511
-#define GL_REFLECTION_MAP_ARB 0x8512
-#define GL_TEXTURE_CUBE_MAP_ARB 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARB 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARB 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_ARB 0x851C
-#endif /* GL_ARB_texture_cube_map */
-
-#ifndef GL_ARB_texture_cube_map_array
-#define GL_ARB_texture_cube_map_array 1
-#define GL_TEXTURE_CUBE_MAP_ARRAY_ARB 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_ARB 0x900A
-#define GL_PROXY_TEXTURE_CUBE_MAP_ARRAY_ARB 0x900B
-#define GL_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_ARB 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_ARB 0x900F
-#endif /* GL_ARB_texture_cube_map_array */
-
-#ifndef GL_ARB_texture_env_add
-#define GL_ARB_texture_env_add 1
-#endif /* GL_ARB_texture_env_add */
-
-#ifndef GL_ARB_texture_env_combine
-#define GL_ARB_texture_env_combine 1
-#define GL_COMBINE_ARB 0x8570
-#define GL_COMBINE_RGB_ARB 0x8571
-#define GL_COMBINE_ALPHA_ARB 0x8572
-#define GL_SOURCE0_RGB_ARB 0x8580
-#define GL_SOURCE1_RGB_ARB 0x8581
-#define GL_SOURCE2_RGB_ARB 0x8582
-#define GL_SOURCE0_ALPHA_ARB 0x8588
-#define GL_SOURCE1_ALPHA_ARB 0x8589
-#define GL_SOURCE2_ALPHA_ARB 0x858A
-#define GL_OPERAND0_RGB_ARB 0x8590
-#define GL_OPERAND1_RGB_ARB 0x8591
-#define GL_OPERAND2_RGB_ARB 0x8592
-#define GL_OPERAND0_ALPHA_ARB 0x8598
-#define GL_OPERAND1_ALPHA_ARB 0x8599
-#define GL_OPERAND2_ALPHA_ARB 0x859A
-#define GL_RGB_SCALE_ARB 0x8573
-#define GL_ADD_SIGNED_ARB 0x8574
-#define GL_INTERPOLATE_ARB 0x8575
-#define GL_SUBTRACT_ARB 0x84E7
-#define GL_CONSTANT_ARB 0x8576
-#define GL_PRIMARY_COLOR_ARB 0x8577
-#define GL_PREVIOUS_ARB 0x8578
-#endif /* GL_ARB_texture_env_combine */
-
-#ifndef GL_ARB_texture_env_crossbar
-#define GL_ARB_texture_env_crossbar 1
-#endif /* GL_ARB_texture_env_crossbar */
-
-#ifndef GL_ARB_texture_env_dot3
-#define GL_ARB_texture_env_dot3 1
-#define GL_DOT3_RGB_ARB 0x86AE
-#define GL_DOT3_RGBA_ARB 0x86AF
-#endif /* GL_ARB_texture_env_dot3 */
-
-#ifndef GL_ARB_texture_filter_anisotropic
-#define GL_ARB_texture_filter_anisotropic 1
-#endif /* GL_ARB_texture_filter_anisotropic */
-
-#ifndef GL_ARB_texture_filter_minmax
-#define GL_ARB_texture_filter_minmax 1
-#define GL_TEXTURE_REDUCTION_MODE_ARB 0x9366
-#define GL_WEIGHTED_AVERAGE_ARB 0x9367
-#endif /* GL_ARB_texture_filter_minmax */
-
-#ifndef GL_ARB_texture_float
-#define GL_ARB_texture_float 1
-#define GL_TEXTURE_RED_TYPE_ARB 0x8C10
-#define GL_TEXTURE_GREEN_TYPE_ARB 0x8C11
-#define GL_TEXTURE_BLUE_TYPE_ARB 0x8C12
-#define GL_TEXTURE_ALPHA_TYPE_ARB 0x8C13
-#define GL_TEXTURE_LUMINANCE_TYPE_ARB 0x8C14
-#define GL_TEXTURE_INTENSITY_TYPE_ARB 0x8C15
-#define GL_TEXTURE_DEPTH_TYPE_ARB 0x8C16
-#define GL_UNSIGNED_NORMALIZED_ARB 0x8C17
-#define GL_RGBA32F_ARB 0x8814
-#define GL_RGB32F_ARB 0x8815
-#define GL_ALPHA32F_ARB 0x8816
-#define GL_INTENSITY32F_ARB 0x8817
-#define GL_LUMINANCE32F_ARB 0x8818
-#define GL_LUMINANCE_ALPHA32F_ARB 0x8819
-#define GL_RGBA16F_ARB 0x881A
-#define GL_RGB16F_ARB 0x881B
-#define GL_ALPHA16F_ARB 0x881C
-#define GL_INTENSITY16F_ARB 0x881D
-#define GL_LUMINANCE16F_ARB 0x881E
-#define GL_LUMINANCE_ALPHA16F_ARB 0x881F
-#endif /* GL_ARB_texture_float */
-
-#ifndef GL_ARB_texture_gather
-#define GL_ARB_texture_gather 1
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_ARB 0x8E5F
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_COMPONENTS_ARB 0x8F9F
-#endif /* GL_ARB_texture_gather */
-
-#ifndef GL_ARB_texture_mirror_clamp_to_edge
-#define GL_ARB_texture_mirror_clamp_to_edge 1
-#endif /* GL_ARB_texture_mirror_clamp_to_edge */
-
-#ifndef GL_ARB_texture_mirrored_repeat
-#define GL_ARB_texture_mirrored_repeat 1
-#define GL_MIRRORED_REPEAT_ARB 0x8370
-#endif /* GL_ARB_texture_mirrored_repeat */
-
-#ifndef GL_ARB_texture_multisample
-#define GL_ARB_texture_multisample 1
-#endif /* GL_ARB_texture_multisample */
-
-#ifndef GL_ARB_texture_non_power_of_two
-#define GL_ARB_texture_non_power_of_two 1
-#endif /* GL_ARB_texture_non_power_of_two */
-
-#ifndef GL_ARB_texture_query_levels
-#define GL_ARB_texture_query_levels 1
-#endif /* GL_ARB_texture_query_levels */
-
-#ifndef GL_ARB_texture_query_lod
-#define GL_ARB_texture_query_lod 1
-#endif /* GL_ARB_texture_query_lod */
-
-#ifndef GL_ARB_texture_rectangle
-#define GL_ARB_texture_rectangle 1
-#define GL_TEXTURE_RECTANGLE_ARB 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_ARB 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_ARB 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB 0x84F8
-#endif /* GL_ARB_texture_rectangle */
-
-#ifndef GL_ARB_texture_rg
-#define GL_ARB_texture_rg 1
-#endif /* GL_ARB_texture_rg */
-
-#ifndef GL_ARB_texture_rgb10_a2ui
-#define GL_ARB_texture_rgb10_a2ui 1
-#endif /* GL_ARB_texture_rgb10_a2ui */
-
-#ifndef GL_ARB_texture_stencil8
-#define GL_ARB_texture_stencil8 1
-#endif /* GL_ARB_texture_stencil8 */
-
-#ifndef GL_ARB_texture_storage
-#define GL_ARB_texture_storage 1
-#endif /* GL_ARB_texture_storage */
-
-#ifndef GL_ARB_texture_storage_multisample
-#define GL_ARB_texture_storage_multisample 1
-#endif /* GL_ARB_texture_storage_multisample */
-
-#ifndef GL_ARB_texture_swizzle
-#define GL_ARB_texture_swizzle 1
-#endif /* GL_ARB_texture_swizzle */
-
-#ifndef GL_ARB_texture_view
-#define GL_ARB_texture_view 1
-#endif /* GL_ARB_texture_view */
-
-#ifndef GL_ARB_timer_query
-#define GL_ARB_timer_query 1
-#endif /* GL_ARB_timer_query */
-
-#ifndef GL_ARB_transform_feedback2
-#define GL_ARB_transform_feedback2 1
-#endif /* GL_ARB_transform_feedback2 */
-
-#ifndef GL_ARB_transform_feedback3
-#define GL_ARB_transform_feedback3 1
-#endif /* GL_ARB_transform_feedback3 */
-
-#ifndef GL_ARB_transform_feedback_instanced
-#define GL_ARB_transform_feedback_instanced 1
-#endif /* GL_ARB_transform_feedback_instanced */
-
-#ifndef GL_ARB_transform_feedback_overflow_query
-#define GL_ARB_transform_feedback_overflow_query 1
-#define GL_TRANSFORM_FEEDBACK_OVERFLOW_ARB 0x82EC
-#define GL_TRANSFORM_FEEDBACK_STREAM_OVERFLOW_ARB 0x82ED
-#endif /* GL_ARB_transform_feedback_overflow_query */
-
-#ifndef GL_ARB_transpose_matrix
-#define GL_ARB_transpose_matrix 1
-#define GL_TRANSPOSE_MODELVIEW_MATRIX_ARB 0x84E3
-#define GL_TRANSPOSE_PROJECTION_MATRIX_ARB 0x84E4
-#define GL_TRANSPOSE_TEXTURE_MATRIX_ARB 0x84E5
-#define GL_TRANSPOSE_COLOR_MATRIX_ARB 0x84E6
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXFARBPROC) (const GLfloat *m);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXDARBPROC) (const GLdouble *m);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLoadTransposeMatrixfARB (const GLfloat *m);
-GLAPI void APIENTRY glLoadTransposeMatrixdARB (const GLdouble *m);
-GLAPI void APIENTRY glMultTransposeMatrixfARB (const GLfloat *m);
-GLAPI void APIENTRY glMultTransposeMatrixdARB (const GLdouble *m);
-#endif
-#endif /* GL_ARB_transpose_matrix */
-
-#ifndef GL_ARB_uniform_buffer_object
-#define GL_ARB_uniform_buffer_object 1
-#endif /* GL_ARB_uniform_buffer_object */
-
-#ifndef GL_ARB_vertex_array_bgra
-#define GL_ARB_vertex_array_bgra 1
-#endif /* GL_ARB_vertex_array_bgra */
-
-#ifndef GL_ARB_vertex_array_object
-#define GL_ARB_vertex_array_object 1
-#endif /* GL_ARB_vertex_array_object */
-
-#ifndef GL_ARB_vertex_attrib_64bit
-#define GL_ARB_vertex_attrib_64bit 1
-#endif /* GL_ARB_vertex_attrib_64bit */
-
-#ifndef GL_ARB_vertex_attrib_binding
-#define GL_ARB_vertex_attrib_binding 1
-#endif /* GL_ARB_vertex_attrib_binding */
-
-#ifndef GL_ARB_vertex_blend
-#define GL_ARB_vertex_blend 1
-#define GL_MAX_VERTEX_UNITS_ARB 0x86A4
-#define GL_ACTIVE_VERTEX_UNITS_ARB 0x86A5
-#define GL_WEIGHT_SUM_UNITY_ARB 0x86A6
-#define GL_VERTEX_BLEND_ARB 0x86A7
-#define GL_CURRENT_WEIGHT_ARB 0x86A8
-#define GL_WEIGHT_ARRAY_TYPE_ARB 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_ARB 0x86AA
-#define GL_WEIGHT_ARRAY_SIZE_ARB 0x86AB
-#define GL_WEIGHT_ARRAY_POINTER_ARB 0x86AC
-#define GL_WEIGHT_ARRAY_ARB 0x86AD
-#define GL_MODELVIEW0_ARB 0x1700
-#define GL_MODELVIEW1_ARB 0x850A
-#define GL_MODELVIEW2_ARB 0x8722
-#define GL_MODELVIEW3_ARB 0x8723
-#define GL_MODELVIEW4_ARB 0x8724
-#define GL_MODELVIEW5_ARB 0x8725
-#define GL_MODELVIEW6_ARB 0x8726
-#define GL_MODELVIEW7_ARB 0x8727
-#define GL_MODELVIEW8_ARB 0x8728
-#define GL_MODELVIEW9_ARB 0x8729
-#define GL_MODELVIEW10_ARB 0x872A
-#define GL_MODELVIEW11_ARB 0x872B
-#define GL_MODELVIEW12_ARB 0x872C
-#define GL_MODELVIEW13_ARB 0x872D
-#define GL_MODELVIEW14_ARB 0x872E
-#define GL_MODELVIEW15_ARB 0x872F
-#define GL_MODELVIEW16_ARB 0x8730
-#define GL_MODELVIEW17_ARB 0x8731
-#define GL_MODELVIEW18_ARB 0x8732
-#define GL_MODELVIEW19_ARB 0x8733
-#define GL_MODELVIEW20_ARB 0x8734
-#define GL_MODELVIEW21_ARB 0x8735
-#define GL_MODELVIEW22_ARB 0x8736
-#define GL_MODELVIEW23_ARB 0x8737
-#define GL_MODELVIEW24_ARB 0x8738
-#define GL_MODELVIEW25_ARB 0x8739
-#define GL_MODELVIEW26_ARB 0x873A
-#define GL_MODELVIEW27_ARB 0x873B
-#define GL_MODELVIEW28_ARB 0x873C
-#define GL_MODELVIEW29_ARB 0x873D
-#define GL_MODELVIEW30_ARB 0x873E
-#define GL_MODELVIEW31_ARB 0x873F
-typedef void (APIENTRYP PFNGLWEIGHTBVARBPROC) (GLint size, const GLbyte *weights);
-typedef void (APIENTRYP PFNGLWEIGHTSVARBPROC) (GLint size, const GLshort *weights);
-typedef void (APIENTRYP PFNGLWEIGHTIVARBPROC) (GLint size, const GLint *weights);
-typedef void (APIENTRYP PFNGLWEIGHTFVARBPROC) (GLint size, const GLfloat *weights);
-typedef void (APIENTRYP PFNGLWEIGHTDVARBPROC) (GLint size, const GLdouble *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUBVARBPROC) (GLint size, const GLubyte *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUSVARBPROC) (GLint size, const GLushort *weights);
-typedef void (APIENTRYP PFNGLWEIGHTUIVARBPROC) (GLint size, const GLuint *weights);
-typedef void (APIENTRYP PFNGLWEIGHTPOINTERARBPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLVERTEXBLENDARBPROC) (GLint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWeightbvARB (GLint size, const GLbyte *weights);
-GLAPI void APIENTRY glWeightsvARB (GLint size, const GLshort *weights);
-GLAPI void APIENTRY glWeightivARB (GLint size, const GLint *weights);
-GLAPI void APIENTRY glWeightfvARB (GLint size, const GLfloat *weights);
-GLAPI void APIENTRY glWeightdvARB (GLint size, const GLdouble *weights);
-GLAPI void APIENTRY glWeightubvARB (GLint size, const GLubyte *weights);
-GLAPI void APIENTRY glWeightusvARB (GLint size, const GLushort *weights);
-GLAPI void APIENTRY glWeightuivARB (GLint size, const GLuint *weights);
-GLAPI void APIENTRY glWeightPointerARB (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glVertexBlendARB (GLint count);
-#endif
-#endif /* GL_ARB_vertex_blend */
-
-#ifndef GL_ARB_vertex_buffer_object
-#define GL_ARB_vertex_buffer_object 1
-#include <stddef.h>
-typedef ptrdiff_t GLsizeiptrARB;
-typedef ptrdiff_t GLintptrARB;
-#define GL_BUFFER_SIZE_ARB 0x8764
-#define GL_BUFFER_USAGE_ARB 0x8765
-#define GL_ARRAY_BUFFER_ARB 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893
-#define GL_ARRAY_BUFFER_BINDING_ARB 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING_ARB 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING_ARB 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING_ARB 0x8898
-#define GL_INDEX_ARRAY_BUFFER_BINDING_ARB 0x8899
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING_ARB 0x889A
-#define GL_EDGE_FLAG_ARRAY_BUFFER_BINDING_ARB 0x889B
-#define GL_SECONDARY_COLOR_ARRAY_BUFFER_BINDING_ARB 0x889C
-#define GL_FOG_COORDINATE_ARRAY_BUFFER_BINDING_ARB 0x889D
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_ARB 0x889E
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING_ARB 0x889F
-#define GL_READ_ONLY_ARB 0x88B8
-#define GL_WRITE_ONLY_ARB 0x88B9
-#define GL_READ_WRITE_ARB 0x88BA
-#define GL_BUFFER_ACCESS_ARB 0x88BB
-#define GL_BUFFER_MAPPED_ARB 0x88BC
-#define GL_BUFFER_MAP_POINTER_ARB 0x88BD
-#define GL_STREAM_DRAW_ARB 0x88E0
-#define GL_STREAM_READ_ARB 0x88E1
-#define GL_STREAM_COPY_ARB 0x88E2
-#define GL_STATIC_DRAW_ARB 0x88E4
-#define GL_STATIC_READ_ARB 0x88E5
-#define GL_STATIC_COPY_ARB 0x88E6
-#define GL_DYNAMIC_DRAW_ARB 0x88E8
-#define GL_DYNAMIC_READ_ARB 0x88E9
-#define GL_DYNAMIC_COPY_ARB 0x88EA
-typedef void (APIENTRYP PFNGLBINDBUFFERARBPROC) (GLenum target, GLuint buffer);
-typedef void (APIENTRYP PFNGLDELETEBUFFERSARBPROC) (GLsizei n, const GLuint *buffers);
-typedef void (APIENTRYP PFNGLGENBUFFERSARBPROC) (GLsizei n, GLuint *buffers);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERARBPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLBUFFERDATAARBPROC) (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data);
-typedef void (APIENTRYP PFNGLGETBUFFERSUBDATAARBPROC) (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data);
-typedef void *(APIENTRYP PFNGLMAPBUFFERARBPROC) (GLenum target, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPBUFFERARBPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERIVARBPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETBUFFERPOINTERVARBPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindBufferARB (GLenum target, GLuint buffer);
-GLAPI void APIENTRY glDeleteBuffersARB (GLsizei n, const GLuint *buffers);
-GLAPI void APIENTRY glGenBuffersARB (GLsizei n, GLuint *buffers);
-GLAPI GLboolean APIENTRY glIsBufferARB (GLuint buffer);
-GLAPI void APIENTRY glBufferDataARB (GLenum target, GLsizeiptrARB size, const void *data, GLenum usage);
-GLAPI void APIENTRY glBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, const void *data);
-GLAPI void APIENTRY glGetBufferSubDataARB (GLenum target, GLintptrARB offset, GLsizeiptrARB size, void *data);
-GLAPI void *APIENTRY glMapBufferARB (GLenum target, GLenum access);
-GLAPI GLboolean APIENTRY glUnmapBufferARB (GLenum target);
-GLAPI void APIENTRY glGetBufferParameterivARB (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetBufferPointervARB (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_ARB_vertex_buffer_object */
-
-#ifndef GL_ARB_vertex_program
-#define GL_ARB_vertex_program 1
-#define GL_COLOR_SUM_ARB 0x8458
-#define GL_VERTEX_PROGRAM_ARB 0x8620
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED_ARB 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE_ARB 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE_ARB 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE_ARB 0x8625
-#define GL_CURRENT_VERTEX_ATTRIB_ARB 0x8626
-#define GL_VERTEX_PROGRAM_POINT_SIZE_ARB 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_ARB 0x8643
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER_ARB 0x8645
-#define GL_MAX_VERTEX_ATTRIBS_ARB 0x8869
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED_ARB 0x886A
-#define GL_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B0
-#define GL_MAX_PROGRAM_ADDRESS_REGISTERS_ARB 0x88B1
-#define GL_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B2
-#define GL_MAX_PROGRAM_NATIVE_ADDRESS_REGISTERS_ARB 0x88B3
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DARBPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FARBPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SARBPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DARBPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FARBPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SARBPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NBVARBPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NIVARBPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NSVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBARBPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUBVARBPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUIVARBPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4NUSVARBPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4BVARBPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DARBPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVARBPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FARBPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVARBPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4IVARBPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SARBPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVARBPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVARBPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UIVARBPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4USVARBPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERARBPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYARBPROC) (GLuint index);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVARBPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVARBPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVARBPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVARBPROC) (GLuint index, GLenum pname, void **pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttrib1dARB (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttrib1dvARB (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib1fARB (GLuint index, GLfloat x);
-GLAPI void APIENTRY glVertexAttrib1fvARB (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib1sARB (GLuint index, GLshort x);
-GLAPI void APIENTRY glVertexAttrib1svARB (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib2dARB (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttrib2dvARB (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib2fARB (GLuint index, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glVertexAttrib2fvARB (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib2sARB (GLuint index, GLshort x, GLshort y);
-GLAPI void APIENTRY glVertexAttrib2svARB (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib3dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttrib3dvARB (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib3fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glVertexAttrib3fvARB (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib3sARB (GLuint index, GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glVertexAttrib3svARB (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4NbvARB (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4NivARB (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4NsvARB (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4NubARB (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-GLAPI void APIENTRY glVertexAttrib4NubvARB (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4NuivARB (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4NusvARB (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttrib4bvARB (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttrib4dARB (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttrib4dvARB (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib4fARB (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glVertexAttrib4fvARB (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib4ivARB (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttrib4sARB (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glVertexAttrib4svARB (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4ubvARB (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttrib4uivARB (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttrib4usvARB (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttribPointerARB (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glEnableVertexAttribArrayARB (GLuint index);
-GLAPI void APIENTRY glDisableVertexAttribArrayARB (GLuint index);
-GLAPI void APIENTRY glGetVertexAttribdvARB (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetVertexAttribfvARB (GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVertexAttribivARB (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribPointervARB (GLuint index, GLenum pname, void **pointer);
-#endif
-#endif /* GL_ARB_vertex_program */
-
-#ifndef GL_ARB_vertex_shader
-#define GL_ARB_vertex_shader 1
-#define GL_VERTEX_SHADER_ARB 0x8B31
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS_ARB 0x8B4A
-#define GL_MAX_VARYING_FLOATS_ARB 0x8B4B
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS_ARB 0x8B4C
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS_ARB 0x8B4D
-#define GL_OBJECT_ACTIVE_ATTRIBUTES_ARB 0x8B89
-#define GL_OBJECT_ACTIVE_ATTRIBUTE_MAX_LENGTH_ARB 0x8B8A
-typedef void (APIENTRYP PFNGLBINDATTRIBLOCATIONARBPROC) (GLhandleARB programObj, GLuint index, const GLcharARB *name);
-typedef void (APIENTRYP PFNGLGETACTIVEATTRIBARBPROC) (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-typedef GLint (APIENTRYP PFNGLGETATTRIBLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name);
-GLAPI void APIENTRY glGetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name);
-GLAPI GLint APIENTRY glGetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name);
-#endif
-#endif /* GL_ARB_vertex_shader */
-
-#ifndef GL_ARB_vertex_type_10f_11f_11f_rev
-#define GL_ARB_vertex_type_10f_11f_11f_rev 1
-#endif /* GL_ARB_vertex_type_10f_11f_11f_rev */
-
-#ifndef GL_ARB_vertex_type_2_10_10_10_rev
-#define GL_ARB_vertex_type_2_10_10_10_rev 1
-#endif /* GL_ARB_vertex_type_2_10_10_10_rev */
-
-#ifndef GL_ARB_viewport_array
-#define GL_ARB_viewport_array 1
-#endif /* GL_ARB_viewport_array */
-
-#ifndef GL_ARB_window_pos
-#define GL_ARB_window_pos 1
-typedef void (APIENTRYP PFNGLWINDOWPOS2DARBPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVARBPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FARBPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVARBPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IARBPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVARBPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SARBPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVARBPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DARBPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVARBPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FARBPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVARBPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IARBPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVARBPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SARBPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVARBPROC) (const GLshort *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dARB (GLdouble x, GLdouble y);
-GLAPI void APIENTRY glWindowPos2dvARB (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos2fARB (GLfloat x, GLfloat y);
-GLAPI void APIENTRY glWindowPos2fvARB (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos2iARB (GLint x, GLint y);
-GLAPI void APIENTRY glWindowPos2ivARB (const GLint *v);
-GLAPI void APIENTRY glWindowPos2sARB (GLshort x, GLshort y);
-GLAPI void APIENTRY glWindowPos2svARB (const GLshort *v);
-GLAPI void APIENTRY glWindowPos3dARB (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glWindowPos3dvARB (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos3fARB (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glWindowPos3fvARB (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos3iARB (GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glWindowPos3ivARB (const GLint *v);
-GLAPI void APIENTRY glWindowPos3sARB (GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glWindowPos3svARB (const GLshort *v);
-#endif
-#endif /* GL_ARB_window_pos */
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#define GL_HSL_HUE_KHR 0x92AD
-#define GL_HSL_SATURATION_KHR 0x92AE
-#define GL_HSL_COLOR_KHR 0x92AF
-#define GL_HSL_LUMINOSITY_KHR 0x92B0
-typedef void (APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendBarrierKHR (void);
-#endif
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifndef GL_KHR_blend_equation_advanced_coherent
-#define GL_KHR_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-#ifndef GL_KHR_context_flush_control
-#define GL_KHR_context_flush_control 1
-#endif /* GL_KHR_context_flush_control */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-#endif /* GL_KHR_debug */
-
-#ifndef GL_KHR_no_error
-#define GL_KHR_no_error 1
-#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
-#endif /* GL_KHR_no_error */
-
-#ifndef GL_KHR_parallel_shader_compile
-#define GL_KHR_parallel_shader_compile 1
-#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0
-#define GL_COMPLETION_STATUS_KHR 0x91B1
-typedef void (APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count);
-#endif
-#endif /* GL_KHR_parallel_shader_compile */
-
-#ifndef GL_KHR_robust_buffer_access_behavior
-#define GL_KHR_robust_buffer_access_behavior 1
-#endif /* GL_KHR_robust_buffer_access_behavior */
-
-#ifndef GL_KHR_robustness
-#define GL_KHR_robustness 1
-#define GL_CONTEXT_ROBUST_ACCESS 0x90F3
-#endif /* GL_KHR_robustness */
-
-#ifndef GL_KHR_texture_compression_astc_hdr
-#define GL_KHR_texture_compression_astc_hdr 1
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-#ifndef GL_KHR_texture_compression_astc_sliced_3d
-#define GL_KHR_texture_compression_astc_sliced_3d 1
-#endif /* GL_KHR_texture_compression_astc_sliced_3d */
-
-#ifndef GL_OES_byte_coordinates
-#define GL_OES_byte_coordinates 1
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1BOESPROC) (GLenum texture, GLbyte s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1BVOESPROC) (GLenum texture, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2BOESPROC) (GLenum texture, GLbyte s, GLbyte t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2BVOESPROC) (GLenum texture, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3BVOESPROC) (GLenum texture, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4BOESPROC) (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4BVOESPROC) (GLenum texture, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD1BOESPROC) (GLbyte s);
-typedef void (APIENTRYP PFNGLTEXCOORD1BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD2BOESPROC) (GLbyte s, GLbyte t);
-typedef void (APIENTRYP PFNGLTEXCOORD2BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD3BOESPROC) (GLbyte s, GLbyte t, GLbyte r);
-typedef void (APIENTRYP PFNGLTEXCOORD3BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD4BOESPROC) (GLbyte s, GLbyte t, GLbyte r, GLbyte q);
-typedef void (APIENTRYP PFNGLTEXCOORD4BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLVERTEX2BOESPROC) (GLbyte x, GLbyte y);
-typedef void (APIENTRYP PFNGLVERTEX2BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLVERTEX3BOESPROC) (GLbyte x, GLbyte y, GLbyte z);
-typedef void (APIENTRYP PFNGLVERTEX3BVOESPROC) (const GLbyte *coords);
-typedef void (APIENTRYP PFNGLVERTEX4BOESPROC) (GLbyte x, GLbyte y, GLbyte z, GLbyte w);
-typedef void (APIENTRYP PFNGLVERTEX4BVOESPROC) (const GLbyte *coords);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiTexCoord1bOES (GLenum texture, GLbyte s);
-GLAPI void APIENTRY glMultiTexCoord1bvOES (GLenum texture, const GLbyte *coords);
-GLAPI void APIENTRY glMultiTexCoord2bOES (GLenum texture, GLbyte s, GLbyte t);
-GLAPI void APIENTRY glMultiTexCoord2bvOES (GLenum texture, const GLbyte *coords);
-GLAPI void APIENTRY glMultiTexCoord3bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r);
-GLAPI void APIENTRY glMultiTexCoord3bvOES (GLenum texture, const GLbyte *coords);
-GLAPI void APIENTRY glMultiTexCoord4bOES (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q);
-GLAPI void APIENTRY glMultiTexCoord4bvOES (GLenum texture, const GLbyte *coords);
-GLAPI void APIENTRY glTexCoord1bOES (GLbyte s);
-GLAPI void APIENTRY glTexCoord1bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glTexCoord2bOES (GLbyte s, GLbyte t);
-GLAPI void APIENTRY glTexCoord2bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glTexCoord3bOES (GLbyte s, GLbyte t, GLbyte r);
-GLAPI void APIENTRY glTexCoord3bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glTexCoord4bOES (GLbyte s, GLbyte t, GLbyte r, GLbyte q);
-GLAPI void APIENTRY glTexCoord4bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glVertex2bOES (GLbyte x, GLbyte y);
-GLAPI void APIENTRY glVertex2bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glVertex3bOES (GLbyte x, GLbyte y, GLbyte z);
-GLAPI void APIENTRY glVertex3bvOES (const GLbyte *coords);
-GLAPI void APIENTRY glVertex4bOES (GLbyte x, GLbyte y, GLbyte z, GLbyte w);
-GLAPI void APIENTRY glVertex4bvOES (const GLbyte *coords);
-#endif
-#endif /* GL_OES_byte_coordinates */
-
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif /* GL_OES_compressed_paletted_texture */
-
-#ifndef GL_OES_fixed_point
-#define GL_OES_fixed_point 1
-typedef GLint GLfixed;
-#define GL_FIXED_OES 0x140C
-typedef void (APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);
-typedef void (APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);
-typedef void (APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
-typedef void (APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);
-typedef void (APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);
-typedef void (APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-typedef void (APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);
-typedef void (APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);
-typedef void (APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
-typedef void (APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
-typedef void (APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);
-typedef void (APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
-typedef void (APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
-typedef void (APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-typedef void (APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (APIENTRYP PFNGLACCUMXOESPROC) (GLenum op, GLfixed value);
-typedef void (APIENTRYP PFNGLBITMAPXOESPROC) (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);
-typedef void (APIENTRYP PFNGLBLENDCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (APIENTRYP PFNGLCLEARACCUMXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (APIENTRYP PFNGLCOLOR3XOESPROC) (GLfixed red, GLfixed green, GLfixed blue);
-typedef void (APIENTRYP PFNGLCOLOR3XVOESPROC) (const GLfixed *components);
-typedef void (APIENTRYP PFNGLCOLOR4XVOESPROC) (const GLfixed *components);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLEVALCOORD1XOESPROC) (GLfixed u);
-typedef void (APIENTRYP PFNGLEVALCOORD1XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLEVALCOORD2XOESPROC) (GLfixed u, GLfixed v);
-typedef void (APIENTRYP PFNGLEVALCOORD2XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLFEEDBACKBUFFERXOESPROC) (GLsizei n, GLenum type, const GLfixed *buffer);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETMAPXVOESPROC) (GLenum target, GLenum query, GLfixed *v);
-typedef void (APIENTRYP PFNGLGETMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLGETPIXELMAPXVPROC) (GLenum map, GLint size, GLfixed *values);
-typedef void (APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLGETTEXLEVELPARAMETERXVOESPROC) (GLenum target, GLint level, GLenum pname, GLfixed *params);
-typedef void (APIENTRYP PFNGLINDEXXOESPROC) (GLfixed component);
-typedef void (APIENTRYP PFNGLINDEXXVOESPROC) (const GLfixed *component);
-typedef void (APIENTRYP PFNGLLOADTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);
-typedef void (APIENTRYP PFNGLMAP1XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);
-typedef void (APIENTRYP PFNGLMAP2XOESPROC) (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);
-typedef void (APIENTRYP PFNGLMAPGRID1XOESPROC) (GLint n, GLfixed u1, GLfixed u2);
-typedef void (APIENTRYP PFNGLMAPGRID2XOESPROC) (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);
-typedef void (APIENTRYP PFNGLMULTTRANSPOSEMATRIXXOESPROC) (const GLfixed *m);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1XOESPROC) (GLenum texture, GLfixed s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1XVOESPROC) (GLenum texture, const GLfixed *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2XOESPROC) (GLenum texture, GLfixed s, GLfixed t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2XVOESPROC) (GLenum texture, const GLfixed *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3XVOESPROC) (GLenum texture, const GLfixed *coords);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4XVOESPROC) (GLenum texture, const GLfixed *coords);
-typedef void (APIENTRYP PFNGLNORMAL3XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLPASSTHROUGHXOESPROC) (GLfixed token);
-typedef void (APIENTRYP PFNGLPIXELMAPXPROC) (GLenum map, GLint size, const GLfixed *values);
-typedef void (APIENTRYP PFNGLPIXELSTOREXPROC) (GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLPIXELTRANSFERXOESPROC) (GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLPIXELZOOMXOESPROC) (GLfixed xfactor, GLfixed yfactor);
-typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESXOESPROC) (GLsizei n, const GLuint *textures, const GLfixed *priorities);
-typedef void (APIENTRYP PFNGLRASTERPOS2XOESPROC) (GLfixed x, GLfixed y);
-typedef void (APIENTRYP PFNGLRASTERPOS2XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLRASTERPOS3XOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (APIENTRYP PFNGLRASTERPOS3XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLRASTERPOS4XOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed w);
-typedef void (APIENTRYP PFNGLRASTERPOS4XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLRECTXOESPROC) (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);
-typedef void (APIENTRYP PFNGLRECTXVOESPROC) (const GLfixed *v1, const GLfixed *v2);
-typedef void (APIENTRYP PFNGLTEXCOORD1XOESPROC) (GLfixed s);
-typedef void (APIENTRYP PFNGLTEXCOORD1XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD2XOESPROC) (GLfixed s, GLfixed t);
-typedef void (APIENTRYP PFNGLTEXCOORD2XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD3XOESPROC) (GLfixed s, GLfixed t, GLfixed r);
-typedef void (APIENTRYP PFNGLTEXCOORD3XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLTEXCOORD4XOESPROC) (GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (APIENTRYP PFNGLTEXCOORD4XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
-typedef void (APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
-typedef void (APIENTRYP PFNGLVERTEX2XOESPROC) (GLfixed x);
-typedef void (APIENTRYP PFNGLVERTEX2XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLVERTEX3XOESPROC) (GLfixed x, GLfixed y);
-typedef void (APIENTRYP PFNGLVERTEX3XVOESPROC) (const GLfixed *coords);
-typedef void (APIENTRYP PFNGLVERTEX4XOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (APIENTRYP PFNGLVERTEX4XVOESPROC) (const GLfixed *coords);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);
-GLAPI void APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GLAPI void APIENTRY glClearDepthxOES (GLfixed depth);
-GLAPI void APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
-GLAPI void APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GLAPI void APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);
-GLAPI void APIENTRY glFogxOES (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);
-GLAPI void APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GLAPI void APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);
-GLAPI void APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);
-GLAPI void APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glLineWidthxOES (GLfixed width);
-GLAPI void APIENTRY glLoadMatrixxOES (const GLfixed *m);
-GLAPI void APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);
-GLAPI void APIENTRY glMultMatrixxOES (const GLfixed *m);
-GLAPI void APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GLAPI void APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
-GLAPI void APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GLAPI void APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glPointSizexOES (GLfixed size);
-GLAPI void APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
-GLAPI void APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glAccumxOES (GLenum op, GLfixed value);
-GLAPI void APIENTRY glBitmapxOES (GLsizei width, GLsizei height, GLfixed xorig, GLfixed yorig, GLfixed xmove, GLfixed ymove, const GLubyte *bitmap);
-GLAPI void APIENTRY glBlendColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GLAPI void APIENTRY glClearAccumxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GLAPI void APIENTRY glColor3xOES (GLfixed red, GLfixed green, GLfixed blue);
-GLAPI void APIENTRY glColor3xvOES (const GLfixed *components);
-GLAPI void APIENTRY glColor4xvOES (const GLfixed *components);
-GLAPI void APIENTRY glConvolutionParameterxOES (GLenum target, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glConvolutionParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glEvalCoord1xOES (GLfixed u);
-GLAPI void APIENTRY glEvalCoord1xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glEvalCoord2xOES (GLfixed u, GLfixed v);
-GLAPI void APIENTRY glEvalCoord2xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glFeedbackBufferxOES (GLsizei n, GLenum type, const GLfixed *buffer);
-GLAPI void APIENTRY glGetConvolutionParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetHistogramParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetLightxOES (GLenum light, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetMapxvOES (GLenum target, GLenum query, GLfixed *v);
-GLAPI void APIENTRY glGetMaterialxOES (GLenum face, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glGetPixelMapxv (GLenum map, GLint size, GLfixed *values);
-GLAPI void APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glGetTexLevelParameterxvOES (GLenum target, GLint level, GLenum pname, GLfixed *params);
-GLAPI void APIENTRY glIndexxOES (GLfixed component);
-GLAPI void APIENTRY glIndexxvOES (const GLfixed *component);
-GLAPI void APIENTRY glLoadTransposeMatrixxOES (const GLfixed *m);
-GLAPI void APIENTRY glMap1xOES (GLenum target, GLfixed u1, GLfixed u2, GLint stride, GLint order, GLfixed points);
-GLAPI void APIENTRY glMap2xOES (GLenum target, GLfixed u1, GLfixed u2, GLint ustride, GLint uorder, GLfixed v1, GLfixed v2, GLint vstride, GLint vorder, GLfixed points);
-GLAPI void APIENTRY glMapGrid1xOES (GLint n, GLfixed u1, GLfixed u2);
-GLAPI void APIENTRY glMapGrid2xOES (GLint n, GLfixed u1, GLfixed u2, GLfixed v1, GLfixed v2);
-GLAPI void APIENTRY glMultTransposeMatrixxOES (const GLfixed *m);
-GLAPI void APIENTRY glMultiTexCoord1xOES (GLenum texture, GLfixed s);
-GLAPI void APIENTRY glMultiTexCoord1xvOES (GLenum texture, const GLfixed *coords);
-GLAPI void APIENTRY glMultiTexCoord2xOES (GLenum texture, GLfixed s, GLfixed t);
-GLAPI void APIENTRY glMultiTexCoord2xvOES (GLenum texture, const GLfixed *coords);
-GLAPI void APIENTRY glMultiTexCoord3xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r);
-GLAPI void APIENTRY glMultiTexCoord3xvOES (GLenum texture, const GLfixed *coords);
-GLAPI void APIENTRY glMultiTexCoord4xvOES (GLenum texture, const GLfixed *coords);
-GLAPI void APIENTRY glNormal3xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glPassThroughxOES (GLfixed token);
-GLAPI void APIENTRY glPixelMapx (GLenum map, GLint size, const GLfixed *values);
-GLAPI void APIENTRY glPixelStorex (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glPixelTransferxOES (GLenum pname, GLfixed param);
-GLAPI void APIENTRY glPixelZoomxOES (GLfixed xfactor, GLfixed yfactor);
-GLAPI void APIENTRY glPrioritizeTexturesxOES (GLsizei n, const GLuint *textures, const GLfixed *priorities);
-GLAPI void APIENTRY glRasterPos2xOES (GLfixed x, GLfixed y);
-GLAPI void APIENTRY glRasterPos2xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glRasterPos3xOES (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glRasterPos3xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glRasterPos4xOES (GLfixed x, GLfixed y, GLfixed z, GLfixed w);
-GLAPI void APIENTRY glRasterPos4xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glRectxOES (GLfixed x1, GLfixed y1, GLfixed x2, GLfixed y2);
-GLAPI void APIENTRY glRectxvOES (const GLfixed *v1, const GLfixed *v2);
-GLAPI void APIENTRY glTexCoord1xOES (GLfixed s);
-GLAPI void APIENTRY glTexCoord1xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glTexCoord2xOES (GLfixed s, GLfixed t);
-GLAPI void APIENTRY glTexCoord2xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glTexCoord3xOES (GLfixed s, GLfixed t, GLfixed r);
-GLAPI void APIENTRY glTexCoord3xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glTexCoord4xOES (GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GLAPI void APIENTRY glTexCoord4xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
-GLAPI void APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
-GLAPI void APIENTRY glVertex2xOES (GLfixed x);
-GLAPI void APIENTRY glVertex2xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glVertex3xOES (GLfixed x, GLfixed y);
-GLAPI void APIENTRY glVertex3xvOES (const GLfixed *coords);
-GLAPI void APIENTRY glVertex4xOES (GLfixed x, GLfixed y, GLfixed z);
-GLAPI void APIENTRY glVertex4xvOES (const GLfixed *coords);
-#endif
-#endif /* GL_OES_fixed_point */
-
-#ifndef GL_OES_query_matrix
-#define GL_OES_query_matrix 1
-typedef GLbitfield (APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLbitfield APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);
-#endif
-#endif /* GL_OES_query_matrix */
-
-#ifndef GL_OES_read_format
-#define GL_OES_read_format 1
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#endif /* GL_OES_read_format */
-
-#ifndef GL_OES_single_precision
-#define GL_OES_single_precision 1
-typedef void (APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
-typedef void (APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
-typedef void (APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
-typedef void (APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-typedef void (APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);
-typedef void (APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glClearDepthfOES (GLclampf depth);
-GLAPI void APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
-GLAPI void APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);
-GLAPI void APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-GLAPI void APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);
-GLAPI void APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-#endif
-#endif /* GL_OES_single_precision */
-
-#ifndef GL_3DFX_multisample
-#define GL_3DFX_multisample 1
-#define GL_MULTISAMPLE_3DFX 0x86B2
-#define GL_SAMPLE_BUFFERS_3DFX 0x86B3
-#define GL_SAMPLES_3DFX 0x86B4
-#define GL_MULTISAMPLE_BIT_3DFX 0x20000000
-#endif /* GL_3DFX_multisample */
-
-#ifndef GL_3DFX_tbuffer
-#define GL_3DFX_tbuffer 1
-typedef void (APIENTRYP PFNGLTBUFFERMASK3DFXPROC) (GLuint mask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTbufferMask3DFX (GLuint mask);
-#endif
-#endif /* GL_3DFX_tbuffer */
-
-#ifndef GL_3DFX_texture_compression_FXT1
-#define GL_3DFX_texture_compression_FXT1 1
-#define GL_COMPRESSED_RGB_FXT1_3DFX 0x86B0
-#define GL_COMPRESSED_RGBA_FXT1_3DFX 0x86B1
-#endif /* GL_3DFX_texture_compression_FXT1 */
-
-#ifndef GL_AMD_blend_minmax_factor
-#define GL_AMD_blend_minmax_factor 1
-#define GL_FACTOR_MIN_AMD 0x901C
-#define GL_FACTOR_MAX_AMD 0x901D
-#endif /* GL_AMD_blend_minmax_factor */
-
-#ifndef GL_AMD_conservative_depth
-#define GL_AMD_conservative_depth 1
-#endif /* GL_AMD_conservative_depth */
-
-#ifndef GL_AMD_debug_output
-#define GL_AMD_debug_output 1
-typedef void (APIENTRY *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam);
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_AMD 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_AMD 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_AMD 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_AMD 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_AMD 0x9147
-#define GL_DEBUG_SEVERITY_LOW_AMD 0x9148
-#define GL_DEBUG_CATEGORY_API_ERROR_AMD 0x9149
-#define GL_DEBUG_CATEGORY_WINDOW_SYSTEM_AMD 0x914A
-#define GL_DEBUG_CATEGORY_DEPRECATION_AMD 0x914B
-#define GL_DEBUG_CATEGORY_UNDEFINED_BEHAVIOR_AMD 0x914C
-#define GL_DEBUG_CATEGORY_PERFORMANCE_AMD 0x914D
-#define GL_DEBUG_CATEGORY_SHADER_COMPILER_AMD 0x914E
-#define GL_DEBUG_CATEGORY_APPLICATION_AMD 0x914F
-#define GL_DEBUG_CATEGORY_OTHER_AMD 0x9150
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEENABLEAMDPROC) (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGEINSERTAMDPROC) (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
-typedef void (APIENTRYP PFNGLDEBUGMESSAGECALLBACKAMDPROC) (GLDEBUGPROCAMD callback, void *userParam);
-typedef GLuint (APIENTRYP PFNGLGETDEBUGMESSAGELOGAMDPROC) (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDebugMessageEnableAMD (GLenum category, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GLAPI void APIENTRY glDebugMessageInsertAMD (GLenum category, GLenum severity, GLuint id, GLsizei length, const GLchar *buf);
-GLAPI void APIENTRY glDebugMessageCallbackAMD (GLDEBUGPROCAMD callback, void *userParam);
-GLAPI GLuint APIENTRY glGetDebugMessageLogAMD (GLuint count, GLsizei bufsize, GLenum *categories, GLuint *severities, GLuint *ids, GLsizei *lengths, GLchar *message);
-#endif
-#endif /* GL_AMD_debug_output */
-
-#ifndef GL_AMD_depth_clamp_separate
-#define GL_AMD_depth_clamp_separate 1
-#define GL_DEPTH_CLAMP_NEAR_AMD 0x901E
-#define GL_DEPTH_CLAMP_FAR_AMD 0x901F
-#endif /* GL_AMD_depth_clamp_separate */
-
-#ifndef GL_AMD_draw_buffers_blend
-#define GL_AMD_draw_buffers_blend 1
-typedef void (APIENTRYP PFNGLBLENDFUNCINDEXEDAMDPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONINDEXEDAMDPROC) (GLuint buf, GLenum mode);
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEINDEXEDAMDPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncIndexedAMD (GLuint buf, GLenum src, GLenum dst);
-GLAPI void APIENTRY glBlendFuncSeparateIndexedAMD (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GLAPI void APIENTRY glBlendEquationIndexedAMD (GLuint buf, GLenum mode);
-GLAPI void APIENTRY glBlendEquationSeparateIndexedAMD (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-#endif
-#endif /* GL_AMD_draw_buffers_blend */
-
-#ifndef GL_AMD_framebuffer_sample_positions
-#define GL_AMD_framebuffer_sample_positions 1
-#define GL_SUBSAMPLE_DISTANCE_AMD 0x883F
-#define GL_PIXELS_PER_SAMPLE_PATTERN_X_AMD 0x91AE
-#define GL_PIXELS_PER_SAMPLE_PATTERN_Y_AMD 0x91AF
-#define GL_ALL_PIXELS_AMD 0xFFFFFFFF
-typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLEPOSITIONSFVAMDPROC) (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERFVAMDPROC) (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERFVAMDPROC) (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferSamplePositionsfvAMD (GLenum target, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
-GLAPI void APIENTRY glNamedFramebufferSamplePositionsfvAMD (GLuint framebuffer, GLuint numsamples, GLuint pixelindex, const GLfloat *values);
-GLAPI void APIENTRY glGetFramebufferParameterfvAMD (GLenum target, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
-GLAPI void APIENTRY glGetNamedFramebufferParameterfvAMD (GLuint framebuffer, GLenum pname, GLuint numsamples, GLuint pixelindex, GLsizei size, GLfloat *values);
-#endif
-#endif /* GL_AMD_framebuffer_sample_positions */
-
-#ifndef GL_AMD_gcn_shader
-#define GL_AMD_gcn_shader 1
-#endif /* GL_AMD_gcn_shader */
-
-#ifndef GL_AMD_gpu_shader_half_float
-#define GL_AMD_gpu_shader_half_float 1
-#define GL_FLOAT16_NV 0x8FF8
-#define GL_FLOAT16_VEC2_NV 0x8FF9
-#define GL_FLOAT16_VEC3_NV 0x8FFA
-#define GL_FLOAT16_VEC4_NV 0x8FFB
-#define GL_FLOAT16_MAT2_AMD 0x91C5
-#define GL_FLOAT16_MAT3_AMD 0x91C6
-#define GL_FLOAT16_MAT4_AMD 0x91C7
-#define GL_FLOAT16_MAT2x3_AMD 0x91C8
-#define GL_FLOAT16_MAT2x4_AMD 0x91C9
-#define GL_FLOAT16_MAT3x2_AMD 0x91CA
-#define GL_FLOAT16_MAT3x4_AMD 0x91CB
-#define GL_FLOAT16_MAT4x2_AMD 0x91CC
-#define GL_FLOAT16_MAT4x3_AMD 0x91CD
-#endif /* GL_AMD_gpu_shader_half_float */
-
-#ifndef GL_AMD_gpu_shader_int16
-#define GL_AMD_gpu_shader_int16 1
-#endif /* GL_AMD_gpu_shader_int16 */
-
-#ifndef GL_AMD_gpu_shader_int64
-#define GL_AMD_gpu_shader_int64 1
-typedef int64_t GLint64EXT;
-#define GL_INT64_NV 0x140E
-#define GL_UNSIGNED_INT64_NV 0x140F
-#define GL_INT8_NV 0x8FE0
-#define GL_INT8_VEC2_NV 0x8FE1
-#define GL_INT8_VEC3_NV 0x8FE2
-#define GL_INT8_VEC4_NV 0x8FE3
-#define GL_INT16_NV 0x8FE4
-#define GL_INT16_VEC2_NV 0x8FE5
-#define GL_INT16_VEC3_NV 0x8FE6
-#define GL_INT16_VEC4_NV 0x8FE7
-#define GL_INT64_VEC2_NV 0x8FE9
-#define GL_INT64_VEC3_NV 0x8FEA
-#define GL_INT64_VEC4_NV 0x8FEB
-#define GL_UNSIGNED_INT8_NV 0x8FEC
-#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
-#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
-#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
-#define GL_UNSIGNED_INT16_NV 0x8FF0
-#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
-#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
-#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
-#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
-typedef void (APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
-typedef void (APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
-typedef void (APIENTRYP PFNGLGETUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
-GLAPI void APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
-GLAPI void APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
-GLAPI void APIENTRY glGetUniformui64vNV (GLuint program, GLint location, GLuint64EXT *params);
-GLAPI void APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
-GLAPI void APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GLAPI void APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
-GLAPI void APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#endif
-#endif /* GL_AMD_gpu_shader_int64 */
-
-#ifndef GL_AMD_interleaved_elements
-#define GL_AMD_interleaved_elements 1
-#define GL_VERTEX_ELEMENT_SWIZZLE_AMD 0x91A4
-#define GL_VERTEX_ID_SWIZZLE_AMD 0x91A5
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPARAMETERIAMDPROC) (GLuint index, GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribParameteriAMD (GLuint index, GLenum pname, GLint param);
-#endif
-#endif /* GL_AMD_interleaved_elements */
-
-#ifndef GL_AMD_multi_draw_indirect
-#define GL_AMD_multi_draw_indirect 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTAMDPROC) (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTAMDPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectAMD (GLenum mode, const void *indirect, GLsizei primcount, GLsizei stride);
-GLAPI void APIENTRY glMultiDrawElementsIndirectAMD (GLenum mode, GLenum type, const void *indirect, GLsizei primcount, GLsizei stride);
-#endif
-#endif /* GL_AMD_multi_draw_indirect */
-
-#ifndef GL_AMD_name_gen_delete
-#define GL_AMD_name_gen_delete 1
-#define GL_DATA_BUFFER_AMD 0x9151
-#define GL_PERFORMANCE_MONITOR_AMD 0x9152
-#define GL_QUERY_OBJECT_AMD 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_AMD 0x9154
-#define GL_SAMPLER_OBJECT_AMD 0x9155
-typedef void (APIENTRYP PFNGLGENNAMESAMDPROC) (GLenum identifier, GLuint num, GLuint *names);
-typedef void (APIENTRYP PFNGLDELETENAMESAMDPROC) (GLenum identifier, GLuint num, const GLuint *names);
-typedef GLboolean (APIENTRYP PFNGLISNAMEAMDPROC) (GLenum identifier, GLuint name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenNamesAMD (GLenum identifier, GLuint num, GLuint *names);
-GLAPI void APIENTRY glDeleteNamesAMD (GLenum identifier, GLuint num, const GLuint *names);
-GLAPI GLboolean APIENTRY glIsNameAMD (GLenum identifier, GLuint name);
-#endif
-#endif /* GL_AMD_name_gen_delete */
-
-#ifndef GL_AMD_occlusion_query_event
-#define GL_AMD_occlusion_query_event 1
-#define GL_OCCLUSION_QUERY_EVENT_MASK_AMD 0x874F
-#define GL_QUERY_DEPTH_PASS_EVENT_BIT_AMD 0x00000001
-#define GL_QUERY_DEPTH_FAIL_EVENT_BIT_AMD 0x00000002
-#define GL_QUERY_STENCIL_FAIL_EVENT_BIT_AMD 0x00000004
-#define GL_QUERY_DEPTH_BOUNDS_FAIL_EVENT_BIT_AMD 0x00000008
-#define GL_QUERY_ALL_EVENT_BITS_AMD 0xFFFFFFFF
-typedef void (APIENTRYP PFNGLQUERYOBJECTPARAMETERUIAMDPROC) (GLenum target, GLuint id, GLenum pname, GLuint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glQueryObjectParameteruiAMD (GLenum target, GLuint id, GLenum pname, GLuint param);
-#endif
-#endif /* GL_AMD_occlusion_query_event */
-
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-typedef void (APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
-typedef void (APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-typedef void (APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-GLAPI void APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-GLAPI void APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-GLAPI void APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-GLAPI void APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
-GLAPI void APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GLAPI void APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GLAPI void APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-GLAPI void APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
-GLAPI void APIENTRY glEndPerfMonitorAMD (GLuint monitor);
-GLAPI void APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-#endif /* GL_AMD_performance_monitor */
-
-#ifndef GL_AMD_pinned_memory
-#define GL_AMD_pinned_memory 1
-#define GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD 0x9160
-#endif /* GL_AMD_pinned_memory */
-
-#ifndef GL_AMD_query_buffer_object
-#define GL_AMD_query_buffer_object 1
-#define GL_QUERY_BUFFER_AMD 0x9192
-#define GL_QUERY_BUFFER_BINDING_AMD 0x9193
-#define GL_QUERY_RESULT_NO_WAIT_AMD 0x9194
-#endif /* GL_AMD_query_buffer_object */
-
-#ifndef GL_AMD_sample_positions
-#define GL_AMD_sample_positions 1
-typedef void (APIENTRYP PFNGLSETMULTISAMPLEFVAMDPROC) (GLenum pname, GLuint index, const GLfloat *val);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSetMultisamplefvAMD (GLenum pname, GLuint index, const GLfloat *val);
-#endif
-#endif /* GL_AMD_sample_positions */
-
-#ifndef GL_AMD_seamless_cubemap_per_texture
-#define GL_AMD_seamless_cubemap_per_texture 1
-#endif /* GL_AMD_seamless_cubemap_per_texture */
-
-#ifndef GL_AMD_shader_atomic_counter_ops
-#define GL_AMD_shader_atomic_counter_ops 1
-#endif /* GL_AMD_shader_atomic_counter_ops */
-
-#ifndef GL_AMD_shader_ballot
-#define GL_AMD_shader_ballot 1
-#endif /* GL_AMD_shader_ballot */
-
-#ifndef GL_AMD_shader_explicit_vertex_parameter
-#define GL_AMD_shader_explicit_vertex_parameter 1
-#endif /* GL_AMD_shader_explicit_vertex_parameter */
-
-#ifndef GL_AMD_shader_gpu_shader_half_float_fetch
-#define GL_AMD_shader_gpu_shader_half_float_fetch 1
-#endif /* GL_AMD_shader_gpu_shader_half_float_fetch */
-
-#ifndef GL_AMD_shader_image_load_store_lod
-#define GL_AMD_shader_image_load_store_lod 1
-#endif /* GL_AMD_shader_image_load_store_lod */
-
-#ifndef GL_AMD_shader_stencil_export
-#define GL_AMD_shader_stencil_export 1
-#endif /* GL_AMD_shader_stencil_export */
-
-#ifndef GL_AMD_shader_trinary_minmax
-#define GL_AMD_shader_trinary_minmax 1
-#endif /* GL_AMD_shader_trinary_minmax */
-
-#ifndef GL_AMD_sparse_texture
-#define GL_AMD_sparse_texture 1
-#define GL_VIRTUAL_PAGE_SIZE_X_AMD 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_AMD 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_AMD 0x9197
-#define GL_MAX_SPARSE_TEXTURE_SIZE_AMD 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_AMD 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS 0x919A
-#define GL_MIN_SPARSE_LEVEL_AMD 0x919B
-#define GL_MIN_LOD_WARNING_AMD 0x919C
-#define GL_TEXTURE_STORAGE_SPARSE_BIT_AMD 0x00000001
-typedef void (APIENTRYP PFNGLTEXSTORAGESPARSEAMDPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGESPARSEAMDPROC) (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexStorageSparseAMD (GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-GLAPI void APIENTRY glTextureStorageSparseAMD (GLuint texture, GLenum target, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLsizei layers, GLbitfield flags);
-#endif
-#endif /* GL_AMD_sparse_texture */
-
-#ifndef GL_AMD_stencil_operation_extended
-#define GL_AMD_stencil_operation_extended 1
-#define GL_SET_AMD 0x874A
-#define GL_REPLACE_VALUE_AMD 0x874B
-#define GL_STENCIL_OP_VALUE_AMD 0x874C
-#define GL_STENCIL_BACK_OP_VALUE_AMD 0x874D
-typedef void (APIENTRYP PFNGLSTENCILOPVALUEAMDPROC) (GLenum face, GLuint value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilOpValueAMD (GLenum face, GLuint value);
-#endif
-#endif /* GL_AMD_stencil_operation_extended */
-
-#ifndef GL_AMD_texture_gather_bias_lod
-#define GL_AMD_texture_gather_bias_lod 1
-#endif /* GL_AMD_texture_gather_bias_lod */
-
-#ifndef GL_AMD_texture_texture4
-#define GL_AMD_texture_texture4 1
-#endif /* GL_AMD_texture_texture4 */
-
-#ifndef GL_AMD_transform_feedback3_lines_triangles
-#define GL_AMD_transform_feedback3_lines_triangles 1
-#endif /* GL_AMD_transform_feedback3_lines_triangles */
-
-#ifndef GL_AMD_transform_feedback4
-#define GL_AMD_transform_feedback4 1
-#define GL_STREAM_RASTERIZATION_AMD 0x91A0
-#endif /* GL_AMD_transform_feedback4 */
-
-#ifndef GL_AMD_vertex_shader_layer
-#define GL_AMD_vertex_shader_layer 1
-#endif /* GL_AMD_vertex_shader_layer */
-
-#ifndef GL_AMD_vertex_shader_tessellator
-#define GL_AMD_vertex_shader_tessellator 1
-#define GL_SAMPLER_BUFFER_AMD 0x9001
-#define GL_INT_SAMPLER_BUFFER_AMD 0x9002
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_AMD 0x9003
-#define GL_TESSELLATION_MODE_AMD 0x9004
-#define GL_TESSELLATION_FACTOR_AMD 0x9005
-#define GL_DISCRETE_AMD 0x9006
-#define GL_CONTINUOUS_AMD 0x9007
-typedef void (APIENTRYP PFNGLTESSELLATIONFACTORAMDPROC) (GLfloat factor);
-typedef void (APIENTRYP PFNGLTESSELLATIONMODEAMDPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTessellationFactorAMD (GLfloat factor);
-GLAPI void APIENTRY glTessellationModeAMD (GLenum mode);
-#endif
-#endif /* GL_AMD_vertex_shader_tessellator */
-
-#ifndef GL_AMD_vertex_shader_viewport_index
-#define GL_AMD_vertex_shader_viewport_index 1
-#endif /* GL_AMD_vertex_shader_viewport_index */
-
-#ifndef GL_APPLE_aux_depth_stencil
-#define GL_APPLE_aux_depth_stencil 1
-#define GL_AUX_DEPTH_STENCIL_APPLE 0x8A14
-#endif /* GL_APPLE_aux_depth_stencil */
-
-#ifndef GL_APPLE_client_storage
-#define GL_APPLE_client_storage 1
-#define GL_UNPACK_CLIENT_STORAGE_APPLE 0x85B2
-#endif /* GL_APPLE_client_storage */
-
-#ifndef GL_APPLE_element_array
-#define GL_APPLE_element_array 1
-#define GL_ELEMENT_ARRAY_APPLE 0x8A0C
-#define GL_ELEMENT_ARRAY_TYPE_APPLE 0x8A0D
-#define GL_ELEMENT_ARRAY_POINTER_APPLE 0x8A0E
-typedef void (APIENTRYP PFNGLELEMENTPOINTERAPPLEPROC) (GLenum type, const void *pointer);
-typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTARRAYAPPLEPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWRANGEELEMENTARRAYAPPLEPROC) (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerAPPLE (GLenum type, const void *pointer);
-GLAPI void APIENTRY glDrawElementArrayAPPLE (GLenum mode, GLint first, GLsizei count);
-GLAPI void APIENTRY glDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, GLint first, GLsizei count);
-GLAPI void APIENTRY glMultiDrawElementArrayAPPLE (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-GLAPI void APIENTRY glMultiDrawRangeElementArrayAPPLE (GLenum mode, GLuint start, GLuint end, const GLint *first, const GLsizei *count, GLsizei primcount);
-#endif
-#endif /* GL_APPLE_element_array */
-
-#ifndef GL_APPLE_fence
-#define GL_APPLE_fence 1
-#define GL_DRAW_PIXELS_APPLE 0x8A0A
-#define GL_FENCE_APPLE 0x8A0B
-typedef void (APIENTRYP PFNGLGENFENCESAPPLEPROC) (GLsizei n, GLuint *fences);
-typedef void (APIENTRYP PFNGLDELETEFENCESAPPLEPROC) (GLsizei n, const GLuint *fences);
-typedef void (APIENTRYP PFNGLSETFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLISFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTFENCEAPPLEPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLFINISHFENCEAPPLEPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTOBJECTAPPLEPROC) (GLenum object, GLuint name);
-typedef void (APIENTRYP PFNGLFINISHOBJECTAPPLEPROC) (GLenum object, GLint name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenFencesAPPLE (GLsizei n, GLuint *fences);
-GLAPI void APIENTRY glDeleteFencesAPPLE (GLsizei n, const GLuint *fences);
-GLAPI void APIENTRY glSetFenceAPPLE (GLuint fence);
-GLAPI GLboolean APIENTRY glIsFenceAPPLE (GLuint fence);
-GLAPI GLboolean APIENTRY glTestFenceAPPLE (GLuint fence);
-GLAPI void APIENTRY glFinishFenceAPPLE (GLuint fence);
-GLAPI GLboolean APIENTRY glTestObjectAPPLE (GLenum object, GLuint name);
-GLAPI void APIENTRY glFinishObjectAPPLE (GLenum object, GLint name);
-#endif
-#endif /* GL_APPLE_fence */
-
-#ifndef GL_APPLE_float_pixels
-#define GL_APPLE_float_pixels 1
-#define GL_HALF_APPLE 0x140B
-#define GL_RGBA_FLOAT32_APPLE 0x8814
-#define GL_RGB_FLOAT32_APPLE 0x8815
-#define GL_ALPHA_FLOAT32_APPLE 0x8816
-#define GL_INTENSITY_FLOAT32_APPLE 0x8817
-#define GL_LUMINANCE_FLOAT32_APPLE 0x8818
-#define GL_LUMINANCE_ALPHA_FLOAT32_APPLE 0x8819
-#define GL_RGBA_FLOAT16_APPLE 0x881A
-#define GL_RGB_FLOAT16_APPLE 0x881B
-#define GL_ALPHA_FLOAT16_APPLE 0x881C
-#define GL_INTENSITY_FLOAT16_APPLE 0x881D
-#define GL_LUMINANCE_FLOAT16_APPLE 0x881E
-#define GL_LUMINANCE_ALPHA_FLOAT16_APPLE 0x881F
-#define GL_COLOR_FLOAT_APPLE 0x8A0F
-#endif /* GL_APPLE_float_pixels */
-
-#ifndef GL_APPLE_flush_buffer_range
-#define GL_APPLE_flush_buffer_range 1
-#define GL_BUFFER_SERIALIZED_MODIFY_APPLE 0x8A12
-#define GL_BUFFER_FLUSHING_UNMAP_APPLE 0x8A13
-typedef void (APIENTRYP PFNGLBUFFERPARAMETERIAPPLEPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEAPPLEPROC) (GLenum target, GLintptr offset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferParameteriAPPLE (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glFlushMappedBufferRangeAPPLE (GLenum target, GLintptr offset, GLsizeiptr size);
-#endif
-#endif /* GL_APPLE_flush_buffer_range */
-
-#ifndef GL_APPLE_object_purgeable
-#define GL_APPLE_object_purgeable 1
-#define GL_BUFFER_OBJECT_APPLE 0x85B3
-#define GL_RELEASED_APPLE 0x8A19
-#define GL_VOLATILE_APPLE 0x8A1A
-#define GL_RETAINED_APPLE 0x8A1B
-#define GL_UNDEFINED_APPLE 0x8A1C
-#define GL_PURGEABLE_APPLE 0x8A1D
-typedef GLenum (APIENTRYP PFNGLOBJECTPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
-typedef GLenum (APIENTRYP PFNGLOBJECTUNPURGEABLEAPPLEPROC) (GLenum objectType, GLuint name, GLenum option);
-typedef void (APIENTRYP PFNGLGETOBJECTPARAMETERIVAPPLEPROC) (GLenum objectType, GLuint name, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLenum APIENTRY glObjectPurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
-GLAPI GLenum APIENTRY glObjectUnpurgeableAPPLE (GLenum objectType, GLuint name, GLenum option);
-GLAPI void APIENTRY glGetObjectParameterivAPPLE (GLenum objectType, GLuint name, GLenum pname, GLint *params);
-#endif
-#endif /* GL_APPLE_object_purgeable */
-
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#define GL_RGB_RAW_422_APPLE 0x8A51
-#endif /* GL_APPLE_rgb_422 */
-
-#ifndef GL_APPLE_row_bytes
-#define GL_APPLE_row_bytes 1
-#define GL_PACK_ROW_BYTES_APPLE 0x8A15
-#define GL_UNPACK_ROW_BYTES_APPLE 0x8A16
-#endif /* GL_APPLE_row_bytes */
-
-#ifndef GL_APPLE_specular_vector
-#define GL_APPLE_specular_vector 1
-#define GL_LIGHT_MODEL_SPECULAR_VECTOR_APPLE 0x85B0
-#endif /* GL_APPLE_specular_vector */
-
-#ifndef GL_APPLE_texture_range
-#define GL_APPLE_texture_range 1
-#define GL_TEXTURE_RANGE_LENGTH_APPLE 0x85B7
-#define GL_TEXTURE_RANGE_POINTER_APPLE 0x85B8
-#define GL_TEXTURE_STORAGE_HINT_APPLE 0x85BC
-#define GL_STORAGE_PRIVATE_APPLE 0x85BD
-#define GL_STORAGE_CACHED_APPLE 0x85BE
-#define GL_STORAGE_SHARED_APPLE 0x85BF
-typedef void (APIENTRYP PFNGLTEXTURERANGEAPPLEPROC) (GLenum target, GLsizei length, const void *pointer);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERPOINTERVAPPLEPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureRangeAPPLE (GLenum target, GLsizei length, const void *pointer);
-GLAPI void APIENTRY glGetTexParameterPointervAPPLE (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_APPLE_texture_range */
-
-#ifndef GL_APPLE_transform_hint
-#define GL_APPLE_transform_hint 1
-#define GL_TRANSFORM_HINT_APPLE 0x85B1
-#endif /* GL_APPLE_transform_hint */
-
-#ifndef GL_APPLE_vertex_array_object
-#define GL_APPLE_vertex_array_object 1
-#define GL_VERTEX_ARRAY_BINDING_APPLE 0x85B5
-typedef void (APIENTRYP PFNGLBINDVERTEXARRAYAPPLEPROC) (GLuint array);
-typedef void (APIENTRYP PFNGLDELETEVERTEXARRAYSAPPLEPROC) (GLsizei n, const GLuint *arrays);
-typedef void (APIENTRYP PFNGLGENVERTEXARRAYSAPPLEPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (APIENTRYP PFNGLISVERTEXARRAYAPPLEPROC) (GLuint array);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindVertexArrayAPPLE (GLuint array);
-GLAPI void APIENTRY glDeleteVertexArraysAPPLE (GLsizei n, const GLuint *arrays);
-GLAPI void APIENTRY glGenVertexArraysAPPLE (GLsizei n, GLuint *arrays);
-GLAPI GLboolean APIENTRY glIsVertexArrayAPPLE (GLuint array);
-#endif
-#endif /* GL_APPLE_vertex_array_object */
-
-#ifndef GL_APPLE_vertex_array_range
-#define GL_APPLE_vertex_array_range 1
-#define GL_VERTEX_ARRAY_RANGE_APPLE 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_APPLE 0x851E
-#define GL_VERTEX_ARRAY_STORAGE_HINT_APPLE 0x851F
-#define GL_VERTEX_ARRAY_RANGE_POINTER_APPLE 0x8521
-#define GL_STORAGE_CLIENT_APPLE 0x85B4
-typedef void (APIENTRYP PFNGLVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
-typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGEAPPLEPROC) (GLsizei length, void *pointer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYPARAMETERIAPPLEPROC) (GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexArrayRangeAPPLE (GLsizei length, void *pointer);
-GLAPI void APIENTRY glFlushVertexArrayRangeAPPLE (GLsizei length, void *pointer);
-GLAPI void APIENTRY glVertexArrayParameteriAPPLE (GLenum pname, GLint param);
-#endif
-#endif /* GL_APPLE_vertex_array_range */
-
-#ifndef GL_APPLE_vertex_program_evaluators
-#define GL_APPLE_vertex_program_evaluators 1
-#define GL_VERTEX_ATTRIB_MAP1_APPLE 0x8A00
-#define GL_VERTEX_ATTRIB_MAP2_APPLE 0x8A01
-#define GL_VERTEX_ATTRIB_MAP1_SIZE_APPLE 0x8A02
-#define GL_VERTEX_ATTRIB_MAP1_COEFF_APPLE 0x8A03
-#define GL_VERTEX_ATTRIB_MAP1_ORDER_APPLE 0x8A04
-#define GL_VERTEX_ATTRIB_MAP1_DOMAIN_APPLE 0x8A05
-#define GL_VERTEX_ATTRIB_MAP2_SIZE_APPLE 0x8A06
-#define GL_VERTEX_ATTRIB_MAP2_COEFF_APPLE 0x8A07
-#define GL_VERTEX_ATTRIB_MAP2_ORDER_APPLE 0x8A08
-#define GL_VERTEX_ATTRIB_MAP2_DOMAIN_APPLE 0x8A09
-typedef void (APIENTRYP PFNGLENABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXATTRIBAPPLEPROC) (GLuint index, GLenum pname);
-typedef GLboolean (APIENTRYP PFNGLISVERTEXATTRIBENABLEDAPPLEPROC) (GLuint index, GLenum pname);
-typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
-typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB1FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
-typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2DAPPLEPROC) (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
-typedef void (APIENTRYP PFNGLMAPVERTEXATTRIB2FAPPLEPROC) (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glEnableVertexAttribAPPLE (GLuint index, GLenum pname);
-GLAPI void APIENTRY glDisableVertexAttribAPPLE (GLuint index, GLenum pname);
-GLAPI GLboolean APIENTRY glIsVertexAttribEnabledAPPLE (GLuint index, GLenum pname);
-GLAPI void APIENTRY glMapVertexAttrib1dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points);
-GLAPI void APIENTRY glMapVertexAttrib1fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points);
-GLAPI void APIENTRY glMapVertexAttrib2dAPPLE (GLuint index, GLuint size, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points);
-GLAPI void APIENTRY glMapVertexAttrib2fAPPLE (GLuint index, GLuint size, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points);
-#endif
-#endif /* GL_APPLE_vertex_program_evaluators */
-
-#ifndef GL_APPLE_ycbcr_422
-#define GL_APPLE_ycbcr_422 1
-#define GL_YCBCR_422_APPLE 0x85B9
-#endif /* GL_APPLE_ycbcr_422 */
-
-#ifndef GL_ATI_draw_buffers
-#define GL_ATI_draw_buffers 1
-#define GL_MAX_DRAW_BUFFERS_ATI 0x8824
-#define GL_DRAW_BUFFER0_ATI 0x8825
-#define GL_DRAW_BUFFER1_ATI 0x8826
-#define GL_DRAW_BUFFER2_ATI 0x8827
-#define GL_DRAW_BUFFER3_ATI 0x8828
-#define GL_DRAW_BUFFER4_ATI 0x8829
-#define GL_DRAW_BUFFER5_ATI 0x882A
-#define GL_DRAW_BUFFER6_ATI 0x882B
-#define GL_DRAW_BUFFER7_ATI 0x882C
-#define GL_DRAW_BUFFER8_ATI 0x882D
-#define GL_DRAW_BUFFER9_ATI 0x882E
-#define GL_DRAW_BUFFER10_ATI 0x882F
-#define GL_DRAW_BUFFER11_ATI 0x8830
-#define GL_DRAW_BUFFER12_ATI 0x8831
-#define GL_DRAW_BUFFER13_ATI 0x8832
-#define GL_DRAW_BUFFER14_ATI 0x8833
-#define GL_DRAW_BUFFER15_ATI 0x8834
-typedef void (APIENTRYP PFNGLDRAWBUFFERSATIPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawBuffersATI (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_ATI_draw_buffers */
-
-#ifndef GL_ATI_element_array
-#define GL_ATI_element_array 1
-#define GL_ELEMENT_ARRAY_ATI 0x8768
-#define GL_ELEMENT_ARRAY_TYPE_ATI 0x8769
-#define GL_ELEMENT_ARRAY_POINTER_ATI 0x876A
-typedef void (APIENTRYP PFNGLELEMENTPOINTERATIPROC) (GLenum type, const void *pointer);
-typedef void (APIENTRYP PFNGLDRAWELEMENTARRAYATIPROC) (GLenum mode, GLsizei count);
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTARRAYATIPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glElementPointerATI (GLenum type, const void *pointer);
-GLAPI void APIENTRY glDrawElementArrayATI (GLenum mode, GLsizei count);
-GLAPI void APIENTRY glDrawRangeElementArrayATI (GLenum mode, GLuint start, GLuint end, GLsizei count);
-#endif
-#endif /* GL_ATI_element_array */
-
-#ifndef GL_ATI_envmap_bumpmap
-#define GL_ATI_envmap_bumpmap 1
-#define GL_BUMP_ROT_MATRIX_ATI 0x8775
-#define GL_BUMP_ROT_MATRIX_SIZE_ATI 0x8776
-#define GL_BUMP_NUM_TEX_UNITS_ATI 0x8777
-#define GL_BUMP_TEX_UNITS_ATI 0x8778
-#define GL_DUDV_ATI 0x8779
-#define GL_DU8DV8_ATI 0x877A
-#define GL_BUMP_ENVMAP_ATI 0x877B
-#define GL_BUMP_TARGET_ATI 0x877C
-typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERIVATIPROC) (GLenum pname, const GLint *param);
-typedef void (APIENTRYP PFNGLTEXBUMPPARAMETERFVATIPROC) (GLenum pname, const GLfloat *param);
-typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERIVATIPROC) (GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETTEXBUMPPARAMETERFVATIPROC) (GLenum pname, GLfloat *param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBumpParameterivATI (GLenum pname, const GLint *param);
-GLAPI void APIENTRY glTexBumpParameterfvATI (GLenum pname, const GLfloat *param);
-GLAPI void APIENTRY glGetTexBumpParameterivATI (GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetTexBumpParameterfvATI (GLenum pname, GLfloat *param);
-#endif
-#endif /* GL_ATI_envmap_bumpmap */
-
-#ifndef GL_ATI_fragment_shader
-#define GL_ATI_fragment_shader 1
-#define GL_FRAGMENT_SHADER_ATI 0x8920
-#define GL_REG_0_ATI 0x8921
-#define GL_REG_1_ATI 0x8922
-#define GL_REG_2_ATI 0x8923
-#define GL_REG_3_ATI 0x8924
-#define GL_REG_4_ATI 0x8925
-#define GL_REG_5_ATI 0x8926
-#define GL_REG_6_ATI 0x8927
-#define GL_REG_7_ATI 0x8928
-#define GL_REG_8_ATI 0x8929
-#define GL_REG_9_ATI 0x892A
-#define GL_REG_10_ATI 0x892B
-#define GL_REG_11_ATI 0x892C
-#define GL_REG_12_ATI 0x892D
-#define GL_REG_13_ATI 0x892E
-#define GL_REG_14_ATI 0x892F
-#define GL_REG_15_ATI 0x8930
-#define GL_REG_16_ATI 0x8931
-#define GL_REG_17_ATI 0x8932
-#define GL_REG_18_ATI 0x8933
-#define GL_REG_19_ATI 0x8934
-#define GL_REG_20_ATI 0x8935
-#define GL_REG_21_ATI 0x8936
-#define GL_REG_22_ATI 0x8937
-#define GL_REG_23_ATI 0x8938
-#define GL_REG_24_ATI 0x8939
-#define GL_REG_25_ATI 0x893A
-#define GL_REG_26_ATI 0x893B
-#define GL_REG_27_ATI 0x893C
-#define GL_REG_28_ATI 0x893D
-#define GL_REG_29_ATI 0x893E
-#define GL_REG_30_ATI 0x893F
-#define GL_REG_31_ATI 0x8940
-#define GL_CON_0_ATI 0x8941
-#define GL_CON_1_ATI 0x8942
-#define GL_CON_2_ATI 0x8943
-#define GL_CON_3_ATI 0x8944
-#define GL_CON_4_ATI 0x8945
-#define GL_CON_5_ATI 0x8946
-#define GL_CON_6_ATI 0x8947
-#define GL_CON_7_ATI 0x8948
-#define GL_CON_8_ATI 0x8949
-#define GL_CON_9_ATI 0x894A
-#define GL_CON_10_ATI 0x894B
-#define GL_CON_11_ATI 0x894C
-#define GL_CON_12_ATI 0x894D
-#define GL_CON_13_ATI 0x894E
-#define GL_CON_14_ATI 0x894F
-#define GL_CON_15_ATI 0x8950
-#define GL_CON_16_ATI 0x8951
-#define GL_CON_17_ATI 0x8952
-#define GL_CON_18_ATI 0x8953
-#define GL_CON_19_ATI 0x8954
-#define GL_CON_20_ATI 0x8955
-#define GL_CON_21_ATI 0x8956
-#define GL_CON_22_ATI 0x8957
-#define GL_CON_23_ATI 0x8958
-#define GL_CON_24_ATI 0x8959
-#define GL_CON_25_ATI 0x895A
-#define GL_CON_26_ATI 0x895B
-#define GL_CON_27_ATI 0x895C
-#define GL_CON_28_ATI 0x895D
-#define GL_CON_29_ATI 0x895E
-#define GL_CON_30_ATI 0x895F
-#define GL_CON_31_ATI 0x8960
-#define GL_MOV_ATI 0x8961
-#define GL_ADD_ATI 0x8963
-#define GL_MUL_ATI 0x8964
-#define GL_SUB_ATI 0x8965
-#define GL_DOT3_ATI 0x8966
-#define GL_DOT4_ATI 0x8967
-#define GL_MAD_ATI 0x8968
-#define GL_LERP_ATI 0x8969
-#define GL_CND_ATI 0x896A
-#define GL_CND0_ATI 0x896B
-#define GL_DOT2_ADD_ATI 0x896C
-#define GL_SECONDARY_INTERPOLATOR_ATI 0x896D
-#define GL_NUM_FRAGMENT_REGISTERS_ATI 0x896E
-#define GL_NUM_FRAGMENT_CONSTANTS_ATI 0x896F
-#define GL_NUM_PASSES_ATI 0x8970
-#define GL_NUM_INSTRUCTIONS_PER_PASS_ATI 0x8971
-#define GL_NUM_INSTRUCTIONS_TOTAL_ATI 0x8972
-#define GL_NUM_INPUT_INTERPOLATOR_COMPONENTS_ATI 0x8973
-#define GL_NUM_LOOPBACK_COMPONENTS_ATI 0x8974
-#define GL_COLOR_ALPHA_PAIRING_ATI 0x8975
-#define GL_SWIZZLE_STR_ATI 0x8976
-#define GL_SWIZZLE_STQ_ATI 0x8977
-#define GL_SWIZZLE_STR_DR_ATI 0x8978
-#define GL_SWIZZLE_STQ_DQ_ATI 0x8979
-#define GL_SWIZZLE_STRQ_ATI 0x897A
-#define GL_SWIZZLE_STRQ_DQ_ATI 0x897B
-#define GL_RED_BIT_ATI 0x00000001
-#define GL_GREEN_BIT_ATI 0x00000002
-#define GL_BLUE_BIT_ATI 0x00000004
-#define GL_2X_BIT_ATI 0x00000001
-#define GL_4X_BIT_ATI 0x00000002
-#define GL_8X_BIT_ATI 0x00000004
-#define GL_HALF_BIT_ATI 0x00000008
-#define GL_QUARTER_BIT_ATI 0x00000010
-#define GL_EIGHTH_BIT_ATI 0x00000020
-#define GL_SATURATE_BIT_ATI 0x00000040
-#define GL_COMP_BIT_ATI 0x00000002
-#define GL_NEGATE_BIT_ATI 0x00000004
-#define GL_BIAS_BIT_ATI 0x00000008
-typedef GLuint (APIENTRYP PFNGLGENFRAGMENTSHADERSATIPROC) (GLuint range);
-typedef void (APIENTRYP PFNGLBINDFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLDELETEFRAGMENTSHADERATIPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINFRAGMENTSHADERATIPROC) (void);
-typedef void (APIENTRYP PFNGLENDFRAGMENTSHADERATIPROC) (void);
-typedef void (APIENTRYP PFNGLPASSTEXCOORDATIPROC) (GLuint dst, GLuint coord, GLenum swizzle);
-typedef void (APIENTRYP PFNGLSAMPLEMAPATIPROC) (GLuint dst, GLuint interp, GLenum swizzle);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (APIENTRYP PFNGLCOLORFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP1ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP2ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-typedef void (APIENTRYP PFNGLALPHAFRAGMENTOP3ATIPROC) (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-typedef void (APIENTRYP PFNGLSETFRAGMENTSHADERCONSTANTATIPROC) (GLuint dst, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glGenFragmentShadersATI (GLuint range);
-GLAPI void APIENTRY glBindFragmentShaderATI (GLuint id);
-GLAPI void APIENTRY glDeleteFragmentShaderATI (GLuint id);
-GLAPI void APIENTRY glBeginFragmentShaderATI (void);
-GLAPI void APIENTRY glEndFragmentShaderATI (void);
-GLAPI void APIENTRY glPassTexCoordATI (GLuint dst, GLuint coord, GLenum swizzle);
-GLAPI void APIENTRY glSampleMapATI (GLuint dst, GLuint interp, GLenum swizzle);
-GLAPI void APIENTRY glColorFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-GLAPI void APIENTRY glColorFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-GLAPI void APIENTRY glColorFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMask, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-GLAPI void APIENTRY glAlphaFragmentOp1ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod);
-GLAPI void APIENTRY glAlphaFragmentOp2ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod);
-GLAPI void APIENTRY glAlphaFragmentOp3ATI (GLenum op, GLuint dst, GLuint dstMod, GLuint arg1, GLuint arg1Rep, GLuint arg1Mod, GLuint arg2, GLuint arg2Rep, GLuint arg2Mod, GLuint arg3, GLuint arg3Rep, GLuint arg3Mod);
-GLAPI void APIENTRY glSetFragmentShaderConstantATI (GLuint dst, const GLfloat *value);
-#endif
-#endif /* GL_ATI_fragment_shader */
-
-#ifndef GL_ATI_map_object_buffer
-#define GL_ATI_map_object_buffer 1
-typedef void *(APIENTRYP PFNGLMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLUNMAPOBJECTBUFFERATIPROC) (GLuint buffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void *APIENTRY glMapObjectBufferATI (GLuint buffer);
-GLAPI void APIENTRY glUnmapObjectBufferATI (GLuint buffer);
-#endif
-#endif /* GL_ATI_map_object_buffer */
-
-#ifndef GL_ATI_meminfo
-#define GL_ATI_meminfo 1
-#define GL_VBO_FREE_MEMORY_ATI 0x87FB
-#define GL_TEXTURE_FREE_MEMORY_ATI 0x87FC
-#define GL_RENDERBUFFER_FREE_MEMORY_ATI 0x87FD
-#endif /* GL_ATI_meminfo */
-
-#ifndef GL_ATI_pixel_format_float
-#define GL_ATI_pixel_format_float 1
-#define GL_RGBA_FLOAT_MODE_ATI 0x8820
-#define GL_COLOR_CLEAR_UNCLAMPED_VALUE_ATI 0x8835
-#endif /* GL_ATI_pixel_format_float */
-
-#ifndef GL_ATI_pn_triangles
-#define GL_ATI_pn_triangles 1
-#define GL_PN_TRIANGLES_ATI 0x87F0
-#define GL_MAX_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F1
-#define GL_PN_TRIANGLES_POINT_MODE_ATI 0x87F2
-#define GL_PN_TRIANGLES_NORMAL_MODE_ATI 0x87F3
-#define GL_PN_TRIANGLES_TESSELATION_LEVEL_ATI 0x87F4
-#define GL_PN_TRIANGLES_POINT_MODE_LINEAR_ATI 0x87F5
-#define GL_PN_TRIANGLES_POINT_MODE_CUBIC_ATI 0x87F6
-#define GL_PN_TRIANGLES_NORMAL_MODE_LINEAR_ATI 0x87F7
-#define GL_PN_TRIANGLES_NORMAL_MODE_QUADRATIC_ATI 0x87F8
-typedef void (APIENTRYP PFNGLPNTRIANGLESIATIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPNTRIANGLESFATIPROC) (GLenum pname, GLfloat param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPNTrianglesiATI (GLenum pname, GLint param);
-GLAPI void APIENTRY glPNTrianglesfATI (GLenum pname, GLfloat param);
-#endif
-#endif /* GL_ATI_pn_triangles */
-
-#ifndef GL_ATI_separate_stencil
-#define GL_ATI_separate_stencil 1
-#define GL_STENCIL_BACK_FUNC_ATI 0x8800
-#define GL_STENCIL_BACK_FAIL_ATI 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL_ATI 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS_ATI 0x8803
-typedef void (APIENTRYP PFNGLSTENCILOPSEPARATEATIPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (APIENTRYP PFNGLSTENCILFUNCSEPARATEATIPROC) (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilOpSeparateATI (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GLAPI void APIENTRY glStencilFuncSeparateATI (GLenum frontfunc, GLenum backfunc, GLint ref, GLuint mask);
-#endif
-#endif /* GL_ATI_separate_stencil */
-
-#ifndef GL_ATI_text_fragment_shader
-#define GL_ATI_text_fragment_shader 1
-#define GL_TEXT_FRAGMENT_SHADER_ATI 0x8200
-#endif /* GL_ATI_text_fragment_shader */
-
-#ifndef GL_ATI_texture_env_combine3
-#define GL_ATI_texture_env_combine3 1
-#define GL_MODULATE_ADD_ATI 0x8744
-#define GL_MODULATE_SIGNED_ADD_ATI 0x8745
-#define GL_MODULATE_SUBTRACT_ATI 0x8746
-#endif /* GL_ATI_texture_env_combine3 */
-
-#ifndef GL_ATI_texture_float
-#define GL_ATI_texture_float 1
-#define GL_RGBA_FLOAT32_ATI 0x8814
-#define GL_RGB_FLOAT32_ATI 0x8815
-#define GL_ALPHA_FLOAT32_ATI 0x8816
-#define GL_INTENSITY_FLOAT32_ATI 0x8817
-#define GL_LUMINANCE_FLOAT32_ATI 0x8818
-#define GL_LUMINANCE_ALPHA_FLOAT32_ATI 0x8819
-#define GL_RGBA_FLOAT16_ATI 0x881A
-#define GL_RGB_FLOAT16_ATI 0x881B
-#define GL_ALPHA_FLOAT16_ATI 0x881C
-#define GL_INTENSITY_FLOAT16_ATI 0x881D
-#define GL_LUMINANCE_FLOAT16_ATI 0x881E
-#define GL_LUMINANCE_ALPHA_FLOAT16_ATI 0x881F
-#endif /* GL_ATI_texture_float */
-
-#ifndef GL_ATI_texture_mirror_once
-#define GL_ATI_texture_mirror_once 1
-#define GL_MIRROR_CLAMP_ATI 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_ATI 0x8743
-#endif /* GL_ATI_texture_mirror_once */
-
-#ifndef GL_ATI_vertex_array_object
-#define GL_ATI_vertex_array_object 1
-#define GL_STATIC_ATI 0x8760
-#define GL_DYNAMIC_ATI 0x8761
-#define GL_PRESERVE_ATI 0x8762
-#define GL_DISCARD_ATI 0x8763
-#define GL_OBJECT_BUFFER_SIZE_ATI 0x8764
-#define GL_OBJECT_BUFFER_USAGE_ATI 0x8765
-#define GL_ARRAY_OBJECT_BUFFER_ATI 0x8766
-#define GL_ARRAY_OBJECT_OFFSET_ATI 0x8767
-typedef GLuint (APIENTRYP PFNGLNEWOBJECTBUFFERATIPROC) (GLsizei size, const void *pointer, GLenum usage);
-typedef GLboolean (APIENTRYP PFNGLISOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLUPDATEOBJECTBUFFERATIPROC) (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve);
-typedef void (APIENTRYP PFNGLGETOBJECTBUFFERFVATIPROC) (GLuint buffer, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETOBJECTBUFFERIVATIPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLFREEOBJECTBUFFERATIPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLARRAYOBJECTATIPROC) (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETARRAYOBJECTFVATIPROC) (GLenum array, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETARRAYOBJECTIVATIPROC) (GLenum array, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLVARIANTARRAYOBJECTATIPROC) (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTFVATIPROC) (GLuint id, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVARIANTARRAYOBJECTIVATIPROC) (GLuint id, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glNewObjectBufferATI (GLsizei size, const void *pointer, GLenum usage);
-GLAPI GLboolean APIENTRY glIsObjectBufferATI (GLuint buffer);
-GLAPI void APIENTRY glUpdateObjectBufferATI (GLuint buffer, GLuint offset, GLsizei size, const void *pointer, GLenum preserve);
-GLAPI void APIENTRY glGetObjectBufferfvATI (GLuint buffer, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetObjectBufferivATI (GLuint buffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glFreeObjectBufferATI (GLuint buffer);
-GLAPI void APIENTRY glArrayObjectATI (GLenum array, GLint size, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-GLAPI void APIENTRY glGetArrayObjectfvATI (GLenum array, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetArrayObjectivATI (GLenum array, GLenum pname, GLint *params);
-GLAPI void APIENTRY glVariantArrayObjectATI (GLuint id, GLenum type, GLsizei stride, GLuint buffer, GLuint offset);
-GLAPI void APIENTRY glGetVariantArrayObjectfvATI (GLuint id, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVariantArrayObjectivATI (GLuint id, GLenum pname, GLint *params);
-#endif
-#endif /* GL_ATI_vertex_array_object */
-
-#ifndef GL_ATI_vertex_attrib_array_object
-#define GL_ATI_vertex_attrib_array_object 1
-typedef void (APIENTRYP PFNGLVERTEXATTRIBARRAYOBJECTATIPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTFVATIPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBARRAYOBJECTIVATIPROC) (GLuint index, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribArrayObjectATI (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLuint buffer, GLuint offset);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectfvATI (GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVertexAttribArrayObjectivATI (GLuint index, GLenum pname, GLint *params);
-#endif
-#endif /* GL_ATI_vertex_attrib_array_object */
-
-#ifndef GL_ATI_vertex_streams
-#define GL_ATI_vertex_streams 1
-#define GL_MAX_VERTEX_STREAMS_ATI 0x876B
-#define GL_VERTEX_STREAM0_ATI 0x876C
-#define GL_VERTEX_STREAM1_ATI 0x876D
-#define GL_VERTEX_STREAM2_ATI 0x876E
-#define GL_VERTEX_STREAM3_ATI 0x876F
-#define GL_VERTEX_STREAM4_ATI 0x8770
-#define GL_VERTEX_STREAM5_ATI 0x8771
-#define GL_VERTEX_STREAM6_ATI 0x8772
-#define GL_VERTEX_STREAM7_ATI 0x8773
-#define GL_VERTEX_SOURCE_ATI 0x8774
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1SATIPROC) (GLenum stream, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1IATIPROC) (GLenum stream, GLint x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1FATIPROC) (GLenum stream, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1DATIPROC) (GLenum stream, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM1DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2SATIPROC) (GLenum stream, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2IATIPROC) (GLenum stream, GLint x, GLint y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2FATIPROC) (GLenum stream, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2DATIPROC) (GLenum stream, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM2DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3IATIPROC) (GLenum stream, GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4SATIPROC) (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4IATIPROC) (GLenum stream, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4FATIPROC) (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4DATIPROC) (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXSTREAM4DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3BATIPROC) (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3BVATIPROC) (GLenum stream, const GLbyte *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3SATIPROC) (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3SVATIPROC) (GLenum stream, const GLshort *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3IATIPROC) (GLenum stream, GLint nx, GLint ny, GLint nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3IVATIPROC) (GLenum stream, const GLint *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3FATIPROC) (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3FVATIPROC) (GLenum stream, const GLfloat *coords);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3DATIPROC) (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
-typedef void (APIENTRYP PFNGLNORMALSTREAM3DVATIPROC) (GLenum stream, const GLdouble *coords);
-typedef void (APIENTRYP PFNGLCLIENTACTIVEVERTEXSTREAMATIPROC) (GLenum stream);
-typedef void (APIENTRYP PFNGLVERTEXBLENDENVIATIPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLVERTEXBLENDENVFATIPROC) (GLenum pname, GLfloat param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexStream1sATI (GLenum stream, GLshort x);
-GLAPI void APIENTRY glVertexStream1svATI (GLenum stream, const GLshort *coords);
-GLAPI void APIENTRY glVertexStream1iATI (GLenum stream, GLint x);
-GLAPI void APIENTRY glVertexStream1ivATI (GLenum stream, const GLint *coords);
-GLAPI void APIENTRY glVertexStream1fATI (GLenum stream, GLfloat x);
-GLAPI void APIENTRY glVertexStream1fvATI (GLenum stream, const GLfloat *coords);
-GLAPI void APIENTRY glVertexStream1dATI (GLenum stream, GLdouble x);
-GLAPI void APIENTRY glVertexStream1dvATI (GLenum stream, const GLdouble *coords);
-GLAPI void APIENTRY glVertexStream2sATI (GLenum stream, GLshort x, GLshort y);
-GLAPI void APIENTRY glVertexStream2svATI (GLenum stream, const GLshort *coords);
-GLAPI void APIENTRY glVertexStream2iATI (GLenum stream, GLint x, GLint y);
-GLAPI void APIENTRY glVertexStream2ivATI (GLenum stream, const GLint *coords);
-GLAPI void APIENTRY glVertexStream2fATI (GLenum stream, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glVertexStream2fvATI (GLenum stream, const GLfloat *coords);
-GLAPI void APIENTRY glVertexStream2dATI (GLenum stream, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexStream2dvATI (GLenum stream, const GLdouble *coords);
-GLAPI void APIENTRY glVertexStream3sATI (GLenum stream, GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glVertexStream3svATI (GLenum stream, const GLshort *coords);
-GLAPI void APIENTRY glVertexStream3iATI (GLenum stream, GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glVertexStream3ivATI (GLenum stream, const GLint *coords);
-GLAPI void APIENTRY glVertexStream3fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glVertexStream3fvATI (GLenum stream, const GLfloat *coords);
-GLAPI void APIENTRY glVertexStream3dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexStream3dvATI (GLenum stream, const GLdouble *coords);
-GLAPI void APIENTRY glVertexStream4sATI (GLenum stream, GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glVertexStream4svATI (GLenum stream, const GLshort *coords);
-GLAPI void APIENTRY glVertexStream4iATI (GLenum stream, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glVertexStream4ivATI (GLenum stream, const GLint *coords);
-GLAPI void APIENTRY glVertexStream4fATI (GLenum stream, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glVertexStream4fvATI (GLenum stream, const GLfloat *coords);
-GLAPI void APIENTRY glVertexStream4dATI (GLenum stream, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexStream4dvATI (GLenum stream, const GLdouble *coords);
-GLAPI void APIENTRY glNormalStream3bATI (GLenum stream, GLbyte nx, GLbyte ny, GLbyte nz);
-GLAPI void APIENTRY glNormalStream3bvATI (GLenum stream, const GLbyte *coords);
-GLAPI void APIENTRY glNormalStream3sATI (GLenum stream, GLshort nx, GLshort ny, GLshort nz);
-GLAPI void APIENTRY glNormalStream3svATI (GLenum stream, const GLshort *coords);
-GLAPI void APIENTRY glNormalStream3iATI (GLenum stream, GLint nx, GLint ny, GLint nz);
-GLAPI void APIENTRY glNormalStream3ivATI (GLenum stream, const GLint *coords);
-GLAPI void APIENTRY glNormalStream3fATI (GLenum stream, GLfloat nx, GLfloat ny, GLfloat nz);
-GLAPI void APIENTRY glNormalStream3fvATI (GLenum stream, const GLfloat *coords);
-GLAPI void APIENTRY glNormalStream3dATI (GLenum stream, GLdouble nx, GLdouble ny, GLdouble nz);
-GLAPI void APIENTRY glNormalStream3dvATI (GLenum stream, const GLdouble *coords);
-GLAPI void APIENTRY glClientActiveVertexStreamATI (GLenum stream);
-GLAPI void APIENTRY glVertexBlendEnviATI (GLenum pname, GLint param);
-GLAPI void APIENTRY glVertexBlendEnvfATI (GLenum pname, GLfloat param);
-#endif
-#endif /* GL_ATI_vertex_streams */
-
-#ifndef GL_EXT_422_pixels
-#define GL_EXT_422_pixels 1
-#define GL_422_EXT 0x80CC
-#define GL_422_REV_EXT 0x80CD
-#define GL_422_AVERAGE_EXT 0x80CE
-#define GL_422_REV_AVERAGE_EXT 0x80CF
-#endif /* GL_EXT_422_pixels */
-
-#ifndef GL_EXT_EGL_image_storage
-#define GL_EXT_EGL_image_storage 1
-typedef void *GLeglImageOES;
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-typedef void (APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-GLAPI void APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#endif
-#endif /* GL_EXT_EGL_image_storage */
-
-#ifndef GL_EXT_abgr
-#define GL_EXT_abgr 1
-#define GL_ABGR_EXT 0x8000
-#endif /* GL_EXT_abgr */
-
-#ifndef GL_EXT_bgra
-#define GL_EXT_bgra 1
-#define GL_BGR_EXT 0x80E0
-#define GL_BGRA_EXT 0x80E1
-#endif /* GL_EXT_bgra */
-
-#ifndef GL_EXT_bindable_uniform
-#define GL_EXT_bindable_uniform 1
-#define GL_MAX_VERTEX_BINDABLE_UNIFORMS_EXT 0x8DE2
-#define GL_MAX_FRAGMENT_BINDABLE_UNIFORMS_EXT 0x8DE3
-#define GL_MAX_GEOMETRY_BINDABLE_UNIFORMS_EXT 0x8DE4
-#define GL_MAX_BINDABLE_UNIFORM_SIZE_EXT 0x8DED
-#define GL_UNIFORM_BUFFER_EXT 0x8DEE
-#define GL_UNIFORM_BUFFER_BINDING_EXT 0x8DEF
-typedef void (APIENTRYP PFNGLUNIFORMBUFFEREXTPROC) (GLuint program, GLint location, GLuint buffer);
-typedef GLint (APIENTRYP PFNGLGETUNIFORMBUFFERSIZEEXTPROC) (GLuint program, GLint location);
-typedef GLintptr (APIENTRYP PFNGLGETUNIFORMOFFSETEXTPROC) (GLuint program, GLint location);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUniformBufferEXT (GLuint program, GLint location, GLuint buffer);
-GLAPI GLint APIENTRY glGetUniformBufferSizeEXT (GLuint program, GLint location);
-GLAPI GLintptr APIENTRY glGetUniformOffsetEXT (GLuint program, GLint location);
-#endif
-#endif /* GL_EXT_bindable_uniform */
-
-#ifndef GL_EXT_blend_color
-#define GL_EXT_blend_color 1
-#define GL_CONSTANT_COLOR_EXT 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR_EXT 0x8002
-#define GL_CONSTANT_ALPHA_EXT 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA_EXT 0x8004
-#define GL_BLEND_COLOR_EXT 0x8005
-typedef void (APIENTRYP PFNGLBLENDCOLOREXTPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendColorEXT (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-#endif
-#endif /* GL_EXT_blend_color */
-
-#ifndef GL_EXT_blend_equation_separate
-#define GL_EXT_blend_equation_separate 1
-#define GL_BLEND_EQUATION_RGB_EXT 0x8009
-#define GL_BLEND_EQUATION_ALPHA_EXT 0x883D
-typedef void (APIENTRYP PFNGLBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, GLenum modeAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationSeparateEXT (GLenum modeRGB, GLenum modeAlpha);
-#endif
-#endif /* GL_EXT_blend_equation_separate */
-
-#ifndef GL_EXT_blend_func_separate
-#define GL_EXT_blend_func_separate 1
-#define GL_BLEND_DST_RGB_EXT 0x80C8
-#define GL_BLEND_SRC_RGB_EXT 0x80C9
-#define GL_BLEND_DST_ALPHA_EXT 0x80CA
-#define GL_BLEND_SRC_ALPHA_EXT 0x80CB
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEEXTPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateEXT (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#endif
-#endif /* GL_EXT_blend_func_separate */
-
-#ifndef GL_EXT_blend_logic_op
-#define GL_EXT_blend_logic_op 1
-#endif /* GL_EXT_blend_logic_op */
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#define GL_FUNC_ADD_EXT 0x8006
-#define GL_BLEND_EQUATION_EXT 0x8009
-typedef void (APIENTRYP PFNGLBLENDEQUATIONEXTPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendEquationEXT (GLenum mode);
-#endif
-#endif /* GL_EXT_blend_minmax */
-
-#ifndef GL_EXT_blend_subtract
-#define GL_EXT_blend_subtract 1
-#define GL_FUNC_SUBTRACT_EXT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_EXT 0x800B
-#endif /* GL_EXT_blend_subtract */
-
-#ifndef GL_EXT_clip_volume_hint
-#define GL_EXT_clip_volume_hint 1
-#define GL_CLIP_VOLUME_CLIPPING_HINT_EXT 0x80F0
-#endif /* GL_EXT_clip_volume_hint */
-
-#ifndef GL_EXT_cmyka
-#define GL_EXT_cmyka 1
-#define GL_CMYK_EXT 0x800C
-#define GL_CMYKA_EXT 0x800D
-#define GL_PACK_CMYK_HINT_EXT 0x800E
-#define GL_UNPACK_CMYK_HINT_EXT 0x800F
-#endif /* GL_EXT_cmyka */
-
-#ifndef GL_EXT_color_subtable
-#define GL_EXT_color_subtable 1
-typedef void (APIENTRYP PFNGLCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCOPYCOLORSUBTABLEEXTPROC) (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorSubTableEXT (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glCopyColorSubTableEXT (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width);
-#endif
-#endif /* GL_EXT_color_subtable */
-
-#ifndef GL_EXT_compiled_vertex_array
-#define GL_EXT_compiled_vertex_array 1
-#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
-#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
-typedef void (APIENTRYP PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLUNLOCKARRAYSEXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLockArraysEXT (GLint first, GLsizei count);
-GLAPI void APIENTRY glUnlockArraysEXT (void);
-#endif
-#endif /* GL_EXT_compiled_vertex_array */
-
-#ifndef GL_EXT_convolution
-#define GL_EXT_convolution 1
-#define GL_CONVOLUTION_1D_EXT 0x8010
-#define GL_CONVOLUTION_2D_EXT 0x8011
-#define GL_SEPARABLE_2D_EXT 0x8012
-#define GL_CONVOLUTION_BORDER_MODE_EXT 0x8013
-#define GL_CONVOLUTION_FILTER_SCALE_EXT 0x8014
-#define GL_CONVOLUTION_FILTER_BIAS_EXT 0x8015
-#define GL_REDUCE_EXT 0x8016
-#define GL_CONVOLUTION_FORMAT_EXT 0x8017
-#define GL_CONVOLUTION_WIDTH_EXT 0x8018
-#define GL_CONVOLUTION_HEIGHT_EXT 0x8019
-#define GL_MAX_CONVOLUTION_WIDTH_EXT 0x801A
-#define GL_MAX_CONVOLUTION_HEIGHT_EXT 0x801B
-#define GL_POST_CONVOLUTION_RED_SCALE_EXT 0x801C
-#define GL_POST_CONVOLUTION_GREEN_SCALE_EXT 0x801D
-#define GL_POST_CONVOLUTION_BLUE_SCALE_EXT 0x801E
-#define GL_POST_CONVOLUTION_ALPHA_SCALE_EXT 0x801F
-#define GL_POST_CONVOLUTION_RED_BIAS_EXT 0x8020
-#define GL_POST_CONVOLUTION_GREEN_BIAS_EXT 0x8021
-#define GL_POST_CONVOLUTION_BLUE_BIAS_EXT 0x8022
-#define GL_POST_CONVOLUTION_ALPHA_BIAS_EXT 0x8023
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint params);
-typedef void (APIENTRYP PFNGLCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER1DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYCONVOLUTIONFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *image);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCONVOLUTIONPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETSEPARABLEFILTEREXTPROC) (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-typedef void (APIENTRYP PFNGLSEPARABLEFILTER2DEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *image);
-GLAPI void APIENTRY glConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *image);
-GLAPI void APIENTRY glConvolutionParameterfEXT (GLenum target, GLenum pname, GLfloat params);
-GLAPI void APIENTRY glConvolutionParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glConvolutionParameteriEXT (GLenum target, GLenum pname, GLint params);
-GLAPI void APIENTRY glConvolutionParameterivEXT (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glCopyConvolutionFilter1DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyConvolutionFilter2DEXT (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetConvolutionFilterEXT (GLenum target, GLenum format, GLenum type, void *image);
-GLAPI void APIENTRY glGetConvolutionParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetConvolutionParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetSeparableFilterEXT (GLenum target, GLenum format, GLenum type, void *row, void *column, void *span);
-GLAPI void APIENTRY glSeparableFilter2DEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *row, const void *column);
-#endif
-#endif /* GL_EXT_convolution */
-
-#ifndef GL_EXT_coordinate_frame
-#define GL_EXT_coordinate_frame 1
-#define GL_TANGENT_ARRAY_EXT 0x8439
-#define GL_BINORMAL_ARRAY_EXT 0x843A
-#define GL_CURRENT_TANGENT_EXT 0x843B
-#define GL_CURRENT_BINORMAL_EXT 0x843C
-#define GL_TANGENT_ARRAY_TYPE_EXT 0x843E
-#define GL_TANGENT_ARRAY_STRIDE_EXT 0x843F
-#define GL_BINORMAL_ARRAY_TYPE_EXT 0x8440
-#define GL_BINORMAL_ARRAY_STRIDE_EXT 0x8441
-#define GL_TANGENT_ARRAY_POINTER_EXT 0x8442
-#define GL_BINORMAL_ARRAY_POINTER_EXT 0x8443
-#define GL_MAP1_TANGENT_EXT 0x8444
-#define GL_MAP2_TANGENT_EXT 0x8445
-#define GL_MAP1_BINORMAL_EXT 0x8446
-#define GL_MAP2_BINORMAL_EXT 0x8447
-typedef void (APIENTRYP PFNGLTANGENT3BEXTPROC) (GLbyte tx, GLbyte ty, GLbyte tz);
-typedef void (APIENTRYP PFNGLTANGENT3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLTANGENT3DEXTPROC) (GLdouble tx, GLdouble ty, GLdouble tz);
-typedef void (APIENTRYP PFNGLTANGENT3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLTANGENT3FEXTPROC) (GLfloat tx, GLfloat ty, GLfloat tz);
-typedef void (APIENTRYP PFNGLTANGENT3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLTANGENT3IEXTPROC) (GLint tx, GLint ty, GLint tz);
-typedef void (APIENTRYP PFNGLTANGENT3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLTANGENT3SEXTPROC) (GLshort tx, GLshort ty, GLshort tz);
-typedef void (APIENTRYP PFNGLTANGENT3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLBINORMAL3BEXTPROC) (GLbyte bx, GLbyte by, GLbyte bz);
-typedef void (APIENTRYP PFNGLBINORMAL3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLBINORMAL3DEXTPROC) (GLdouble bx, GLdouble by, GLdouble bz);
-typedef void (APIENTRYP PFNGLBINORMAL3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLBINORMAL3FEXTPROC) (GLfloat bx, GLfloat by, GLfloat bz);
-typedef void (APIENTRYP PFNGLBINORMAL3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLBINORMAL3IEXTPROC) (GLint bx, GLint by, GLint bz);
-typedef void (APIENTRYP PFNGLBINORMAL3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLBINORMAL3SEXTPROC) (GLshort bx, GLshort by, GLshort bz);
-typedef void (APIENTRYP PFNGLBINORMAL3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLTANGENTPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLBINORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTangent3bEXT (GLbyte tx, GLbyte ty, GLbyte tz);
-GLAPI void APIENTRY glTangent3bvEXT (const GLbyte *v);
-GLAPI void APIENTRY glTangent3dEXT (GLdouble tx, GLdouble ty, GLdouble tz);
-GLAPI void APIENTRY glTangent3dvEXT (const GLdouble *v);
-GLAPI void APIENTRY glTangent3fEXT (GLfloat tx, GLfloat ty, GLfloat tz);
-GLAPI void APIENTRY glTangent3fvEXT (const GLfloat *v);
-GLAPI void APIENTRY glTangent3iEXT (GLint tx, GLint ty, GLint tz);
-GLAPI void APIENTRY glTangent3ivEXT (const GLint *v);
-GLAPI void APIENTRY glTangent3sEXT (GLshort tx, GLshort ty, GLshort tz);
-GLAPI void APIENTRY glTangent3svEXT (const GLshort *v);
-GLAPI void APIENTRY glBinormal3bEXT (GLbyte bx, GLbyte by, GLbyte bz);
-GLAPI void APIENTRY glBinormal3bvEXT (const GLbyte *v);
-GLAPI void APIENTRY glBinormal3dEXT (GLdouble bx, GLdouble by, GLdouble bz);
-GLAPI void APIENTRY glBinormal3dvEXT (const GLdouble *v);
-GLAPI void APIENTRY glBinormal3fEXT (GLfloat bx, GLfloat by, GLfloat bz);
-GLAPI void APIENTRY glBinormal3fvEXT (const GLfloat *v);
-GLAPI void APIENTRY glBinormal3iEXT (GLint bx, GLint by, GLint bz);
-GLAPI void APIENTRY glBinormal3ivEXT (const GLint *v);
-GLAPI void APIENTRY glBinormal3sEXT (GLshort bx, GLshort by, GLshort bz);
-GLAPI void APIENTRY glBinormal3svEXT (const GLshort *v);
-GLAPI void APIENTRY glTangentPointerEXT (GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glBinormalPointerEXT (GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_EXT_coordinate_frame */
-
-#ifndef GL_EXT_copy_texture
-#define GL_EXT_copy_texture 1
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE1DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXIMAGE2DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLCOPYTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCopyTexImage1DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyTexImage2DEXT (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glCopyTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_EXT_copy_texture */
-
-#ifndef GL_EXT_cull_vertex
-#define GL_EXT_cull_vertex 1
-#define GL_CULL_VERTEX_EXT 0x81AA
-#define GL_CULL_VERTEX_EYE_POSITION_EXT 0x81AB
-#define GL_CULL_VERTEX_OBJECT_POSITION_EXT 0x81AC
-typedef void (APIENTRYP PFNGLCULLPARAMETERDVEXTPROC) (GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLCULLPARAMETERFVEXTPROC) (GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCullParameterdvEXT (GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glCullParameterfvEXT (GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_EXT_cull_vertex */
-
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-typedef void (APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GLAPI void APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_EXT_debug_label */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-typedef void (APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GLAPI void APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GLAPI void APIENTRY glPopGroupMarkerEXT (void);
-#endif
-#endif /* GL_EXT_debug_marker */
-
-#ifndef GL_EXT_depth_bounds_test
-#define GL_EXT_depth_bounds_test 1
-#define GL_DEPTH_BOUNDS_TEST_EXT 0x8890
-#define GL_DEPTH_BOUNDS_EXT 0x8891
-typedef void (APIENTRYP PFNGLDEPTHBOUNDSEXTPROC) (GLclampd zmin, GLclampd zmax);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDepthBoundsEXT (GLclampd zmin, GLclampd zmax);
-#endif
-#endif /* GL_EXT_depth_bounds_test */
-
-#ifndef GL_EXT_direct_state_access
-#define GL_EXT_direct_state_access 1
-#define GL_PROGRAM_MATRIX_EXT 0x8E2D
-#define GL_TRANSPOSE_PROGRAM_MATRIX_EXT 0x8E2E
-#define GL_PROGRAM_MATRIX_STACK_DEPTH_EXT 0x8E2F
-typedef void (APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLPUSHCLIENTATTRIBDEFAULTEXTPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERFVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETTEXTURELEVELPARAMETERIVEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLBINDMULTITEXTUREEXTPROC) (GLenum texunit, GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLMULTITEXCOORDPOINTEREXTPROC) (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLMULTITEXENVFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXENVIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENDEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
-typedef void (APIENTRYP PFNGLMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENFEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXGENIEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXENVFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXENVIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENDVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENFVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXGENIVEXTPROC) (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERFVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXLEVELPARAMETERIVEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLCOPYMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLENABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEINDEXEDEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLGETFLOATINDEXEDVEXTPROC) (GLenum target, GLuint index, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETDOUBLEINDEXEDVEXTPROC) (GLenum target, GLuint index, GLdouble *data);
-typedef void (APIENTRYP PFNGLGETPOINTERINDEXEDVEXTPROC) (GLenum target, GLuint index, void **data);
-typedef void (APIENTRYP PFNGLENABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef GLboolean (APIENTRYP PFNGLISENABLEDINDEXEDEXTPROC) (GLenum target, GLuint index);
-typedef void (APIENTRYP PFNGLGETINTEGERINDEXEDVEXTPROC) (GLenum target, GLuint index, GLint *data);
-typedef void (APIENTRYP PFNGLGETBOOLEANINDEXEDVEXTPROC) (GLenum target, GLuint index, GLboolean *data);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTUREIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE3DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE2DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDTEXTURESUBIMAGE1DEXTPROC) (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDTEXTUREIMAGEEXTPROC) (GLuint texture, GLenum target, GLint lod, void *img);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE3DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE2DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLCOMPRESSEDMULTITEXSUBIMAGE1DEXTPROC) (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-typedef void (APIENTRYP PFNGLGETCOMPRESSEDMULTITEXIMAGEEXTPROC) (GLenum texunit, GLenum target, GLint lod, void *img);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFEREXTPROC) (GLuint buffer, GLenum access);
-typedef GLboolean (APIENTRYP PFNGLUNMAPNAMEDBUFFEREXTPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERIVEXTPROC) (GLuint buffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPOINTERVEXTPROC) (GLuint buffer, GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFEREXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLMULTITEXBUFFEREXTPROC) (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXTUREPARAMETERIUIVEXTPROC) (GLuint texture, GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMULTITEXPARAMETERIUIVEXTPROC) (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IEXTPROC) (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4IVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLuint *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETERSI4UIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERIUIVEXTPROC) (GLuint program, GLenum target, GLuint index, GLuint *params);
-typedef void (APIENTRYP PFNGLENABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLECLIENTSTATEIEXTPROC) (GLenum array, GLuint index);
-typedef void (APIENTRYP PFNGLGETFLOATI_VEXTPROC) (GLenum pname, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETDOUBLEI_VEXTPROC) (GLenum pname, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPOINTERI_VEXTPROC) (GLenum pname, GLuint index, void **params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4DVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLdouble *params);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLNAMEDPROGRAMLOCALPARAMETER4FVEXTPROC) (GLuint program, GLenum target, GLuint index, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERDVEXTPROC) (GLuint program, GLenum target, GLuint index, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMLOCALPARAMETERFVEXTPROC) (GLuint program, GLenum target, GLuint index, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMIVEXTPROC) (GLuint program, GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETNAMEDPROGRAMSTRINGEXTPROC) (GLuint program, GLenum target, GLenum pname, void *string);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEEXTPROC) (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETNAMEDRENDERBUFFERPARAMETERIVEXTPROC) (GLuint renderbuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLECOVERAGEEXTPROC) (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef GLenum (APIENTRYP PFNGLCHECKNAMEDFRAMEBUFFERSTATUSEXTPROC) (GLuint framebuffer, GLenum target);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE1DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE2DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURE3DEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERRENDERBUFFEREXTPROC) (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATETEXTUREMIPMAPEXTPROC) (GLuint texture, GLenum target);
-typedef void (APIENTRYP PFNGLGENERATEMULTITEXMIPMAPEXTPROC) (GLenum texunit, GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERDRAWBUFFERSEXTPROC) (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERREADBUFFEREXTPROC) (GLuint framebuffer, GLenum mode);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLNAMEDCOPYBUFFERSUBDATAEXTPROC) (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTURELAYEREXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERTEXTUREFACEEXTPROC) (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
-typedef void (APIENTRYP PFNGLTEXTURERENDERBUFFEREXTPROC) (GLuint texture, GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLMULTITEXRENDERBUFFEREXTPROC) (GLenum texunit, GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYEDGEFLAGOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYINDEXOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYNORMALOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYTEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYMULTITEXCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYFOGCOORDOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYSECONDARYCOLOROFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYEXTPROC) (GLuint vaobj, GLenum array);
-typedef void (APIENTRYP PFNGLENABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLDISABLEVERTEXARRAYATTRIBEXTPROC) (GLuint vaobj, GLuint index);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERVEXTPROC) (GLuint vaobj, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERVEXTPROC) (GLuint vaobj, GLenum pname, void **param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYINTEGERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-typedef void (APIENTRYP PFNGLGETVERTEXARRAYPOINTERI_VEXTPROC) (GLuint vaobj, GLuint index, GLenum pname, void **param);
-typedef void *(APIENTRYP PFNGLMAPNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (APIENTRYP PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTPROC) (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLCLEARNAMEDBUFFERSUBDATAEXTPROC) (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERPARAMETERIEXTPROC) (GLuint framebuffer, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVEXTPROC) (GLuint framebuffer, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DEXTPROC) (GLuint program, GLint location, GLdouble x);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DEXTPROC) (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM1DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM2DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM3DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORM4DVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3DVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-typedef void (APIENTRYP PFNGLTEXTUREBUFFERRANGEEXTPROC) (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE2DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGE3DMULTISAMPLEEXTPROC) (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-typedef void (APIENTRYP PFNGLVERTEXARRAYBINDVERTEXBUFFEREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBIFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLFORMATEXTPROC) (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBBINDINGEXTPROC) (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXBINDINGDIVISOREXTPROC) (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBLOFFSETEXTPROC) (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-typedef void (APIENTRYP PFNGLTEXTUREPAGECOMMITMENTEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-typedef void (APIENTRYP PFNGLVERTEXARRAYVERTEXATTRIBDIVISOREXTPROC) (GLuint vaobj, GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
-GLAPI void APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI void APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GLAPI void APIENTRY glMatrixPopEXT (GLenum mode);
-GLAPI void APIENTRY glMatrixPushEXT (GLenum mode);
-GLAPI void APIENTRY glClientAttribDefaultEXT (GLbitfield mask);
-GLAPI void APIENTRY glPushClientAttribDefaultEXT (GLbitfield mask);
-GLAPI void APIENTRY glTextureParameterfEXT (GLuint texture, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glTextureParameteriEXT (GLuint texture, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetTextureImageEXT (GLuint texture, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetTextureParameterfvEXT (GLuint texture, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureParameterivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureLevelParameterfvEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetTextureLevelParameterivEXT (GLuint texture, GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glBindMultiTextureEXT (GLenum texunit, GLenum target, GLuint texture);
-GLAPI void APIENTRY glMultiTexCoordPointerEXT (GLenum texunit, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glMultiTexEnvfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexEnviEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexGendEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble param);
-GLAPI void APIENTRY glMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLdouble *params);
-GLAPI void APIENTRY glMultiTexGenfEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexGeniEXT (GLenum texunit, GLenum coord, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glGetMultiTexEnvfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexEnvivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexGendvEXT (GLenum texunit, GLenum coord, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetMultiTexGenfvEXT (GLenum texunit, GLenum coord, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexGenivEXT (GLenum texunit, GLenum coord, GLenum pname, GLint *params);
-GLAPI void APIENTRY glMultiTexParameteriEXT (GLenum texunit, GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexParameterfEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border);
-GLAPI void APIENTRY glCopyMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GLAPI void APIENTRY glCopyMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glCopyMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetMultiTexImageEXT (GLenum texunit, GLenum target, GLint level, GLenum format, GLenum type, void *pixels);
-GLAPI void APIENTRY glGetMultiTexParameterfvEXT (GLenum texunit, GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexParameterivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexLevelParameterfvEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMultiTexLevelParameterivEXT (GLenum texunit, GLenum target, GLint level, GLenum pname, GLint *params);
-GLAPI void APIENTRY glMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glCopyMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glEnableClientStateIndexedEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glDisableClientStateIndexedEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glGetFloatIndexedvEXT (GLenum target, GLuint index, GLfloat *data);
-GLAPI void APIENTRY glGetDoubleIndexedvEXT (GLenum target, GLuint index, GLdouble *data);
-GLAPI void APIENTRY glGetPointerIndexedvEXT (GLenum target, GLuint index, void **data);
-GLAPI void APIENTRY glEnableIndexedEXT (GLenum target, GLuint index);
-GLAPI void APIENTRY glDisableIndexedEXT (GLenum target, GLuint index);
-GLAPI GLboolean APIENTRY glIsEnabledIndexedEXT (GLenum target, GLuint index);
-GLAPI void APIENTRY glGetIntegerIndexedvEXT (GLenum target, GLuint index, GLint *data);
-GLAPI void APIENTRY glGetBooleanIndexedvEXT (GLenum target, GLuint index, GLboolean *data);
-GLAPI void APIENTRY glCompressedTextureImage3DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureImage2DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureImage1DEXT (GLuint texture, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage3DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage2DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedTextureSubImage1DEXT (GLuint texture, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glGetCompressedTextureImageEXT (GLuint texture, GLenum target, GLint lod, void *img);
-GLAPI void APIENTRY glCompressedMultiTexImage3DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexImage2DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexImage1DEXT (GLenum texunit, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage3DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage2DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glCompressedMultiTexSubImage1DEXT (GLenum texunit, GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const void *bits);
-GLAPI void APIENTRY glGetCompressedMultiTexImageEXT (GLenum texunit, GLenum target, GLint lod, void *img);
-GLAPI void APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
-GLAPI void APIENTRY glNamedBufferDataEXT (GLuint buffer, GLsizeiptr size, const void *data, GLenum usage);
-GLAPI void APIENTRY glNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void *APIENTRY glMapNamedBufferEXT (GLuint buffer, GLenum access);
-GLAPI GLboolean APIENTRY glUnmapNamedBufferEXT (GLuint buffer);
-GLAPI void APIENTRY glGetNamedBufferParameterivEXT (GLuint buffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedBufferPointervEXT (GLuint buffer, GLenum pname, void **params);
-GLAPI void APIENTRY glGetNamedBufferSubDataEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, void *data);
-GLAPI void APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
-GLAPI void APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GLAPI void APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GLAPI void APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GLAPI void APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
-GLAPI void APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
-GLAPI void APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GLAPI void APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GLAPI void APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GLAPI void APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GLAPI void APIENTRY glTextureBufferEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glMultiTexBufferEXT (GLenum texunit, GLenum target, GLenum internalformat, GLuint buffer);
-GLAPI void APIENTRY glTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetTextureParameterIivEXT (GLuint texture, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTextureParameterIuivEXT (GLuint texture, GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetMultiTexParameterIivEXT (GLenum texunit, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMultiTexParameterIuivEXT (GLenum texunit, GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
-GLAPI void APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glNamedProgramLocalParameters4fvEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4iEXT (GLuint program, GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4ivEXT (GLuint program, GLenum target, GLuint index, const GLint *params);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4ivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLint *params);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uiEXT (GLuint program, GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glNamedProgramLocalParameterI4uivEXT (GLuint program, GLenum target, GLuint index, const GLuint *params);
-GLAPI void APIENTRY glNamedProgramLocalParametersI4uivEXT (GLuint program, GLenum target, GLuint index, GLsizei count, const GLuint *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIivEXT (GLuint program, GLenum target, GLuint index, GLint *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterIuivEXT (GLuint program, GLenum target, GLuint index, GLuint *params);
-GLAPI void APIENTRY glEnableClientStateiEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glDisableClientStateiEXT (GLenum array, GLuint index);
-GLAPI void APIENTRY glGetFloati_vEXT (GLenum pname, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetDoublei_vEXT (GLenum pname, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetPointeri_vEXT (GLenum pname, GLuint index, void **params);
-GLAPI void APIENTRY glNamedProgramStringEXT (GLuint program, GLenum target, GLenum format, GLsizei len, const void *string);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dEXT (GLuint program, GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glNamedProgramLocalParameter4dvEXT (GLuint program, GLenum target, GLuint index, const GLdouble *params);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fEXT (GLuint program, GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glNamedProgramLocalParameter4fvEXT (GLuint program, GLenum target, GLuint index, const GLfloat *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterdvEXT (GLuint program, GLenum target, GLuint index, GLdouble *params);
-GLAPI void APIENTRY glGetNamedProgramLocalParameterfvEXT (GLuint program, GLenum target, GLuint index, GLfloat *params);
-GLAPI void APIENTRY glGetNamedProgramivEXT (GLuint program, GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetNamedProgramStringEXT (GLuint program, GLenum target, GLenum pname, void *string);
-GLAPI void APIENTRY glNamedRenderbufferStorageEXT (GLuint renderbuffer, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetNamedRenderbufferParameterivEXT (GLuint renderbuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleEXT (GLuint renderbuffer, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glNamedRenderbufferStorageMultisampleCoverageEXT (GLuint renderbuffer, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI GLenum APIENTRY glCheckNamedFramebufferStatusEXT (GLuint framebuffer, GLenum target);
-GLAPI void APIENTRY glNamedFramebufferTexture1DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTexture2DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTexture3DEXT (GLuint framebuffer, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-GLAPI void APIENTRY glNamedFramebufferRenderbufferEXT (GLuint framebuffer, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glGetNamedFramebufferAttachmentParameterivEXT (GLuint framebuffer, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGenerateTextureMipmapEXT (GLuint texture, GLenum target);
-GLAPI void APIENTRY glGenerateMultiTexMipmapEXT (GLenum texunit, GLenum target);
-GLAPI void APIENTRY glFramebufferDrawBufferEXT (GLuint framebuffer, GLenum mode);
-GLAPI void APIENTRY glFramebufferDrawBuffersEXT (GLuint framebuffer, GLsizei n, const GLenum *bufs);
-GLAPI void APIENTRY glFramebufferReadBufferEXT (GLuint framebuffer, GLenum mode);
-GLAPI void APIENTRY glGetFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glNamedCopyBufferSubDataEXT (GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glNamedFramebufferTextureEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glNamedFramebufferTextureLayerEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GLAPI void APIENTRY glNamedFramebufferTextureFaceEXT (GLuint framebuffer, GLenum attachment, GLuint texture, GLint level, GLenum face);
-GLAPI void APIENTRY glTextureRenderbufferEXT (GLuint texture, GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glMultiTexRenderbufferEXT (GLenum texunit, GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glVertexArrayVertexOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayEdgeFlagOffsetEXT (GLuint vaobj, GLuint buffer, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayIndexOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayNormalOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayMultiTexCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum texunit, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayFogCoordOffsetEXT (GLuint vaobj, GLuint buffer, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArraySecondaryColorOffsetEXT (GLuint vaobj, GLuint buffer, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayVertexAttribOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glVertexArrayVertexAttribIOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glEnableVertexArrayEXT (GLuint vaobj, GLenum array);
-GLAPI void APIENTRY glDisableVertexArrayEXT (GLuint vaobj, GLenum array);
-GLAPI void APIENTRY glEnableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glDisableVertexArrayAttribEXT (GLuint vaobj, GLuint index);
-GLAPI void APIENTRY glGetVertexArrayIntegervEXT (GLuint vaobj, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayPointervEXT (GLuint vaobj, GLenum pname, void **param);
-GLAPI void APIENTRY glGetVertexArrayIntegeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, GLint *param);
-GLAPI void APIENTRY glGetVertexArrayPointeri_vEXT (GLuint vaobj, GLuint index, GLenum pname, void **param);
-GLAPI void *APIENTRY glMapNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GLAPI void APIENTRY glFlushMappedNamedBufferRangeEXT (GLuint buffer, GLintptr offset, GLsizeiptr length);
-GLAPI void APIENTRY glNamedBufferStorageEXT (GLuint buffer, GLsizeiptr size, const void *data, GLbitfield flags);
-GLAPI void APIENTRY glClearNamedBufferDataEXT (GLuint buffer, GLenum internalformat, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glClearNamedBufferSubDataEXT (GLuint buffer, GLenum internalformat, GLsizeiptr offset, GLsizeiptr size, GLenum format, GLenum type, const void *data);
-GLAPI void APIENTRY glNamedFramebufferParameteriEXT (GLuint framebuffer, GLenum pname, GLint param);
-GLAPI void APIENTRY glGetNamedFramebufferParameterivEXT (GLuint framebuffer, GLenum pname, GLint *params);
-GLAPI void APIENTRY glProgramUniform1dEXT (GLuint program, GLint location, GLdouble x);
-GLAPI void APIENTRY glProgramUniform2dEXT (GLuint program, GLint location, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glProgramUniform3dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glProgramUniform4dEXT (GLuint program, GLint location, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramUniform1dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform2dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform3dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniform4dvEXT (GLuint program, GLint location, GLsizei count, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix2x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix3x4dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x2dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glProgramUniformMatrix4x3dvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLdouble *value);
-GLAPI void APIENTRY glTextureBufferRangeEXT (GLuint texture, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GLAPI void APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glTextureStorage2DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glTextureStorage3DMultisampleEXT (GLuint texture, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-GLAPI void APIENTRY glVertexArrayBindVertexBufferEXT (GLuint vaobj, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride);
-GLAPI void APIENTRY glVertexArrayVertexAttribFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribIFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribLFormatEXT (GLuint vaobj, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset);
-GLAPI void APIENTRY glVertexArrayVertexAttribBindingEXT (GLuint vaobj, GLuint attribindex, GLuint bindingindex);
-GLAPI void APIENTRY glVertexArrayVertexBindingDivisorEXT (GLuint vaobj, GLuint bindingindex, GLuint divisor);
-GLAPI void APIENTRY glVertexArrayVertexAttribLOffsetEXT (GLuint vaobj, GLuint buffer, GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
-GLAPI void APIENTRY glTexturePageCommitmentEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-GLAPI void APIENTRY glVertexArrayVertexAttribDivisorEXT (GLuint vaobj, GLuint index, GLuint divisor);
-#endif
-#endif /* GL_EXT_direct_state_access */
-
-#ifndef GL_EXT_draw_buffers2
-#define GL_EXT_draw_buffers2 1
-typedef void (APIENTRYP PFNGLCOLORMASKINDEXEDEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorMaskIndexedEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-#endif
-#endif /* GL_EXT_draw_buffers2 */
-
-#ifndef GL_EXT_draw_instanced
-#define GL_EXT_draw_instanced 1
-typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-GLAPI void APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_draw_instanced */
-
-#ifndef GL_EXT_draw_range_elements
-#define GL_EXT_draw_range_elements 1
-#define GL_MAX_ELEMENTS_VERTICES_EXT 0x80E8
-#define GL_MAX_ELEMENTS_INDICES_EXT 0x80E9
-typedef void (APIENTRYP PFNGLDRAWRANGEELEMENTSEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawRangeElementsEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-#endif
-#endif /* GL_EXT_draw_range_elements */
-
-#ifndef GL_EXT_external_buffer
-#define GL_EXT_external_buffer 1
-typedef void *GLeglClientBufferEXT;
-typedef void (APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-GLAPI void APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-#endif
-#endif /* GL_EXT_external_buffer */
-
-#ifndef GL_EXT_fog_coord
-#define GL_EXT_fog_coord 1
-#define GL_FOG_COORDINATE_SOURCE_EXT 0x8450
-#define GL_FOG_COORDINATE_EXT 0x8451
-#define GL_FRAGMENT_DEPTH_EXT 0x8452
-#define GL_CURRENT_FOG_COORDINATE_EXT 0x8453
-#define GL_FOG_COORDINATE_ARRAY_TYPE_EXT 0x8454
-#define GL_FOG_COORDINATE_ARRAY_STRIDE_EXT 0x8455
-#define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456
-#define GL_FOG_COORDINATE_ARRAY_EXT 0x8457
-typedef void (APIENTRYP PFNGLFOGCOORDFEXTPROC) (GLfloat coord);
-typedef void (APIENTRYP PFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDEXTPROC) (GLdouble coord);
-typedef void (APIENTRYP PFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogCoordfEXT (GLfloat coord);
-GLAPI void APIENTRY glFogCoordfvEXT (const GLfloat *coord);
-GLAPI void APIENTRY glFogCoorddEXT (GLdouble coord);
-GLAPI void APIENTRY glFogCoorddvEXT (const GLdouble *coord);
-GLAPI void APIENTRY glFogCoordPointerEXT (GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_EXT_fog_coord */
-
-#ifndef GL_EXT_framebuffer_blit
-#define GL_EXT_framebuffer_blit 1
-#define GL_READ_FRAMEBUFFER_EXT 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_EXT 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_EXT 0x8CAA
-typedef void (APIENTRYP PFNGLBLITFRAMEBUFFEREXTPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlitFramebufferEXT (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* GL_EXT_framebuffer_blit */
-
-#ifndef GL_EXT_framebuffer_multisample
-#define GL_EXT_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_EXT_framebuffer_multisample */
-
-#ifndef GL_EXT_framebuffer_multisample_blit_scaled
-#define GL_EXT_framebuffer_multisample_blit_scaled 1
-#define GL_SCALED_RESOLVE_FASTEST_EXT 0x90BA
-#define GL_SCALED_RESOLVE_NICEST_EXT 0x90BB
-#endif /* GL_EXT_framebuffer_multisample_blit_scaled */
-
-#ifndef GL_EXT_framebuffer_object
-#define GL_EXT_framebuffer_object 1
-#define GL_INVALID_FRAMEBUFFER_OPERATION_EXT 0x0506
-#define GL_MAX_RENDERBUFFER_SIZE_EXT 0x84E8
-#define GL_FRAMEBUFFER_BINDING_EXT 0x8CA6
-#define GL_RENDERBUFFER_BINDING_EXT 0x8CA7
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_EXT 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_EXT 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_EXT 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_EXT 0x8CD3
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_EXT 0x8CD4
-#define GL_FRAMEBUFFER_COMPLETE_EXT 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_EXT 0x8CDA
-#define GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT 0x8CDB
-#define GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT 0x8CDC
-#define GL_FRAMEBUFFER_UNSUPPORTED_EXT 0x8CDD
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-#define GL_DEPTH_ATTACHMENT_EXT 0x8D00
-#define GL_STENCIL_ATTACHMENT_EXT 0x8D20
-#define GL_FRAMEBUFFER_EXT 0x8D40
-#define GL_RENDERBUFFER_EXT 0x8D41
-#define GL_RENDERBUFFER_WIDTH_EXT 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_EXT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_EXT 0x8D44
-#define GL_STENCIL_INDEX1_EXT 0x8D46
-#define GL_STENCIL_INDEX4_EXT 0x8D47
-#define GL_STENCIL_INDEX8_EXT 0x8D48
-#define GL_STENCIL_INDEX16_EXT 0x8D49
-#define GL_RENDERBUFFER_RED_SIZE_EXT 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_EXT 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_EXT 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_EXT 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_EXT 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_EXT 0x8D55
-typedef GLboolean (APIENTRYP PFNGLISRENDERBUFFEREXTPROC) (GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLBINDRENDERBUFFEREXTPROC) (GLenum target, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLDELETERENDERBUFFERSEXTPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLGENRENDERBUFFERSEXTPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEEXTPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLboolean (APIENTRYP PFNGLISFRAMEBUFFEREXTPROC) (GLuint framebuffer);
-typedef void (APIENTRYP PFNGLBINDFRAMEBUFFEREXTPROC) (GLenum target, GLuint framebuffer);
-typedef void (APIENTRYP PFNGLDELETEFRAMEBUFFERSEXTPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (APIENTRYP PFNGLGENFRAMEBUFFERSEXTPROC) (GLsizei n, GLuint *framebuffers);
-typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEREXTPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVEXTPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGENERATEMIPMAPEXTPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glIsRenderbufferEXT (GLuint renderbuffer);
-GLAPI void APIENTRY glBindRenderbufferEXT (GLenum target, GLuint renderbuffer);
-GLAPI void APIENTRY glDeleteRenderbuffersEXT (GLsizei n, const GLuint *renderbuffers);
-GLAPI void APIENTRY glGenRenderbuffersEXT (GLsizei n, GLuint *renderbuffers);
-GLAPI void APIENTRY glRenderbufferStorageEXT (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GLAPI void APIENTRY glGetRenderbufferParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI GLboolean APIENTRY glIsFramebufferEXT (GLuint framebuffer);
-GLAPI void APIENTRY glBindFramebufferEXT (GLenum target, GLuint framebuffer);
-GLAPI void APIENTRY glDeleteFramebuffersEXT (GLsizei n, const GLuint *framebuffers);
-GLAPI void APIENTRY glGenFramebuffersEXT (GLsizei n, GLuint *framebuffers);
-GLAPI GLenum APIENTRY glCheckFramebufferStatusEXT (GLenum target);
-GLAPI void APIENTRY glFramebufferTexture1DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture2DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTexture3DEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-GLAPI void APIENTRY glFramebufferRenderbufferEXT (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GLAPI void APIENTRY glGetFramebufferAttachmentParameterivEXT (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGenerateMipmapEXT (GLenum target);
-#endif
-#endif /* GL_EXT_framebuffer_object */
-
-#ifndef GL_EXT_framebuffer_sRGB
-#define GL_EXT_framebuffer_sRGB 1
-#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
-#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
-#endif /* GL_EXT_framebuffer_sRGB */
-
-#ifndef GL_EXT_geometry_shader4
-#define GL_EXT_geometry_shader4 1
-#define GL_GEOMETRY_SHADER_EXT 0x8DD9
-#define GL_GEOMETRY_VERTICES_OUT_EXT 0x8DDA
-#define GL_GEOMETRY_INPUT_TYPE_EXT 0x8DDB
-#define GL_GEOMETRY_OUTPUT_TYPE_EXT 0x8DDC
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
-#define GL_MAX_GEOMETRY_VARYING_COMPONENTS_EXT 0x8DDD
-#define GL_MAX_VERTEX_VARYING_COMPONENTS_EXT 0x8DDE
-#define GL_MAX_VARYING_COMPONENTS_EXT 0x8B4B
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
-#define GL_LINES_ADJACENCY_EXT 0x000A
-#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
-#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_COUNT_EXT 0x8DA9
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER_EXT 0x8CD4
-#define GL_PROGRAM_POINT_SIZE_EXT 0x8642
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
-#endif
-#endif /* GL_EXT_geometry_shader4 */
-
-#ifndef GL_EXT_gpu_program_parameters
-#define GL_EXT_gpu_program_parameters 1
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERS4FVEXTPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramEnvParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-GLAPI void APIENTRY glProgramLocalParameters4fvEXT (GLenum target, GLuint index, GLsizei count, const GLfloat *params);
-#endif
-#endif /* GL_EXT_gpu_program_parameters */
-
-#ifndef GL_EXT_gpu_shader4
-#define GL_EXT_gpu_shader4 1
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_EXT 0x88FD
-#define GL_SAMPLER_1D_ARRAY_EXT 0x8DC0
-#define GL_SAMPLER_2D_ARRAY_EXT 0x8DC1
-#define GL_SAMPLER_BUFFER_EXT 0x8DC2
-#define GL_SAMPLER_1D_ARRAY_SHADOW_EXT 0x8DC3
-#define GL_SAMPLER_2D_ARRAY_SHADOW_EXT 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW_EXT 0x8DC5
-#define GL_UNSIGNED_INT_VEC2_EXT 0x8DC6
-#define GL_UNSIGNED_INT_VEC3_EXT 0x8DC7
-#define GL_UNSIGNED_INT_VEC4_EXT 0x8DC8
-#define GL_INT_SAMPLER_1D_EXT 0x8DC9
-#define GL_INT_SAMPLER_2D_EXT 0x8DCA
-#define GL_INT_SAMPLER_3D_EXT 0x8DCB
-#define GL_INT_SAMPLER_CUBE_EXT 0x8DCC
-#define GL_INT_SAMPLER_2D_RECT_EXT 0x8DCD
-#define GL_INT_SAMPLER_1D_ARRAY_EXT 0x8DCE
-#define GL_INT_SAMPLER_2D_ARRAY_EXT 0x8DCF
-#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_1D_EXT 0x8DD1
-#define GL_UNSIGNED_INT_SAMPLER_2D_EXT 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D_EXT 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_EXT 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_2D_RECT_EXT 0x8DD5
-#define GL_UNSIGNED_INT_SAMPLER_1D_ARRAY_EXT 0x8DD6
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY_EXT 0x8DD7
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
-#define GL_MIN_PROGRAM_TEXEL_OFFSET_EXT 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET_EXT 0x8905
-typedef void (APIENTRYP PFNGLGETUNIFORMUIVEXTPROC) (GLuint program, GLint location, GLuint *params);
-typedef void (APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETFRAGDATALOCATIONEXTPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLUNIFORM1UIEXTPROC) (GLint location, GLuint v0);
-typedef void (APIENTRYP PFNGLUNIFORM2UIEXTPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (APIENTRYP PFNGLUNIFORM3UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (APIENTRYP PFNGLUNIFORM4UIEXTPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (APIENTRYP PFNGLUNIFORM1UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM2UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM3UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (APIENTRYP PFNGLUNIFORM4UIVEXTPROC) (GLint location, GLsizei count, const GLuint *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetUniformuivEXT (GLuint program, GLint location, GLuint *params);
-GLAPI void APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
-GLAPI GLint APIENTRY glGetFragDataLocationEXT (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glUniform1uiEXT (GLint location, GLuint v0);
-GLAPI void APIENTRY glUniform2uiEXT (GLint location, GLuint v0, GLuint v1);
-GLAPI void APIENTRY glUniform3uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GLAPI void APIENTRY glUniform4uiEXT (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GLAPI void APIENTRY glUniform1uivEXT (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform2uivEXT (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform3uivEXT (GLint location, GLsizei count, const GLuint *value);
-GLAPI void APIENTRY glUniform4uivEXT (GLint location, GLsizei count, const GLuint *value);
-#endif
-#endif /* GL_EXT_gpu_shader4 */
-
-#ifndef GL_EXT_histogram
-#define GL_EXT_histogram 1
-#define GL_HISTOGRAM_EXT 0x8024
-#define GL_PROXY_HISTOGRAM_EXT 0x8025
-#define GL_HISTOGRAM_WIDTH_EXT 0x8026
-#define GL_HISTOGRAM_FORMAT_EXT 0x8027
-#define GL_HISTOGRAM_RED_SIZE_EXT 0x8028
-#define GL_HISTOGRAM_GREEN_SIZE_EXT 0x8029
-#define GL_HISTOGRAM_BLUE_SIZE_EXT 0x802A
-#define GL_HISTOGRAM_ALPHA_SIZE_EXT 0x802B
-#define GL_HISTOGRAM_LUMINANCE_SIZE_EXT 0x802C
-#define GL_HISTOGRAM_SINK_EXT 0x802D
-#define GL_MINMAX_EXT 0x802E
-#define GL_MINMAX_FORMAT_EXT 0x802F
-#define GL_MINMAX_SINK_EXT 0x8030
-#define GL_TABLE_TOO_LARGE_EXT 0x8031
-typedef void (APIENTRYP PFNGLGETHISTOGRAMEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETHISTOGRAMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMINMAXEXTPROC) (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMINMAXPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLHISTOGRAMEXTPROC) (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLMINMAXEXTPROC) (GLenum target, GLenum internalformat, GLboolean sink);
-typedef void (APIENTRYP PFNGLRESETHISTOGRAMEXTPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLRESETMINMAXEXTPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetHistogramEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-GLAPI void APIENTRY glGetHistogramParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetHistogramParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMinmaxEXT (GLenum target, GLboolean reset, GLenum format, GLenum type, void *values);
-GLAPI void APIENTRY glGetMinmaxParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMinmaxParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glHistogramEXT (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink);
-GLAPI void APIENTRY glMinmaxEXT (GLenum target, GLenum internalformat, GLboolean sink);
-GLAPI void APIENTRY glResetHistogramEXT (GLenum target);
-GLAPI void APIENTRY glResetMinmaxEXT (GLenum target);
-#endif
-#endif /* GL_EXT_histogram */
-
-#ifndef GL_EXT_index_array_formats
-#define GL_EXT_index_array_formats 1
-#define GL_IUI_V2F_EXT 0x81AD
-#define GL_IUI_V3F_EXT 0x81AE
-#define GL_IUI_N3F_V2F_EXT 0x81AF
-#define GL_IUI_N3F_V3F_EXT 0x81B0
-#define GL_T2F_IUI_V2F_EXT 0x81B1
-#define GL_T2F_IUI_V3F_EXT 0x81B2
-#define GL_T2F_IUI_N3F_V2F_EXT 0x81B3
-#define GL_T2F_IUI_N3F_V3F_EXT 0x81B4
-#endif /* GL_EXT_index_array_formats */
-
-#ifndef GL_EXT_index_func
-#define GL_EXT_index_func 1
-#define GL_INDEX_TEST_EXT 0x81B5
-#define GL_INDEX_TEST_FUNC_EXT 0x81B6
-#define GL_INDEX_TEST_REF_EXT 0x81B7
-typedef void (APIENTRYP PFNGLINDEXFUNCEXTPROC) (GLenum func, GLclampf ref);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexFuncEXT (GLenum func, GLclampf ref);
-#endif
-#endif /* GL_EXT_index_func */
-
-#ifndef GL_EXT_index_material
-#define GL_EXT_index_material 1
-#define GL_INDEX_MATERIAL_EXT 0x81B8
-#define GL_INDEX_MATERIAL_PARAMETER_EXT 0x81B9
-#define GL_INDEX_MATERIAL_FACE_EXT 0x81BA
-typedef void (APIENTRYP PFNGLINDEXMATERIALEXTPROC) (GLenum face, GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIndexMaterialEXT (GLenum face, GLenum mode);
-#endif
-#endif /* GL_EXT_index_material */
-
-#ifndef GL_EXT_index_texture
-#define GL_EXT_index_texture 1
-#endif /* GL_EXT_index_texture */
-
-#ifndef GL_EXT_light_texture
-#define GL_EXT_light_texture 1
-#define GL_FRAGMENT_MATERIAL_EXT 0x8349
-#define GL_FRAGMENT_NORMAL_EXT 0x834A
-#define GL_FRAGMENT_COLOR_EXT 0x834C
-#define GL_ATTENUATION_EXT 0x834D
-#define GL_SHADOW_ATTENUATION_EXT 0x834E
-#define GL_TEXTURE_APPLICATION_MODE_EXT 0x834F
-#define GL_TEXTURE_LIGHT_EXT 0x8350
-#define GL_TEXTURE_MATERIAL_FACE_EXT 0x8351
-#define GL_TEXTURE_MATERIAL_PARAMETER_EXT 0x8352
-typedef void (APIENTRYP PFNGLAPPLYTEXTUREEXTPROC) (GLenum mode);
-typedef void (APIENTRYP PFNGLTEXTURELIGHTEXTPROC) (GLenum pname);
-typedef void (APIENTRYP PFNGLTEXTUREMATERIALEXTPROC) (GLenum face, GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glApplyTextureEXT (GLenum mode);
-GLAPI void APIENTRY glTextureLightEXT (GLenum pname);
-GLAPI void APIENTRY glTextureMaterialEXT (GLenum face, GLenum mode);
-#endif
-#endif /* GL_EXT_light_texture */
-
-#ifndef GL_EXT_memory_object
-#define GL_EXT_memory_object 1
-#define GL_TEXTURE_TILING_EXT 0x9580
-#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581
-#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B
-#define GL_NUM_TILING_TYPES_EXT 0x9582
-#define GL_TILING_TYPES_EXT 0x9583
-#define GL_OPTIMAL_TILING_EXT 0x9584
-#define GL_LINEAR_TILING_EXT 0x9585
-#define GL_NUM_DEVICE_UUIDS_EXT 0x9596
-#define GL_DEVICE_UUID_EXT 0x9597
-#define GL_DRIVER_UUID_EXT 0x9598
-#define GL_UUID_SIZE_EXT 16
-typedef void (APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data);
-typedef void (APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data);
-typedef void (APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects);
-typedef GLboolean (APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject);
-typedef void (APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects);
-typedef void (APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXSTORAGEMEM1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset);
-typedef void (APIENTRYP PFNGLTEXTURESTORAGEMEM1DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data);
-GLAPI void APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data);
-GLAPI void APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects);
-GLAPI GLboolean APIENTRY glIsMemoryObjectEXT (GLuint memoryObject);
-GLAPI void APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects);
-GLAPI void APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params);
-GLAPI void APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTexStorageMem1DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset);
-GLAPI void APIENTRY glTextureStorageMem1DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLuint memory, GLuint64 offset);
-#endif
-#endif /* GL_EXT_memory_object */
-
-#ifndef GL_EXT_memory_object_fd
-#define GL_EXT_memory_object_fd 1
-#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586
-typedef void (APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
-#endif
-#endif /* GL_EXT_memory_object_fd */
-
-#ifndef GL_EXT_memory_object_win32
-#define GL_EXT_memory_object_win32 1
-#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587
-#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588
-#define GL_DEVICE_LUID_EXT 0x9599
-#define GL_DEVICE_NODE_MASK_EXT 0x959A
-#define GL_LUID_SIZE_EXT 8
-#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589
-#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A
-#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B
-#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C
-typedef void (APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
-typedef void (APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
-GLAPI void APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
-#endif
-#endif /* GL_EXT_memory_object_win32 */
-
-#ifndef GL_EXT_misc_attribute
-#define GL_EXT_misc_attribute 1
-#endif /* GL_EXT_misc_attribute */
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-GLAPI void APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_multi_draw_arrays */
-
-#ifndef GL_EXT_multisample
-#define GL_EXT_multisample 1
-#define GL_MULTISAMPLE_EXT 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_EXT 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
-#define GL_SAMPLE_MASK_EXT 0x80A0
-#define GL_1PASS_EXT 0x80A1
-#define GL_2PASS_0_EXT 0x80A2
-#define GL_2PASS_1_EXT 0x80A3
-#define GL_4PASS_0_EXT 0x80A4
-#define GL_4PASS_1_EXT 0x80A5
-#define GL_4PASS_2_EXT 0x80A6
-#define GL_4PASS_3_EXT 0x80A7
-#define GL_SAMPLE_BUFFERS_EXT 0x80A8
-#define GL_SAMPLES_EXT 0x80A9
-#define GL_SAMPLE_MASK_VALUE_EXT 0x80AA
-#define GL_SAMPLE_MASK_INVERT_EXT 0x80AB
-#define GL_SAMPLE_PATTERN_EXT 0x80AC
-#define GL_MULTISAMPLE_BIT_EXT 0x20000000
-typedef void (APIENTRYP PFNGLSAMPLEMASKEXTPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLSAMPLEPATTERNEXTPROC) (GLenum pattern);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskEXT (GLclampf value, GLboolean invert);
-GLAPI void APIENTRY glSamplePatternEXT (GLenum pattern);
-#endif
-#endif /* GL_EXT_multisample */
-
-#ifndef GL_EXT_packed_depth_stencil
-#define GL_EXT_packed_depth_stencil 1
-#define GL_DEPTH_STENCIL_EXT 0x84F9
-#define GL_UNSIGNED_INT_24_8_EXT 0x84FA
-#define GL_DEPTH24_STENCIL8_EXT 0x88F0
-#define GL_TEXTURE_STENCIL_SIZE_EXT 0x88F1
-#endif /* GL_EXT_packed_depth_stencil */
-
-#ifndef GL_EXT_packed_float
-#define GL_EXT_packed_float 1
-#define GL_R11F_G11F_B10F_EXT 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV_EXT 0x8C3B
-#define GL_RGBA_SIGNED_COMPONENTS_EXT 0x8C3C
-#endif /* GL_EXT_packed_float */
-
-#ifndef GL_EXT_packed_pixels
-#define GL_EXT_packed_pixels 1
-#define GL_UNSIGNED_BYTE_3_3_2_EXT 0x8032
-#define GL_UNSIGNED_SHORT_4_4_4_4_EXT 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1_EXT 0x8034
-#define GL_UNSIGNED_INT_8_8_8_8_EXT 0x8035
-#define GL_UNSIGNED_INT_10_10_10_2_EXT 0x8036
-#endif /* GL_EXT_packed_pixels */
-
-#ifndef GL_EXT_paletted_texture
-#define GL_EXT_paletted_texture 1
-#define GL_COLOR_INDEX1_EXT 0x80E2
-#define GL_COLOR_INDEX2_EXT 0x80E3
-#define GL_COLOR_INDEX4_EXT 0x80E4
-#define GL_COLOR_INDEX8_EXT 0x80E5
-#define GL_COLOR_INDEX12_EXT 0x80E6
-#define GL_COLOR_INDEX16_EXT 0x80E7
-#define GL_TEXTURE_INDEX_SIZE_EXT 0x80ED
-typedef void (APIENTRYP PFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEEXTPROC) (GLenum target, GLenum format, GLenum type, void *data);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableEXT (GLenum target, GLenum internalFormat, GLsizei width, GLenum format, GLenum type, const void *table);
-GLAPI void APIENTRY glGetColorTableEXT (GLenum target, GLenum format, GLenum type, void *data);
-GLAPI void APIENTRY glGetColorTableParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetColorTableParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_EXT_paletted_texture */
-
-#ifndef GL_EXT_pixel_buffer_object
-#define GL_EXT_pixel_buffer_object 1
-#define GL_PIXEL_PACK_BUFFER_EXT 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_EXT 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_EXT 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_EXT 0x88EF
-#endif /* GL_EXT_pixel_buffer_object */
-
-#ifndef GL_EXT_pixel_transform
-#define GL_EXT_pixel_transform 1
-#define GL_PIXEL_TRANSFORM_2D_EXT 0x8330
-#define GL_PIXEL_MAG_FILTER_EXT 0x8331
-#define GL_PIXEL_MIN_FILTER_EXT 0x8332
-#define GL_PIXEL_CUBIC_WEIGHT_EXT 0x8333
-#define GL_CUBIC_EXT 0x8334
-#define GL_AVERAGE_EXT 0x8335
-#define GL_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8336
-#define GL_MAX_PIXEL_TRANSFORM_2D_STACK_DEPTH_EXT 0x8337
-#define GL_PIXEL_TRANSFORM_2D_MATRIX_EXT 0x8338
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIEXTPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFEXTPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPIXELTRANSFORMPARAMETERFVEXTPROC) (GLenum target, GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTransformParameteriEXT (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glPixelTransformParameterfEXT (GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPixelTransformParameterivEXT (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glPixelTransformParameterfvEXT (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glGetPixelTransformParameterivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetPixelTransformParameterfvEXT (GLenum target, GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_EXT_pixel_transform */
-
-#ifndef GL_EXT_pixel_transform_color_table
-#define GL_EXT_pixel_transform_color_table 1
-#endif /* GL_EXT_pixel_transform_color_table */
-
-#ifndef GL_EXT_point_parameters
-#define GL_EXT_point_parameters 1
-#define GL_POINT_SIZE_MIN_EXT 0x8126
-#define GL_POINT_SIZE_MAX_EXT 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_EXT 0x8128
-#define GL_DISTANCE_ATTENUATION_EXT 0x8129
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfEXT (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPointParameterfvEXT (GLenum pname, const GLfloat *params);
-#endif
-#endif /* GL_EXT_point_parameters */
-
-#ifndef GL_EXT_polygon_offset
-#define GL_EXT_polygon_offset 1
-#define GL_POLYGON_OFFSET_EXT 0x8037
-#define GL_POLYGON_OFFSET_FACTOR_EXT 0x8038
-#define GL_POLYGON_OFFSET_BIAS_EXT 0x8039
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETEXTPROC) (GLfloat factor, GLfloat bias);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPolygonOffsetEXT (GLfloat factor, GLfloat bias);
-#endif
-#endif /* GL_EXT_polygon_offset */
-
-#ifndef GL_EXT_polygon_offset_clamp
-#define GL_EXT_polygon_offset_clamp 1
-#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
-typedef void (APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
-#endif
-#endif /* GL_EXT_polygon_offset_clamp */
-
-#ifndef GL_EXT_post_depth_coverage
-#define GL_EXT_post_depth_coverage 1
-#endif /* GL_EXT_post_depth_coverage */
-
-#ifndef GL_EXT_provoking_vertex
-#define GL_EXT_provoking_vertex 1
-#define GL_QUADS_FOLLOW_PROVOKING_VERTEX_CONVENTION_EXT 0x8E4C
-#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
-#define GL_PROVOKING_VERTEX_EXT 0x8E4F
-typedef void (APIENTRYP PFNGLPROVOKINGVERTEXEXTPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProvokingVertexEXT (GLenum mode);
-#endif
-#endif /* GL_EXT_provoking_vertex */
-
-#ifndef GL_EXT_raster_multisample
-#define GL_EXT_raster_multisample 1
-#define GL_RASTER_MULTISAMPLE_EXT 0x9327
-#define GL_RASTER_SAMPLES_EXT 0x9328
-#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
-#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
-#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
-#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
-typedef void (APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations);
-#endif
-#endif /* GL_EXT_raster_multisample */
-
-#ifndef GL_EXT_rescale_normal
-#define GL_EXT_rescale_normal 1
-#define GL_RESCALE_NORMAL_EXT 0x803A
-#endif /* GL_EXT_rescale_normal */
-
-#ifndef GL_EXT_secondary_color
-#define GL_EXT_secondary_color 1
-#define GL_COLOR_SUM_EXT 0x8458
-#define GL_CURRENT_SECONDARY_COLOR_EXT 0x8459
-#define GL_SECONDARY_COLOR_ARRAY_SIZE_EXT 0x845A
-#define GL_SECONDARY_COLOR_ARRAY_TYPE_EXT 0x845B
-#define GL_SECONDARY_COLOR_ARRAY_STRIDE_EXT 0x845C
-#define GL_SECONDARY_COLOR_ARRAY_POINTER_EXT 0x845D
-#define GL_SECONDARY_COLOR_ARRAY_EXT 0x845E
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BEXTPROC) (GLbyte red, GLbyte green, GLbyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3BVEXTPROC) (const GLbyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DEXTPROC) (GLdouble red, GLdouble green, GLdouble blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3DVEXTPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FEXTPROC) (GLfloat red, GLfloat green, GLfloat blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3FVEXTPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IEXTPROC) (GLint red, GLint green, GLint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3IVEXTPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SEXTPROC) (GLshort red, GLshort green, GLshort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3SVEXTPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBEXTPROC) (GLubyte red, GLubyte green, GLubyte blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UBVEXTPROC) (const GLubyte *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIEXTPROC) (GLuint red, GLuint green, GLuint blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3UIVEXTPROC) (const GLuint *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USEXTPROC) (GLushort red, GLushort green, GLushort blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3USVEXTPROC) (const GLushort *v);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSecondaryColor3bEXT (GLbyte red, GLbyte green, GLbyte blue);
-GLAPI void APIENTRY glSecondaryColor3bvEXT (const GLbyte *v);
-GLAPI void APIENTRY glSecondaryColor3dEXT (GLdouble red, GLdouble green, GLdouble blue);
-GLAPI void APIENTRY glSecondaryColor3dvEXT (const GLdouble *v);
-GLAPI void APIENTRY glSecondaryColor3fEXT (GLfloat red, GLfloat green, GLfloat blue);
-GLAPI void APIENTRY glSecondaryColor3fvEXT (const GLfloat *v);
-GLAPI void APIENTRY glSecondaryColor3iEXT (GLint red, GLint green, GLint blue);
-GLAPI void APIENTRY glSecondaryColor3ivEXT (const GLint *v);
-GLAPI void APIENTRY glSecondaryColor3sEXT (GLshort red, GLshort green, GLshort blue);
-GLAPI void APIENTRY glSecondaryColor3svEXT (const GLshort *v);
-GLAPI void APIENTRY glSecondaryColor3ubEXT (GLubyte red, GLubyte green, GLubyte blue);
-GLAPI void APIENTRY glSecondaryColor3ubvEXT (const GLubyte *v);
-GLAPI void APIENTRY glSecondaryColor3uiEXT (GLuint red, GLuint green, GLuint blue);
-GLAPI void APIENTRY glSecondaryColor3uivEXT (const GLuint *v);
-GLAPI void APIENTRY glSecondaryColor3usEXT (GLushort red, GLushort green, GLushort blue);
-GLAPI void APIENTRY glSecondaryColor3usvEXT (const GLushort *v);
-GLAPI void APIENTRY glSecondaryColorPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_EXT_secondary_color */
-
-#ifndef GL_EXT_semaphore
-#define GL_EXT_semaphore 1
-#define GL_LAYOUT_GENERAL_EXT 0x958D
-#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E
-#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F
-#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590
-#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591
-#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592
-#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593
-#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530
-#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531
-typedef void (APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores);
-typedef void (APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores);
-typedef GLboolean (APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore);
-typedef void (APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params);
-typedef void (APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params);
-typedef void (APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
-typedef void (APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores);
-GLAPI void APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores);
-GLAPI GLboolean APIENTRY glIsSemaphoreEXT (GLuint semaphore);
-GLAPI void APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params);
-GLAPI void APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params);
-GLAPI void APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
-GLAPI void APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
-#endif
-#endif /* GL_EXT_semaphore */
-
-#ifndef GL_EXT_semaphore_fd
-#define GL_EXT_semaphore_fd 1
-typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd);
-#endif
-#endif /* GL_EXT_semaphore_fd */
-
-#ifndef GL_EXT_semaphore_win32
-#define GL_EXT_semaphore_win32 1
-#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594
-#define GL_D3D12_FENCE_VALUE_EXT 0x9595
-typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle);
-typedef void (APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle);
-GLAPI void APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name);
-#endif
-#endif /* GL_EXT_semaphore_win32 */
-
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#define GL_ACTIVE_PROGRAM_EXT 0x8B8D
-typedef void (APIENTRYP PFNGLUSESHADERPROGRAMEXTPROC) (GLenum type, GLuint program);
-typedef void (APIENTRYP PFNGLACTIVEPROGRAMEXTPROC) (GLuint program);
-typedef GLuint (APIENTRYP PFNGLCREATESHADERPROGRAMEXTPROC) (GLenum type, const GLchar *string);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glUseShaderProgramEXT (GLenum type, GLuint program);
-GLAPI void APIENTRY glActiveProgramEXT (GLuint program);
-GLAPI GLuint APIENTRY glCreateShaderProgramEXT (GLenum type, const GLchar *string);
-#endif
-#endif /* GL_EXT_separate_shader_objects */
-
-#ifndef GL_EXT_separate_specular_color
-#define GL_EXT_separate_specular_color 1
-#define GL_LIGHT_MODEL_COLOR_CONTROL_EXT 0x81F8
-#define GL_SINGLE_COLOR_EXT 0x81F9
-#define GL_SEPARATE_SPECULAR_COLOR_EXT 0x81FA
-#endif /* GL_EXT_separate_specular_color */
-
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_EXT_shader_framebuffer_fetch 1
-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
-#endif /* GL_EXT_shader_framebuffer_fetch */
-
-#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent
-#define GL_EXT_shader_framebuffer_fetch_non_coherent 1
-typedef void (APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferFetchBarrierEXT (void);
-#endif
-#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */
-
-#ifndef GL_EXT_shader_image_load_formatted
-#define GL_EXT_shader_image_load_formatted 1
-#endif /* GL_EXT_shader_image_load_formatted */
-
-#ifndef GL_EXT_shader_image_load_store
-#define GL_EXT_shader_image_load_store 1
-#define GL_MAX_IMAGE_UNITS_EXT 0x8F38
-#define GL_MAX_COMBINED_IMAGE_UNITS_AND_FRAGMENT_OUTPUTS_EXT 0x8F39
-#define GL_IMAGE_BINDING_NAME_EXT 0x8F3A
-#define GL_IMAGE_BINDING_LEVEL_EXT 0x8F3B
-#define GL_IMAGE_BINDING_LAYERED_EXT 0x8F3C
-#define GL_IMAGE_BINDING_LAYER_EXT 0x8F3D
-#define GL_IMAGE_BINDING_ACCESS_EXT 0x8F3E
-#define GL_IMAGE_1D_EXT 0x904C
-#define GL_IMAGE_2D_EXT 0x904D
-#define GL_IMAGE_3D_EXT 0x904E
-#define GL_IMAGE_2D_RECT_EXT 0x904F
-#define GL_IMAGE_CUBE_EXT 0x9050
-#define GL_IMAGE_BUFFER_EXT 0x9051
-#define GL_IMAGE_1D_ARRAY_EXT 0x9052
-#define GL_IMAGE_2D_ARRAY_EXT 0x9053
-#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
-#define GL_IMAGE_2D_MULTISAMPLE_EXT 0x9055
-#define GL_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9056
-#define GL_INT_IMAGE_1D_EXT 0x9057
-#define GL_INT_IMAGE_2D_EXT 0x9058
-#define GL_INT_IMAGE_3D_EXT 0x9059
-#define GL_INT_IMAGE_2D_RECT_EXT 0x905A
-#define GL_INT_IMAGE_CUBE_EXT 0x905B
-#define GL_INT_IMAGE_BUFFER_EXT 0x905C
-#define GL_INT_IMAGE_1D_ARRAY_EXT 0x905D
-#define GL_INT_IMAGE_2D_ARRAY_EXT 0x905E
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
-#define GL_INT_IMAGE_2D_MULTISAMPLE_EXT 0x9060
-#define GL_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x9061
-#define GL_UNSIGNED_INT_IMAGE_1D_EXT 0x9062
-#define GL_UNSIGNED_INT_IMAGE_2D_EXT 0x9063
-#define GL_UNSIGNED_INT_IMAGE_3D_EXT 0x9064
-#define GL_UNSIGNED_INT_IMAGE_2D_RECT_EXT 0x9065
-#define GL_UNSIGNED_INT_IMAGE_CUBE_EXT 0x9066
-#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
-#define GL_UNSIGNED_INT_IMAGE_1D_ARRAY_EXT 0x9068
-#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT 0x9069
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_EXT 0x906B
-#define GL_UNSIGNED_INT_IMAGE_2D_MULTISAMPLE_ARRAY_EXT 0x906C
-#define GL_MAX_IMAGE_SAMPLES_EXT 0x906D
-#define GL_IMAGE_BINDING_FORMAT_EXT 0x906E
-#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT_EXT 0x00000001
-#define GL_ELEMENT_ARRAY_BARRIER_BIT_EXT 0x00000002
-#define GL_UNIFORM_BARRIER_BIT_EXT 0x00000004
-#define GL_TEXTURE_FETCH_BARRIER_BIT_EXT 0x00000008
-#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT_EXT 0x00000020
-#define GL_COMMAND_BARRIER_BIT_EXT 0x00000040
-#define GL_PIXEL_BUFFER_BARRIER_BIT_EXT 0x00000080
-#define GL_TEXTURE_UPDATE_BARRIER_BIT_EXT 0x00000100
-#define GL_BUFFER_UPDATE_BARRIER_BIT_EXT 0x00000200
-#define GL_FRAMEBUFFER_BARRIER_BIT_EXT 0x00000400
-#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT_EXT 0x00000800
-#define GL_ATOMIC_COUNTER_BARRIER_BIT_EXT 0x00001000
-#define GL_ALL_BARRIER_BITS_EXT 0xFFFFFFFF
-typedef void (APIENTRYP PFNGLBINDIMAGETEXTUREEXTPROC) (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
-typedef void (APIENTRYP PFNGLMEMORYBARRIEREXTPROC) (GLbitfield barriers);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindImageTextureEXT (GLuint index, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLint format);
-GLAPI void APIENTRY glMemoryBarrierEXT (GLbitfield barriers);
-#endif
-#endif /* GL_EXT_shader_image_load_store */
-
-#ifndef GL_EXT_shader_integer_mix
-#define GL_EXT_shader_integer_mix 1
-#endif /* GL_EXT_shader_integer_mix */
-
-#ifndef GL_EXT_shadow_funcs
-#define GL_EXT_shadow_funcs 1
-#endif /* GL_EXT_shadow_funcs */
-
-#ifndef GL_EXT_shared_texture_palette
-#define GL_EXT_shared_texture_palette 1
-#define GL_SHARED_TEXTURE_PALETTE_EXT 0x81FB
-#endif /* GL_EXT_shared_texture_palette */
-
-#ifndef GL_EXT_sparse_texture2
-#define GL_EXT_sparse_texture2 1
-#endif /* GL_EXT_sparse_texture2 */
-
-#ifndef GL_EXT_stencil_clear_tag
-#define GL_EXT_stencil_clear_tag 1
-#define GL_STENCIL_TAG_BITS_EXT 0x88F2
-#define GL_STENCIL_CLEAR_TAG_VALUE_EXT 0x88F3
-typedef void (APIENTRYP PFNGLSTENCILCLEARTAGEXTPROC) (GLsizei stencilTagBits, GLuint stencilClearTag);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStencilClearTagEXT (GLsizei stencilTagBits, GLuint stencilClearTag);
-#endif
-#endif /* GL_EXT_stencil_clear_tag */
-
-#ifndef GL_EXT_stencil_two_side
-#define GL_EXT_stencil_two_side 1
-#define GL_STENCIL_TEST_TWO_SIDE_EXT 0x8910
-#define GL_ACTIVE_STENCIL_FACE_EXT 0x8911
-typedef void (APIENTRYP PFNGLACTIVESTENCILFACEEXTPROC) (GLenum face);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glActiveStencilFaceEXT (GLenum face);
-#endif
-#endif /* GL_EXT_stencil_two_side */
-
-#ifndef GL_EXT_stencil_wrap
-#define GL_EXT_stencil_wrap 1
-#define GL_INCR_WRAP_EXT 0x8507
-#define GL_DECR_WRAP_EXT 0x8508
-#endif /* GL_EXT_stencil_wrap */
-
-#ifndef GL_EXT_subtexture
-#define GL_EXT_subtexture 1
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE1DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE2DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexSubImage1DEXT (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage2DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-#endif
-#endif /* GL_EXT_subtexture */
-
-#ifndef GL_EXT_texture
-#define GL_EXT_texture 1
-#define GL_ALPHA4_EXT 0x803B
-#define GL_ALPHA8_EXT 0x803C
-#define GL_ALPHA12_EXT 0x803D
-#define GL_ALPHA16_EXT 0x803E
-#define GL_LUMINANCE4_EXT 0x803F
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE12_EXT 0x8041
-#define GL_LUMINANCE16_EXT 0x8042
-#define GL_LUMINANCE4_ALPHA4_EXT 0x8043
-#define GL_LUMINANCE6_ALPHA2_EXT 0x8044
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_LUMINANCE12_ALPHA4_EXT 0x8046
-#define GL_LUMINANCE12_ALPHA12_EXT 0x8047
-#define GL_LUMINANCE16_ALPHA16_EXT 0x8048
-#define GL_INTENSITY_EXT 0x8049
-#define GL_INTENSITY4_EXT 0x804A
-#define GL_INTENSITY8_EXT 0x804B
-#define GL_INTENSITY12_EXT 0x804C
-#define GL_INTENSITY16_EXT 0x804D
-#define GL_RGB2_EXT 0x804E
-#define GL_RGB4_EXT 0x804F
-#define GL_RGB5_EXT 0x8050
-#define GL_RGB8_EXT 0x8051
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB12_EXT 0x8053
-#define GL_RGB16_EXT 0x8054
-#define GL_RGBA2_EXT 0x8055
-#define GL_RGBA4_EXT 0x8056
-#define GL_RGB5_A1_EXT 0x8057
-#define GL_RGBA8_EXT 0x8058
-#define GL_RGB10_A2_EXT 0x8059
-#define GL_RGBA12_EXT 0x805A
-#define GL_RGBA16_EXT 0x805B
-#define GL_TEXTURE_RED_SIZE_EXT 0x805C
-#define GL_TEXTURE_GREEN_SIZE_EXT 0x805D
-#define GL_TEXTURE_BLUE_SIZE_EXT 0x805E
-#define GL_TEXTURE_ALPHA_SIZE_EXT 0x805F
-#define GL_TEXTURE_LUMINANCE_SIZE_EXT 0x8060
-#define GL_TEXTURE_INTENSITY_SIZE_EXT 0x8061
-#define GL_REPLACE_EXT 0x8062
-#define GL_PROXY_TEXTURE_1D_EXT 0x8063
-#define GL_PROXY_TEXTURE_2D_EXT 0x8064
-#define GL_TEXTURE_TOO_LARGE_EXT 0x8065
-#endif /* GL_EXT_texture */
-
-#ifndef GL_EXT_texture3D
-#define GL_EXT_texture3D 1
-#define GL_PACK_SKIP_IMAGES_EXT 0x806B
-#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C
-#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E
-#define GL_TEXTURE_3D_EXT 0x806F
-#define GL_PROXY_TEXTURE_3D_EXT 0x8070
-#define GL_TEXTURE_DEPTH_EXT 0x8071
-#define GL_TEXTURE_WRAP_R_EXT 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073
-typedef void (APIENTRYP PFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage3DEXT (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage3DEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-#endif
-#endif /* GL_EXT_texture3D */
-
-#ifndef GL_EXT_texture_array
-#define GL_EXT_texture_array 1
-#define GL_TEXTURE_1D_ARRAY_EXT 0x8C18
-#define GL_PROXY_TEXTURE_1D_ARRAY_EXT 0x8C19
-#define GL_TEXTURE_2D_ARRAY_EXT 0x8C1A
-#define GL_PROXY_TEXTURE_2D_ARRAY_EXT 0x8C1B
-#define GL_TEXTURE_BINDING_1D_ARRAY_EXT 0x8C1C
-#define GL_TEXTURE_BINDING_2D_ARRAY_EXT 0x8C1D
-#define GL_MAX_ARRAY_TEXTURE_LAYERS_EXT 0x88FF
-#define GL_COMPARE_REF_DEPTH_TO_TEXTURE_EXT 0x884E
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYEREXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferTextureLayerEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-#endif
-#endif /* GL_EXT_texture_array */
-
-#ifndef GL_EXT_texture_buffer_object
-#define GL_EXT_texture_buffer_object 1
-#define GL_TEXTURE_BUFFER_EXT 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
-#define GL_TEXTURE_BUFFER_FORMAT_EXT 0x8C2E
-typedef void (APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
-#endif
-#endif /* GL_EXT_texture_buffer_object */
-
-#ifndef GL_EXT_texture_compression_latc
-#define GL_EXT_texture_compression_latc 1
-#define GL_COMPRESSED_LUMINANCE_LATC1_EXT 0x8C70
-#define GL_COMPRESSED_SIGNED_LUMINANCE_LATC1_EXT 0x8C71
-#define GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT 0x8C72
-#define GL_COMPRESSED_SIGNED_LUMINANCE_ALPHA_LATC2_EXT 0x8C73
-#endif /* GL_EXT_texture_compression_latc */
-
-#ifndef GL_EXT_texture_compression_rgtc
-#define GL_EXT_texture_compression_rgtc 1
-#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
-#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
-#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
-#endif /* GL_EXT_texture_compression_rgtc */
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_EXT_texture_compression_s3tc 1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-#endif /* GL_EXT_texture_compression_s3tc */
-
-#ifndef GL_EXT_texture_cube_map
-#define GL_EXT_texture_cube_map 1
-#define GL_NORMAL_MAP_EXT 0x8511
-#define GL_REFLECTION_MAP_EXT 0x8512
-#define GL_TEXTURE_CUBE_MAP_EXT 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_EXT 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_EXT 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_EXT 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_EXT 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_EXT 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_EXT 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT 0x851A
-#define GL_PROXY_TEXTURE_CUBE_MAP_EXT 0x851B
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_EXT 0x851C
-#endif /* GL_EXT_texture_cube_map */
-
-#ifndef GL_EXT_texture_env_add
-#define GL_EXT_texture_env_add 1
-#endif /* GL_EXT_texture_env_add */
-
-#ifndef GL_EXT_texture_env_combine
-#define GL_EXT_texture_env_combine 1
-#define GL_COMBINE_EXT 0x8570
-#define GL_COMBINE_RGB_EXT 0x8571
-#define GL_COMBINE_ALPHA_EXT 0x8572
-#define GL_RGB_SCALE_EXT 0x8573
-#define GL_ADD_SIGNED_EXT 0x8574
-#define GL_INTERPOLATE_EXT 0x8575
-#define GL_CONSTANT_EXT 0x8576
-#define GL_PRIMARY_COLOR_EXT 0x8577
-#define GL_PREVIOUS_EXT 0x8578
-#define GL_SOURCE0_RGB_EXT 0x8580
-#define GL_SOURCE1_RGB_EXT 0x8581
-#define GL_SOURCE2_RGB_EXT 0x8582
-#define GL_SOURCE0_ALPHA_EXT 0x8588
-#define GL_SOURCE1_ALPHA_EXT 0x8589
-#define GL_SOURCE2_ALPHA_EXT 0x858A
-#define GL_OPERAND0_RGB_EXT 0x8590
-#define GL_OPERAND1_RGB_EXT 0x8591
-#define GL_OPERAND2_RGB_EXT 0x8592
-#define GL_OPERAND0_ALPHA_EXT 0x8598
-#define GL_OPERAND1_ALPHA_EXT 0x8599
-#define GL_OPERAND2_ALPHA_EXT 0x859A
-#endif /* GL_EXT_texture_env_combine */
-
-#ifndef GL_EXT_texture_env_dot3
-#define GL_EXT_texture_env_dot3 1
-#define GL_DOT3_RGB_EXT 0x8740
-#define GL_DOT3_RGBA_EXT 0x8741
-#endif /* GL_EXT_texture_env_dot3 */
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-#ifndef GL_EXT_texture_filter_minmax
-#define GL_EXT_texture_filter_minmax 1
-#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366
-#define GL_WEIGHTED_AVERAGE_EXT 0x9367
-#endif /* GL_EXT_texture_filter_minmax */
-
-#ifndef GL_EXT_texture_integer
-#define GL_EXT_texture_integer 1
-#define GL_RGBA32UI_EXT 0x8D70
-#define GL_RGB32UI_EXT 0x8D71
-#define GL_ALPHA32UI_EXT 0x8D72
-#define GL_INTENSITY32UI_EXT 0x8D73
-#define GL_LUMINANCE32UI_EXT 0x8D74
-#define GL_LUMINANCE_ALPHA32UI_EXT 0x8D75
-#define GL_RGBA16UI_EXT 0x8D76
-#define GL_RGB16UI_EXT 0x8D77
-#define GL_ALPHA16UI_EXT 0x8D78
-#define GL_INTENSITY16UI_EXT 0x8D79
-#define GL_LUMINANCE16UI_EXT 0x8D7A
-#define GL_LUMINANCE_ALPHA16UI_EXT 0x8D7B
-#define GL_RGBA8UI_EXT 0x8D7C
-#define GL_RGB8UI_EXT 0x8D7D
-#define GL_ALPHA8UI_EXT 0x8D7E
-#define GL_INTENSITY8UI_EXT 0x8D7F
-#define GL_LUMINANCE8UI_EXT 0x8D80
-#define GL_LUMINANCE_ALPHA8UI_EXT 0x8D81
-#define GL_RGBA32I_EXT 0x8D82
-#define GL_RGB32I_EXT 0x8D83
-#define GL_ALPHA32I_EXT 0x8D84
-#define GL_INTENSITY32I_EXT 0x8D85
-#define GL_LUMINANCE32I_EXT 0x8D86
-#define GL_LUMINANCE_ALPHA32I_EXT 0x8D87
-#define GL_RGBA16I_EXT 0x8D88
-#define GL_RGB16I_EXT 0x8D89
-#define GL_ALPHA16I_EXT 0x8D8A
-#define GL_INTENSITY16I_EXT 0x8D8B
-#define GL_LUMINANCE16I_EXT 0x8D8C
-#define GL_LUMINANCE_ALPHA16I_EXT 0x8D8D
-#define GL_RGBA8I_EXT 0x8D8E
-#define GL_RGB8I_EXT 0x8D8F
-#define GL_ALPHA8I_EXT 0x8D90
-#define GL_INTENSITY8I_EXT 0x8D91
-#define GL_LUMINANCE8I_EXT 0x8D92
-#define GL_LUMINANCE_ALPHA8I_EXT 0x8D93
-#define GL_RED_INTEGER_EXT 0x8D94
-#define GL_GREEN_INTEGER_EXT 0x8D95
-#define GL_BLUE_INTEGER_EXT 0x8D96
-#define GL_ALPHA_INTEGER_EXT 0x8D97
-#define GL_RGB_INTEGER_EXT 0x8D98
-#define GL_RGBA_INTEGER_EXT 0x8D99
-#define GL_BGR_INTEGER_EXT 0x8D9A
-#define GL_BGRA_INTEGER_EXT 0x8D9B
-#define GL_LUMINANCE_INTEGER_EXT 0x8D9C
-#define GL_LUMINANCE_ALPHA_INTEGER_EXT 0x8D9D
-#define GL_RGBA_INTEGER_MODE_EXT 0x8D9E
-typedef void (APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLCLEARCOLORIIEXTPROC) (GLint red, GLint green, GLint blue, GLint alpha);
-typedef void (APIENTRYP PFNGLCLEARCOLORIUIEXTPROC) (GLuint red, GLuint green, GLuint blue, GLuint alpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
-GLAPI void APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glClearColorIiEXT (GLint red, GLint green, GLint blue, GLint alpha);
-GLAPI void APIENTRY glClearColorIuiEXT (GLuint red, GLuint green, GLuint blue, GLuint alpha);
-#endif
-#endif /* GL_EXT_texture_integer */
-
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-#endif /* GL_EXT_texture_lod_bias */
-
-#ifndef GL_EXT_texture_mirror_clamp
-#define GL_EXT_texture_mirror_clamp 1
-#define GL_MIRROR_CLAMP_EXT 0x8742
-#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
-#define GL_MIRROR_CLAMP_TO_BORDER_EXT 0x8912
-#endif /* GL_EXT_texture_mirror_clamp */
-
-#ifndef GL_EXT_texture_object
-#define GL_EXT_texture_object 1
-#define GL_TEXTURE_PRIORITY_EXT 0x8066
-#define GL_TEXTURE_RESIDENT_EXT 0x8067
-#define GL_TEXTURE_1D_BINDING_EXT 0x8068
-#define GL_TEXTURE_2D_BINDING_EXT 0x8069
-#define GL_TEXTURE_3D_BINDING_EXT 0x806A
-typedef GLboolean (APIENTRYP PFNGLARETEXTURESRESIDENTEXTPROC) (GLsizei n, const GLuint *textures, GLboolean *residences);
-typedef void (APIENTRYP PFNGLBINDTEXTUREEXTPROC) (GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLDELETETEXTURESEXTPROC) (GLsizei n, const GLuint *textures);
-typedef void (APIENTRYP PFNGLGENTEXTURESEXTPROC) (GLsizei n, GLuint *textures);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREEXTPROC) (GLuint texture);
-typedef void (APIENTRYP PFNGLPRIORITIZETEXTURESEXTPROC) (GLsizei n, const GLuint *textures, const GLclampf *priorities);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreTexturesResidentEXT (GLsizei n, const GLuint *textures, GLboolean *residences);
-GLAPI void APIENTRY glBindTextureEXT (GLenum target, GLuint texture);
-GLAPI void APIENTRY glDeleteTexturesEXT (GLsizei n, const GLuint *textures);
-GLAPI void APIENTRY glGenTexturesEXT (GLsizei n, GLuint *textures);
-GLAPI GLboolean APIENTRY glIsTextureEXT (GLuint texture);
-GLAPI void APIENTRY glPrioritizeTexturesEXT (GLsizei n, const GLuint *textures, const GLclampf *priorities);
-#endif
-#endif /* GL_EXT_texture_object */
-
-#ifndef GL_EXT_texture_perturb_normal
-#define GL_EXT_texture_perturb_normal 1
-#define GL_PERTURB_EXT 0x85AE
-#define GL_TEXTURE_NORMAL_EXT 0x85AF
-typedef void (APIENTRYP PFNGLTEXTURENORMALEXTPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureNormalEXT (GLenum mode);
-#endif
-#endif /* GL_EXT_texture_perturb_normal */
-
-#ifndef GL_EXT_texture_sRGB
-#define GL_EXT_texture_sRGB 1
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB8_EXT 0x8C41
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_SLUMINANCE_ALPHA_EXT 0x8C44
-#define GL_SLUMINANCE8_ALPHA8_EXT 0x8C45
-#define GL_SLUMINANCE_EXT 0x8C46
-#define GL_SLUMINANCE8_EXT 0x8C47
-#define GL_COMPRESSED_SRGB_EXT 0x8C48
-#define GL_COMPRESSED_SRGB_ALPHA_EXT 0x8C49
-#define GL_COMPRESSED_SLUMINANCE_EXT 0x8C4A
-#define GL_COMPRESSED_SLUMINANCE_ALPHA_EXT 0x8C4B
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
-#endif /* GL_EXT_texture_sRGB */
-
-#ifndef GL_EXT_texture_sRGB_decode
-#define GL_EXT_texture_sRGB_decode 1
-#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
-#define GL_DECODE_EXT 0x8A49
-#define GL_SKIP_DECODE_EXT 0x8A4A
-#endif /* GL_EXT_texture_sRGB_decode */
-
-#ifndef GL_EXT_texture_shared_exponent
-#define GL_EXT_texture_shared_exponent 1
-#define GL_RGB9_E5_EXT 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV_EXT 0x8C3E
-#define GL_TEXTURE_SHARED_SIZE_EXT 0x8C3F
-#endif /* GL_EXT_texture_shared_exponent */
-
-#ifndef GL_EXT_texture_snorm
-#define GL_EXT_texture_snorm 1
-#define GL_ALPHA_SNORM 0x9010
-#define GL_LUMINANCE_SNORM 0x9011
-#define GL_LUMINANCE_ALPHA_SNORM 0x9012
-#define GL_INTENSITY_SNORM 0x9013
-#define GL_ALPHA8_SNORM 0x9014
-#define GL_LUMINANCE8_SNORM 0x9015
-#define GL_LUMINANCE8_ALPHA8_SNORM 0x9016
-#define GL_INTENSITY8_SNORM 0x9017
-#define GL_ALPHA16_SNORM 0x9018
-#define GL_LUMINANCE16_SNORM 0x9019
-#define GL_LUMINANCE16_ALPHA16_SNORM 0x901A
-#define GL_INTENSITY16_SNORM 0x901B
-#define GL_RED_SNORM 0x8F90
-#define GL_RG_SNORM 0x8F91
-#define GL_RGB_SNORM 0x8F92
-#define GL_RGBA_SNORM 0x8F93
-#endif /* GL_EXT_texture_snorm */
-
-#ifndef GL_EXT_texture_swizzle
-#define GL_EXT_texture_swizzle 1
-#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42
-#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43
-#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44
-#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45
-#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46
-#endif /* GL_EXT_texture_swizzle */
-
-#ifndef GL_EXT_timer_query
-#define GL_EXT_timer_query 1
-#define GL_TIME_ELAPSED_EXT 0x88BF
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
-#endif
-#endif /* GL_EXT_timer_query */
-
-#ifndef GL_EXT_transform_feedback
-#define GL_EXT_transform_feedback 1
-#define GL_TRANSFORM_FEEDBACK_BUFFER_EXT 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START_EXT 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_EXT 0x8C85
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_EXT 0x8C8F
-#define GL_INTERLEAVED_ATTRIBS_EXT 0x8C8C
-#define GL_SEPARATE_ATTRIBS_EXT 0x8C8D
-#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT 0x8C88
-#define GL_RASTERIZER_DISCARD_EXT 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_EXT 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_EXT 0x8C8B
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_EXT 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS_EXT 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_EXT 0x8C7F
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH_EXT 0x8C76
-typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKEXTPROC) (GLenum primitiveMode);
-typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKEXTPROC) (void);
-typedef void (APIENTRYP PFNGLBINDBUFFERRANGEEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETEXTPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-typedef void (APIENTRYP PFNGLBINDBUFFERBASEEXTPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSEXTPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGEXTPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginTransformFeedbackEXT (GLenum primitiveMode);
-GLAPI void APIENTRY glEndTransformFeedbackEXT (void);
-GLAPI void APIENTRY glBindBufferRangeEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glBindBufferOffsetEXT (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-GLAPI void APIENTRY glBindBufferBaseEXT (GLenum target, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackVaryingsEXT (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingEXT (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-#endif
-#endif /* GL_EXT_transform_feedback */
-
-#ifndef GL_EXT_vertex_array
-#define GL_EXT_vertex_array 1
-#define GL_VERTEX_ARRAY_EXT 0x8074
-#define GL_NORMAL_ARRAY_EXT 0x8075
-#define GL_COLOR_ARRAY_EXT 0x8076
-#define GL_INDEX_ARRAY_EXT 0x8077
-#define GL_TEXTURE_COORD_ARRAY_EXT 0x8078
-#define GL_EDGE_FLAG_ARRAY_EXT 0x8079
-#define GL_VERTEX_ARRAY_SIZE_EXT 0x807A
-#define GL_VERTEX_ARRAY_TYPE_EXT 0x807B
-#define GL_VERTEX_ARRAY_STRIDE_EXT 0x807C
-#define GL_VERTEX_ARRAY_COUNT_EXT 0x807D
-#define GL_NORMAL_ARRAY_TYPE_EXT 0x807E
-#define GL_NORMAL_ARRAY_STRIDE_EXT 0x807F
-#define GL_NORMAL_ARRAY_COUNT_EXT 0x8080
-#define GL_COLOR_ARRAY_SIZE_EXT 0x8081
-#define GL_COLOR_ARRAY_TYPE_EXT 0x8082
-#define GL_COLOR_ARRAY_STRIDE_EXT 0x8083
-#define GL_COLOR_ARRAY_COUNT_EXT 0x8084
-#define GL_INDEX_ARRAY_TYPE_EXT 0x8085
-#define GL_INDEX_ARRAY_STRIDE_EXT 0x8086
-#define GL_INDEX_ARRAY_COUNT_EXT 0x8087
-#define GL_TEXTURE_COORD_ARRAY_SIZE_EXT 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE_EXT 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE_EXT 0x808A
-#define GL_TEXTURE_COORD_ARRAY_COUNT_EXT 0x808B
-#define GL_EDGE_FLAG_ARRAY_STRIDE_EXT 0x808C
-#define GL_EDGE_FLAG_ARRAY_COUNT_EXT 0x808D
-#define GL_VERTEX_ARRAY_POINTER_EXT 0x808E
-#define GL_NORMAL_ARRAY_POINTER_EXT 0x808F
-#define GL_COLOR_ARRAY_POINTER_EXT 0x8090
-#define GL_INDEX_ARRAY_POINTER_EXT 0x8091
-#define GL_TEXTURE_COORD_ARRAY_POINTER_EXT 0x8092
-#define GL_EDGE_FLAG_ARRAY_POINTER_EXT 0x8093
-typedef void (APIENTRYP PFNGLARRAYELEMENTEXTPROC) (GLint i);
-typedef void (APIENTRYP PFNGLCOLORPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (APIENTRYP PFNGLDRAWARRAYSEXTPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (APIENTRYP PFNGLEDGEFLAGPOINTEREXTPROC) (GLsizei stride, GLsizei count, const GLboolean *pointer);
-typedef void (APIENTRYP PFNGLGETPOINTERVEXTPROC) (GLenum pname, void **params);
-typedef void (APIENTRYP PFNGLINDEXPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (APIENTRYP PFNGLNORMALPOINTEREXTPROC) (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-typedef void (APIENTRYP PFNGLVERTEXPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glArrayElementEXT (GLint i);
-GLAPI void APIENTRY glColorPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-GLAPI void APIENTRY glDrawArraysEXT (GLenum mode, GLint first, GLsizei count);
-GLAPI void APIENTRY glEdgeFlagPointerEXT (GLsizei stride, GLsizei count, const GLboolean *pointer);
-GLAPI void APIENTRY glGetPointervEXT (GLenum pname, void **params);
-GLAPI void APIENTRY glIndexPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-GLAPI void APIENTRY glNormalPointerEXT (GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-GLAPI void APIENTRY glTexCoordPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-GLAPI void APIENTRY glVertexPointerEXT (GLint size, GLenum type, GLsizei stride, GLsizei count, const void *pointer);
-#endif
-#endif /* GL_EXT_vertex_array */
-
-#ifndef GL_EXT_vertex_array_bgra
-#define GL_EXT_vertex_array_bgra 1
-#endif /* GL_EXT_vertex_array_bgra */
-
-#ifndef GL_EXT_vertex_attrib_64bit
-#define GL_EXT_vertex_attrib_64bit 1
-#define GL_DOUBLE_VEC2_EXT 0x8FFC
-#define GL_DOUBLE_VEC3_EXT 0x8FFD
-#define GL_DOUBLE_VEC4_EXT 0x8FFE
-#define GL_DOUBLE_MAT2_EXT 0x8F46
-#define GL_DOUBLE_MAT3_EXT 0x8F47
-#define GL_DOUBLE_MAT4_EXT 0x8F48
-#define GL_DOUBLE_MAT2x3_EXT 0x8F49
-#define GL_DOUBLE_MAT2x4_EXT 0x8F4A
-#define GL_DOUBLE_MAT3x2_EXT 0x8F4B
-#define GL_DOUBLE_MAT3x4_EXT 0x8F4C
-#define GL_DOUBLE_MAT4x2_EXT 0x8F4D
-#define GL_DOUBLE_MAT4x3_EXT 0x8F4E
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DEXTPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DEXTPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DEXTPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1DVEXTPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2DVEXTPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3DVEXTPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4DVEXTPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLDVEXTPROC) (GLuint index, GLenum pname, GLdouble *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribL1dEXT (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttribL2dEXT (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttribL3dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttribL4dEXT (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttribL1dvEXT (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL2dvEXT (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL3dvEXT (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribL4dvEXT (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribLPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribLdvEXT (GLuint index, GLenum pname, GLdouble *params);
-#endif
-#endif /* GL_EXT_vertex_attrib_64bit */
-
-#ifndef GL_EXT_vertex_shader
-#define GL_EXT_vertex_shader 1
-#define GL_VERTEX_SHADER_EXT 0x8780
-#define GL_VERTEX_SHADER_BINDING_EXT 0x8781
-#define GL_OP_INDEX_EXT 0x8782
-#define GL_OP_NEGATE_EXT 0x8783
-#define GL_OP_DOT3_EXT 0x8784
-#define GL_OP_DOT4_EXT 0x8785
-#define GL_OP_MUL_EXT 0x8786
-#define GL_OP_ADD_EXT 0x8787
-#define GL_OP_MADD_EXT 0x8788
-#define GL_OP_FRAC_EXT 0x8789
-#define GL_OP_MAX_EXT 0x878A
-#define GL_OP_MIN_EXT 0x878B
-#define GL_OP_SET_GE_EXT 0x878C
-#define GL_OP_SET_LT_EXT 0x878D
-#define GL_OP_CLAMP_EXT 0x878E
-#define GL_OP_FLOOR_EXT 0x878F
-#define GL_OP_ROUND_EXT 0x8790
-#define GL_OP_EXP_BASE_2_EXT 0x8791
-#define GL_OP_LOG_BASE_2_EXT 0x8792
-#define GL_OP_POWER_EXT 0x8793
-#define GL_OP_RECIP_EXT 0x8794
-#define GL_OP_RECIP_SQRT_EXT 0x8795
-#define GL_OP_SUB_EXT 0x8796
-#define GL_OP_CROSS_PRODUCT_EXT 0x8797
-#define GL_OP_MULTIPLY_MATRIX_EXT 0x8798
-#define GL_OP_MOV_EXT 0x8799
-#define GL_OUTPUT_VERTEX_EXT 0x879A
-#define GL_OUTPUT_COLOR0_EXT 0x879B
-#define GL_OUTPUT_COLOR1_EXT 0x879C
-#define GL_OUTPUT_TEXTURE_COORD0_EXT 0x879D
-#define GL_OUTPUT_TEXTURE_COORD1_EXT 0x879E
-#define GL_OUTPUT_TEXTURE_COORD2_EXT 0x879F
-#define GL_OUTPUT_TEXTURE_COORD3_EXT 0x87A0
-#define GL_OUTPUT_TEXTURE_COORD4_EXT 0x87A1
-#define GL_OUTPUT_TEXTURE_COORD5_EXT 0x87A2
-#define GL_OUTPUT_TEXTURE_COORD6_EXT 0x87A3
-#define GL_OUTPUT_TEXTURE_COORD7_EXT 0x87A4
-#define GL_OUTPUT_TEXTURE_COORD8_EXT 0x87A5
-#define GL_OUTPUT_TEXTURE_COORD9_EXT 0x87A6
-#define GL_OUTPUT_TEXTURE_COORD10_EXT 0x87A7
-#define GL_OUTPUT_TEXTURE_COORD11_EXT 0x87A8
-#define GL_OUTPUT_TEXTURE_COORD12_EXT 0x87A9
-#define GL_OUTPUT_TEXTURE_COORD13_EXT 0x87AA
-#define GL_OUTPUT_TEXTURE_COORD14_EXT 0x87AB
-#define GL_OUTPUT_TEXTURE_COORD15_EXT 0x87AC
-#define GL_OUTPUT_TEXTURE_COORD16_EXT 0x87AD
-#define GL_OUTPUT_TEXTURE_COORD17_EXT 0x87AE
-#define GL_OUTPUT_TEXTURE_COORD18_EXT 0x87AF
-#define GL_OUTPUT_TEXTURE_COORD19_EXT 0x87B0
-#define GL_OUTPUT_TEXTURE_COORD20_EXT 0x87B1
-#define GL_OUTPUT_TEXTURE_COORD21_EXT 0x87B2
-#define GL_OUTPUT_TEXTURE_COORD22_EXT 0x87B3
-#define GL_OUTPUT_TEXTURE_COORD23_EXT 0x87B4
-#define GL_OUTPUT_TEXTURE_COORD24_EXT 0x87B5
-#define GL_OUTPUT_TEXTURE_COORD25_EXT 0x87B6
-#define GL_OUTPUT_TEXTURE_COORD26_EXT 0x87B7
-#define GL_OUTPUT_TEXTURE_COORD27_EXT 0x87B8
-#define GL_OUTPUT_TEXTURE_COORD28_EXT 0x87B9
-#define GL_OUTPUT_TEXTURE_COORD29_EXT 0x87BA
-#define GL_OUTPUT_TEXTURE_COORD30_EXT 0x87BB
-#define GL_OUTPUT_TEXTURE_COORD31_EXT 0x87BC
-#define GL_OUTPUT_FOG_EXT 0x87BD
-#define GL_SCALAR_EXT 0x87BE
-#define GL_VECTOR_EXT 0x87BF
-#define GL_MATRIX_EXT 0x87C0
-#define GL_VARIANT_EXT 0x87C1
-#define GL_INVARIANT_EXT 0x87C2
-#define GL_LOCAL_CONSTANT_EXT 0x87C3
-#define GL_LOCAL_EXT 0x87C4
-#define GL_MAX_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87C5
-#define GL_MAX_VERTEX_SHADER_VARIANTS_EXT 0x87C6
-#define GL_MAX_VERTEX_SHADER_INVARIANTS_EXT 0x87C7
-#define GL_MAX_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87C8
-#define GL_MAX_VERTEX_SHADER_LOCALS_EXT 0x87C9
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CA
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_VARIANTS_EXT 0x87CB
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87CC
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_INVARIANTS_EXT 0x87CD
-#define GL_MAX_OPTIMIZED_VERTEX_SHADER_LOCALS_EXT 0x87CE
-#define GL_VERTEX_SHADER_INSTRUCTIONS_EXT 0x87CF
-#define GL_VERTEX_SHADER_VARIANTS_EXT 0x87D0
-#define GL_VERTEX_SHADER_INVARIANTS_EXT 0x87D1
-#define GL_VERTEX_SHADER_LOCAL_CONSTANTS_EXT 0x87D2
-#define GL_VERTEX_SHADER_LOCALS_EXT 0x87D3
-#define GL_VERTEX_SHADER_OPTIMIZED_EXT 0x87D4
-#define GL_X_EXT 0x87D5
-#define GL_Y_EXT 0x87D6
-#define GL_Z_EXT 0x87D7
-#define GL_W_EXT 0x87D8
-#define GL_NEGATIVE_X_EXT 0x87D9
-#define GL_NEGATIVE_Y_EXT 0x87DA
-#define GL_NEGATIVE_Z_EXT 0x87DB
-#define GL_NEGATIVE_W_EXT 0x87DC
-#define GL_ZERO_EXT 0x87DD
-#define GL_ONE_EXT 0x87DE
-#define GL_NEGATIVE_ONE_EXT 0x87DF
-#define GL_NORMALIZED_RANGE_EXT 0x87E0
-#define GL_FULL_RANGE_EXT 0x87E1
-#define GL_CURRENT_VERTEX_EXT 0x87E2
-#define GL_MVP_MATRIX_EXT 0x87E3
-#define GL_VARIANT_VALUE_EXT 0x87E4
-#define GL_VARIANT_DATATYPE_EXT 0x87E5
-#define GL_VARIANT_ARRAY_STRIDE_EXT 0x87E6
-#define GL_VARIANT_ARRAY_TYPE_EXT 0x87E7
-#define GL_VARIANT_ARRAY_EXT 0x87E8
-#define GL_VARIANT_ARRAY_POINTER_EXT 0x87E9
-#define GL_INVARIANT_VALUE_EXT 0x87EA
-#define GL_INVARIANT_DATATYPE_EXT 0x87EB
-#define GL_LOCAL_CONSTANT_VALUE_EXT 0x87EC
-#define GL_LOCAL_CONSTANT_DATATYPE_EXT 0x87ED
-typedef void (APIENTRYP PFNGLBEGINVERTEXSHADEREXTPROC) (void);
-typedef void (APIENTRYP PFNGLENDVERTEXSHADEREXTPROC) (void);
-typedef void (APIENTRYP PFNGLBINDVERTEXSHADEREXTPROC) (GLuint id);
-typedef GLuint (APIENTRYP PFNGLGENVERTEXSHADERSEXTPROC) (GLuint range);
-typedef void (APIENTRYP PFNGLDELETEVERTEXSHADEREXTPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLSHADEROP1EXTPROC) (GLenum op, GLuint res, GLuint arg1);
-typedef void (APIENTRYP PFNGLSHADEROP2EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
-typedef void (APIENTRYP PFNGLSHADEROP3EXTPROC) (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
-typedef void (APIENTRYP PFNGLSWIZZLEEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-typedef void (APIENTRYP PFNGLWRITEMASKEXTPROC) (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-typedef void (APIENTRYP PFNGLINSERTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef void (APIENTRYP PFNGLEXTRACTCOMPONENTEXTPROC) (GLuint res, GLuint src, GLuint num);
-typedef GLuint (APIENTRYP PFNGLGENSYMBOLSEXTPROC) (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
-typedef void (APIENTRYP PFNGLSETINVARIANTEXTPROC) (GLuint id, GLenum type, const void *addr);
-typedef void (APIENTRYP PFNGLSETLOCALCONSTANTEXTPROC) (GLuint id, GLenum type, const void *addr);
-typedef void (APIENTRYP PFNGLVARIANTBVEXTPROC) (GLuint id, const GLbyte *addr);
-typedef void (APIENTRYP PFNGLVARIANTSVEXTPROC) (GLuint id, const GLshort *addr);
-typedef void (APIENTRYP PFNGLVARIANTIVEXTPROC) (GLuint id, const GLint *addr);
-typedef void (APIENTRYP PFNGLVARIANTFVEXTPROC) (GLuint id, const GLfloat *addr);
-typedef void (APIENTRYP PFNGLVARIANTDVEXTPROC) (GLuint id, const GLdouble *addr);
-typedef void (APIENTRYP PFNGLVARIANTUBVEXTPROC) (GLuint id, const GLubyte *addr);
-typedef void (APIENTRYP PFNGLVARIANTUSVEXTPROC) (GLuint id, const GLushort *addr);
-typedef void (APIENTRYP PFNGLVARIANTUIVEXTPROC) (GLuint id, const GLuint *addr);
-typedef void (APIENTRYP PFNGLVARIANTPOINTEREXTPROC) (GLuint id, GLenum type, GLuint stride, const void *addr);
-typedef void (APIENTRYP PFNGLENABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLDISABLEVARIANTCLIENTSTATEEXTPROC) (GLuint id);
-typedef GLuint (APIENTRYP PFNGLBINDLIGHTPARAMETEREXTPROC) (GLenum light, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDMATERIALPARAMETEREXTPROC) (GLenum face, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDTEXGENPARAMETEREXTPROC) (GLenum unit, GLenum coord, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDTEXTUREUNITPARAMETEREXTPROC) (GLenum unit, GLenum value);
-typedef GLuint (APIENTRYP PFNGLBINDPARAMETEREXTPROC) (GLenum value);
-typedef GLboolean (APIENTRYP PFNGLISVARIANTENABLEDEXTPROC) (GLuint id, GLenum cap);
-typedef void (APIENTRYP PFNGLGETVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETVARIANTPOINTERVEXTPROC) (GLuint id, GLenum value, void **data);
-typedef void (APIENTRYP PFNGLGETINVARIANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETINVARIANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETINVARIANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTBOOLEANVEXTPROC) (GLuint id, GLenum value, GLboolean *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTINTEGERVEXTPROC) (GLuint id, GLenum value, GLint *data);
-typedef void (APIENTRYP PFNGLGETLOCALCONSTANTFLOATVEXTPROC) (GLuint id, GLenum value, GLfloat *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginVertexShaderEXT (void);
-GLAPI void APIENTRY glEndVertexShaderEXT (void);
-GLAPI void APIENTRY glBindVertexShaderEXT (GLuint id);
-GLAPI GLuint APIENTRY glGenVertexShadersEXT (GLuint range);
-GLAPI void APIENTRY glDeleteVertexShaderEXT (GLuint id);
-GLAPI void APIENTRY glShaderOp1EXT (GLenum op, GLuint res, GLuint arg1);
-GLAPI void APIENTRY glShaderOp2EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2);
-GLAPI void APIENTRY glShaderOp3EXT (GLenum op, GLuint res, GLuint arg1, GLuint arg2, GLuint arg3);
-GLAPI void APIENTRY glSwizzleEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-GLAPI void APIENTRY glWriteMaskEXT (GLuint res, GLuint in, GLenum outX, GLenum outY, GLenum outZ, GLenum outW);
-GLAPI void APIENTRY glInsertComponentEXT (GLuint res, GLuint src, GLuint num);
-GLAPI void APIENTRY glExtractComponentEXT (GLuint res, GLuint src, GLuint num);
-GLAPI GLuint APIENTRY glGenSymbolsEXT (GLenum datatype, GLenum storagetype, GLenum range, GLuint components);
-GLAPI void APIENTRY glSetInvariantEXT (GLuint id, GLenum type, const void *addr);
-GLAPI void APIENTRY glSetLocalConstantEXT (GLuint id, GLenum type, const void *addr);
-GLAPI void APIENTRY glVariantbvEXT (GLuint id, const GLbyte *addr);
-GLAPI void APIENTRY glVariantsvEXT (GLuint id, const GLshort *addr);
-GLAPI void APIENTRY glVariantivEXT (GLuint id, const GLint *addr);
-GLAPI void APIENTRY glVariantfvEXT (GLuint id, const GLfloat *addr);
-GLAPI void APIENTRY glVariantdvEXT (GLuint id, const GLdouble *addr);
-GLAPI void APIENTRY glVariantubvEXT (GLuint id, const GLubyte *addr);
-GLAPI void APIENTRY glVariantusvEXT (GLuint id, const GLushort *addr);
-GLAPI void APIENTRY glVariantuivEXT (GLuint id, const GLuint *addr);
-GLAPI void APIENTRY glVariantPointerEXT (GLuint id, GLenum type, GLuint stride, const void *addr);
-GLAPI void APIENTRY glEnableVariantClientStateEXT (GLuint id);
-GLAPI void APIENTRY glDisableVariantClientStateEXT (GLuint id);
-GLAPI GLuint APIENTRY glBindLightParameterEXT (GLenum light, GLenum value);
-GLAPI GLuint APIENTRY glBindMaterialParameterEXT (GLenum face, GLenum value);
-GLAPI GLuint APIENTRY glBindTexGenParameterEXT (GLenum unit, GLenum coord, GLenum value);
-GLAPI GLuint APIENTRY glBindTextureUnitParameterEXT (GLenum unit, GLenum value);
-GLAPI GLuint APIENTRY glBindParameterEXT (GLenum value);
-GLAPI GLboolean APIENTRY glIsVariantEnabledEXT (GLuint id, GLenum cap);
-GLAPI void APIENTRY glGetVariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
-GLAPI void APIENTRY glGetVariantIntegervEXT (GLuint id, GLenum value, GLint *data);
-GLAPI void APIENTRY glGetVariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
-GLAPI void APIENTRY glGetVariantPointervEXT (GLuint id, GLenum value, void **data);
-GLAPI void APIENTRY glGetInvariantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
-GLAPI void APIENTRY glGetInvariantIntegervEXT (GLuint id, GLenum value, GLint *data);
-GLAPI void APIENTRY glGetInvariantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
-GLAPI void APIENTRY glGetLocalConstantBooleanvEXT (GLuint id, GLenum value, GLboolean *data);
-GLAPI void APIENTRY glGetLocalConstantIntegervEXT (GLuint id, GLenum value, GLint *data);
-GLAPI void APIENTRY glGetLocalConstantFloatvEXT (GLuint id, GLenum value, GLfloat *data);
-#endif
-#endif /* GL_EXT_vertex_shader */
-
-#ifndef GL_EXT_vertex_weighting
-#define GL_EXT_vertex_weighting 1
-#define GL_MODELVIEW0_STACK_DEPTH_EXT 0x0BA3
-#define GL_MODELVIEW1_STACK_DEPTH_EXT 0x8502
-#define GL_MODELVIEW0_MATRIX_EXT 0x0BA6
-#define GL_MODELVIEW1_MATRIX_EXT 0x8506
-#define GL_VERTEX_WEIGHTING_EXT 0x8509
-#define GL_MODELVIEW0_EXT 0x1700
-#define GL_MODELVIEW1_EXT 0x850A
-#define GL_CURRENT_VERTEX_WEIGHT_EXT 0x850B
-#define GL_VERTEX_WEIGHT_ARRAY_EXT 0x850C
-#define GL_VERTEX_WEIGHT_ARRAY_SIZE_EXT 0x850D
-#define GL_VERTEX_WEIGHT_ARRAY_TYPE_EXT 0x850E
-#define GL_VERTEX_WEIGHT_ARRAY_STRIDE_EXT 0x850F
-#define GL_VERTEX_WEIGHT_ARRAY_POINTER_EXT 0x8510
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTFEXTPROC) (GLfloat weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTFVEXTPROC) (const GLfloat *weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTPOINTEREXTPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexWeightfEXT (GLfloat weight);
-GLAPI void APIENTRY glVertexWeightfvEXT (const GLfloat *weight);
-GLAPI void APIENTRY glVertexWeightPointerEXT (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_EXT_vertex_weighting */
-
-#ifndef GL_EXT_win32_keyed_mutex
-#define GL_EXT_win32_keyed_mutex 1
-typedef GLboolean (APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout);
-typedef GLboolean (APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout);
-GLAPI GLboolean APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key);
-#endif
-#endif /* GL_EXT_win32_keyed_mutex */
-
-#ifndef GL_EXT_window_rectangles
-#define GL_EXT_window_rectangles 1
-#define GL_INCLUSIVE_EXT 0x8F10
-#define GL_EXCLUSIVE_EXT 0x8F11
-#define GL_WINDOW_RECTANGLE_EXT 0x8F12
-#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
-#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
-#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
-typedef void (APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
-#endif
-#endif /* GL_EXT_window_rectangles */
-
-#ifndef GL_EXT_x11_sync_object
-#define GL_EXT_x11_sync_object 1
-#define GL_SYNC_X11_FENCE_EXT 0x90E1
-typedef GLsync (APIENTRYP PFNGLIMPORTSYNCEXTPROC) (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLsync APIENTRY glImportSyncEXT (GLenum external_sync_type, GLintptr external_sync, GLbitfield flags);
-#endif
-#endif /* GL_EXT_x11_sync_object */
-
-#ifndef GL_GREMEDY_frame_terminator
-#define GL_GREMEDY_frame_terminator 1
-typedef void (APIENTRYP PFNGLFRAMETERMINATORGREMEDYPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFrameTerminatorGREMEDY (void);
-#endif
-#endif /* GL_GREMEDY_frame_terminator */
-
-#ifndef GL_GREMEDY_string_marker
-#define GL_GREMEDY_string_marker 1
-typedef void (APIENTRYP PFNGLSTRINGMARKERGREMEDYPROC) (GLsizei len, const void *string);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glStringMarkerGREMEDY (GLsizei len, const void *string);
-#endif
-#endif /* GL_GREMEDY_string_marker */
-
-#ifndef GL_HP_convolution_border_modes
-#define GL_HP_convolution_border_modes 1
-#define GL_IGNORE_BORDER_HP 0x8150
-#define GL_CONSTANT_BORDER_HP 0x8151
-#define GL_REPLICATE_BORDER_HP 0x8153
-#define GL_CONVOLUTION_BORDER_COLOR_HP 0x8154
-#endif /* GL_HP_convolution_border_modes */
-
-#ifndef GL_HP_image_transform
-#define GL_HP_image_transform 1
-#define GL_IMAGE_SCALE_X_HP 0x8155
-#define GL_IMAGE_SCALE_Y_HP 0x8156
-#define GL_IMAGE_TRANSLATE_X_HP 0x8157
-#define GL_IMAGE_TRANSLATE_Y_HP 0x8158
-#define GL_IMAGE_ROTATE_ANGLE_HP 0x8159
-#define GL_IMAGE_ROTATE_ORIGIN_X_HP 0x815A
-#define GL_IMAGE_ROTATE_ORIGIN_Y_HP 0x815B
-#define GL_IMAGE_MAG_FILTER_HP 0x815C
-#define GL_IMAGE_MIN_FILTER_HP 0x815D
-#define GL_IMAGE_CUBIC_WEIGHT_HP 0x815E
-#define GL_CUBIC_HP 0x815F
-#define GL_AVERAGE_HP 0x8160
-#define GL_IMAGE_TRANSFORM_2D_HP 0x8161
-#define GL_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8162
-#define GL_PROXY_POST_IMAGE_TRANSFORM_COLOR_TABLE_HP 0x8163
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIHPPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFHPPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERIVHPPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETIMAGETRANSFORMPARAMETERFVHPPROC) (GLenum target, GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glImageTransformParameteriHP (GLenum target, GLenum pname, GLint param);
-GLAPI void APIENTRY glImageTransformParameterfHP (GLenum target, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glImageTransformParameterivHP (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glImageTransformParameterfvHP (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glGetImageTransformParameterivHP (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetImageTransformParameterfvHP (GLenum target, GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_HP_image_transform */
-
-#ifndef GL_HP_occlusion_test
-#define GL_HP_occlusion_test 1
-#define GL_OCCLUSION_TEST_HP 0x8165
-#define GL_OCCLUSION_TEST_RESULT_HP 0x8166
-#endif /* GL_HP_occlusion_test */
-
-#ifndef GL_HP_texture_lighting
-#define GL_HP_texture_lighting 1
-#define GL_TEXTURE_LIGHTING_MODE_HP 0x8167
-#define GL_TEXTURE_POST_SPECULAR_HP 0x8168
-#define GL_TEXTURE_PRE_SPECULAR_HP 0x8169
-#endif /* GL_HP_texture_lighting */
-
-#ifndef GL_IBM_cull_vertex
-#define GL_IBM_cull_vertex 1
-#define GL_CULL_VERTEX_IBM 103050
-#endif /* GL_IBM_cull_vertex */
-
-#ifndef GL_IBM_multimode_draw_arrays
-#define GL_IBM_multimode_draw_arrays 1
-typedef void (APIENTRYP PFNGLMULTIMODEDRAWARRAYSIBMPROC) (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
-typedef void (APIENTRYP PFNGLMULTIMODEDRAWELEMENTSIBMPROC) (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiModeDrawArraysIBM (const GLenum *mode, const GLint *first, const GLsizei *count, GLsizei primcount, GLint modestride);
-GLAPI void APIENTRY glMultiModeDrawElementsIBM (const GLenum *mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, GLint modestride);
-#endif
-#endif /* GL_IBM_multimode_draw_arrays */
-
-#ifndef GL_IBM_rasterpos_clip
-#define GL_IBM_rasterpos_clip 1
-#define GL_RASTER_POSITION_UNCLIPPED_IBM 0x19262
-#endif /* GL_IBM_rasterpos_clip */
-
-#ifndef GL_IBM_static_data
-#define GL_IBM_static_data 1
-#define GL_ALL_STATIC_DATA_IBM 103060
-#define GL_STATIC_VERTEX_ARRAY_IBM 103061
-typedef void (APIENTRYP PFNGLFLUSHSTATICDATAIBMPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFlushStaticDataIBM (GLenum target);
-#endif
-#endif /* GL_IBM_static_data */
-
-#ifndef GL_IBM_texture_mirrored_repeat
-#define GL_IBM_texture_mirrored_repeat 1
-#define GL_MIRRORED_REPEAT_IBM 0x8370
-#endif /* GL_IBM_texture_mirrored_repeat */
-
-#ifndef GL_IBM_vertex_array_lists
-#define GL_IBM_vertex_array_lists 1
-#define GL_VERTEX_ARRAY_LIST_IBM 103070
-#define GL_NORMAL_ARRAY_LIST_IBM 103071
-#define GL_COLOR_ARRAY_LIST_IBM 103072
-#define GL_INDEX_ARRAY_LIST_IBM 103073
-#define GL_TEXTURE_COORD_ARRAY_LIST_IBM 103074
-#define GL_EDGE_FLAG_ARRAY_LIST_IBM 103075
-#define GL_FOG_COORDINATE_ARRAY_LIST_IBM 103076
-#define GL_SECONDARY_COLOR_ARRAY_LIST_IBM 103077
-#define GL_VERTEX_ARRAY_LIST_STRIDE_IBM 103080
-#define GL_NORMAL_ARRAY_LIST_STRIDE_IBM 103081
-#define GL_COLOR_ARRAY_LIST_STRIDE_IBM 103082
-#define GL_INDEX_ARRAY_LIST_STRIDE_IBM 103083
-#define GL_TEXTURE_COORD_ARRAY_LIST_STRIDE_IBM 103084
-#define GL_EDGE_FLAG_ARRAY_LIST_STRIDE_IBM 103085
-#define GL_FOG_COORDINATE_ARRAY_LIST_STRIDE_IBM 103086
-#define GL_SECONDARY_COLOR_ARRAY_LIST_STRIDE_IBM 103087
-typedef void (APIENTRYP PFNGLCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLEDGEFLAGPOINTERLISTIBMPROC) (GLint stride, const GLboolean **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLFOGCOORDPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLINDEXPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLNORMALPOINTERLISTIBMPROC) (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-typedef void (APIENTRYP PFNGLVERTEXPOINTERLISTIBMPROC) (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glSecondaryColorPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glEdgeFlagPointerListIBM (GLint stride, const GLboolean **pointer, GLint ptrstride);
-GLAPI void APIENTRY glFogCoordPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glIndexPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glNormalPointerListIBM (GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glTexCoordPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-GLAPI void APIENTRY glVertexPointerListIBM (GLint size, GLenum type, GLint stride, const void **pointer, GLint ptrstride);
-#endif
-#endif /* GL_IBM_vertex_array_lists */
-
-#ifndef GL_INGR_blend_func_separate
-#define GL_INGR_blend_func_separate 1
-typedef void (APIENTRYP PFNGLBLENDFUNCSEPARATEINGRPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendFuncSeparateINGR (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-#endif
-#endif /* GL_INGR_blend_func_separate */
-
-#ifndef GL_INGR_color_clamp
-#define GL_INGR_color_clamp 1
-#define GL_RED_MIN_CLAMP_INGR 0x8560
-#define GL_GREEN_MIN_CLAMP_INGR 0x8561
-#define GL_BLUE_MIN_CLAMP_INGR 0x8562
-#define GL_ALPHA_MIN_CLAMP_INGR 0x8563
-#define GL_RED_MAX_CLAMP_INGR 0x8564
-#define GL_GREEN_MAX_CLAMP_INGR 0x8565
-#define GL_BLUE_MAX_CLAMP_INGR 0x8566
-#define GL_ALPHA_MAX_CLAMP_INGR 0x8567
-#endif /* GL_INGR_color_clamp */
-
-#ifndef GL_INGR_interlace_read
-#define GL_INGR_interlace_read 1
-#define GL_INTERLACE_READ_INGR 0x8568
-#endif /* GL_INGR_interlace_read */
-
-#ifndef GL_INTEL_blackhole_render
-#define GL_INTEL_blackhole_render 1
-#define GL_BLACKHOLE_RENDER_INTEL 0x83FC
-#endif /* GL_INTEL_blackhole_render */
-
-#ifndef GL_INTEL_conservative_rasterization
-#define GL_INTEL_conservative_rasterization 1
-#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
-#endif /* GL_INTEL_conservative_rasterization */
-
-#ifndef GL_INTEL_fragment_shader_ordering
-#define GL_INTEL_fragment_shader_ordering 1
-#endif /* GL_INTEL_fragment_shader_ordering */
-
-#ifndef GL_INTEL_framebuffer_CMAA
-#define GL_INTEL_framebuffer_CMAA 1
-typedef void (APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
-#endif
-#endif /* GL_INTEL_framebuffer_CMAA */
-
-#ifndef GL_INTEL_map_texture
-#define GL_INTEL_map_texture 1
-#define GL_TEXTURE_MEMORY_LAYOUT_INTEL 0x83FF
-#define GL_LAYOUT_DEFAULT_INTEL 0
-#define GL_LAYOUT_LINEAR_INTEL 1
-#define GL_LAYOUT_LINEAR_CPU_CACHED_INTEL 2
-typedef void (APIENTRYP PFNGLSYNCTEXTUREINTELPROC) (GLuint texture);
-typedef void (APIENTRYP PFNGLUNMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level);
-typedef void *(APIENTRYP PFNGLMAPTEXTURE2DINTELPROC) (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSyncTextureINTEL (GLuint texture);
-GLAPI void APIENTRY glUnmapTexture2DINTEL (GLuint texture, GLint level);
-GLAPI void *APIENTRY glMapTexture2DINTEL (GLuint texture, GLint level, GLbitfield access, GLint *stride, GLenum *layout);
-#endif
-#endif /* GL_INTEL_map_texture */
-
-#ifndef GL_INTEL_parallel_arrays
-#define GL_INTEL_parallel_arrays 1
-#define GL_PARALLEL_ARRAYS_INTEL 0x83F4
-#define GL_VERTEX_ARRAY_PARALLEL_POINTERS_INTEL 0x83F5
-#define GL_NORMAL_ARRAY_PARALLEL_POINTERS_INTEL 0x83F6
-#define GL_COLOR_ARRAY_PARALLEL_POINTERS_INTEL 0x83F7
-#define GL_TEXTURE_COORD_ARRAY_PARALLEL_POINTERS_INTEL 0x83F8
-typedef void (APIENTRYP PFNGLVERTEXPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
-typedef void (APIENTRYP PFNGLNORMALPOINTERVINTELPROC) (GLenum type, const void **pointer);
-typedef void (APIENTRYP PFNGLCOLORPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
-typedef void (APIENTRYP PFNGLTEXCOORDPOINTERVINTELPROC) (GLint size, GLenum type, const void **pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexPointervINTEL (GLint size, GLenum type, const void **pointer);
-GLAPI void APIENTRY glNormalPointervINTEL (GLenum type, const void **pointer);
-GLAPI void APIENTRY glColorPointervINTEL (GLint size, GLenum type, const void **pointer);
-GLAPI void APIENTRY glTexCoordPointervINTEL (GLint size, GLenum type, const void **pointer);
-#endif
-#endif /* GL_INTEL_parallel_arrays */
-
-#ifndef GL_INTEL_performance_query
-#define GL_INTEL_performance_query 1
-#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
-#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
-#define GL_PERFQUERY_WAIT_INTEL 0x83FB
-#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
-#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
-#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
-#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
-#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
-#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
-#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
-#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
-#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
-#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
-#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
-#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
-#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
-#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
-#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
-#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
-#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
-typedef void (APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
-typedef void (APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
-typedef void (APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
-typedef void (APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-typedef void (APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-typedef void (APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
-typedef void (APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
-GLAPI void APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
-GLAPI void APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
-GLAPI void APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
-GLAPI void APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-GLAPI void APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-GLAPI void APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
-GLAPI void APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#endif
-#endif /* GL_INTEL_performance_query */
-
-#ifndef GL_MESAX_texture_stack
-#define GL_MESAX_texture_stack 1
-#define GL_TEXTURE_1D_STACK_MESAX 0x8759
-#define GL_TEXTURE_2D_STACK_MESAX 0x875A
-#define GL_PROXY_TEXTURE_1D_STACK_MESAX 0x875B
-#define GL_PROXY_TEXTURE_2D_STACK_MESAX 0x875C
-#define GL_TEXTURE_1D_STACK_BINDING_MESAX 0x875D
-#define GL_TEXTURE_2D_STACK_BINDING_MESAX 0x875E
-#endif /* GL_MESAX_texture_stack */
-
-#ifndef GL_MESA_pack_invert
-#define GL_MESA_pack_invert 1
-#define GL_PACK_INVERT_MESA 0x8758
-#endif /* GL_MESA_pack_invert */
-
-#ifndef GL_MESA_program_binary_formats
-#define GL_MESA_program_binary_formats 1
-#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
-#endif /* GL_MESA_program_binary_formats */
-
-#ifndef GL_MESA_resize_buffers
-#define GL_MESA_resize_buffers 1
-typedef void (APIENTRYP PFNGLRESIZEBUFFERSMESAPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glResizeBuffersMESA (void);
-#endif
-#endif /* GL_MESA_resize_buffers */
-
-#ifndef GL_MESA_shader_integer_functions
-#define GL_MESA_shader_integer_functions 1
-#endif /* GL_MESA_shader_integer_functions */
-
-#ifndef GL_MESA_tile_raster_order
-#define GL_MESA_tile_raster_order 1
-#define GL_TILE_RASTER_ORDER_FIXED_MESA 0x8BB8
-#define GL_TILE_RASTER_ORDER_INCREASING_X_MESA 0x8BB9
-#define GL_TILE_RASTER_ORDER_INCREASING_Y_MESA 0x8BBA
-#endif /* GL_MESA_tile_raster_order */
-
-#ifndef GL_MESA_window_pos
-#define GL_MESA_window_pos 1
-typedef void (APIENTRYP PFNGLWINDOWPOS2DMESAPROC) (GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FMESAPROC) (GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IMESAPROC) (GLint x, GLint y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SMESAPROC) (GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLWINDOWPOS2SVMESAPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DMESAPROC) (GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FMESAPROC) (GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IMESAPROC) (GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SMESAPROC) (GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLWINDOWPOS3SVMESAPROC) (const GLshort *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4DMESAPROC) (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4DVMESAPROC) (const GLdouble *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4FMESAPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4FVMESAPROC) (const GLfloat *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4IMESAPROC) (GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4IVMESAPROC) (const GLint *v);
-typedef void (APIENTRYP PFNGLWINDOWPOS4SMESAPROC) (GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLWINDOWPOS4SVMESAPROC) (const GLshort *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glWindowPos2dMESA (GLdouble x, GLdouble y);
-GLAPI void APIENTRY glWindowPos2dvMESA (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos2fMESA (GLfloat x, GLfloat y);
-GLAPI void APIENTRY glWindowPos2fvMESA (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos2iMESA (GLint x, GLint y);
-GLAPI void APIENTRY glWindowPos2ivMESA (const GLint *v);
-GLAPI void APIENTRY glWindowPos2sMESA (GLshort x, GLshort y);
-GLAPI void APIENTRY glWindowPos2svMESA (const GLshort *v);
-GLAPI void APIENTRY glWindowPos3dMESA (GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glWindowPos3dvMESA (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos3fMESA (GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glWindowPos3fvMESA (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos3iMESA (GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glWindowPos3ivMESA (const GLint *v);
-GLAPI void APIENTRY glWindowPos3sMESA (GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glWindowPos3svMESA (const GLshort *v);
-GLAPI void APIENTRY glWindowPos4dMESA (GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glWindowPos4dvMESA (const GLdouble *v);
-GLAPI void APIENTRY glWindowPos4fMESA (GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glWindowPos4fvMESA (const GLfloat *v);
-GLAPI void APIENTRY glWindowPos4iMESA (GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glWindowPos4ivMESA (const GLint *v);
-GLAPI void APIENTRY glWindowPos4sMESA (GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glWindowPos4svMESA (const GLshort *v);
-#endif
-#endif /* GL_MESA_window_pos */
-
-#ifndef GL_MESA_ycbcr_texture
-#define GL_MESA_ycbcr_texture 1
-#define GL_UNSIGNED_SHORT_8_8_MESA 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_MESA 0x85BB
-#define GL_YCBCR_MESA 0x8757
-#endif /* GL_MESA_ycbcr_texture */
-
-#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
-#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
-#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
-
-#ifndef GL_NVX_conditional_render
-#define GL_NVX_conditional_render 1
-typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVXPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVXPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginConditionalRenderNVX (GLuint id);
-GLAPI void APIENTRY glEndConditionalRenderNVX (void);
-#endif
-#endif /* GL_NVX_conditional_render */
-
-#ifndef GL_NVX_gpu_memory_info
-#define GL_NVX_gpu_memory_info 1
-#define GL_GPU_MEMORY_INFO_DEDICATED_VIDMEM_NVX 0x9047
-#define GL_GPU_MEMORY_INFO_TOTAL_AVAILABLE_MEMORY_NVX 0x9048
-#define GL_GPU_MEMORY_INFO_CURRENT_AVAILABLE_VIDMEM_NVX 0x9049
-#define GL_GPU_MEMORY_INFO_EVICTION_COUNT_NVX 0x904A
-#define GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX 0x904B
-#endif /* GL_NVX_gpu_memory_info */
-
-#ifndef GL_NVX_linked_gpu_multicast
-#define GL_NVX_linked_gpu_multicast 1
-#define GL_LGPU_SEPARATE_STORAGE_BIT_NVX 0x0800
-#define GL_MAX_LGPU_GPUS_NVX 0x92BA
-typedef void (APIENTRYP PFNGLLGPUNAMEDBUFFERSUBDATANVXPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLLGPUCOPYIMAGESUBDATANVXPROC) (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (APIENTRYP PFNGLLGPUINTERLOCKNVXPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glLGPUNamedBufferSubDataNVX (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glLGPUCopyImageSubDataNVX (GLuint sourceGpu, GLbitfield destinationGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srxY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-GLAPI void APIENTRY glLGPUInterlockNVX (void);
-#endif
-#endif /* GL_NVX_linked_gpu_multicast */
-
-#ifndef GL_NV_alpha_to_coverage_dither_control
-#define GL_NV_alpha_to_coverage_dither_control 1
-#define GL_ALPHA_TO_COVERAGE_DITHER_DEFAULT_NV 0x934D
-#define GL_ALPHA_TO_COVERAGE_DITHER_ENABLE_NV 0x934E
-#define GL_ALPHA_TO_COVERAGE_DITHER_DISABLE_NV 0x934F
-#define GL_ALPHA_TO_COVERAGE_DITHER_MODE_NV 0x92BF
-typedef void (APIENTRYP PFNGLALPHATOCOVERAGEDITHERCONTROLNVPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glAlphaToCoverageDitherControlNV (GLenum mode);
-#endif
-#endif /* GL_NV_alpha_to_coverage_dither_control */
-
-#ifndef GL_NV_bindless_multi_draw_indirect
-#define GL_NV_bindless_multi_draw_indirect 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei stride, GLint vertexBufferCount);
-#endif
-#endif /* GL_NV_bindless_multi_draw_indirect */
-
-#ifndef GL_NV_bindless_multi_draw_indirect_count
-#define GL_NV_bindless_multi_draw_indirect_count 1
-typedef void (APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-typedef void (APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTBINDLESSCOUNTNVPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMultiDrawArraysIndirectBindlessCountNV (GLenum mode, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-GLAPI void APIENTRY glMultiDrawElementsIndirectBindlessCountNV (GLenum mode, GLenum type, const void *indirect, GLsizei drawCount, GLsizei maxDrawCount, GLsizei stride, GLint vertexBufferCount);
-#endif
-#endif /* GL_NV_bindless_multi_draw_indirect_count */
-
-#ifndef GL_NV_bindless_texture
-#define GL_NV_bindless_texture 1
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
-typedef GLuint64 (APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef GLuint64 (APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-typedef GLboolean (APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef GLboolean (APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint64 APIENTRY glGetTextureHandleNV (GLuint texture);
-GLAPI GLuint64 APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
-GLAPI void APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
-GLAPI void APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
-GLAPI GLuint64 APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-GLAPI void APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
-GLAPI void APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
-GLAPI void APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
-GLAPI void APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
-GLAPI void APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
-GLAPI void APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-GLAPI GLboolean APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
-GLAPI GLboolean APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
-#endif
-#endif /* GL_NV_bindless_texture */
-
-#ifndef GL_NV_blend_equation_advanced
-#define GL_NV_blend_equation_advanced 1
-#define GL_BLEND_OVERLAP_NV 0x9281
-#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
-#define GL_BLUE_NV 0x1905
-#define GL_COLORBURN_NV 0x929A
-#define GL_COLORDODGE_NV 0x9299
-#define GL_CONJOINT_NV 0x9284
-#define GL_CONTRAST_NV 0x92A1
-#define GL_DARKEN_NV 0x9297
-#define GL_DIFFERENCE_NV 0x929E
-#define GL_DISJOINT_NV 0x9283
-#define GL_DST_ATOP_NV 0x928F
-#define GL_DST_IN_NV 0x928B
-#define GL_DST_NV 0x9287
-#define GL_DST_OUT_NV 0x928D
-#define GL_DST_OVER_NV 0x9289
-#define GL_EXCLUSION_NV 0x92A0
-#define GL_GREEN_NV 0x1904
-#define GL_HARDLIGHT_NV 0x929B
-#define GL_HARDMIX_NV 0x92A9
-#define GL_HSL_COLOR_NV 0x92AF
-#define GL_HSL_HUE_NV 0x92AD
-#define GL_HSL_LUMINOSITY_NV 0x92B0
-#define GL_HSL_SATURATION_NV 0x92AE
-#define GL_INVERT_OVG_NV 0x92B4
-#define GL_INVERT_RGB_NV 0x92A3
-#define GL_LIGHTEN_NV 0x9298
-#define GL_LINEARBURN_NV 0x92A5
-#define GL_LINEARDODGE_NV 0x92A4
-#define GL_LINEARLIGHT_NV 0x92A7
-#define GL_MINUS_CLAMPED_NV 0x92B3
-#define GL_MINUS_NV 0x929F
-#define GL_MULTIPLY_NV 0x9294
-#define GL_OVERLAY_NV 0x9296
-#define GL_PINLIGHT_NV 0x92A8
-#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
-#define GL_PLUS_CLAMPED_NV 0x92B1
-#define GL_PLUS_DARKER_NV 0x9292
-#define GL_PLUS_NV 0x9291
-#define GL_RED_NV 0x1903
-#define GL_SCREEN_NV 0x9295
-#define GL_SOFTLIGHT_NV 0x929C
-#define GL_SRC_ATOP_NV 0x928E
-#define GL_SRC_IN_NV 0x928A
-#define GL_SRC_NV 0x9286
-#define GL_SRC_OUT_NV 0x928C
-#define GL_SRC_OVER_NV 0x9288
-#define GL_UNCORRELATED_NV 0x9282
-#define GL_VIVIDLIGHT_NV 0x92A6
-#define GL_XOR_NV 0x1506
-typedef void (APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
-GLAPI void APIENTRY glBlendBarrierNV (void);
-#endif
-#endif /* GL_NV_blend_equation_advanced */
-
-#ifndef GL_NV_blend_equation_advanced_coherent
-#define GL_NV_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-#ifndef GL_NV_blend_minmax_factor
-#define GL_NV_blend_minmax_factor 1
-#endif /* GL_NV_blend_minmax_factor */
-
-#ifndef GL_NV_blend_square
-#define GL_NV_blend_square 1
-#endif /* GL_NV_blend_square */
-
-#ifndef GL_NV_clip_space_w_scaling
-#define GL_NV_clip_space_w_scaling 1
-#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
-#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
-#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
-typedef void (APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#endif
-#endif /* GL_NV_clip_space_w_scaling */
-
-#ifndef GL_NV_command_list
-#define GL_NV_command_list 1
-#define GL_TERMINATE_SEQUENCE_COMMAND_NV 0x0000
-#define GL_NOP_COMMAND_NV 0x0001
-#define GL_DRAW_ELEMENTS_COMMAND_NV 0x0002
-#define GL_DRAW_ARRAYS_COMMAND_NV 0x0003
-#define GL_DRAW_ELEMENTS_STRIP_COMMAND_NV 0x0004
-#define GL_DRAW_ARRAYS_STRIP_COMMAND_NV 0x0005
-#define GL_DRAW_ELEMENTS_INSTANCED_COMMAND_NV 0x0006
-#define GL_DRAW_ARRAYS_INSTANCED_COMMAND_NV 0x0007
-#define GL_ELEMENT_ADDRESS_COMMAND_NV 0x0008
-#define GL_ATTRIBUTE_ADDRESS_COMMAND_NV 0x0009
-#define GL_UNIFORM_ADDRESS_COMMAND_NV 0x000A
-#define GL_BLEND_COLOR_COMMAND_NV 0x000B
-#define GL_STENCIL_REF_COMMAND_NV 0x000C
-#define GL_LINE_WIDTH_COMMAND_NV 0x000D
-#define GL_POLYGON_OFFSET_COMMAND_NV 0x000E
-#define GL_ALPHA_REF_COMMAND_NV 0x000F
-#define GL_VIEWPORT_COMMAND_NV 0x0010
-#define GL_SCISSOR_COMMAND_NV 0x0011
-#define GL_FRONT_FACE_COMMAND_NV 0x0012
-typedef void (APIENTRYP PFNGLCREATESTATESNVPROC) (GLsizei n, GLuint *states);
-typedef void (APIENTRYP PFNGLDELETESTATESNVPROC) (GLsizei n, const GLuint *states);
-typedef GLboolean (APIENTRYP PFNGLISSTATENVPROC) (GLuint state);
-typedef void (APIENTRYP PFNGLSTATECAPTURENVPROC) (GLuint state, GLenum mode);
-typedef GLuint (APIENTRYP PFNGLGETCOMMANDHEADERNVPROC) (GLenum tokenID, GLuint size);
-typedef GLushort (APIENTRYP PFNGLGETSTAGEINDEXNVPROC) (GLenum shadertype);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSNVPROC) (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSADDRESSNVPROC) (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESNVPROC) (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLDRAWCOMMANDSSTATESADDRESSNVPROC) (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLCREATECOMMANDLISTSNVPROC) (GLsizei n, GLuint *lists);
-typedef void (APIENTRYP PFNGLDELETECOMMANDLISTSNVPROC) (GLsizei n, const GLuint *lists);
-typedef GLboolean (APIENTRYP PFNGLISCOMMANDLISTNVPROC) (GLuint list);
-typedef void (APIENTRYP PFNGLLISTDRAWCOMMANDSSTATESCLIENTNVPROC) (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-typedef void (APIENTRYP PFNGLCOMMANDLISTSEGMENTSNVPROC) (GLuint list, GLuint segments);
-typedef void (APIENTRYP PFNGLCOMPILECOMMANDLISTNVPROC) (GLuint list);
-typedef void (APIENTRYP PFNGLCALLCOMMANDLISTNVPROC) (GLuint list);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCreateStatesNV (GLsizei n, GLuint *states);
-GLAPI void APIENTRY glDeleteStatesNV (GLsizei n, const GLuint *states);
-GLAPI GLboolean APIENTRY glIsStateNV (GLuint state);
-GLAPI void APIENTRY glStateCaptureNV (GLuint state, GLenum mode);
-GLAPI GLuint APIENTRY glGetCommandHeaderNV (GLenum tokenID, GLuint size);
-GLAPI GLushort APIENTRY glGetStageIndexNV (GLenum shadertype);
-GLAPI void APIENTRY glDrawCommandsNV (GLenum primitiveMode, GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, GLuint count);
-GLAPI void APIENTRY glDrawCommandsAddressNV (GLenum primitiveMode, const GLuint64 *indirects, const GLsizei *sizes, GLuint count);
-GLAPI void APIENTRY glDrawCommandsStatesNV (GLuint buffer, const GLintptr *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glDrawCommandsStatesAddressNV (const GLuint64 *indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glCreateCommandListsNV (GLsizei n, GLuint *lists);
-GLAPI void APIENTRY glDeleteCommandListsNV (GLsizei n, const GLuint *lists);
-GLAPI GLboolean APIENTRY glIsCommandListNV (GLuint list);
-GLAPI void APIENTRY glListDrawCommandsStatesClientNV (GLuint list, GLuint segment, const void **indirects, const GLsizei *sizes, const GLuint *states, const GLuint *fbos, GLuint count);
-GLAPI void APIENTRY glCommandListSegmentsNV (GLuint list, GLuint segments);
-GLAPI void APIENTRY glCompileCommandListNV (GLuint list);
-GLAPI void APIENTRY glCallCommandListNV (GLuint list);
-#endif
-#endif /* GL_NV_command_list */
-
-#ifndef GL_NV_compute_program5
-#define GL_NV_compute_program5 1
-#define GL_COMPUTE_PROGRAM_NV 0x90FB
-#define GL_COMPUTE_PROGRAM_PARAMETER_BUFFER_NV 0x90FC
-#endif /* GL_NV_compute_program5 */
-
-#ifndef GL_NV_conditional_render
-#define GL_NV_conditional_render 1
-#define GL_QUERY_WAIT_NV 0x8E13
-#define GL_QUERY_NO_WAIT_NV 0x8E14
-#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
-typedef void (APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
-typedef void (APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
-GLAPI void APIENTRY glEndConditionalRenderNV (void);
-#endif
-#endif /* GL_NV_conditional_render */
-
-#ifndef GL_NV_conservative_raster
-#define GL_NV_conservative_raster 1
-#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
-#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
-#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
-#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
-typedef void (APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
-#endif
-#endif /* GL_NV_conservative_raster */
-
-#ifndef GL_NV_conservative_raster_dilate
-#define GL_NV_conservative_raster_dilate 1
-#define GL_CONSERVATIVE_RASTER_DILATE_NV 0x9379
-#define GL_CONSERVATIVE_RASTER_DILATE_RANGE_NV 0x937A
-#define GL_CONSERVATIVE_RASTER_DILATE_GRANULARITY_NV 0x937B
-typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERFNVPROC) (GLenum pname, GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConservativeRasterParameterfNV (GLenum pname, GLfloat value);
-#endif
-#endif /* GL_NV_conservative_raster_dilate */
-
-#ifndef GL_NV_conservative_raster_pre_snap
-#define GL_NV_conservative_raster_pre_snap 1
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550
-#endif /* GL_NV_conservative_raster_pre_snap */
-
-#ifndef GL_NV_conservative_raster_pre_snap_triangles
-#define GL_NV_conservative_raster_pre_snap_triangles 1
-#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
-#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
-typedef void (APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
-#endif
-#endif /* GL_NV_conservative_raster_pre_snap_triangles */
-
-#ifndef GL_NV_conservative_raster_underestimation
-#define GL_NV_conservative_raster_underestimation 1
-#endif /* GL_NV_conservative_raster_underestimation */
-
-#ifndef GL_NV_copy_depth_to_color
-#define GL_NV_copy_depth_to_color 1
-#define GL_DEPTH_STENCIL_TO_RGBA_NV 0x886E
-#define GL_DEPTH_STENCIL_TO_BGRA_NV 0x886F
-#endif /* GL_NV_copy_depth_to_color */
-
-#ifndef GL_NV_copy_image
-#define GL_NV_copy_image 1
-typedef void (APIENTRYP PFNGLCOPYIMAGESUBDATANVPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCopyImageSubDataNV (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* GL_NV_copy_image */
-
-#ifndef GL_NV_deep_texture3D
-#define GL_NV_deep_texture3D 1
-#define GL_MAX_DEEP_3D_TEXTURE_WIDTH_HEIGHT_NV 0x90D0
-#define GL_MAX_DEEP_3D_TEXTURE_DEPTH_NV 0x90D1
-#endif /* GL_NV_deep_texture3D */
-
-#ifndef GL_NV_depth_buffer_float
-#define GL_NV_depth_buffer_float 1
-#define GL_DEPTH_COMPONENT32F_NV 0x8DAB
-#define GL_DEPTH32F_STENCIL8_NV 0x8DAC
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV_NV 0x8DAD
-#define GL_DEPTH_BUFFER_FLOAT_MODE_NV 0x8DAF
-typedef void (APIENTRYP PFNGLDEPTHRANGEDNVPROC) (GLdouble zNear, GLdouble zFar);
-typedef void (APIENTRYP PFNGLCLEARDEPTHDNVPROC) (GLdouble depth);
-typedef void (APIENTRYP PFNGLDEPTHBOUNDSDNVPROC) (GLdouble zmin, GLdouble zmax);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDepthRangedNV (GLdouble zNear, GLdouble zFar);
-GLAPI void APIENTRY glClearDepthdNV (GLdouble depth);
-GLAPI void APIENTRY glDepthBoundsdNV (GLdouble zmin, GLdouble zmax);
-#endif
-#endif /* GL_NV_depth_buffer_float */
-
-#ifndef GL_NV_depth_clamp
-#define GL_NV_depth_clamp 1
-#define GL_DEPTH_CLAMP_NV 0x864F
-#endif /* GL_NV_depth_clamp */
-
-#ifndef GL_NV_draw_texture
-#define GL_NV_draw_texture 1
-typedef void (APIENTRYP PFNGLDRAWTEXTURENVPROC) (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawTextureNV (GLuint texture, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-#endif
-#endif /* GL_NV_draw_texture */
-
-#ifndef GL_NV_draw_vulkan_image
-#define GL_NV_draw_vulkan_image 1
-typedef void (APIENTRY *GLVULKANPROCNV)(void);
-typedef void (APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-typedef GLVULKANPROCNV (APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
-typedef void (APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-GLAPI GLVULKANPROCNV APIENTRY glGetVkProcAddrNV (const GLchar *name);
-GLAPI void APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
-GLAPI void APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
-GLAPI void APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
-#endif
-#endif /* GL_NV_draw_vulkan_image */
-
-#ifndef GL_NV_evaluators
-#define GL_NV_evaluators 1
-#define GL_EVAL_2D_NV 0x86C0
-#define GL_EVAL_TRIANGULAR_2D_NV 0x86C1
-#define GL_MAP_TESSELLATION_NV 0x86C2
-#define GL_MAP_ATTRIB_U_ORDER_NV 0x86C3
-#define GL_MAP_ATTRIB_V_ORDER_NV 0x86C4
-#define GL_EVAL_FRACTIONAL_TESSELLATION_NV 0x86C5
-#define GL_EVAL_VERTEX_ATTRIB0_NV 0x86C6
-#define GL_EVAL_VERTEX_ATTRIB1_NV 0x86C7
-#define GL_EVAL_VERTEX_ATTRIB2_NV 0x86C8
-#define GL_EVAL_VERTEX_ATTRIB3_NV 0x86C9
-#define GL_EVAL_VERTEX_ATTRIB4_NV 0x86CA
-#define GL_EVAL_VERTEX_ATTRIB5_NV 0x86CB
-#define GL_EVAL_VERTEX_ATTRIB6_NV 0x86CC
-#define GL_EVAL_VERTEX_ATTRIB7_NV 0x86CD
-#define GL_EVAL_VERTEX_ATTRIB8_NV 0x86CE
-#define GL_EVAL_VERTEX_ATTRIB9_NV 0x86CF
-#define GL_EVAL_VERTEX_ATTRIB10_NV 0x86D0
-#define GL_EVAL_VERTEX_ATTRIB11_NV 0x86D1
-#define GL_EVAL_VERTEX_ATTRIB12_NV 0x86D2
-#define GL_EVAL_VERTEX_ATTRIB13_NV 0x86D3
-#define GL_EVAL_VERTEX_ATTRIB14_NV 0x86D4
-#define GL_EVAL_VERTEX_ATTRIB15_NV 0x86D5
-#define GL_MAX_MAP_TESSELLATION_NV 0x86D6
-#define GL_MAX_RATIONAL_EVAL_ORDER_NV 0x86D7
-typedef void (APIENTRYP PFNGLMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points);
-typedef void (APIENTRYP PFNGLMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMAPCONTROLPOINTSNVPROC) (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points);
-typedef void (APIENTRYP PFNGLGETMAPPARAMETERIVNVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMAPPARAMETERFVNVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERIVNVPROC) (GLenum target, GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETMAPATTRIBPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLEVALMAPSNVPROC) (GLenum target, GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLint uorder, GLint vorder, GLboolean packed, const void *points);
-GLAPI void APIENTRY glMapParameterivNV (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glMapParameterfvNV (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glGetMapControlPointsNV (GLenum target, GLuint index, GLenum type, GLsizei ustride, GLsizei vstride, GLboolean packed, void *points);
-GLAPI void APIENTRY glGetMapParameterivNV (GLenum target, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMapParameterfvNV (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetMapAttribParameterivNV (GLenum target, GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetMapAttribParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glEvalMapsNV (GLenum target, GLenum mode);
-#endif
-#endif /* GL_NV_evaluators */
-
-#ifndef GL_NV_explicit_multisample
-#define GL_NV_explicit_multisample 1
-#define GL_SAMPLE_POSITION_NV 0x8E50
-#define GL_SAMPLE_MASK_NV 0x8E51
-#define GL_SAMPLE_MASK_VALUE_NV 0x8E52
-#define GL_TEXTURE_BINDING_RENDERBUFFER_NV 0x8E53
-#define GL_TEXTURE_RENDERBUFFER_DATA_STORE_BINDING_NV 0x8E54
-#define GL_TEXTURE_RENDERBUFFER_NV 0x8E55
-#define GL_SAMPLER_RENDERBUFFER_NV 0x8E56
-#define GL_INT_SAMPLER_RENDERBUFFER_NV 0x8E57
-#define GL_UNSIGNED_INT_SAMPLER_RENDERBUFFER_NV 0x8E58
-#define GL_MAX_SAMPLE_MASK_WORDS_NV 0x8E59
-typedef void (APIENTRYP PFNGLGETMULTISAMPLEFVNVPROC) (GLenum pname, GLuint index, GLfloat *val);
-typedef void (APIENTRYP PFNGLSAMPLEMASKINDEXEDNVPROC) (GLuint index, GLbitfield mask);
-typedef void (APIENTRYP PFNGLTEXRENDERBUFFERNVPROC) (GLenum target, GLuint renderbuffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetMultisamplefvNV (GLenum pname, GLuint index, GLfloat *val);
-GLAPI void APIENTRY glSampleMaskIndexedNV (GLuint index, GLbitfield mask);
-GLAPI void APIENTRY glTexRenderbufferNV (GLenum target, GLuint renderbuffer);
-#endif
-#endif /* GL_NV_explicit_multisample */
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-typedef void (APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GLAPI void APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GLAPI GLboolean APIENTRY glIsFenceNV (GLuint fence);
-GLAPI GLboolean APIENTRY glTestFenceNV (GLuint fence);
-GLAPI void APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GLAPI void APIENTRY glFinishFenceNV (GLuint fence);
-GLAPI void APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-#endif /* GL_NV_fence */
-
-#ifndef GL_NV_fill_rectangle
-#define GL_NV_fill_rectangle 1
-#define GL_FILL_RECTANGLE_NV 0x933C
-#endif /* GL_NV_fill_rectangle */
-
-#ifndef GL_NV_float_buffer
-#define GL_NV_float_buffer 1
-#define GL_FLOAT_R_NV 0x8880
-#define GL_FLOAT_RG_NV 0x8881
-#define GL_FLOAT_RGB_NV 0x8882
-#define GL_FLOAT_RGBA_NV 0x8883
-#define GL_FLOAT_R16_NV 0x8884
-#define GL_FLOAT_R32_NV 0x8885
-#define GL_FLOAT_RG16_NV 0x8886
-#define GL_FLOAT_RG32_NV 0x8887
-#define GL_FLOAT_RGB16_NV 0x8888
-#define GL_FLOAT_RGB32_NV 0x8889
-#define GL_FLOAT_RGBA16_NV 0x888A
-#define GL_FLOAT_RGBA32_NV 0x888B
-#define GL_TEXTURE_FLOAT_COMPONENTS_NV 0x888C
-#define GL_FLOAT_CLEAR_COLOR_VALUE_NV 0x888D
-#define GL_FLOAT_RGBA_MODE_NV 0x888E
-#endif /* GL_NV_float_buffer */
-
-#ifndef GL_NV_fog_distance
-#define GL_NV_fog_distance 1
-#define GL_FOG_DISTANCE_MODE_NV 0x855A
-#define GL_EYE_RADIAL_NV 0x855B
-#define GL_EYE_PLANE_ABSOLUTE_NV 0x855C
-#endif /* GL_NV_fog_distance */
-
-#ifndef GL_NV_fragment_coverage_to_color
-#define GL_NV_fragment_coverage_to_color 1
-#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
-#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
-typedef void (APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFragmentCoverageColorNV (GLuint color);
-#endif
-#endif /* GL_NV_fragment_coverage_to_color */
-
-#ifndef GL_NV_fragment_program
-#define GL_NV_fragment_program 1
-#define GL_MAX_FRAGMENT_PROGRAM_LOCAL_PARAMETERS_NV 0x8868
-#define GL_FRAGMENT_PROGRAM_NV 0x8870
-#define GL_MAX_TEXTURE_COORDS_NV 0x8871
-#define GL_MAX_TEXTURE_IMAGE_UNITS_NV 0x8872
-#define GL_FRAGMENT_PROGRAM_BINDING_NV 0x8873
-#define GL_PROGRAM_ERROR_STRING_NV 0x8874
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4FVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMNAMEDPARAMETER4DVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
-typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERFVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMNAMEDPARAMETERDVNVPROC) (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramNamedParameter4fNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glProgramNamedParameter4fvNV (GLuint id, GLsizei len, const GLubyte *name, const GLfloat *v);
-GLAPI void APIENTRY glProgramNamedParameter4dNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramNamedParameter4dvNV (GLuint id, GLsizei len, const GLubyte *name, const GLdouble *v);
-GLAPI void APIENTRY glGetProgramNamedParameterfvNV (GLuint id, GLsizei len, const GLubyte *name, GLfloat *params);
-GLAPI void APIENTRY glGetProgramNamedParameterdvNV (GLuint id, GLsizei len, const GLubyte *name, GLdouble *params);
-#endif
-#endif /* GL_NV_fragment_program */
-
-#ifndef GL_NV_fragment_program2
-#define GL_NV_fragment_program2 1
-#define GL_MAX_PROGRAM_EXEC_INSTRUCTIONS_NV 0x88F4
-#define GL_MAX_PROGRAM_CALL_DEPTH_NV 0x88F5
-#define GL_MAX_PROGRAM_IF_DEPTH_NV 0x88F6
-#define GL_MAX_PROGRAM_LOOP_DEPTH_NV 0x88F7
-#define GL_MAX_PROGRAM_LOOP_COUNT_NV 0x88F8
-#endif /* GL_NV_fragment_program2 */
-
-#ifndef GL_NV_fragment_program4
-#define GL_NV_fragment_program4 1
-#endif /* GL_NV_fragment_program4 */
-
-#ifndef GL_NV_fragment_program_option
-#define GL_NV_fragment_program_option 1
-#endif /* GL_NV_fragment_program_option */
-
-#ifndef GL_NV_fragment_shader_interlock
-#define GL_NV_fragment_shader_interlock 1
-#endif /* GL_NV_fragment_shader_interlock */
-
-#ifndef GL_NV_framebuffer_mixed_samples
-#define GL_NV_framebuffer_mixed_samples 1
-#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
-#define GL_COLOR_SAMPLES_NV 0x8E20
-#define GL_DEPTH_SAMPLES_NV 0x932D
-#define GL_STENCIL_SAMPLES_NV 0x932E
-#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
-#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
-#define GL_COVERAGE_MODULATION_NV 0x9332
-#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
-typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v);
-typedef void (APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v);
-GLAPI void APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v);
-GLAPI void APIENTRY glCoverageModulationNV (GLenum components);
-#endif
-#endif /* GL_NV_framebuffer_mixed_samples */
-
-#ifndef GL_NV_framebuffer_multisample_coverage
-#define GL_NV_framebuffer_multisample_coverage 1
-#define GL_RENDERBUFFER_COVERAGE_SAMPLES_NV 0x8CAB
-#define GL_RENDERBUFFER_COLOR_SAMPLES_NV 0x8E10
-#define GL_MAX_MULTISAMPLE_COVERAGE_MODES_NV 0x8E11
-#define GL_MULTISAMPLE_COVERAGE_MODES_NV 0x8E12
-typedef void (APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderbufferStorageMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_NV_framebuffer_multisample_coverage */
-
-#ifndef GL_NV_geometry_program4
-#define GL_NV_geometry_program4 1
-#define GL_GEOMETRY_PROGRAM_NV 0x8C26
-#define GL_MAX_PROGRAM_OUTPUT_VERTICES_NV 0x8C27
-#define GL_MAX_PROGRAM_TOTAL_OUTPUT_COMPONENTS_NV 0x8C28
-typedef void (APIENTRYP PFNGLPROGRAMVERTEXLIMITNVPROC) (GLenum target, GLint limit);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREFACEEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramVertexLimitNV (GLenum target, GLint limit);
-GLAPI void APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
-GLAPI void APIENTRY glFramebufferTextureFaceEXT (GLenum target, GLenum attachment, GLuint texture, GLint level, GLenum face);
-#endif
-#endif /* GL_NV_geometry_program4 */
-
-#ifndef GL_NV_geometry_shader4
-#define GL_NV_geometry_shader4 1
-#endif /* GL_NV_geometry_shader4 */
-
-#ifndef GL_NV_geometry_shader_passthrough
-#define GL_NV_geometry_shader_passthrough 1
-#endif /* GL_NV_geometry_shader_passthrough */
-
-#ifndef GL_NV_gpu_multicast
-#define GL_NV_gpu_multicast 1
-#define GL_PER_GPU_STORAGE_BIT_NV 0x0800
-#define GL_MULTICAST_GPUS_NV 0x92BA
-#define GL_RENDER_GPU_MASK_NV 0x9558
-#define GL_PER_GPU_STORAGE_NV 0x9548
-#define GL_MULTICAST_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9549
-typedef void (APIENTRYP PFNGLRENDERGPUMASKNVPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLMULTICASTBUFFERSUBDATANVPROC) (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-typedef void (APIENTRYP PFNGLMULTICASTCOPYBUFFERSUBDATANVPROC) (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLMULTICASTCOPYIMAGESUBDATANVPROC) (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-typedef void (APIENTRYP PFNGLMULTICASTBLITFRAMEBUFFERNVPROC) (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef void (APIENTRYP PFNGLMULTICASTFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLMULTICASTBARRIERNVPROC) (void);
-typedef void (APIENTRYP PFNGLMULTICASTWAITSYNCNVPROC) (GLuint signalGpu, GLbitfield waitGpuMask);
-typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUIVNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
-typedef void (APIENTRYP PFNGLMULTICASTGETQUERYOBJECTUI64VNVPROC) (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glRenderGpuMaskNV (GLbitfield mask);
-GLAPI void APIENTRY glMulticastBufferSubDataNV (GLbitfield gpuMask, GLuint buffer, GLintptr offset, GLsizeiptr size, const void *data);
-GLAPI void APIENTRY glMulticastCopyBufferSubDataNV (GLuint readGpu, GLbitfield writeGpuMask, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GLAPI void APIENTRY glMulticastCopyImageSubDataNV (GLuint srcGpu, GLbitfield dstGpuMask, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-GLAPI void APIENTRY glMulticastBlitFramebufferNV (GLuint srcGpu, GLuint dstGpu, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GLAPI void APIENTRY glMulticastFramebufferSampleLocationsfvNV (GLuint gpu, GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glMulticastBarrierNV (void);
-GLAPI void APIENTRY glMulticastWaitSyncNV (GLuint signalGpu, GLbitfield waitGpuMask);
-GLAPI void APIENTRY glMulticastGetQueryObjectivNV (GLuint gpu, GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glMulticastGetQueryObjectuivNV (GLuint gpu, GLuint id, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glMulticastGetQueryObjecti64vNV (GLuint gpu, GLuint id, GLenum pname, GLint64 *params);
-GLAPI void APIENTRY glMulticastGetQueryObjectui64vNV (GLuint gpu, GLuint id, GLenum pname, GLuint64 *params);
-#endif
-#endif /* GL_NV_gpu_multicast */
-
-#ifndef GL_NV_gpu_program4
-#define GL_NV_gpu_program4 1
-#define GL_MIN_PROGRAM_TEXEL_OFFSET_NV 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET_NV 0x8905
-#define GL_PROGRAM_ATTRIB_COMPONENTS_NV 0x8906
-#define GL_PROGRAM_RESULT_COMPONENTS_NV 0x8907
-#define GL_MAX_PROGRAM_ATTRIB_COMPONENTS_NV 0x8908
-#define GL_MAX_PROGRAM_RESULT_COMPONENTS_NV 0x8909
-#define GL_MAX_PROGRAM_GENERIC_ATTRIBS_NV 0x8DA5
-#define GL_MAX_PROGRAM_GENERIC_RESULTS_NV 0x8DA6
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
-typedef void (APIENTRYP PFNGLPROGRAMLOCALPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4INVPROC) (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4IVNVPROC) (GLenum target, GLuint index, const GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4IVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UINVPROC) (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERI4UIVNVPROC) (GLenum target, GLuint index, const GLuint *params);
-typedef void (APIENTRYP PFNGLPROGRAMENVPARAMETERSI4UIVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMLOCALPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIIVNVPROC) (GLenum target, GLuint index, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMENVPARAMETERIUIVNVPROC) (GLenum target, GLuint index, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramLocalParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glProgramLocalParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
-GLAPI void APIENTRY glProgramLocalParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
-GLAPI void APIENTRY glProgramLocalParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glProgramLocalParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
-GLAPI void APIENTRY glProgramLocalParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-GLAPI void APIENTRY glProgramEnvParameterI4iNV (GLenum target, GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glProgramEnvParameterI4ivNV (GLenum target, GLuint index, const GLint *params);
-GLAPI void APIENTRY glProgramEnvParametersI4ivNV (GLenum target, GLuint index, GLsizei count, const GLint *params);
-GLAPI void APIENTRY glProgramEnvParameterI4uiNV (GLenum target, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glProgramEnvParameterI4uivNV (GLenum target, GLuint index, const GLuint *params);
-GLAPI void APIENTRY glProgramEnvParametersI4uivNV (GLenum target, GLuint index, GLsizei count, const GLuint *params);
-GLAPI void APIENTRY glGetProgramLocalParameterIivNV (GLenum target, GLuint index, GLint *params);
-GLAPI void APIENTRY glGetProgramLocalParameterIuivNV (GLenum target, GLuint index, GLuint *params);
-GLAPI void APIENTRY glGetProgramEnvParameterIivNV (GLenum target, GLuint index, GLint *params);
-GLAPI void APIENTRY glGetProgramEnvParameterIuivNV (GLenum target, GLuint index, GLuint *params);
-#endif
-#endif /* GL_NV_gpu_program4 */
-
-#ifndef GL_NV_gpu_program5
-#define GL_NV_gpu_program5 1
-#define GL_MAX_GEOMETRY_PROGRAM_INVOCATIONS_NV 0x8E5A
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_NV 0x8E5C
-#define GL_FRAGMENT_PROGRAM_INTERPOLATION_OFFSET_BITS_NV 0x8E5D
-#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5E
-#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET_NV 0x8E5F
-#define GL_MAX_PROGRAM_SUBROUTINE_PARAMETERS_NV 0x8F44
-#define GL_MAX_PROGRAM_SUBROUTINE_NUM_NV 0x8F45
-typedef void (APIENTRYP PFNGLPROGRAMSUBROUTINEPARAMETERSUIVNVPROC) (GLenum target, GLsizei count, const GLuint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSUBROUTINEPARAMETERUIVNVPROC) (GLenum target, GLuint index, GLuint *param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramSubroutineParametersuivNV (GLenum target, GLsizei count, const GLuint *params);
-GLAPI void APIENTRY glGetProgramSubroutineParameteruivNV (GLenum target, GLuint index, GLuint *param);
-#endif
-#endif /* GL_NV_gpu_program5 */
-
-#ifndef GL_NV_gpu_program5_mem_extended
-#define GL_NV_gpu_program5_mem_extended 1
-#endif /* GL_NV_gpu_program5_mem_extended */
-
-#ifndef GL_NV_gpu_shader5
-#define GL_NV_gpu_shader5 1
-#endif /* GL_NV_gpu_shader5 */
-
-#ifndef GL_NV_half_float
-#define GL_NV_half_float 1
-typedef unsigned short GLhalfNV;
-#define GL_HALF_FLOAT_NV 0x140B
-typedef void (APIENTRYP PFNGLVERTEX2HNVPROC) (GLhalfNV x, GLhalfNV y);
-typedef void (APIENTRYP PFNGLVERTEX2HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEX3HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z);
-typedef void (APIENTRYP PFNGLVERTEX3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEX4HNVPROC) (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-typedef void (APIENTRYP PFNGLVERTEX4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLNORMAL3HNVPROC) (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
-typedef void (APIENTRYP PFNGLNORMAL3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-typedef void (APIENTRYP PFNGLCOLOR3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLCOLOR4HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
-typedef void (APIENTRYP PFNGLCOLOR4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD1HNVPROC) (GLhalfNV s);
-typedef void (APIENTRYP PFNGLTEXCOORD1HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2HNVPROC) (GLhalfNV s, GLhalfNV t);
-typedef void (APIENTRYP PFNGLTEXCOORD2HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD3HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r);
-typedef void (APIENTRYP PFNGLTEXCOORD3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4HNVPROC) (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-typedef void (APIENTRYP PFNGLTEXCOORD4HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1HNVPROC) (GLenum target, GLhalfNV s);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD1HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD2HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD3HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4HNVPROC) (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-typedef void (APIENTRYP PFNGLMULTITEXCOORD4HVNVPROC) (GLenum target, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLFOGCOORDHNVPROC) (GLhalfNV fog);
-typedef void (APIENTRYP PFNGLFOGCOORDHVNVPROC) (const GLhalfNV *fog);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HNVPROC) (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-typedef void (APIENTRYP PFNGLSECONDARYCOLOR3HVNVPROC) (const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTHNVPROC) (GLhalfNV weight);
-typedef void (APIENTRYP PFNGLVERTEXWEIGHTHVNVPROC) (const GLhalfNV *weight);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1HNVPROC) (GLuint index, GLhalfNV x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4HNVPROC) (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4HVNVPROC) (GLuint index, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4HVNVPROC) (GLuint index, GLsizei n, const GLhalfNV *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertex2hNV (GLhalfNV x, GLhalfNV y);
-GLAPI void APIENTRY glVertex2hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glVertex3hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z);
-GLAPI void APIENTRY glVertex3hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glVertex4hNV (GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-GLAPI void APIENTRY glVertex4hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glNormal3hNV (GLhalfNV nx, GLhalfNV ny, GLhalfNV nz);
-GLAPI void APIENTRY glNormal3hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-GLAPI void APIENTRY glColor3hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glColor4hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue, GLhalfNV alpha);
-GLAPI void APIENTRY glColor4hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glTexCoord1hNV (GLhalfNV s);
-GLAPI void APIENTRY glTexCoord1hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glTexCoord2hNV (GLhalfNV s, GLhalfNV t);
-GLAPI void APIENTRY glTexCoord2hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glTexCoord3hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r);
-GLAPI void APIENTRY glTexCoord3hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glTexCoord4hNV (GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-GLAPI void APIENTRY glTexCoord4hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glMultiTexCoord1hNV (GLenum target, GLhalfNV s);
-GLAPI void APIENTRY glMultiTexCoord1hvNV (GLenum target, const GLhalfNV *v);
-GLAPI void APIENTRY glMultiTexCoord2hNV (GLenum target, GLhalfNV s, GLhalfNV t);
-GLAPI void APIENTRY glMultiTexCoord2hvNV (GLenum target, const GLhalfNV *v);
-GLAPI void APIENTRY glMultiTexCoord3hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r);
-GLAPI void APIENTRY glMultiTexCoord3hvNV (GLenum target, const GLhalfNV *v);
-GLAPI void APIENTRY glMultiTexCoord4hNV (GLenum target, GLhalfNV s, GLhalfNV t, GLhalfNV r, GLhalfNV q);
-GLAPI void APIENTRY glMultiTexCoord4hvNV (GLenum target, const GLhalfNV *v);
-GLAPI void APIENTRY glFogCoordhNV (GLhalfNV fog);
-GLAPI void APIENTRY glFogCoordhvNV (const GLhalfNV *fog);
-GLAPI void APIENTRY glSecondaryColor3hNV (GLhalfNV red, GLhalfNV green, GLhalfNV blue);
-GLAPI void APIENTRY glSecondaryColor3hvNV (const GLhalfNV *v);
-GLAPI void APIENTRY glVertexWeighthNV (GLhalfNV weight);
-GLAPI void APIENTRY glVertexWeighthvNV (const GLhalfNV *weight);
-GLAPI void APIENTRY glVertexAttrib1hNV (GLuint index, GLhalfNV x);
-GLAPI void APIENTRY glVertexAttrib1hvNV (GLuint index, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttrib2hNV (GLuint index, GLhalfNV x, GLhalfNV y);
-GLAPI void APIENTRY glVertexAttrib2hvNV (GLuint index, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttrib3hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z);
-GLAPI void APIENTRY glVertexAttrib3hvNV (GLuint index, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttrib4hNV (GLuint index, GLhalfNV x, GLhalfNV y, GLhalfNV z, GLhalfNV w);
-GLAPI void APIENTRY glVertexAttrib4hvNV (GLuint index, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttribs1hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttribs2hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttribs3hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
-GLAPI void APIENTRY glVertexAttribs4hvNV (GLuint index, GLsizei n, const GLhalfNV *v);
-#endif
-#endif /* GL_NV_half_float */
-
-#ifndef GL_NV_internalformat_sample_query
-#define GL_NV_internalformat_sample_query 1
-#define GL_MULTISAMPLES_NV 0x9371
-#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
-#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
-#define GL_CONFORMANT_NV 0x9374
-typedef void (APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_NV_internalformat_sample_query */
-
-#ifndef GL_NV_light_max_exponent
-#define GL_NV_light_max_exponent 1
-#define GL_MAX_SHININESS_NV 0x8504
-#define GL_MAX_SPOT_EXPONENT_NV 0x8505
-#endif /* GL_NV_light_max_exponent */
-
-#ifndef GL_NV_multisample_coverage
-#define GL_NV_multisample_coverage 1
-#endif /* GL_NV_multisample_coverage */
-
-#ifndef GL_NV_multisample_filter_hint
-#define GL_NV_multisample_filter_hint 1
-#define GL_MULTISAMPLE_FILTER_HINT_NV 0x8534
-#endif /* GL_NV_multisample_filter_hint */
-
-#ifndef GL_NV_occlusion_query
-#define GL_NV_occlusion_query 1
-#define GL_PIXEL_COUNTER_BITS_NV 0x8864
-#define GL_CURRENT_OCCLUSION_QUERY_ID_NV 0x8865
-#define GL_PIXEL_COUNT_NV 0x8866
-#define GL_PIXEL_COUNT_AVAILABLE_NV 0x8867
-typedef void (APIENTRYP PFNGLGENOCCLUSIONQUERIESNVPROC) (GLsizei n, GLuint *ids);
-typedef void (APIENTRYP PFNGLDELETEOCCLUSIONQUERIESNVPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISOCCLUSIONQUERYNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLBEGINOCCLUSIONQUERYNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLENDOCCLUSIONQUERYNVPROC) (void);
-typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYIVNVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETOCCLUSIONQUERYUIVNVPROC) (GLuint id, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenOcclusionQueriesNV (GLsizei n, GLuint *ids);
-GLAPI void APIENTRY glDeleteOcclusionQueriesNV (GLsizei n, const GLuint *ids);
-GLAPI GLboolean APIENTRY glIsOcclusionQueryNV (GLuint id);
-GLAPI void APIENTRY glBeginOcclusionQueryNV (GLuint id);
-GLAPI void APIENTRY glEndOcclusionQueryNV (void);
-GLAPI void APIENTRY glGetOcclusionQueryivNV (GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetOcclusionQueryuivNV (GLuint id, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_NV_occlusion_query */
-
-#ifndef GL_NV_packed_depth_stencil
-#define GL_NV_packed_depth_stencil 1
-#define GL_DEPTH_STENCIL_NV 0x84F9
-#define GL_UNSIGNED_INT_24_8_NV 0x84FA
-#endif /* GL_NV_packed_depth_stencil */
-
-#ifndef GL_NV_parameter_buffer_object
-#define GL_NV_parameter_buffer_object 1
-#define GL_MAX_PROGRAM_PARAMETER_BUFFER_BINDINGS_NV 0x8DA0
-#define GL_MAX_PROGRAM_PARAMETER_BUFFER_SIZE_NV 0x8DA1
-#define GL_VERTEX_PROGRAM_PARAMETER_BUFFER_NV 0x8DA2
-#define GL_GEOMETRY_PROGRAM_PARAMETER_BUFFER_NV 0x8DA3
-#define GL_FRAGMENT_PROGRAM_PARAMETER_BUFFER_NV 0x8DA4
-typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSFVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);
-typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);
-typedef void (APIENTRYP PFNGLPROGRAMBUFFERPARAMETERSIUIVNVPROC) (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glProgramBufferParametersfvNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLfloat *params);
-GLAPI void APIENTRY glProgramBufferParametersIivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLint *params);
-GLAPI void APIENTRY glProgramBufferParametersIuivNV (GLenum target, GLuint bindingIndex, GLuint wordIndex, GLsizei count, const GLuint *params);
-#endif
-#endif /* GL_NV_parameter_buffer_object */
-
-#ifndef GL_NV_parameter_buffer_object2
-#define GL_NV_parameter_buffer_object2 1
-#endif /* GL_NV_parameter_buffer_object2 */
-
-#ifndef GL_NV_path_rendering
-#define GL_NV_path_rendering 1
-#define GL_PATH_FORMAT_SVG_NV 0x9070
-#define GL_PATH_FORMAT_PS_NV 0x9071
-#define GL_STANDARD_FONT_NAME_NV 0x9072
-#define GL_SYSTEM_FONT_NAME_NV 0x9073
-#define GL_FILE_NAME_NV 0x9074
-#define GL_PATH_STROKE_WIDTH_NV 0x9075
-#define GL_PATH_END_CAPS_NV 0x9076
-#define GL_PATH_INITIAL_END_CAP_NV 0x9077
-#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
-#define GL_PATH_JOIN_STYLE_NV 0x9079
-#define GL_PATH_MITER_LIMIT_NV 0x907A
-#define GL_PATH_DASH_CAPS_NV 0x907B
-#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
-#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
-#define GL_PATH_DASH_OFFSET_NV 0x907E
-#define GL_PATH_CLIENT_LENGTH_NV 0x907F
-#define GL_PATH_FILL_MODE_NV 0x9080
-#define GL_PATH_FILL_MASK_NV 0x9081
-#define GL_PATH_FILL_COVER_MODE_NV 0x9082
-#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
-#define GL_PATH_STROKE_MASK_NV 0x9084
-#define GL_COUNT_UP_NV 0x9088
-#define GL_COUNT_DOWN_NV 0x9089
-#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
-#define GL_CONVEX_HULL_NV 0x908B
-#define GL_BOUNDING_BOX_NV 0x908D
-#define GL_TRANSLATE_X_NV 0x908E
-#define GL_TRANSLATE_Y_NV 0x908F
-#define GL_TRANSLATE_2D_NV 0x9090
-#define GL_TRANSLATE_3D_NV 0x9091
-#define GL_AFFINE_2D_NV 0x9092
-#define GL_AFFINE_3D_NV 0x9094
-#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
-#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
-#define GL_UTF8_NV 0x909A
-#define GL_UTF16_NV 0x909B
-#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
-#define GL_PATH_COMMAND_COUNT_NV 0x909D
-#define GL_PATH_COORD_COUNT_NV 0x909E
-#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
-#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
-#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
-#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
-#define GL_SQUARE_NV 0x90A3
-#define GL_ROUND_NV 0x90A4
-#define GL_TRIANGULAR_NV 0x90A5
-#define GL_BEVEL_NV 0x90A6
-#define GL_MITER_REVERT_NV 0x90A7
-#define GL_MITER_TRUNCATE_NV 0x90A8
-#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
-#define GL_USE_MISSING_GLYPH_NV 0x90AA
-#define GL_PATH_ERROR_POSITION_NV 0x90AB
-#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
-#define GL_ADJACENT_PAIRS_NV 0x90AE
-#define GL_FIRST_TO_REST_NV 0x90AF
-#define GL_PATH_GEN_MODE_NV 0x90B0
-#define GL_PATH_GEN_COEFF_NV 0x90B1
-#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
-#define GL_PATH_STENCIL_FUNC_NV 0x90B7
-#define GL_PATH_STENCIL_REF_NV 0x90B8
-#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
-#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
-#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
-#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
-#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
-#define GL_MOVE_TO_RESETS_NV 0x90B5
-#define GL_MOVE_TO_CONTINUES_NV 0x90B6
-#define GL_CLOSE_PATH_NV 0x00
-#define GL_MOVE_TO_NV 0x02
-#define GL_RELATIVE_MOVE_TO_NV 0x03
-#define GL_LINE_TO_NV 0x04
-#define GL_RELATIVE_LINE_TO_NV 0x05
-#define GL_HORIZONTAL_LINE_TO_NV 0x06
-#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
-#define GL_VERTICAL_LINE_TO_NV 0x08
-#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
-#define GL_QUADRATIC_CURVE_TO_NV 0x0A
-#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
-#define GL_CUBIC_CURVE_TO_NV 0x0C
-#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
-#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
-#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
-#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
-#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
-#define GL_SMALL_CCW_ARC_TO_NV 0x12
-#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
-#define GL_SMALL_CW_ARC_TO_NV 0x14
-#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
-#define GL_LARGE_CCW_ARC_TO_NV 0x16
-#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
-#define GL_LARGE_CW_ARC_TO_NV 0x18
-#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
-#define GL_RESTART_PATH_NV 0xF0
-#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
-#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
-#define GL_RECT_NV 0xF6
-#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
-#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
-#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
-#define GL_ARC_TO_NV 0xFE
-#define GL_RELATIVE_ARC_TO_NV 0xFF
-#define GL_BOLD_BIT_NV 0x01
-#define GL_ITALIC_BIT_NV 0x02
-#define GL_GLYPH_WIDTH_BIT_NV 0x01
-#define GL_GLYPH_HEIGHT_BIT_NV 0x02
-#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
-#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
-#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
-#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
-#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
-#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
-#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
-#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
-#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
-#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
-#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
-#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
-#define GL_FONT_ASCENDER_BIT_NV 0x00200000
-#define GL_FONT_DESCENDER_BIT_NV 0x00400000
-#define GL_FONT_HEIGHT_BIT_NV 0x00800000
-#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
-#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
-#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
-#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
-#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
-#define GL_ROUNDED_RECT_NV 0xE8
-#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
-#define GL_ROUNDED_RECT2_NV 0xEA
-#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
-#define GL_ROUNDED_RECT4_NV 0xEC
-#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
-#define GL_ROUNDED_RECT8_NV 0xEE
-#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
-#define GL_RELATIVE_RECT_NV 0xF7
-#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
-#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
-#define GL_FONT_UNAVAILABLE_NV 0x936A
-#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
-#define GL_CONIC_CURVE_TO_NV 0x1A
-#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
-#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
-#define GL_STANDARD_FONT_FORMAT_NV 0x936C
-#define GL_2_BYTES_NV 0x1407
-#define GL_3_BYTES_NV 0x1408
-#define GL_4_BYTES_NV 0x1409
-#define GL_EYE_LINEAR_NV 0x2400
-#define GL_OBJECT_LINEAR_NV 0x2401
-#define GL_CONSTANT_NV 0x8576
-#define GL_PATH_FOG_GEN_MODE_NV 0x90AC
-#define GL_PRIMARY_COLOR_NV 0x852C
-#define GL_SECONDARY_COLOR_NV 0x852D
-#define GL_PATH_GEN_COLOR_FORMAT_NV 0x90B2
-#define GL_PATH_PROJECTION_NV 0x1701
-#define GL_PATH_MODELVIEW_NV 0x1700
-#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
-#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
-#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
-#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
-#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
-#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
-#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
-#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
-#define GL_FRAGMENT_INPUT_NV 0x936D
-typedef GLuint (APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
-typedef void (APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
-typedef GLboolean (APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
-typedef void (APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
-typedef void (APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-typedef void (APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
-typedef void (APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-typedef void (APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
-typedef void (APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
-typedef void (APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-typedef void (APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
-typedef void (APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
-typedef void (APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
-typedef void (APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
-typedef void (APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
-typedef void (APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
-typedef void (APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
-typedef void (APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
-typedef void (APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-typedef void (APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-typedef void (APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-typedef GLboolean (APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-typedef GLboolean (APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
-typedef GLfloat (APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
-typedef GLboolean (APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-typedef void (APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-typedef GLenum (APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-typedef void (APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-typedef void (APIENTRYP PFNGLPATHCOLORGENNVPROC) (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
-typedef void (APIENTRYP PFNGLPATHTEXGENNVPROC) (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
-typedef void (APIENTRYP PFNGLPATHFOGGENNVPROC) (GLenum genMode);
-typedef void (APIENTRYP PFNGLGETPATHCOLORGENIVNVPROC) (GLenum color, GLenum pname, GLint *value);
-typedef void (APIENTRYP PFNGLGETPATHCOLORGENFVNVPROC) (GLenum color, GLenum pname, GLfloat *value);
-typedef void (APIENTRYP PFNGLGETPATHTEXGENIVNVPROC) (GLenum texCoordSet, GLenum pname, GLint *value);
-typedef void (APIENTRYP PFNGLGETPATHTEXGENFVNVPROC) (GLenum texCoordSet, GLenum pname, GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLuint APIENTRY glGenPathsNV (GLsizei range);
-GLAPI void APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
-GLAPI GLboolean APIENTRY glIsPathNV (GLuint path);
-GLAPI void APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-GLAPI void APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
-GLAPI void APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-GLAPI void APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
-GLAPI void APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-GLAPI void APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
-GLAPI void APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
-GLAPI void APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
-GLAPI void APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
-GLAPI void APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-GLAPI void APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
-GLAPI void APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
-GLAPI void APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
-GLAPI void APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
-GLAPI void APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glPathCoverDepthFuncNV (GLenum func);
-GLAPI void APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
-GLAPI void APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
-GLAPI void APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
-GLAPI void APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
-GLAPI void APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
-GLAPI void APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
-GLAPI void APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
-GLAPI void APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-GLAPI void APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-GLAPI void APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-GLAPI GLboolean APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-GLAPI GLboolean APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
-GLAPI GLfloat APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
-GLAPI GLboolean APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-GLAPI void APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GLAPI void APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-GLAPI void APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-GLAPI void APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI void APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GLAPI GLenum APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-GLAPI GLenum APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI GLenum APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GLAPI void APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-GLAPI void APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-GLAPI void APIENTRY glPathColorGenNV (GLenum color, GLenum genMode, GLenum colorFormat, const GLfloat *coeffs);
-GLAPI void APIENTRY glPathTexGenNV (GLenum texCoordSet, GLenum genMode, GLint components, const GLfloat *coeffs);
-GLAPI void APIENTRY glPathFogGenNV (GLenum genMode);
-GLAPI void APIENTRY glGetPathColorGenivNV (GLenum color, GLenum pname, GLint *value);
-GLAPI void APIENTRY glGetPathColorGenfvNV (GLenum color, GLenum pname, GLfloat *value);
-GLAPI void APIENTRY glGetPathTexGenivNV (GLenum texCoordSet, GLenum pname, GLint *value);
-GLAPI void APIENTRY glGetPathTexGenfvNV (GLenum texCoordSet, GLenum pname, GLfloat *value);
-#endif
-#endif /* GL_NV_path_rendering */
-
-#ifndef GL_NV_path_rendering_shared_edge
-#define GL_NV_path_rendering_shared_edge 1
-#define GL_SHARED_EDGE_NV 0xC0
-#endif /* GL_NV_path_rendering_shared_edge */
-
-#ifndef GL_NV_pixel_data_range
-#define GL_NV_pixel_data_range 1
-#define GL_WRITE_PIXEL_DATA_RANGE_NV 0x8878
-#define GL_READ_PIXEL_DATA_RANGE_NV 0x8879
-#define GL_WRITE_PIXEL_DATA_RANGE_LENGTH_NV 0x887A
-#define GL_READ_PIXEL_DATA_RANGE_LENGTH_NV 0x887B
-#define GL_WRITE_PIXEL_DATA_RANGE_POINTER_NV 0x887C
-#define GL_READ_PIXEL_DATA_RANGE_POINTER_NV 0x887D
-typedef void (APIENTRYP PFNGLPIXELDATARANGENVPROC) (GLenum target, GLsizei length, const void *pointer);
-typedef void (APIENTRYP PFNGLFLUSHPIXELDATARANGENVPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelDataRangeNV (GLenum target, GLsizei length, const void *pointer);
-GLAPI void APIENTRY glFlushPixelDataRangeNV (GLenum target);
-#endif
-#endif /* GL_NV_pixel_data_range */
-
-#ifndef GL_NV_point_sprite
-#define GL_NV_point_sprite 1
-#define GL_POINT_SPRITE_NV 0x8861
-#define GL_COORD_REPLACE_NV 0x8862
-#define GL_POINT_SPRITE_R_MODE_NV 0x8863
-typedef void (APIENTRYP PFNGLPOINTPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameteriNV (GLenum pname, GLint param);
-GLAPI void APIENTRY glPointParameterivNV (GLenum pname, const GLint *params);
-#endif
-#endif /* GL_NV_point_sprite */
-
-#ifndef GL_NV_present_video
-#define GL_NV_present_video 1
-#define GL_FRAME_NV 0x8E26
-#define GL_FIELDS_NV 0x8E27
-#define GL_CURRENT_TIME_NV 0x8E28
-#define GL_NUM_FILL_STREAMS_NV 0x8E29
-#define GL_PRESENT_TIME_NV 0x8E2A
-#define GL_PRESENT_DURATION_NV 0x8E2B
-typedef void (APIENTRYP PFNGLPRESENTFRAMEKEYEDNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
-typedef void (APIENTRYP PFNGLPRESENTFRAMEDUALFILLNVPROC) (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
-typedef void (APIENTRYP PFNGLGETVIDEOIVNVPROC) (GLuint video_slot, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVIDEOUIVNVPROC) (GLuint video_slot, GLenum pname, GLuint *params);
-typedef void (APIENTRYP PFNGLGETVIDEOI64VNVPROC) (GLuint video_slot, GLenum pname, GLint64EXT *params);
-typedef void (APIENTRYP PFNGLGETVIDEOUI64VNVPROC) (GLuint video_slot, GLenum pname, GLuint64EXT *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPresentFrameKeyedNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLuint key0, GLenum target1, GLuint fill1, GLuint key1);
-GLAPI void APIENTRY glPresentFrameDualFillNV (GLuint video_slot, GLuint64EXT minPresentTime, GLuint beginPresentTimeId, GLuint presentDurationId, GLenum type, GLenum target0, GLuint fill0, GLenum target1, GLuint fill1, GLenum target2, GLuint fill2, GLenum target3, GLuint fill3);
-GLAPI void APIENTRY glGetVideoivNV (GLuint video_slot, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVideouivNV (GLuint video_slot, GLenum pname, GLuint *params);
-GLAPI void APIENTRY glGetVideoi64vNV (GLuint video_slot, GLenum pname, GLint64EXT *params);
-GLAPI void APIENTRY glGetVideoui64vNV (GLuint video_slot, GLenum pname, GLuint64EXT *params);
-#endif
-#endif /* GL_NV_present_video */
-
-#ifndef GL_NV_primitive_restart
-#define GL_NV_primitive_restart 1
-#define GL_PRIMITIVE_RESTART_NV 0x8558
-#define GL_PRIMITIVE_RESTART_INDEX_NV 0x8559
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTNVPROC) (void);
-typedef void (APIENTRYP PFNGLPRIMITIVERESTARTINDEXNVPROC) (GLuint index);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPrimitiveRestartNV (void);
-GLAPI void APIENTRY glPrimitiveRestartIndexNV (GLuint index);
-#endif
-#endif /* GL_NV_primitive_restart */
-
-#ifndef GL_NV_query_resource
-#define GL_NV_query_resource 1
-#define GL_QUERY_RESOURCE_TYPE_VIDMEM_ALLOC_NV 0x9540
-#define GL_QUERY_RESOURCE_MEMTYPE_VIDMEM_NV 0x9542
-#define GL_QUERY_RESOURCE_SYS_RESERVED_NV 0x9544
-#define GL_QUERY_RESOURCE_TEXTURE_NV 0x9545
-#define GL_QUERY_RESOURCE_RENDERBUFFER_NV 0x9546
-#define GL_QUERY_RESOURCE_BUFFEROBJECT_NV 0x9547
-typedef GLint (APIENTRYP PFNGLQUERYRESOURCENVPROC) (GLenum queryType, GLint tagId, GLuint bufSize, GLint *buffer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLint APIENTRY glQueryResourceNV (GLenum queryType, GLint tagId, GLuint bufSize, GLint *buffer);
-#endif
-#endif /* GL_NV_query_resource */
-
-#ifndef GL_NV_query_resource_tag
-#define GL_NV_query_resource_tag 1
-typedef void (APIENTRYP PFNGLGENQUERYRESOURCETAGNVPROC) (GLsizei n, GLint *tagIds);
-typedef void (APIENTRYP PFNGLDELETEQUERYRESOURCETAGNVPROC) (GLsizei n, const GLint *tagIds);
-typedef void (APIENTRYP PFNGLQUERYRESOURCETAGNVPROC) (GLint tagId, const GLchar *tagString);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGenQueryResourceTagNV (GLsizei n, GLint *tagIds);
-GLAPI void APIENTRY glDeleteQueryResourceTagNV (GLsizei n, const GLint *tagIds);
-GLAPI void APIENTRY glQueryResourceTagNV (GLint tagId, const GLchar *tagString);
-#endif
-#endif /* GL_NV_query_resource_tag */
-
-#ifndef GL_NV_register_combiners
-#define GL_NV_register_combiners 1
-#define GL_REGISTER_COMBINERS_NV 0x8522
-#define GL_VARIABLE_A_NV 0x8523
-#define GL_VARIABLE_B_NV 0x8524
-#define GL_VARIABLE_C_NV 0x8525
-#define GL_VARIABLE_D_NV 0x8526
-#define GL_VARIABLE_E_NV 0x8527
-#define GL_VARIABLE_F_NV 0x8528
-#define GL_VARIABLE_G_NV 0x8529
-#define GL_CONSTANT_COLOR0_NV 0x852A
-#define GL_CONSTANT_COLOR1_NV 0x852B
-#define GL_SPARE0_NV 0x852E
-#define GL_SPARE1_NV 0x852F
-#define GL_DISCARD_NV 0x8530
-#define GL_E_TIMES_F_NV 0x8531
-#define GL_SPARE0_PLUS_SECONDARY_COLOR_NV 0x8532
-#define GL_UNSIGNED_IDENTITY_NV 0x8536
-#define GL_UNSIGNED_INVERT_NV 0x8537
-#define GL_EXPAND_NORMAL_NV 0x8538
-#define GL_EXPAND_NEGATE_NV 0x8539
-#define GL_HALF_BIAS_NORMAL_NV 0x853A
-#define GL_HALF_BIAS_NEGATE_NV 0x853B
-#define GL_SIGNED_IDENTITY_NV 0x853C
-#define GL_SIGNED_NEGATE_NV 0x853D
-#define GL_SCALE_BY_TWO_NV 0x853E
-#define GL_SCALE_BY_FOUR_NV 0x853F
-#define GL_SCALE_BY_ONE_HALF_NV 0x8540
-#define GL_BIAS_BY_NEGATIVE_ONE_HALF_NV 0x8541
-#define GL_COMBINER_INPUT_NV 0x8542
-#define GL_COMBINER_MAPPING_NV 0x8543
-#define GL_COMBINER_COMPONENT_USAGE_NV 0x8544
-#define GL_COMBINER_AB_DOT_PRODUCT_NV 0x8545
-#define GL_COMBINER_CD_DOT_PRODUCT_NV 0x8546
-#define GL_COMBINER_MUX_SUM_NV 0x8547
-#define GL_COMBINER_SCALE_NV 0x8548
-#define GL_COMBINER_BIAS_NV 0x8549
-#define GL_COMBINER_AB_OUTPUT_NV 0x854A
-#define GL_COMBINER_CD_OUTPUT_NV 0x854B
-#define GL_COMBINER_SUM_OUTPUT_NV 0x854C
-#define GL_MAX_GENERAL_COMBINERS_NV 0x854D
-#define GL_NUM_GENERAL_COMBINERS_NV 0x854E
-#define GL_COLOR_SUM_CLAMP_NV 0x854F
-#define GL_COMBINER0_NV 0x8550
-#define GL_COMBINER1_NV 0x8551
-#define GL_COMBINER2_NV 0x8552
-#define GL_COMBINER3_NV 0x8553
-#define GL_COMBINER4_NV 0x8554
-#define GL_COMBINER5_NV 0x8555
-#define GL_COMBINER6_NV 0x8556
-#define GL_COMBINER7_NV 0x8557
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFVNVPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERFNVPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERIVNVPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOMBINERPARAMETERINVPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLCOMBINERINPUTNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (APIENTRYP PFNGLCOMBINEROUTPUTNVPROC) (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
-typedef void (APIENTRYP PFNGLFINALCOMBINERINPUTNVPROC) (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINERINPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERFVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINEROUTPUTPARAMETERIVNVPROC) (GLenum stage, GLenum portion, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERFVNVPROC) (GLenum variable, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFINALCOMBINERINPUTPARAMETERIVNVPROC) (GLenum variable, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerParameterfvNV (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glCombinerParameterfNV (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glCombinerParameterivNV (GLenum pname, const GLint *params);
-GLAPI void APIENTRY glCombinerParameteriNV (GLenum pname, GLint param);
-GLAPI void APIENTRY glCombinerInputNV (GLenum stage, GLenum portion, GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-GLAPI void APIENTRY glCombinerOutputNV (GLenum stage, GLenum portion, GLenum abOutput, GLenum cdOutput, GLenum sumOutput, GLenum scale, GLenum bias, GLboolean abDotProduct, GLboolean cdDotProduct, GLboolean muxSum);
-GLAPI void APIENTRY glFinalCombinerInputNV (GLenum variable, GLenum input, GLenum mapping, GLenum componentUsage);
-GLAPI void APIENTRY glGetCombinerInputParameterfvNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetCombinerInputParameterivNV (GLenum stage, GLenum portion, GLenum variable, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetCombinerOutputParameterfvNV (GLenum stage, GLenum portion, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetCombinerOutputParameterivNV (GLenum stage, GLenum portion, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterfvNV (GLenum variable, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetFinalCombinerInputParameterivNV (GLenum variable, GLenum pname, GLint *params);
-#endif
-#endif /* GL_NV_register_combiners */
-
-#ifndef GL_NV_register_combiners2
-#define GL_NV_register_combiners2 1
-#define GL_PER_STAGE_CONSTANTS_NV 0x8535
-typedef void (APIENTRYP PFNGLCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOMBINERSTAGEPARAMETERFVNVPROC) (GLenum stage, GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glCombinerStageParameterfvNV (GLenum stage, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glGetCombinerStageParameterfvNV (GLenum stage, GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_NV_register_combiners2 */
-
-#ifndef GL_NV_robustness_video_memory_purge
-#define GL_NV_robustness_video_memory_purge 1
-#define GL_PURGED_CONTEXT_RESET_NV 0x92BB
-#endif /* GL_NV_robustness_video_memory_purge */
-
-#ifndef GL_NV_sample_locations
-#define GL_NV_sample_locations 1
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
-#define GL_SAMPLE_LOCATION_NV 0x8E50
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
-typedef void (APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glResolveDepthValuesNV (void);
-#endif
-#endif /* GL_NV_sample_locations */
-
-#ifndef GL_NV_sample_mask_override_coverage
-#define GL_NV_sample_mask_override_coverage 1
-#endif /* GL_NV_sample_mask_override_coverage */
-
-#ifndef GL_NV_shader_atomic_counters
-#define GL_NV_shader_atomic_counters 1
-#endif /* GL_NV_shader_atomic_counters */
-
-#ifndef GL_NV_shader_atomic_float
-#define GL_NV_shader_atomic_float 1
-#endif /* GL_NV_shader_atomic_float */
-
-#ifndef GL_NV_shader_atomic_float64
-#define GL_NV_shader_atomic_float64 1
-#endif /* GL_NV_shader_atomic_float64 */
-
-#ifndef GL_NV_shader_atomic_fp16_vector
-#define GL_NV_shader_atomic_fp16_vector 1
-#endif /* GL_NV_shader_atomic_fp16_vector */
-
-#ifndef GL_NV_shader_atomic_int64
-#define GL_NV_shader_atomic_int64 1
-#endif /* GL_NV_shader_atomic_int64 */
-
-#ifndef GL_NV_shader_buffer_load
-#define GL_NV_shader_buffer_load 1
-#define GL_BUFFER_GPU_ADDRESS_NV 0x8F1D
-#define GL_GPU_ADDRESS_NV 0x8F34
-#define GL_MAX_SHADER_BUFFER_ADDRESS_NV 0x8F35
-typedef void (APIENTRYP PFNGLMAKEBUFFERRESIDENTNVPROC) (GLenum target, GLenum access);
-typedef void (APIENTRYP PFNGLMAKEBUFFERNONRESIDENTNVPROC) (GLenum target);
-typedef GLboolean (APIENTRYP PFNGLISBUFFERRESIDENTNVPROC) (GLenum target);
-typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERRESIDENTNVPROC) (GLuint buffer, GLenum access);
-typedef void (APIENTRYP PFNGLMAKENAMEDBUFFERNONRESIDENTNVPROC) (GLuint buffer);
-typedef GLboolean (APIENTRYP PFNGLISNAMEDBUFFERRESIDENTNVPROC) (GLuint buffer);
-typedef void (APIENTRYP PFNGLGETBUFFERPARAMETERUI64VNVPROC) (GLenum target, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLGETNAMEDBUFFERPARAMETERUI64VNVPROC) (GLuint buffer, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLGETINTEGERUI64VNVPROC) (GLenum value, GLuint64EXT *result);
-typedef void (APIENTRYP PFNGLUNIFORMUI64NVPROC) (GLint location, GLuint64EXT value);
-typedef void (APIENTRYP PFNGLUNIFORMUI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64NVPROC) (GLuint program, GLint location, GLuint64EXT value);
-typedef void (APIENTRYP PFNGLPROGRAMUNIFORMUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glMakeBufferResidentNV (GLenum target, GLenum access);
-GLAPI void APIENTRY glMakeBufferNonResidentNV (GLenum target);
-GLAPI GLboolean APIENTRY glIsBufferResidentNV (GLenum target);
-GLAPI void APIENTRY glMakeNamedBufferResidentNV (GLuint buffer, GLenum access);
-GLAPI void APIENTRY glMakeNamedBufferNonResidentNV (GLuint buffer);
-GLAPI GLboolean APIENTRY glIsNamedBufferResidentNV (GLuint buffer);
-GLAPI void APIENTRY glGetBufferParameterui64vNV (GLenum target, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glGetNamedBufferParameterui64vNV (GLuint buffer, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glGetIntegerui64vNV (GLenum value, GLuint64EXT *result);
-GLAPI void APIENTRY glUniformui64NV (GLint location, GLuint64EXT value);
-GLAPI void APIENTRY glUniformui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GLAPI void APIENTRY glProgramUniformui64NV (GLuint program, GLint location, GLuint64EXT value);
-GLAPI void APIENTRY glProgramUniformui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#endif
-#endif /* GL_NV_shader_buffer_load */
-
-#ifndef GL_NV_shader_buffer_store
-#define GL_NV_shader_buffer_store 1
-#define GL_SHADER_GLOBAL_ACCESS_BARRIER_BIT_NV 0x00000010
-#endif /* GL_NV_shader_buffer_store */
-
-#ifndef GL_NV_shader_storage_buffer_object
-#define GL_NV_shader_storage_buffer_object 1
-#endif /* GL_NV_shader_storage_buffer_object */
-
-#ifndef GL_NV_shader_thread_group
-#define GL_NV_shader_thread_group 1
-#define GL_WARP_SIZE_NV 0x9339
-#define GL_WARPS_PER_SM_NV 0x933A
-#define GL_SM_COUNT_NV 0x933B
-#endif /* GL_NV_shader_thread_group */
-
-#ifndef GL_NV_shader_thread_shuffle
-#define GL_NV_shader_thread_shuffle 1
-#endif /* GL_NV_shader_thread_shuffle */
-
-#ifndef GL_NV_stereo_view_rendering
-#define GL_NV_stereo_view_rendering 1
-#endif /* GL_NV_stereo_view_rendering */
-
-#ifndef GL_NV_tessellation_program5
-#define GL_NV_tessellation_program5 1
-#define GL_MAX_PROGRAM_PATCH_ATTRIBS_NV 0x86D8
-#define GL_TESS_CONTROL_PROGRAM_NV 0x891E
-#define GL_TESS_EVALUATION_PROGRAM_NV 0x891F
-#define GL_TESS_CONTROL_PROGRAM_PARAMETER_BUFFER_NV 0x8C74
-#define GL_TESS_EVALUATION_PROGRAM_PARAMETER_BUFFER_NV 0x8C75
-#endif /* GL_NV_tessellation_program5 */
-
-#ifndef GL_NV_texgen_emboss
-#define GL_NV_texgen_emboss 1
-#define GL_EMBOSS_LIGHT_NV 0x855D
-#define GL_EMBOSS_CONSTANT_NV 0x855E
-#define GL_EMBOSS_MAP_NV 0x855F
-#endif /* GL_NV_texgen_emboss */
-
-#ifndef GL_NV_texgen_reflection
-#define GL_NV_texgen_reflection 1
-#define GL_NORMAL_MAP_NV 0x8511
-#define GL_REFLECTION_MAP_NV 0x8512
-#endif /* GL_NV_texgen_reflection */
-
-#ifndef GL_NV_texture_barrier
-#define GL_NV_texture_barrier 1
-typedef void (APIENTRYP PFNGLTEXTUREBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureBarrierNV (void);
-#endif
-#endif /* GL_NV_texture_barrier */
-
-#ifndef GL_NV_texture_compression_vtc
-#define GL_NV_texture_compression_vtc 1
-#endif /* GL_NV_texture_compression_vtc */
-
-#ifndef GL_NV_texture_env_combine4
-#define GL_NV_texture_env_combine4 1
-#define GL_COMBINE4_NV 0x8503
-#define GL_SOURCE3_RGB_NV 0x8583
-#define GL_SOURCE3_ALPHA_NV 0x858B
-#define GL_OPERAND3_RGB_NV 0x8593
-#define GL_OPERAND3_ALPHA_NV 0x859B
-#endif /* GL_NV_texture_env_combine4 */
-
-#ifndef GL_NV_texture_expand_normal
-#define GL_NV_texture_expand_normal 1
-#define GL_TEXTURE_UNSIGNED_REMAP_MODE_NV 0x888F
-#endif /* GL_NV_texture_expand_normal */
-
-#ifndef GL_NV_texture_multisample
-#define GL_NV_texture_multisample 1
-#define GL_TEXTURE_COVERAGE_SAMPLES_NV 0x9045
-#define GL_TEXTURE_COLOR_SAMPLES_NV 0x9046
-typedef void (APIENTRYP PFNGLTEXIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (APIENTRYP PFNGLTEXIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLENVPROC) (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE2DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-typedef void (APIENTRYP PFNGLTEXTUREIMAGE3DMULTISAMPLECOVERAGENVPROC) (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage2DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-GLAPI void APIENTRY glTexImage3DMultisampleCoverageNV (GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-GLAPI void APIENTRY glTextureImage2DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-GLAPI void APIENTRY glTextureImage3DMultisampleNV (GLuint texture, GLenum target, GLsizei samples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-GLAPI void APIENTRY glTextureImage2DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations);
-GLAPI void APIENTRY glTextureImage3DMultisampleCoverageNV (GLuint texture, GLenum target, GLsizei coverageSamples, GLsizei colorSamples, GLint internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations);
-#endif
-#endif /* GL_NV_texture_multisample */
-
-#ifndef GL_NV_texture_rectangle
-#define GL_NV_texture_rectangle 1
-#define GL_TEXTURE_RECTANGLE_NV 0x84F5
-#define GL_TEXTURE_BINDING_RECTANGLE_NV 0x84F6
-#define GL_PROXY_TEXTURE_RECTANGLE_NV 0x84F7
-#define GL_MAX_RECTANGLE_TEXTURE_SIZE_NV 0x84F8
-#endif /* GL_NV_texture_rectangle */
-
-#ifndef GL_NV_texture_rectangle_compressed
-#define GL_NV_texture_rectangle_compressed 1
-#endif /* GL_NV_texture_rectangle_compressed */
-
-#ifndef GL_NV_texture_shader
-#define GL_NV_texture_shader 1
-#define GL_OFFSET_TEXTURE_RECTANGLE_NV 0x864C
-#define GL_OFFSET_TEXTURE_RECTANGLE_SCALE_NV 0x864D
-#define GL_DOT_PRODUCT_TEXTURE_RECTANGLE_NV 0x864E
-#define GL_RGBA_UNSIGNED_DOT_PRODUCT_MAPPING_NV 0x86D9
-#define GL_UNSIGNED_INT_S8_S8_8_8_NV 0x86DA
-#define GL_UNSIGNED_INT_8_8_S8_S8_REV_NV 0x86DB
-#define GL_DSDT_MAG_INTENSITY_NV 0x86DC
-#define GL_SHADER_CONSISTENT_NV 0x86DD
-#define GL_TEXTURE_SHADER_NV 0x86DE
-#define GL_SHADER_OPERATION_NV 0x86DF
-#define GL_CULL_MODES_NV 0x86E0
-#define GL_OFFSET_TEXTURE_MATRIX_NV 0x86E1
-#define GL_OFFSET_TEXTURE_SCALE_NV 0x86E2
-#define GL_OFFSET_TEXTURE_BIAS_NV 0x86E3
-#define GL_OFFSET_TEXTURE_2D_MATRIX_NV 0x86E1
-#define GL_OFFSET_TEXTURE_2D_SCALE_NV 0x86E2
-#define GL_OFFSET_TEXTURE_2D_BIAS_NV 0x86E3
-#define GL_PREVIOUS_TEXTURE_INPUT_NV 0x86E4
-#define GL_CONST_EYE_NV 0x86E5
-#define GL_PASS_THROUGH_NV 0x86E6
-#define GL_CULL_FRAGMENT_NV 0x86E7
-#define GL_OFFSET_TEXTURE_2D_NV 0x86E8
-#define GL_DEPENDENT_AR_TEXTURE_2D_NV 0x86E9
-#define GL_DEPENDENT_GB_TEXTURE_2D_NV 0x86EA
-#define GL_DOT_PRODUCT_NV 0x86EC
-#define GL_DOT_PRODUCT_DEPTH_REPLACE_NV 0x86ED
-#define GL_DOT_PRODUCT_TEXTURE_2D_NV 0x86EE
-#define GL_DOT_PRODUCT_TEXTURE_CUBE_MAP_NV 0x86F0
-#define GL_DOT_PRODUCT_DIFFUSE_CUBE_MAP_NV 0x86F1
-#define GL_DOT_PRODUCT_REFLECT_CUBE_MAP_NV 0x86F2
-#define GL_DOT_PRODUCT_CONST_EYE_REFLECT_CUBE_MAP_NV 0x86F3
-#define GL_HILO_NV 0x86F4
-#define GL_DSDT_NV 0x86F5
-#define GL_DSDT_MAG_NV 0x86F6
-#define GL_DSDT_MAG_VIB_NV 0x86F7
-#define GL_HILO16_NV 0x86F8
-#define GL_SIGNED_HILO_NV 0x86F9
-#define GL_SIGNED_HILO16_NV 0x86FA
-#define GL_SIGNED_RGBA_NV 0x86FB
-#define GL_SIGNED_RGBA8_NV 0x86FC
-#define GL_SIGNED_RGB_NV 0x86FE
-#define GL_SIGNED_RGB8_NV 0x86FF
-#define GL_SIGNED_LUMINANCE_NV 0x8701
-#define GL_SIGNED_LUMINANCE8_NV 0x8702
-#define GL_SIGNED_LUMINANCE_ALPHA_NV 0x8703
-#define GL_SIGNED_LUMINANCE8_ALPHA8_NV 0x8704
-#define GL_SIGNED_ALPHA_NV 0x8705
-#define GL_SIGNED_ALPHA8_NV 0x8706
-#define GL_SIGNED_INTENSITY_NV 0x8707
-#define GL_SIGNED_INTENSITY8_NV 0x8708
-#define GL_DSDT8_NV 0x8709
-#define GL_DSDT8_MAG8_NV 0x870A
-#define GL_DSDT8_MAG8_INTENSITY8_NV 0x870B
-#define GL_SIGNED_RGB_UNSIGNED_ALPHA_NV 0x870C
-#define GL_SIGNED_RGB8_UNSIGNED_ALPHA8_NV 0x870D
-#define GL_HI_SCALE_NV 0x870E
-#define GL_LO_SCALE_NV 0x870F
-#define GL_DS_SCALE_NV 0x8710
-#define GL_DT_SCALE_NV 0x8711
-#define GL_MAGNITUDE_SCALE_NV 0x8712
-#define GL_VIBRANCE_SCALE_NV 0x8713
-#define GL_HI_BIAS_NV 0x8714
-#define GL_LO_BIAS_NV 0x8715
-#define GL_DS_BIAS_NV 0x8716
-#define GL_DT_BIAS_NV 0x8717
-#define GL_MAGNITUDE_BIAS_NV 0x8718
-#define GL_VIBRANCE_BIAS_NV 0x8719
-#define GL_TEXTURE_BORDER_VALUES_NV 0x871A
-#define GL_TEXTURE_HI_SIZE_NV 0x871B
-#define GL_TEXTURE_LO_SIZE_NV 0x871C
-#define GL_TEXTURE_DS_SIZE_NV 0x871D
-#define GL_TEXTURE_DT_SIZE_NV 0x871E
-#define GL_TEXTURE_MAG_SIZE_NV 0x871F
-#endif /* GL_NV_texture_shader */
-
-#ifndef GL_NV_texture_shader2
-#define GL_NV_texture_shader2 1
-#define GL_DOT_PRODUCT_TEXTURE_3D_NV 0x86EF
-#endif /* GL_NV_texture_shader2 */
-
-#ifndef GL_NV_texture_shader3
-#define GL_NV_texture_shader3 1
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_NV 0x8850
-#define GL_OFFSET_PROJECTIVE_TEXTURE_2D_SCALE_NV 0x8851
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8852
-#define GL_OFFSET_PROJECTIVE_TEXTURE_RECTANGLE_SCALE_NV 0x8853
-#define GL_OFFSET_HILO_TEXTURE_2D_NV 0x8854
-#define GL_OFFSET_HILO_TEXTURE_RECTANGLE_NV 0x8855
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_2D_NV 0x8856
-#define GL_OFFSET_HILO_PROJECTIVE_TEXTURE_RECTANGLE_NV 0x8857
-#define GL_DEPENDENT_HILO_TEXTURE_2D_NV 0x8858
-#define GL_DEPENDENT_RGB_TEXTURE_3D_NV 0x8859
-#define GL_DEPENDENT_RGB_TEXTURE_CUBE_MAP_NV 0x885A
-#define GL_DOT_PRODUCT_PASS_THROUGH_NV 0x885B
-#define GL_DOT_PRODUCT_TEXTURE_1D_NV 0x885C
-#define GL_DOT_PRODUCT_AFFINE_DEPTH_REPLACE_NV 0x885D
-#define GL_HILO8_NV 0x885E
-#define GL_SIGNED_HILO8_NV 0x885F
-#define GL_FORCE_BLUE_TO_ONE_NV 0x8860
-#endif /* GL_NV_texture_shader3 */
-
-#ifndef GL_NV_transform_feedback
-#define GL_NV_transform_feedback 1
-#define GL_BACK_PRIMARY_COLOR_NV 0x8C77
-#define GL_BACK_SECONDARY_COLOR_NV 0x8C78
-#define GL_TEXTURE_COORD_NV 0x8C79
-#define GL_CLIP_DISTANCE_NV 0x8C7A
-#define GL_VERTEX_ID_NV 0x8C7B
-#define GL_PRIMITIVE_ID_NV 0x8C7C
-#define GL_GENERIC_ATTRIB_NV 0x8C7D
-#define GL_TRANSFORM_FEEDBACK_ATTRIBS_NV 0x8C7E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE_NV 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS_NV 0x8C80
-#define GL_ACTIVE_VARYINGS_NV 0x8C81
-#define GL_ACTIVE_VARYING_MAX_LENGTH_NV 0x8C82
-#define GL_TRANSFORM_FEEDBACK_VARYINGS_NV 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START_NV 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE_NV 0x8C85
-#define GL_TRANSFORM_FEEDBACK_RECORD_NV 0x8C86
-#define GL_PRIMITIVES_GENERATED_NV 0x8C87
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_NV 0x8C88
-#define GL_RASTERIZER_DISCARD_NV 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS_NV 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS_NV 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS_NV 0x8C8C
-#define GL_SEPARATE_ATTRIBS_NV 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER_NV 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING_NV 0x8C8F
-#define GL_LAYER_NV 0x8DAA
-#define GL_NEXT_BUFFER_NV -2
-#define GL_SKIP_COMPONENTS4_NV -3
-#define GL_SKIP_COMPONENTS3_NV -4
-#define GL_SKIP_COMPONENTS2_NV -5
-#define GL_SKIP_COMPONENTS1_NV -6
-typedef void (APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKNVPROC) (GLenum primitiveMode);
-typedef void (APIENTRYP PFNGLENDTRANSFORMFEEDBACKNVPROC) (void);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLBINDBUFFERRANGENVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (APIENTRYP PFNGLBINDBUFFEROFFSETNVPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-typedef void (APIENTRYP PFNGLBINDBUFFERBASENVPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSNVPROC) (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-typedef void (APIENTRYP PFNGLACTIVEVARYINGNVPROC) (GLuint program, const GLchar *name);
-typedef GLint (APIENTRYP PFNGLGETVARYINGLOCATIONNVPROC) (GLuint program, const GLchar *name);
-typedef void (APIENTRYP PFNGLGETACTIVEVARYINGNVPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGNVPROC) (GLuint program, GLuint index, GLint *location);
-typedef void (APIENTRYP PFNGLTRANSFORMFEEDBACKSTREAMATTRIBSNVPROC) (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginTransformFeedbackNV (GLenum primitiveMode);
-GLAPI void APIENTRY glEndTransformFeedbackNV (void);
-GLAPI void APIENTRY glTransformFeedbackAttribsNV (GLsizei count, const GLint *attribs, GLenum bufferMode);
-GLAPI void APIENTRY glBindBufferRangeNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GLAPI void APIENTRY glBindBufferOffsetNV (GLenum target, GLuint index, GLuint buffer, GLintptr offset);
-GLAPI void APIENTRY glBindBufferBaseNV (GLenum target, GLuint index, GLuint buffer);
-GLAPI void APIENTRY glTransformFeedbackVaryingsNV (GLuint program, GLsizei count, const GLint *locations, GLenum bufferMode);
-GLAPI void APIENTRY glActiveVaryingNV (GLuint program, const GLchar *name);
-GLAPI GLint APIENTRY glGetVaryingLocationNV (GLuint program, const GLchar *name);
-GLAPI void APIENTRY glGetActiveVaryingNV (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GLAPI void APIENTRY glGetTransformFeedbackVaryingNV (GLuint program, GLuint index, GLint *location);
-GLAPI void APIENTRY glTransformFeedbackStreamAttribsNV (GLsizei count, const GLint *attribs, GLsizei nbuffers, const GLint *bufstreams, GLenum bufferMode);
-#endif
-#endif /* GL_NV_transform_feedback */
-
-#ifndef GL_NV_transform_feedback2
-#define GL_NV_transform_feedback2 1
-#define GL_TRANSFORM_FEEDBACK_NV 0x8E22
-#define GL_TRANSFORM_FEEDBACK_BUFFER_PAUSED_NV 0x8E23
-#define GL_TRANSFORM_FEEDBACK_BUFFER_ACTIVE_NV 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING_NV 0x8E25
-typedef void (APIENTRYP PFNGLBINDTRANSFORMFEEDBACKNVPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSNVPROC) (GLsizei n, const GLuint *ids);
-typedef void (APIENTRYP PFNGLGENTRANSFORMFEEDBACKSNVPROC) (GLsizei n, GLuint *ids);
-typedef GLboolean (APIENTRYP PFNGLISTRANSFORMFEEDBACKNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKNVPROC) (void);
-typedef void (APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKNVPROC) (void);
-typedef void (APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKNVPROC) (GLenum mode, GLuint id);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBindTransformFeedbackNV (GLenum target, GLuint id);
-GLAPI void APIENTRY glDeleteTransformFeedbacksNV (GLsizei n, const GLuint *ids);
-GLAPI void APIENTRY glGenTransformFeedbacksNV (GLsizei n, GLuint *ids);
-GLAPI GLboolean APIENTRY glIsTransformFeedbackNV (GLuint id);
-GLAPI void APIENTRY glPauseTransformFeedbackNV (void);
-GLAPI void APIENTRY glResumeTransformFeedbackNV (void);
-GLAPI void APIENTRY glDrawTransformFeedbackNV (GLenum mode, GLuint id);
-#endif
-#endif /* GL_NV_transform_feedback2 */
-
-#ifndef GL_NV_uniform_buffer_unified_memory
-#define GL_NV_uniform_buffer_unified_memory 1
-#define GL_UNIFORM_BUFFER_UNIFIED_NV 0x936E
-#define GL_UNIFORM_BUFFER_ADDRESS_NV 0x936F
-#define GL_UNIFORM_BUFFER_LENGTH_NV 0x9370
-#endif /* GL_NV_uniform_buffer_unified_memory */
-
-#ifndef GL_NV_vdpau_interop
-#define GL_NV_vdpau_interop 1
-typedef GLintptr GLvdpauSurfaceNV;
-#define GL_SURFACE_STATE_NV 0x86EB
-#define GL_SURFACE_REGISTERED_NV 0x86FD
-#define GL_SURFACE_MAPPED_NV 0x8700
-#define GL_WRITE_DISCARD_NV 0x88BE
-typedef void (APIENTRYP PFNGLVDPAUINITNVPROC) (const void *vdpDevice, const void *getProcAddress);
-typedef void (APIENTRYP PFNGLVDPAUFININVPROC) (void);
-typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTERVIDEOSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-typedef GLvdpauSurfaceNV (APIENTRYP PFNGLVDPAUREGISTEROUTPUTSURFACENVPROC) (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-typedef GLboolean (APIENTRYP PFNGLVDPAUISSURFACENVPROC) (GLvdpauSurfaceNV surface);
-typedef void (APIENTRYP PFNGLVDPAUUNREGISTERSURFACENVPROC) (GLvdpauSurfaceNV surface);
-typedef void (APIENTRYP PFNGLVDPAUGETSURFACEIVNVPROC) (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-typedef void (APIENTRYP PFNGLVDPAUSURFACEACCESSNVPROC) (GLvdpauSurfaceNV surface, GLenum access);
-typedef void (APIENTRYP PFNGLVDPAUMAPSURFACESNVPROC) (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
-typedef void (APIENTRYP PFNGLVDPAUUNMAPSURFACESNVPROC) (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVDPAUInitNV (const void *vdpDevice, const void *getProcAddress);
-GLAPI void APIENTRY glVDPAUFiniNV (void);
-GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterVideoSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-GLAPI GLvdpauSurfaceNV APIENTRY glVDPAURegisterOutputSurfaceNV (const void *vdpSurface, GLenum target, GLsizei numTextureNames, const GLuint *textureNames);
-GLAPI GLboolean APIENTRY glVDPAUIsSurfaceNV (GLvdpauSurfaceNV surface);
-GLAPI void APIENTRY glVDPAUUnregisterSurfaceNV (GLvdpauSurfaceNV surface);
-GLAPI void APIENTRY glVDPAUGetSurfaceivNV (GLvdpauSurfaceNV surface, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GLAPI void APIENTRY glVDPAUSurfaceAccessNV (GLvdpauSurfaceNV surface, GLenum access);
-GLAPI void APIENTRY glVDPAUMapSurfacesNV (GLsizei numSurfaces, const GLvdpauSurfaceNV *surfaces);
-GLAPI void APIENTRY glVDPAUUnmapSurfacesNV (GLsizei numSurface, const GLvdpauSurfaceNV *surfaces);
-#endif
-#endif /* GL_NV_vdpau_interop */
-
-#ifndef GL_NV_vertex_array_range
-#define GL_NV_vertex_array_range 1
-#define GL_VERTEX_ARRAY_RANGE_NV 0x851D
-#define GL_VERTEX_ARRAY_RANGE_LENGTH_NV 0x851E
-#define GL_VERTEX_ARRAY_RANGE_VALID_NV 0x851F
-#define GL_MAX_VERTEX_ARRAY_RANGE_ELEMENT_NV 0x8520
-#define GL_VERTEX_ARRAY_RANGE_POINTER_NV 0x8521
-typedef void (APIENTRYP PFNGLFLUSHVERTEXARRAYRANGENVPROC) (void);
-typedef void (APIENTRYP PFNGLVERTEXARRAYRANGENVPROC) (GLsizei length, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFlushVertexArrayRangeNV (void);
-GLAPI void APIENTRY glVertexArrayRangeNV (GLsizei length, const void *pointer);
-#endif
-#endif /* GL_NV_vertex_array_range */
-
-#ifndef GL_NV_vertex_array_range2
-#define GL_NV_vertex_array_range2 1
-#define GL_VERTEX_ARRAY_RANGE_WITHOUT_FLUSH_NV 0x8533
-#endif /* GL_NV_vertex_array_range2 */
-
-#ifndef GL_NV_vertex_attrib_integer_64bit
-#define GL_NV_vertex_attrib_integer_64bit 1
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64NVPROC) (GLuint index, GLint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64NVPROC) (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4I64VNVPROC) (GLuint index, const GLint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64NVPROC) (GLuint index, GLuint64EXT x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64NVPROC) (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL1UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL2UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL3UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBL4UI64VNVPROC) (GLuint index, const GLuint64EXT *v);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLI64VNVPROC) (GLuint index, GLenum pname, GLint64EXT *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBLUI64VNVPROC) (GLuint index, GLenum pname, GLuint64EXT *params);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBLFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribL1i64NV (GLuint index, GLint64EXT x);
-GLAPI void APIENTRY glVertexAttribL2i64NV (GLuint index, GLint64EXT x, GLint64EXT y);
-GLAPI void APIENTRY glVertexAttribL3i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GLAPI void APIENTRY glVertexAttribL4i64NV (GLuint index, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GLAPI void APIENTRY glVertexAttribL1i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL2i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL3i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL4i64vNV (GLuint index, const GLint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL1ui64NV (GLuint index, GLuint64EXT x);
-GLAPI void APIENTRY glVertexAttribL2ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y);
-GLAPI void APIENTRY glVertexAttribL3ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GLAPI void APIENTRY glVertexAttribL4ui64NV (GLuint index, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GLAPI void APIENTRY glVertexAttribL1ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL2ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL3ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glVertexAttribL4ui64vNV (GLuint index, const GLuint64EXT *v);
-GLAPI void APIENTRY glGetVertexAttribLi64vNV (GLuint index, GLenum pname, GLint64EXT *params);
-GLAPI void APIENTRY glGetVertexAttribLui64vNV (GLuint index, GLenum pname, GLuint64EXT *params);
-GLAPI void APIENTRY glVertexAttribLFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
-#endif
-#endif /* GL_NV_vertex_attrib_integer_64bit */
-
-#ifndef GL_NV_vertex_buffer_unified_memory
-#define GL_NV_vertex_buffer_unified_memory 1
-#define GL_VERTEX_ATTRIB_ARRAY_UNIFIED_NV 0x8F1E
-#define GL_ELEMENT_ARRAY_UNIFIED_NV 0x8F1F
-#define GL_VERTEX_ATTRIB_ARRAY_ADDRESS_NV 0x8F20
-#define GL_VERTEX_ARRAY_ADDRESS_NV 0x8F21
-#define GL_NORMAL_ARRAY_ADDRESS_NV 0x8F22
-#define GL_COLOR_ARRAY_ADDRESS_NV 0x8F23
-#define GL_INDEX_ARRAY_ADDRESS_NV 0x8F24
-#define GL_TEXTURE_COORD_ARRAY_ADDRESS_NV 0x8F25
-#define GL_EDGE_FLAG_ARRAY_ADDRESS_NV 0x8F26
-#define GL_SECONDARY_COLOR_ARRAY_ADDRESS_NV 0x8F27
-#define GL_FOG_COORD_ARRAY_ADDRESS_NV 0x8F28
-#define GL_ELEMENT_ARRAY_ADDRESS_NV 0x8F29
-#define GL_VERTEX_ATTRIB_ARRAY_LENGTH_NV 0x8F2A
-#define GL_VERTEX_ARRAY_LENGTH_NV 0x8F2B
-#define GL_NORMAL_ARRAY_LENGTH_NV 0x8F2C
-#define GL_COLOR_ARRAY_LENGTH_NV 0x8F2D
-#define GL_INDEX_ARRAY_LENGTH_NV 0x8F2E
-#define GL_TEXTURE_COORD_ARRAY_LENGTH_NV 0x8F2F
-#define GL_EDGE_FLAG_ARRAY_LENGTH_NV 0x8F30
-#define GL_SECONDARY_COLOR_ARRAY_LENGTH_NV 0x8F31
-#define GL_FOG_COORD_ARRAY_LENGTH_NV 0x8F32
-#define GL_ELEMENT_ARRAY_LENGTH_NV 0x8F33
-#define GL_DRAW_INDIRECT_UNIFIED_NV 0x8F40
-#define GL_DRAW_INDIRECT_ADDRESS_NV 0x8F41
-#define GL_DRAW_INDIRECT_LENGTH_NV 0x8F42
-typedef void (APIENTRYP PFNGLBUFFERADDRESSRANGENVPROC) (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
-typedef void (APIENTRYP PFNGLVERTEXFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLNORMALFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLINDEXFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLTEXCOORDFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLEDGEFLAGFORMATNVPROC) (GLsizei stride);
-typedef void (APIENTRYP PFNGLSECONDARYCOLORFORMATNVPROC) (GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLFOGCOORDFORMATNVPROC) (GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIFORMATNVPROC) (GLuint index, GLint size, GLenum type, GLsizei stride);
-typedef void (APIENTRYP PFNGLGETINTEGERUI64I_VNVPROC) (GLenum value, GLuint index, GLuint64EXT *result);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBufferAddressRangeNV (GLenum pname, GLuint index, GLuint64EXT address, GLsizeiptr length);
-GLAPI void APIENTRY glVertexFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glNormalFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glColorFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glIndexFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glTexCoordFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glEdgeFlagFormatNV (GLsizei stride);
-GLAPI void APIENTRY glSecondaryColorFormatNV (GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glFogCoordFormatNV (GLenum type, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribFormatNV (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride);
-GLAPI void APIENTRY glVertexAttribIFormatNV (GLuint index, GLint size, GLenum type, GLsizei stride);
-GLAPI void APIENTRY glGetIntegerui64i_vNV (GLenum value, GLuint index, GLuint64EXT *result);
-#endif
-#endif /* GL_NV_vertex_buffer_unified_memory */
-
-#ifndef GL_NV_vertex_program
-#define GL_NV_vertex_program 1
-#define GL_VERTEX_PROGRAM_NV 0x8620
-#define GL_VERTEX_STATE_PROGRAM_NV 0x8621
-#define GL_ATTRIB_ARRAY_SIZE_NV 0x8623
-#define GL_ATTRIB_ARRAY_STRIDE_NV 0x8624
-#define GL_ATTRIB_ARRAY_TYPE_NV 0x8625
-#define GL_CURRENT_ATTRIB_NV 0x8626
-#define GL_PROGRAM_LENGTH_NV 0x8627
-#define GL_PROGRAM_STRING_NV 0x8628
-#define GL_MODELVIEW_PROJECTION_NV 0x8629
-#define GL_IDENTITY_NV 0x862A
-#define GL_INVERSE_NV 0x862B
-#define GL_TRANSPOSE_NV 0x862C
-#define GL_INVERSE_TRANSPOSE_NV 0x862D
-#define GL_MAX_TRACK_MATRIX_STACK_DEPTH_NV 0x862E
-#define GL_MAX_TRACK_MATRICES_NV 0x862F
-#define GL_MATRIX0_NV 0x8630
-#define GL_MATRIX1_NV 0x8631
-#define GL_MATRIX2_NV 0x8632
-#define GL_MATRIX3_NV 0x8633
-#define GL_MATRIX4_NV 0x8634
-#define GL_MATRIX5_NV 0x8635
-#define GL_MATRIX6_NV 0x8636
-#define GL_MATRIX7_NV 0x8637
-#define GL_CURRENT_MATRIX_STACK_DEPTH_NV 0x8640
-#define GL_CURRENT_MATRIX_NV 0x8641
-#define GL_VERTEX_PROGRAM_POINT_SIZE_NV 0x8642
-#define GL_VERTEX_PROGRAM_TWO_SIDE_NV 0x8643
-#define GL_PROGRAM_PARAMETER_NV 0x8644
-#define GL_ATTRIB_ARRAY_POINTER_NV 0x8645
-#define GL_PROGRAM_TARGET_NV 0x8646
-#define GL_PROGRAM_RESIDENT_NV 0x8647
-#define GL_TRACK_MATRIX_NV 0x8648
-#define GL_TRACK_MATRIX_TRANSFORM_NV 0x8649
-#define GL_VERTEX_PROGRAM_BINDING_NV 0x864A
-#define GL_PROGRAM_ERROR_POSITION_NV 0x864B
-#define GL_VERTEX_ATTRIB_ARRAY0_NV 0x8650
-#define GL_VERTEX_ATTRIB_ARRAY1_NV 0x8651
-#define GL_VERTEX_ATTRIB_ARRAY2_NV 0x8652
-#define GL_VERTEX_ATTRIB_ARRAY3_NV 0x8653
-#define GL_VERTEX_ATTRIB_ARRAY4_NV 0x8654
-#define GL_VERTEX_ATTRIB_ARRAY5_NV 0x8655
-#define GL_VERTEX_ATTRIB_ARRAY6_NV 0x8656
-#define GL_VERTEX_ATTRIB_ARRAY7_NV 0x8657
-#define GL_VERTEX_ATTRIB_ARRAY8_NV 0x8658
-#define GL_VERTEX_ATTRIB_ARRAY9_NV 0x8659
-#define GL_VERTEX_ATTRIB_ARRAY10_NV 0x865A
-#define GL_VERTEX_ATTRIB_ARRAY11_NV 0x865B
-#define GL_VERTEX_ATTRIB_ARRAY12_NV 0x865C
-#define GL_VERTEX_ATTRIB_ARRAY13_NV 0x865D
-#define GL_VERTEX_ATTRIB_ARRAY14_NV 0x865E
-#define GL_VERTEX_ATTRIB_ARRAY15_NV 0x865F
-#define GL_MAP1_VERTEX_ATTRIB0_4_NV 0x8660
-#define GL_MAP1_VERTEX_ATTRIB1_4_NV 0x8661
-#define GL_MAP1_VERTEX_ATTRIB2_4_NV 0x8662
-#define GL_MAP1_VERTEX_ATTRIB3_4_NV 0x8663
-#define GL_MAP1_VERTEX_ATTRIB4_4_NV 0x8664
-#define GL_MAP1_VERTEX_ATTRIB5_4_NV 0x8665
-#define GL_MAP1_VERTEX_ATTRIB6_4_NV 0x8666
-#define GL_MAP1_VERTEX_ATTRIB7_4_NV 0x8667
-#define GL_MAP1_VERTEX_ATTRIB8_4_NV 0x8668
-#define GL_MAP1_VERTEX_ATTRIB9_4_NV 0x8669
-#define GL_MAP1_VERTEX_ATTRIB10_4_NV 0x866A
-#define GL_MAP1_VERTEX_ATTRIB11_4_NV 0x866B
-#define GL_MAP1_VERTEX_ATTRIB12_4_NV 0x866C
-#define GL_MAP1_VERTEX_ATTRIB13_4_NV 0x866D
-#define GL_MAP1_VERTEX_ATTRIB14_4_NV 0x866E
-#define GL_MAP1_VERTEX_ATTRIB15_4_NV 0x866F
-#define GL_MAP2_VERTEX_ATTRIB0_4_NV 0x8670
-#define GL_MAP2_VERTEX_ATTRIB1_4_NV 0x8671
-#define GL_MAP2_VERTEX_ATTRIB2_4_NV 0x8672
-#define GL_MAP2_VERTEX_ATTRIB3_4_NV 0x8673
-#define GL_MAP2_VERTEX_ATTRIB4_4_NV 0x8674
-#define GL_MAP2_VERTEX_ATTRIB5_4_NV 0x8675
-#define GL_MAP2_VERTEX_ATTRIB6_4_NV 0x8676
-#define GL_MAP2_VERTEX_ATTRIB7_4_NV 0x8677
-#define GL_MAP2_VERTEX_ATTRIB8_4_NV 0x8678
-#define GL_MAP2_VERTEX_ATTRIB9_4_NV 0x8679
-#define GL_MAP2_VERTEX_ATTRIB10_4_NV 0x867A
-#define GL_MAP2_VERTEX_ATTRIB11_4_NV 0x867B
-#define GL_MAP2_VERTEX_ATTRIB12_4_NV 0x867C
-#define GL_MAP2_VERTEX_ATTRIB13_4_NV 0x867D
-#define GL_MAP2_VERTEX_ATTRIB14_4_NV 0x867E
-#define GL_MAP2_VERTEX_ATTRIB15_4_NV 0x867F
-typedef GLboolean (APIENTRYP PFNGLAREPROGRAMSRESIDENTNVPROC) (GLsizei n, const GLuint *programs, GLboolean *residences);
-typedef void (APIENTRYP PFNGLBINDPROGRAMNVPROC) (GLenum target, GLuint id);
-typedef void (APIENTRYP PFNGLDELETEPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLEXECUTEPROGRAMNVPROC) (GLenum target, GLuint id, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGENPROGRAMSNVPROC) (GLsizei n, GLuint *programs);
-typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERDVNVPROC) (GLenum target, GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMPARAMETERFVNVPROC) (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMIVNVPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPROGRAMSTRINGNVPROC) (GLuint id, GLenum pname, GLubyte *program);
-typedef void (APIENTRYP PFNGLGETTRACKMATRIXIVNVPROC) (GLenum target, GLuint address, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBDVNVPROC) (GLuint index, GLenum pname, GLdouble *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBFVNVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIVNVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVNVPROC) (GLuint index, GLenum pname, void **pointer);
-typedef GLboolean (APIENTRYP PFNGLISPROGRAMNVPROC) (GLuint id);
-typedef void (APIENTRYP PFNGLLOADPROGRAMNVPROC) (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DNVPROC) (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4DVNVPROC) (GLenum target, GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FNVPROC) (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETER4FVNVPROC) (GLenum target, GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4DVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLPROGRAMPARAMETERS4FVNVPROC) (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREQUESTRESIDENTPROGRAMSNVPROC) (GLsizei n, const GLuint *programs);
-typedef void (APIENTRYP PFNGLTRACKMATRIXNVPROC) (GLenum target, GLuint address, GLenum matrix, GLenum transform);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERNVPROC) (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DNVPROC) (GLuint index, GLdouble x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FNVPROC) (GLuint index, GLfloat x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SNVPROC) (GLuint index, GLshort x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB1SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DNVPROC) (GLuint index, GLdouble x, GLdouble y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FNVPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SNVPROC) (GLuint index, GLshort x, GLshort y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB2SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB3SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DNVPROC) (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVNVPROC) (GLuint index, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SNVPROC) (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4SVNVPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBNVPROC) (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIB4UBVNVPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS1SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS2SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS3SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4DVNVPROC) (GLuint index, GLsizei count, const GLdouble *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4FVNVPROC) (GLuint index, GLsizei count, const GLfloat *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4SVNVPROC) (GLuint index, GLsizei count, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBS4UBVNVPROC) (GLuint index, GLsizei count, const GLubyte *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLboolean APIENTRY glAreProgramsResidentNV (GLsizei n, const GLuint *programs, GLboolean *residences);
-GLAPI void APIENTRY glBindProgramNV (GLenum target, GLuint id);
-GLAPI void APIENTRY glDeleteProgramsNV (GLsizei n, const GLuint *programs);
-GLAPI void APIENTRY glExecuteProgramNV (GLenum target, GLuint id, const GLfloat *params);
-GLAPI void APIENTRY glGenProgramsNV (GLsizei n, GLuint *programs);
-GLAPI void APIENTRY glGetProgramParameterdvNV (GLenum target, GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetProgramParameterfvNV (GLenum target, GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetProgramivNV (GLuint id, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetProgramStringNV (GLuint id, GLenum pname, GLubyte *program);
-GLAPI void APIENTRY glGetTrackMatrixivNV (GLenum target, GLuint address, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribdvNV (GLuint index, GLenum pname, GLdouble *params);
-GLAPI void APIENTRY glGetVertexAttribfvNV (GLuint index, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVertexAttribivNV (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribPointervNV (GLuint index, GLenum pname, void **pointer);
-GLAPI GLboolean APIENTRY glIsProgramNV (GLuint id);
-GLAPI void APIENTRY glLoadProgramNV (GLenum target, GLuint id, GLsizei len, const GLubyte *program);
-GLAPI void APIENTRY glProgramParameter4dNV (GLenum target, GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glProgramParameter4dvNV (GLenum target, GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glProgramParameter4fNV (GLenum target, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glProgramParameter4fvNV (GLenum target, GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glProgramParameters4dvNV (GLenum target, GLuint index, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glProgramParameters4fvNV (GLenum target, GLuint index, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glRequestResidentProgramsNV (GLsizei n, const GLuint *programs);
-GLAPI void APIENTRY glTrackMatrixNV (GLenum target, GLuint address, GLenum matrix, GLenum transform);
-GLAPI void APIENTRY glVertexAttribPointerNV (GLuint index, GLint fsize, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glVertexAttrib1dNV (GLuint index, GLdouble x);
-GLAPI void APIENTRY glVertexAttrib1dvNV (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib1fNV (GLuint index, GLfloat x);
-GLAPI void APIENTRY glVertexAttrib1fvNV (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib1sNV (GLuint index, GLshort x);
-GLAPI void APIENTRY glVertexAttrib1svNV (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib2dNV (GLuint index, GLdouble x, GLdouble y);
-GLAPI void APIENTRY glVertexAttrib2dvNV (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib2fNV (GLuint index, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glVertexAttrib2fvNV (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib2sNV (GLuint index, GLshort x, GLshort y);
-GLAPI void APIENTRY glVertexAttrib2svNV (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib3dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z);
-GLAPI void APIENTRY glVertexAttrib3dvNV (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib3fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glVertexAttrib3fvNV (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib3sNV (GLuint index, GLshort x, GLshort y, GLshort z);
-GLAPI void APIENTRY glVertexAttrib3svNV (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4dNV (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w);
-GLAPI void APIENTRY glVertexAttrib4dvNV (GLuint index, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttrib4fNV (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glVertexAttrib4fvNV (GLuint index, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttrib4sNV (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w);
-GLAPI void APIENTRY glVertexAttrib4svNV (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttrib4ubNV (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w);
-GLAPI void APIENTRY glVertexAttrib4ubvNV (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttribs1dvNV (GLuint index, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribs1fvNV (GLuint index, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttribs1svNV (GLuint index, GLsizei count, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribs2dvNV (GLuint index, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribs2fvNV (GLuint index, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttribs2svNV (GLuint index, GLsizei count, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribs3dvNV (GLuint index, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribs3fvNV (GLuint index, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttribs3svNV (GLuint index, GLsizei count, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribs4dvNV (GLuint index, GLsizei count, const GLdouble *v);
-GLAPI void APIENTRY glVertexAttribs4fvNV (GLuint index, GLsizei count, const GLfloat *v);
-GLAPI void APIENTRY glVertexAttribs4svNV (GLuint index, GLsizei count, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribs4ubvNV (GLuint index, GLsizei count, const GLubyte *v);
-#endif
-#endif /* GL_NV_vertex_program */
-
-#ifndef GL_NV_vertex_program1_1
-#define GL_NV_vertex_program1_1 1
-#endif /* GL_NV_vertex_program1_1 */
-
-#ifndef GL_NV_vertex_program2
-#define GL_NV_vertex_program2 1
-#endif /* GL_NV_vertex_program2 */
-
-#ifndef GL_NV_vertex_program2_option
-#define GL_NV_vertex_program2_option 1
-#endif /* GL_NV_vertex_program2_option */
-
-#ifndef GL_NV_vertex_program3
-#define GL_NV_vertex_program3 1
-#endif /* GL_NV_vertex_program3 */
-
-#ifndef GL_NV_vertex_program4
-#define GL_NV_vertex_program4 1
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER_NV 0x88FD
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IEXTPROC) (GLuint index, GLint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IEXTPROC) (GLuint index, GLint x, GLint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IEXTPROC) (GLuint index, GLint x, GLint y, GLint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IEXTPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIEXTPROC) (GLuint index, GLuint x);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIEXTPROC) (GLuint index, GLuint x, GLuint y);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIEXTPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4IVEXTPROC) (GLuint index, const GLint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI1UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI2UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI3UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UIVEXTPROC) (GLuint index, const GLuint *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4BVEXTPROC) (GLuint index, const GLbyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4SVEXTPROC) (GLuint index, const GLshort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4UBVEXTPROC) (GLuint index, const GLubyte *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBI4USVEXTPROC) (GLuint index, const GLushort *v);
-typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTEREXTPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIIVEXTPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVERTEXATTRIBIUIVEXTPROC) (GLuint index, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glVertexAttribI1iEXT (GLuint index, GLint x);
-GLAPI void APIENTRY glVertexAttribI2iEXT (GLuint index, GLint x, GLint y);
-GLAPI void APIENTRY glVertexAttribI3iEXT (GLuint index, GLint x, GLint y, GLint z);
-GLAPI void APIENTRY glVertexAttribI4iEXT (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GLAPI void APIENTRY glVertexAttribI1uiEXT (GLuint index, GLuint x);
-GLAPI void APIENTRY glVertexAttribI2uiEXT (GLuint index, GLuint x, GLuint y);
-GLAPI void APIENTRY glVertexAttribI3uiEXT (GLuint index, GLuint x, GLuint y, GLuint z);
-GLAPI void APIENTRY glVertexAttribI4uiEXT (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GLAPI void APIENTRY glVertexAttribI1ivEXT (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI2ivEXT (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI3ivEXT (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI4ivEXT (GLuint index, const GLint *v);
-GLAPI void APIENTRY glVertexAttribI1uivEXT (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI2uivEXT (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI3uivEXT (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4uivEXT (GLuint index, const GLuint *v);
-GLAPI void APIENTRY glVertexAttribI4bvEXT (GLuint index, const GLbyte *v);
-GLAPI void APIENTRY glVertexAttribI4svEXT (GLuint index, const GLshort *v);
-GLAPI void APIENTRY glVertexAttribI4ubvEXT (GLuint index, const GLubyte *v);
-GLAPI void APIENTRY glVertexAttribI4usvEXT (GLuint index, const GLushort *v);
-GLAPI void APIENTRY glVertexAttribIPointerEXT (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GLAPI void APIENTRY glGetVertexAttribIivEXT (GLuint index, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVertexAttribIuivEXT (GLuint index, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_NV_vertex_program4 */
-
-#ifndef GL_NV_video_capture
-#define GL_NV_video_capture 1
-#define GL_VIDEO_BUFFER_NV 0x9020
-#define GL_VIDEO_BUFFER_BINDING_NV 0x9021
-#define GL_FIELD_UPPER_NV 0x9022
-#define GL_FIELD_LOWER_NV 0x9023
-#define GL_NUM_VIDEO_CAPTURE_STREAMS_NV 0x9024
-#define GL_NEXT_VIDEO_CAPTURE_BUFFER_STATUS_NV 0x9025
-#define GL_VIDEO_CAPTURE_TO_422_SUPPORTED_NV 0x9026
-#define GL_LAST_VIDEO_CAPTURE_STATUS_NV 0x9027
-#define GL_VIDEO_BUFFER_PITCH_NV 0x9028
-#define GL_VIDEO_COLOR_CONVERSION_MATRIX_NV 0x9029
-#define GL_VIDEO_COLOR_CONVERSION_MAX_NV 0x902A
-#define GL_VIDEO_COLOR_CONVERSION_MIN_NV 0x902B
-#define GL_VIDEO_COLOR_CONVERSION_OFFSET_NV 0x902C
-#define GL_VIDEO_BUFFER_INTERNAL_FORMAT_NV 0x902D
-#define GL_PARTIAL_SUCCESS_NV 0x902E
-#define GL_SUCCESS_NV 0x902F
-#define GL_FAILURE_NV 0x9030
-#define GL_YCBYCR8_422_NV 0x9031
-#define GL_YCBAYCR8A_4224_NV 0x9032
-#define GL_Z6Y10Z6CB10Z6Y10Z6CR10_422_NV 0x9033
-#define GL_Z6Y10Z6CB10Z6A10Z6Y10Z6CR10Z6A10_4224_NV 0x9034
-#define GL_Z4Y12Z4CB12Z4Y12Z4CR12_422_NV 0x9035
-#define GL_Z4Y12Z4CB12Z4A12Z4Y12Z4CR12Z4A12_4224_NV 0x9036
-#define GL_Z4Y12Z4CB12Z4CR12_444_NV 0x9037
-#define GL_VIDEO_CAPTURE_FRAME_WIDTH_NV 0x9038
-#define GL_VIDEO_CAPTURE_FRAME_HEIGHT_NV 0x9039
-#define GL_VIDEO_CAPTURE_FIELD_UPPER_HEIGHT_NV 0x903A
-#define GL_VIDEO_CAPTURE_FIELD_LOWER_HEIGHT_NV 0x903B
-#define GL_VIDEO_CAPTURE_SURFACE_ORIGIN_NV 0x903C
-typedef void (APIENTRYP PFNGLBEGINVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
-typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMBUFFERNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
-typedef void (APIENTRYP PFNGLBINDVIDEOCAPTURESTREAMTEXTURENVPROC) (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
-typedef void (APIENTRYP PFNGLENDVIDEOCAPTURENVPROC) (GLuint video_capture_slot);
-typedef void (APIENTRYP PFNGLGETVIDEOCAPTUREIVNVPROC) (GLuint video_capture_slot, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETVIDEOCAPTURESTREAMDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
-typedef GLenum (APIENTRYP PFNGLVIDEOCAPTURENVPROC) (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
-typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERIVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERFVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLVIDEOCAPTURESTREAMPARAMETERDVNVPROC) (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glBeginVideoCaptureNV (GLuint video_capture_slot);
-GLAPI void APIENTRY glBindVideoCaptureStreamBufferNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLintptrARB offset);
-GLAPI void APIENTRY glBindVideoCaptureStreamTextureNV (GLuint video_capture_slot, GLuint stream, GLenum frame_region, GLenum target, GLuint texture);
-GLAPI void APIENTRY glEndVideoCaptureNV (GLuint video_capture_slot);
-GLAPI void APIENTRY glGetVideoCaptureivNV (GLuint video_capture_slot, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVideoCaptureStreamivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetVideoCaptureStreamfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetVideoCaptureStreamdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, GLdouble *params);
-GLAPI GLenum APIENTRY glVideoCaptureNV (GLuint video_capture_slot, GLuint *sequence_num, GLuint64EXT *capture_time);
-GLAPI void APIENTRY glVideoCaptureStreamParameterivNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glVideoCaptureStreamParameterfvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glVideoCaptureStreamParameterdvNV (GLuint video_capture_slot, GLuint stream, GLenum pname, const GLdouble *params);
-#endif
-#endif /* GL_NV_video_capture */
-
-#ifndef GL_NV_viewport_array2
-#define GL_NV_viewport_array2 1
-#endif /* GL_NV_viewport_array2 */
-
-#ifndef GL_NV_viewport_swizzle
-#define GL_NV_viewport_swizzle 1
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
-#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
-#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
-#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
-#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
-typedef void (APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#endif
-#endif /* GL_NV_viewport_swizzle */
-
-#ifndef GL_OML_interlace
-#define GL_OML_interlace 1
-#define GL_INTERLACE_OML 0x8980
-#define GL_INTERLACE_READ_OML 0x8981
-#endif /* GL_OML_interlace */
-
-#ifndef GL_OML_resample
-#define GL_OML_resample 1
-#define GL_PACK_RESAMPLE_OML 0x8984
-#define GL_UNPACK_RESAMPLE_OML 0x8985
-#define GL_RESAMPLE_REPLICATE_OML 0x8986
-#define GL_RESAMPLE_ZERO_FILL_OML 0x8987
-#define GL_RESAMPLE_AVERAGE_OML 0x8988
-#define GL_RESAMPLE_DECIMATE_OML 0x8989
-#endif /* GL_OML_resample */
-
-#ifndef GL_OML_subsample
-#define GL_OML_subsample 1
-#define GL_FORMAT_SUBSAMPLE_24_24_OML 0x8982
-#define GL_FORMAT_SUBSAMPLE_244_244_OML 0x8983
-#endif /* GL_OML_subsample */
-
-#ifndef GL_OVR_multiview
-#define GL_OVR_multiview 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
-#define GL_MAX_VIEWS_OVR 0x9631
-#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
-typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#endif
-#endif /* GL_OVR_multiview */
-
-#ifndef GL_OVR_multiview2
-#define GL_OVR_multiview2 1
-#endif /* GL_OVR_multiview2 */
-
-#ifndef GL_PGI_misc_hints
-#define GL_PGI_misc_hints 1
-#define GL_PREFER_DOUBLEBUFFER_HINT_PGI 0x1A1F8
-#define GL_CONSERVE_MEMORY_HINT_PGI 0x1A1FD
-#define GL_RECLAIM_MEMORY_HINT_PGI 0x1A1FE
-#define GL_NATIVE_GRAPHICS_HANDLE_PGI 0x1A202
-#define GL_NATIVE_GRAPHICS_BEGIN_HINT_PGI 0x1A203
-#define GL_NATIVE_GRAPHICS_END_HINT_PGI 0x1A204
-#define GL_ALWAYS_FAST_HINT_PGI 0x1A20C
-#define GL_ALWAYS_SOFT_HINT_PGI 0x1A20D
-#define GL_ALLOW_DRAW_OBJ_HINT_PGI 0x1A20E
-#define GL_ALLOW_DRAW_WIN_HINT_PGI 0x1A20F
-#define GL_ALLOW_DRAW_FRG_HINT_PGI 0x1A210
-#define GL_ALLOW_DRAW_MEM_HINT_PGI 0x1A211
-#define GL_STRICT_DEPTHFUNC_HINT_PGI 0x1A216
-#define GL_STRICT_LIGHTING_HINT_PGI 0x1A217
-#define GL_STRICT_SCISSOR_HINT_PGI 0x1A218
-#define GL_FULL_STIPPLE_HINT_PGI 0x1A219
-#define GL_CLIP_NEAR_HINT_PGI 0x1A220
-#define GL_CLIP_FAR_HINT_PGI 0x1A221
-#define GL_WIDE_LINE_HINT_PGI 0x1A222
-#define GL_BACK_NORMALS_HINT_PGI 0x1A223
-typedef void (APIENTRYP PFNGLHINTPGIPROC) (GLenum target, GLint mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glHintPGI (GLenum target, GLint mode);
-#endif
-#endif /* GL_PGI_misc_hints */
-
-#ifndef GL_PGI_vertex_hints
-#define GL_PGI_vertex_hints 1
-#define GL_VERTEX_DATA_HINT_PGI 0x1A22A
-#define GL_VERTEX_CONSISTENT_HINT_PGI 0x1A22B
-#define GL_MATERIAL_SIDE_HINT_PGI 0x1A22C
-#define GL_MAX_VERTEX_HINT_PGI 0x1A22D
-#define GL_COLOR3_BIT_PGI 0x00010000
-#define GL_COLOR4_BIT_PGI 0x00020000
-#define GL_EDGEFLAG_BIT_PGI 0x00040000
-#define GL_INDEX_BIT_PGI 0x00080000
-#define GL_MAT_AMBIENT_BIT_PGI 0x00100000
-#define GL_MAT_AMBIENT_AND_DIFFUSE_BIT_PGI 0x00200000
-#define GL_MAT_DIFFUSE_BIT_PGI 0x00400000
-#define GL_MAT_EMISSION_BIT_PGI 0x00800000
-#define GL_MAT_COLOR_INDEXES_BIT_PGI 0x01000000
-#define GL_MAT_SHININESS_BIT_PGI 0x02000000
-#define GL_MAT_SPECULAR_BIT_PGI 0x04000000
-#define GL_NORMAL_BIT_PGI 0x08000000
-#define GL_TEXCOORD1_BIT_PGI 0x10000000
-#define GL_TEXCOORD2_BIT_PGI 0x20000000
-#define GL_TEXCOORD3_BIT_PGI 0x40000000
-#define GL_TEXCOORD4_BIT_PGI 0x80000000
-#define GL_VERTEX23_BIT_PGI 0x00000004
-#define GL_VERTEX4_BIT_PGI 0x00000008
-#endif /* GL_PGI_vertex_hints */
-
-#ifndef GL_REND_screen_coordinates
-#define GL_REND_screen_coordinates 1
-#define GL_SCREEN_COORDINATES_REND 0x8490
-#define GL_INVERTED_SCREEN_W_REND 0x8491
-#endif /* GL_REND_screen_coordinates */
-
-#ifndef GL_S3_s3tc
-#define GL_S3_s3tc 1
-#define GL_RGB_S3TC 0x83A0
-#define GL_RGB4_S3TC 0x83A1
-#define GL_RGBA_S3TC 0x83A2
-#define GL_RGBA4_S3TC 0x83A3
-#define GL_RGBA_DXT5_S3TC 0x83A4
-#define GL_RGBA4_DXT5_S3TC 0x83A5
-#endif /* GL_S3_s3tc */
-
-#ifndef GL_SGIS_detail_texture
-#define GL_SGIS_detail_texture 1
-#define GL_DETAIL_TEXTURE_2D_SGIS 0x8095
-#define GL_DETAIL_TEXTURE_2D_BINDING_SGIS 0x8096
-#define GL_LINEAR_DETAIL_SGIS 0x8097
-#define GL_LINEAR_DETAIL_ALPHA_SGIS 0x8098
-#define GL_LINEAR_DETAIL_COLOR_SGIS 0x8099
-#define GL_DETAIL_TEXTURE_LEVEL_SGIS 0x809A
-#define GL_DETAIL_TEXTURE_MODE_SGIS 0x809B
-#define GL_DETAIL_TEXTURE_FUNC_POINTS_SGIS 0x809C
-typedef void (APIENTRYP PFNGLDETAILTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETDETAILTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDetailTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
-GLAPI void APIENTRY glGetDetailTexFuncSGIS (GLenum target, GLfloat *points);
-#endif
-#endif /* GL_SGIS_detail_texture */
-
-#ifndef GL_SGIS_fog_function
-#define GL_SGIS_fog_function 1
-#define GL_FOG_FUNC_SGIS 0x812A
-#define GL_FOG_FUNC_POINTS_SGIS 0x812B
-#define GL_MAX_FOG_FUNC_POINTS_SGIS 0x812C
-typedef void (APIENTRYP PFNGLFOGFUNCSGISPROC) (GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETFOGFUNCSGISPROC) (GLfloat *points);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFogFuncSGIS (GLsizei n, const GLfloat *points);
-GLAPI void APIENTRY glGetFogFuncSGIS (GLfloat *points);
-#endif
-#endif /* GL_SGIS_fog_function */
-
-#ifndef GL_SGIS_generate_mipmap
-#define GL_SGIS_generate_mipmap 1
-#define GL_GENERATE_MIPMAP_SGIS 0x8191
-#define GL_GENERATE_MIPMAP_HINT_SGIS 0x8192
-#endif /* GL_SGIS_generate_mipmap */
-
-#ifndef GL_SGIS_multisample
-#define GL_SGIS_multisample 1
-#define GL_MULTISAMPLE_SGIS 0x809D
-#define GL_SAMPLE_ALPHA_TO_MASK_SGIS 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE_SGIS 0x809F
-#define GL_SAMPLE_MASK_SGIS 0x80A0
-#define GL_1PASS_SGIS 0x80A1
-#define GL_2PASS_0_SGIS 0x80A2
-#define GL_2PASS_1_SGIS 0x80A3
-#define GL_4PASS_0_SGIS 0x80A4
-#define GL_4PASS_1_SGIS 0x80A5
-#define GL_4PASS_2_SGIS 0x80A6
-#define GL_4PASS_3_SGIS 0x80A7
-#define GL_SAMPLE_BUFFERS_SGIS 0x80A8
-#define GL_SAMPLES_SGIS 0x80A9
-#define GL_SAMPLE_MASK_VALUE_SGIS 0x80AA
-#define GL_SAMPLE_MASK_INVERT_SGIS 0x80AB
-#define GL_SAMPLE_PATTERN_SGIS 0x80AC
-typedef void (APIENTRYP PFNGLSAMPLEMASKSGISPROC) (GLclampf value, GLboolean invert);
-typedef void (APIENTRYP PFNGLSAMPLEPATTERNSGISPROC) (GLenum pattern);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSampleMaskSGIS (GLclampf value, GLboolean invert);
-GLAPI void APIENTRY glSamplePatternSGIS (GLenum pattern);
-#endif
-#endif /* GL_SGIS_multisample */
-
-#ifndef GL_SGIS_pixel_texture
-#define GL_SGIS_pixel_texture 1
-#define GL_PIXEL_TEXTURE_SGIS 0x8353
-#define GL_PIXEL_FRAGMENT_RGB_SOURCE_SGIS 0x8354
-#define GL_PIXEL_FRAGMENT_ALPHA_SOURCE_SGIS 0x8355
-#define GL_PIXEL_GROUP_COLOR_SGIS 0x8356
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERISGISPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERIVSGISPROC) (GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETPIXELTEXGENPARAMETERFVSGISPROC) (GLenum pname, GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenParameteriSGIS (GLenum pname, GLint param);
-GLAPI void APIENTRY glPixelTexGenParameterivSGIS (GLenum pname, const GLint *params);
-GLAPI void APIENTRY glPixelTexGenParameterfSGIS (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPixelTexGenParameterfvSGIS (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glGetPixelTexGenParameterivSGIS (GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetPixelTexGenParameterfvSGIS (GLenum pname, GLfloat *params);
-#endif
-#endif /* GL_SGIS_pixel_texture */
-
-#ifndef GL_SGIS_point_line_texgen
-#define GL_SGIS_point_line_texgen 1
-#define GL_EYE_DISTANCE_TO_POINT_SGIS 0x81F0
-#define GL_OBJECT_DISTANCE_TO_POINT_SGIS 0x81F1
-#define GL_EYE_DISTANCE_TO_LINE_SGIS 0x81F2
-#define GL_OBJECT_DISTANCE_TO_LINE_SGIS 0x81F3
-#define GL_EYE_POINT_SGIS 0x81F4
-#define GL_OBJECT_POINT_SGIS 0x81F5
-#define GL_EYE_LINE_SGIS 0x81F6
-#define GL_OBJECT_LINE_SGIS 0x81F7
-#endif /* GL_SGIS_point_line_texgen */
-
-#ifndef GL_SGIS_point_parameters
-#define GL_SGIS_point_parameters 1
-#define GL_POINT_SIZE_MIN_SGIS 0x8126
-#define GL_POINT_SIZE_MAX_SGIS 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE_SGIS 0x8128
-#define GL_DISTANCE_ATTENUATION_SGIS 0x8129
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFSGISPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLPOINTPARAMETERFVSGISPROC) (GLenum pname, const GLfloat *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPointParameterfSGIS (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glPointParameterfvSGIS (GLenum pname, const GLfloat *params);
-#endif
-#endif /* GL_SGIS_point_parameters */
-
-#ifndef GL_SGIS_sharpen_texture
-#define GL_SGIS_sharpen_texture 1
-#define GL_LINEAR_SHARPEN_SGIS 0x80AD
-#define GL_LINEAR_SHARPEN_ALPHA_SGIS 0x80AE
-#define GL_LINEAR_SHARPEN_COLOR_SGIS 0x80AF
-#define GL_SHARPEN_TEXTURE_FUNC_POINTS_SGIS 0x80B0
-typedef void (APIENTRYP PFNGLSHARPENTEXFUNCSGISPROC) (GLenum target, GLsizei n, const GLfloat *points);
-typedef void (APIENTRYP PFNGLGETSHARPENTEXFUNCSGISPROC) (GLenum target, GLfloat *points);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSharpenTexFuncSGIS (GLenum target, GLsizei n, const GLfloat *points);
-GLAPI void APIENTRY glGetSharpenTexFuncSGIS (GLenum target, GLfloat *points);
-#endif
-#endif /* GL_SGIS_sharpen_texture */
-
-#ifndef GL_SGIS_texture4D
-#define GL_SGIS_texture4D 1
-#define GL_PACK_SKIP_VOLUMES_SGIS 0x8130
-#define GL_PACK_IMAGE_DEPTH_SGIS 0x8131
-#define GL_UNPACK_SKIP_VOLUMES_SGIS 0x8132
-#define GL_UNPACK_IMAGE_DEPTH_SGIS 0x8133
-#define GL_TEXTURE_4D_SGIS 0x8134
-#define GL_PROXY_TEXTURE_4D_SGIS 0x8135
-#define GL_TEXTURE_4DSIZE_SGIS 0x8136
-#define GL_TEXTURE_WRAP_Q_SGIS 0x8137
-#define GL_MAX_4D_TEXTURE_SIZE_SGIS 0x8138
-#define GL_TEXTURE_4D_BINDING_SGIS 0x814F
-typedef void (APIENTRYP PFNGLTEXIMAGE4DSGISPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (APIENTRYP PFNGLTEXSUBIMAGE4DSGISPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTexImage4DSGIS (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLint border, GLenum format, GLenum type, const void *pixels);
-GLAPI void APIENTRY glTexSubImage4DSGIS (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint woffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei size4d, GLenum format, GLenum type, const void *pixels);
-#endif
-#endif /* GL_SGIS_texture4D */
-
-#ifndef GL_SGIS_texture_border_clamp
-#define GL_SGIS_texture_border_clamp 1
-#define GL_CLAMP_TO_BORDER_SGIS 0x812D
-#endif /* GL_SGIS_texture_border_clamp */
-
-#ifndef GL_SGIS_texture_color_mask
-#define GL_SGIS_texture_color_mask 1
-#define GL_TEXTURE_COLOR_WRITEMASK_SGIS 0x81EF
-typedef void (APIENTRYP PFNGLTEXTURECOLORMASKSGISPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTextureColorMaskSGIS (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-#endif
-#endif /* GL_SGIS_texture_color_mask */
-
-#ifndef GL_SGIS_texture_edge_clamp
-#define GL_SGIS_texture_edge_clamp 1
-#define GL_CLAMP_TO_EDGE_SGIS 0x812F
-#endif /* GL_SGIS_texture_edge_clamp */
-
-#ifndef GL_SGIS_texture_filter4
-#define GL_SGIS_texture_filter4 1
-#define GL_FILTER4_SGIS 0x8146
-#define GL_TEXTURE_FILTER4_SIZE_SGIS 0x8147
-typedef void (APIENTRYP PFNGLGETTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLfloat *weights);
-typedef void (APIENTRYP PFNGLTEXFILTERFUNCSGISPROC) (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetTexFilterFuncSGIS (GLenum target, GLenum filter, GLfloat *weights);
-GLAPI void APIENTRY glTexFilterFuncSGIS (GLenum target, GLenum filter, GLsizei n, const GLfloat *weights);
-#endif
-#endif /* GL_SGIS_texture_filter4 */
-
-#ifndef GL_SGIS_texture_lod
-#define GL_SGIS_texture_lod 1
-#define GL_TEXTURE_MIN_LOD_SGIS 0x813A
-#define GL_TEXTURE_MAX_LOD_SGIS 0x813B
-#define GL_TEXTURE_BASE_LEVEL_SGIS 0x813C
-#define GL_TEXTURE_MAX_LEVEL_SGIS 0x813D
-#endif /* GL_SGIS_texture_lod */
-
-#ifndef GL_SGIS_texture_select
-#define GL_SGIS_texture_select 1
-#define GL_DUAL_ALPHA4_SGIS 0x8110
-#define GL_DUAL_ALPHA8_SGIS 0x8111
-#define GL_DUAL_ALPHA12_SGIS 0x8112
-#define GL_DUAL_ALPHA16_SGIS 0x8113
-#define GL_DUAL_LUMINANCE4_SGIS 0x8114
-#define GL_DUAL_LUMINANCE8_SGIS 0x8115
-#define GL_DUAL_LUMINANCE12_SGIS 0x8116
-#define GL_DUAL_LUMINANCE16_SGIS 0x8117
-#define GL_DUAL_INTENSITY4_SGIS 0x8118
-#define GL_DUAL_INTENSITY8_SGIS 0x8119
-#define GL_DUAL_INTENSITY12_SGIS 0x811A
-#define GL_DUAL_INTENSITY16_SGIS 0x811B
-#define GL_DUAL_LUMINANCE_ALPHA4_SGIS 0x811C
-#define GL_DUAL_LUMINANCE_ALPHA8_SGIS 0x811D
-#define GL_QUAD_ALPHA4_SGIS 0x811E
-#define GL_QUAD_ALPHA8_SGIS 0x811F
-#define GL_QUAD_LUMINANCE4_SGIS 0x8120
-#define GL_QUAD_LUMINANCE8_SGIS 0x8121
-#define GL_QUAD_INTENSITY4_SGIS 0x8122
-#define GL_QUAD_INTENSITY8_SGIS 0x8123
-#define GL_DUAL_TEXTURE_SELECT_SGIS 0x8124
-#define GL_QUAD_TEXTURE_SELECT_SGIS 0x8125
-#endif /* GL_SGIS_texture_select */
-
-#ifndef GL_SGIX_async
-#define GL_SGIX_async 1
-#define GL_ASYNC_MARKER_SGIX 0x8329
-typedef void (APIENTRYP PFNGLASYNCMARKERSGIXPROC) (GLuint marker);
-typedef GLint (APIENTRYP PFNGLFINISHASYNCSGIXPROC) (GLuint *markerp);
-typedef GLint (APIENTRYP PFNGLPOLLASYNCSGIXPROC) (GLuint *markerp);
-typedef GLuint (APIENTRYP PFNGLGENASYNCMARKERSSGIXPROC) (GLsizei range);
-typedef void (APIENTRYP PFNGLDELETEASYNCMARKERSSGIXPROC) (GLuint marker, GLsizei range);
-typedef GLboolean (APIENTRYP PFNGLISASYNCMARKERSGIXPROC) (GLuint marker);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glAsyncMarkerSGIX (GLuint marker);
-GLAPI GLint APIENTRY glFinishAsyncSGIX (GLuint *markerp);
-GLAPI GLint APIENTRY glPollAsyncSGIX (GLuint *markerp);
-GLAPI GLuint APIENTRY glGenAsyncMarkersSGIX (GLsizei range);
-GLAPI void APIENTRY glDeleteAsyncMarkersSGIX (GLuint marker, GLsizei range);
-GLAPI GLboolean APIENTRY glIsAsyncMarkerSGIX (GLuint marker);
-#endif
-#endif /* GL_SGIX_async */
-
-#ifndef GL_SGIX_async_histogram
-#define GL_SGIX_async_histogram 1
-#define GL_ASYNC_HISTOGRAM_SGIX 0x832C
-#define GL_MAX_ASYNC_HISTOGRAM_SGIX 0x832D
-#endif /* GL_SGIX_async_histogram */
-
-#ifndef GL_SGIX_async_pixel
-#define GL_SGIX_async_pixel 1
-#define GL_ASYNC_TEX_IMAGE_SGIX 0x835C
-#define GL_ASYNC_DRAW_PIXELS_SGIX 0x835D
-#define GL_ASYNC_READ_PIXELS_SGIX 0x835E
-#define GL_MAX_ASYNC_TEX_IMAGE_SGIX 0x835F
-#define GL_MAX_ASYNC_DRAW_PIXELS_SGIX 0x8360
-#define GL_MAX_ASYNC_READ_PIXELS_SGIX 0x8361
-#endif /* GL_SGIX_async_pixel */
-
-#ifndef GL_SGIX_blend_alpha_minmax
-#define GL_SGIX_blend_alpha_minmax 1
-#define GL_ALPHA_MIN_SGIX 0x8320
-#define GL_ALPHA_MAX_SGIX 0x8321
-#endif /* GL_SGIX_blend_alpha_minmax */
-
-#ifndef GL_SGIX_calligraphic_fragment
-#define GL_SGIX_calligraphic_fragment 1
-#define GL_CALLIGRAPHIC_FRAGMENT_SGIX 0x8183
-#endif /* GL_SGIX_calligraphic_fragment */
-
-#ifndef GL_SGIX_clipmap
-#define GL_SGIX_clipmap 1
-#define GL_LINEAR_CLIPMAP_LINEAR_SGIX 0x8170
-#define GL_TEXTURE_CLIPMAP_CENTER_SGIX 0x8171
-#define GL_TEXTURE_CLIPMAP_FRAME_SGIX 0x8172
-#define GL_TEXTURE_CLIPMAP_OFFSET_SGIX 0x8173
-#define GL_TEXTURE_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8174
-#define GL_TEXTURE_CLIPMAP_LOD_OFFSET_SGIX 0x8175
-#define GL_TEXTURE_CLIPMAP_DEPTH_SGIX 0x8176
-#define GL_MAX_CLIPMAP_DEPTH_SGIX 0x8177
-#define GL_MAX_CLIPMAP_VIRTUAL_DEPTH_SGIX 0x8178
-#define GL_NEAREST_CLIPMAP_NEAREST_SGIX 0x844D
-#define GL_NEAREST_CLIPMAP_LINEAR_SGIX 0x844E
-#define GL_LINEAR_CLIPMAP_NEAREST_SGIX 0x844F
-#endif /* GL_SGIX_clipmap */
-
-#ifndef GL_SGIX_convolution_accuracy
-#define GL_SGIX_convolution_accuracy 1
-#define GL_CONVOLUTION_HINT_SGIX 0x8316
-#endif /* GL_SGIX_convolution_accuracy */
-
-#ifndef GL_SGIX_depth_pass_instrument
-#define GL_SGIX_depth_pass_instrument 1
-#endif /* GL_SGIX_depth_pass_instrument */
-
-#ifndef GL_SGIX_depth_texture
-#define GL_SGIX_depth_texture 1
-#define GL_DEPTH_COMPONENT16_SGIX 0x81A5
-#define GL_DEPTH_COMPONENT24_SGIX 0x81A6
-#define GL_DEPTH_COMPONENT32_SGIX 0x81A7
-#endif /* GL_SGIX_depth_texture */
-
-#ifndef GL_SGIX_flush_raster
-#define GL_SGIX_flush_raster 1
-typedef void (APIENTRYP PFNGLFLUSHRASTERSGIXPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFlushRasterSGIX (void);
-#endif
-#endif /* GL_SGIX_flush_raster */
-
-#ifndef GL_SGIX_fog_offset
-#define GL_SGIX_fog_offset 1
-#define GL_FOG_OFFSET_SGIX 0x8198
-#define GL_FOG_OFFSET_VALUE_SGIX 0x8199
-#endif /* GL_SGIX_fog_offset */
-
-#ifndef GL_SGIX_fragment_lighting
-#define GL_SGIX_fragment_lighting 1
-#define GL_FRAGMENT_LIGHTING_SGIX 0x8400
-#define GL_FRAGMENT_COLOR_MATERIAL_SGIX 0x8401
-#define GL_FRAGMENT_COLOR_MATERIAL_FACE_SGIX 0x8402
-#define GL_FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX 0x8403
-#define GL_MAX_FRAGMENT_LIGHTS_SGIX 0x8404
-#define GL_MAX_ACTIVE_LIGHTS_SGIX 0x8405
-#define GL_CURRENT_RASTER_NORMAL_SGIX 0x8406
-#define GL_LIGHT_ENV_MODE_SGIX 0x8407
-#define GL_FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX 0x8408
-#define GL_FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX 0x8409
-#define GL_FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX 0x840A
-#define GL_FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX 0x840B
-#define GL_FRAGMENT_LIGHT0_SGIX 0x840C
-#define GL_FRAGMENT_LIGHT1_SGIX 0x840D
-#define GL_FRAGMENT_LIGHT2_SGIX 0x840E
-#define GL_FRAGMENT_LIGHT3_SGIX 0x840F
-#define GL_FRAGMENT_LIGHT4_SGIX 0x8410
-#define GL_FRAGMENT_LIGHT5_SGIX 0x8411
-#define GL_FRAGMENT_LIGHT6_SGIX 0x8412
-#define GL_FRAGMENT_LIGHT7_SGIX 0x8413
-typedef void (APIENTRYP PFNGLFRAGMENTCOLORMATERIALSGIXPROC) (GLenum face, GLenum mode);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFSGIXPROC) (GLenum light, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTISGIXPROC) (GLenum light, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELFVSGIXPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELISGIXPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTLIGHTMODELIVSGIXPROC) (GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFSGIXPROC) (GLenum face, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALISGIXPROC) (GLenum face, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTFVSGIXPROC) (GLenum light, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTLIGHTIVSGIXPROC) (GLenum light, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALFVSGIXPROC) (GLenum face, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETFRAGMENTMATERIALIVSGIXPROC) (GLenum face, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLLIGHTENVISGIXPROC) (GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFragmentColorMaterialSGIX (GLenum face, GLenum mode);
-GLAPI void APIENTRY glFragmentLightfSGIX (GLenum light, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glFragmentLightfvSGIX (GLenum light, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glFragmentLightiSGIX (GLenum light, GLenum pname, GLint param);
-GLAPI void APIENTRY glFragmentLightivSGIX (GLenum light, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glFragmentLightModelfSGIX (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glFragmentLightModelfvSGIX (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glFragmentLightModeliSGIX (GLenum pname, GLint param);
-GLAPI void APIENTRY glFragmentLightModelivSGIX (GLenum pname, const GLint *params);
-GLAPI void APIENTRY glFragmentMaterialfSGIX (GLenum face, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glFragmentMaterialfvSGIX (GLenum face, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glFragmentMaterialiSGIX (GLenum face, GLenum pname, GLint param);
-GLAPI void APIENTRY glFragmentMaterialivSGIX (GLenum face, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glGetFragmentLightfvSGIX (GLenum light, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetFragmentLightivSGIX (GLenum light, GLenum pname, GLint *params);
-GLAPI void APIENTRY glGetFragmentMaterialfvSGIX (GLenum face, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetFragmentMaterialivSGIX (GLenum face, GLenum pname, GLint *params);
-GLAPI void APIENTRY glLightEnviSGIX (GLenum pname, GLint param);
-#endif
-#endif /* GL_SGIX_fragment_lighting */
-
-#ifndef GL_SGIX_framezoom
-#define GL_SGIX_framezoom 1
-#define GL_FRAMEZOOM_SGIX 0x818B
-#define GL_FRAMEZOOM_FACTOR_SGIX 0x818C
-#define GL_MAX_FRAMEZOOM_FACTOR_SGIX 0x818D
-typedef void (APIENTRYP PFNGLFRAMEZOOMSGIXPROC) (GLint factor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFrameZoomSGIX (GLint factor);
-#endif
-#endif /* GL_SGIX_framezoom */
-
-#ifndef GL_SGIX_igloo_interface
-#define GL_SGIX_igloo_interface 1
-typedef void (APIENTRYP PFNGLIGLOOINTERFACESGIXPROC) (GLenum pname, const void *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glIglooInterfaceSGIX (GLenum pname, const void *params);
-#endif
-#endif /* GL_SGIX_igloo_interface */
-
-#ifndef GL_SGIX_instruments
-#define GL_SGIX_instruments 1
-#define GL_INSTRUMENT_BUFFER_POINTER_SGIX 0x8180
-#define GL_INSTRUMENT_MEASUREMENTS_SGIX 0x8181
-typedef GLint (APIENTRYP PFNGLGETINSTRUMENTSSGIXPROC) (void);
-typedef void (APIENTRYP PFNGLINSTRUMENTSBUFFERSGIXPROC) (GLsizei size, GLint *buffer);
-typedef GLint (APIENTRYP PFNGLPOLLINSTRUMENTSSGIXPROC) (GLint *marker_p);
-typedef void (APIENTRYP PFNGLREADINSTRUMENTSSGIXPROC) (GLint marker);
-typedef void (APIENTRYP PFNGLSTARTINSTRUMENTSSGIXPROC) (void);
-typedef void (APIENTRYP PFNGLSTOPINSTRUMENTSSGIXPROC) (GLint marker);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI GLint APIENTRY glGetInstrumentsSGIX (void);
-GLAPI void APIENTRY glInstrumentsBufferSGIX (GLsizei size, GLint *buffer);
-GLAPI GLint APIENTRY glPollInstrumentsSGIX (GLint *marker_p);
-GLAPI void APIENTRY glReadInstrumentsSGIX (GLint marker);
-GLAPI void APIENTRY glStartInstrumentsSGIX (void);
-GLAPI void APIENTRY glStopInstrumentsSGIX (GLint marker);
-#endif
-#endif /* GL_SGIX_instruments */
-
-#ifndef GL_SGIX_interlace
-#define GL_SGIX_interlace 1
-#define GL_INTERLACE_SGIX 0x8094
-#endif /* GL_SGIX_interlace */
-
-#ifndef GL_SGIX_ir_instrument1
-#define GL_SGIX_ir_instrument1 1
-#define GL_IR_INSTRUMENT1_SGIX 0x817F
-#endif /* GL_SGIX_ir_instrument1 */
-
-#ifndef GL_SGIX_list_priority
-#define GL_SGIX_list_priority 1
-#define GL_LIST_PRIORITY_SGIX 0x8182
-typedef void (APIENTRYP PFNGLGETLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, GLint *params);
-typedef void (APIENTRYP PFNGLLISTPARAMETERFSGIXPROC) (GLuint list, GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLLISTPARAMETERFVSGIXPROC) (GLuint list, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLLISTPARAMETERISGIXPROC) (GLuint list, GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLLISTPARAMETERIVSGIXPROC) (GLuint list, GLenum pname, const GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGetListParameterfvSGIX (GLuint list, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetListParameterivSGIX (GLuint list, GLenum pname, GLint *params);
-GLAPI void APIENTRY glListParameterfSGIX (GLuint list, GLenum pname, GLfloat param);
-GLAPI void APIENTRY glListParameterfvSGIX (GLuint list, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glListParameteriSGIX (GLuint list, GLenum pname, GLint param);
-GLAPI void APIENTRY glListParameterivSGIX (GLuint list, GLenum pname, const GLint *params);
-#endif
-#endif /* GL_SGIX_list_priority */
-
-#ifndef GL_SGIX_pixel_texture
-#define GL_SGIX_pixel_texture 1
-#define GL_PIXEL_TEX_GEN_SGIX 0x8139
-#define GL_PIXEL_TEX_GEN_MODE_SGIX 0x832B
-typedef void (APIENTRYP PFNGLPIXELTEXGENSGIXPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glPixelTexGenSGIX (GLenum mode);
-#endif
-#endif /* GL_SGIX_pixel_texture */
-
-#ifndef GL_SGIX_pixel_tiles
-#define GL_SGIX_pixel_tiles 1
-#define GL_PIXEL_TILE_BEST_ALIGNMENT_SGIX 0x813E
-#define GL_PIXEL_TILE_CACHE_INCREMENT_SGIX 0x813F
-#define GL_PIXEL_TILE_WIDTH_SGIX 0x8140
-#define GL_PIXEL_TILE_HEIGHT_SGIX 0x8141
-#define GL_PIXEL_TILE_GRID_WIDTH_SGIX 0x8142
-#define GL_PIXEL_TILE_GRID_HEIGHT_SGIX 0x8143
-#define GL_PIXEL_TILE_GRID_DEPTH_SGIX 0x8144
-#define GL_PIXEL_TILE_CACHE_SIZE_SGIX 0x8145
-#endif /* GL_SGIX_pixel_tiles */
-
-#ifndef GL_SGIX_polynomial_ffd
-#define GL_SGIX_polynomial_ffd 1
-#define GL_TEXTURE_DEFORMATION_BIT_SGIX 0x00000001
-#define GL_GEOMETRY_DEFORMATION_BIT_SGIX 0x00000002
-#define GL_GEOMETRY_DEFORMATION_SGIX 0x8194
-#define GL_TEXTURE_DEFORMATION_SGIX 0x8195
-#define GL_DEFORMATIONS_MASK_SGIX 0x8196
-#define GL_MAX_DEFORMATION_ORDER_SGIX 0x8197
-typedef void (APIENTRYP PFNGLDEFORMATIONMAP3DSGIXPROC) (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
-typedef void (APIENTRYP PFNGLDEFORMATIONMAP3FSGIXPROC) (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
-typedef void (APIENTRYP PFNGLDEFORMSGIXPROC) (GLbitfield mask);
-typedef void (APIENTRYP PFNGLLOADIDENTITYDEFORMATIONMAPSGIXPROC) (GLbitfield mask);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDeformationMap3dSGIX (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, GLdouble w1, GLdouble w2, GLint wstride, GLint worder, const GLdouble *points);
-GLAPI void APIENTRY glDeformationMap3fSGIX (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, GLfloat w1, GLfloat w2, GLint wstride, GLint worder, const GLfloat *points);
-GLAPI void APIENTRY glDeformSGIX (GLbitfield mask);
-GLAPI void APIENTRY glLoadIdentityDeformationMapSGIX (GLbitfield mask);
-#endif
-#endif /* GL_SGIX_polynomial_ffd */
-
-#ifndef GL_SGIX_reference_plane
-#define GL_SGIX_reference_plane 1
-#define GL_REFERENCE_PLANE_SGIX 0x817D
-#define GL_REFERENCE_PLANE_EQUATION_SGIX 0x817E
-typedef void (APIENTRYP PFNGLREFERENCEPLANESGIXPROC) (const GLdouble *equation);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReferencePlaneSGIX (const GLdouble *equation);
-#endif
-#endif /* GL_SGIX_reference_plane */
-
-#ifndef GL_SGIX_resample
-#define GL_SGIX_resample 1
-#define GL_PACK_RESAMPLE_SGIX 0x842E
-#define GL_UNPACK_RESAMPLE_SGIX 0x842F
-#define GL_RESAMPLE_REPLICATE_SGIX 0x8433
-#define GL_RESAMPLE_ZERO_FILL_SGIX 0x8434
-#define GL_RESAMPLE_DECIMATE_SGIX 0x8430
-#endif /* GL_SGIX_resample */
-
-#ifndef GL_SGIX_scalebias_hint
-#define GL_SGIX_scalebias_hint 1
-#define GL_SCALEBIAS_HINT_SGIX 0x8322
-#endif /* GL_SGIX_scalebias_hint */
-
-#ifndef GL_SGIX_shadow
-#define GL_SGIX_shadow 1
-#define GL_TEXTURE_COMPARE_SGIX 0x819A
-#define GL_TEXTURE_COMPARE_OPERATOR_SGIX 0x819B
-#define GL_TEXTURE_LEQUAL_R_SGIX 0x819C
-#define GL_TEXTURE_GEQUAL_R_SGIX 0x819D
-#endif /* GL_SGIX_shadow */
-
-#ifndef GL_SGIX_shadow_ambient
-#define GL_SGIX_shadow_ambient 1
-#define GL_SHADOW_AMBIENT_SGIX 0x80BF
-#endif /* GL_SGIX_shadow_ambient */
-
-#ifndef GL_SGIX_sprite
-#define GL_SGIX_sprite 1
-#define GL_SPRITE_SGIX 0x8148
-#define GL_SPRITE_MODE_SGIX 0x8149
-#define GL_SPRITE_AXIS_SGIX 0x814A
-#define GL_SPRITE_TRANSLATION_SGIX 0x814B
-#define GL_SPRITE_AXIAL_SGIX 0x814C
-#define GL_SPRITE_OBJECT_ALIGNED_SGIX 0x814D
-#define GL_SPRITE_EYE_ALIGNED_SGIX 0x814E
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERFSGIXPROC) (GLenum pname, GLfloat param);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERFVSGIXPROC) (GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERISGIXPROC) (GLenum pname, GLint param);
-typedef void (APIENTRYP PFNGLSPRITEPARAMETERIVSGIXPROC) (GLenum pname, const GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glSpriteParameterfSGIX (GLenum pname, GLfloat param);
-GLAPI void APIENTRY glSpriteParameterfvSGIX (GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glSpriteParameteriSGIX (GLenum pname, GLint param);
-GLAPI void APIENTRY glSpriteParameterivSGIX (GLenum pname, const GLint *params);
-#endif
-#endif /* GL_SGIX_sprite */
-
-#ifndef GL_SGIX_subsample
-#define GL_SGIX_subsample 1
-#define GL_PACK_SUBSAMPLE_RATE_SGIX 0x85A0
-#define GL_UNPACK_SUBSAMPLE_RATE_SGIX 0x85A1
-#define GL_PIXEL_SUBSAMPLE_4444_SGIX 0x85A2
-#define GL_PIXEL_SUBSAMPLE_2424_SGIX 0x85A3
-#define GL_PIXEL_SUBSAMPLE_4242_SGIX 0x85A4
-#endif /* GL_SGIX_subsample */
-
-#ifndef GL_SGIX_tag_sample_buffer
-#define GL_SGIX_tag_sample_buffer 1
-typedef void (APIENTRYP PFNGLTAGSAMPLEBUFFERSGIXPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glTagSampleBufferSGIX (void);
-#endif
-#endif /* GL_SGIX_tag_sample_buffer */
-
-#ifndef GL_SGIX_texture_add_env
-#define GL_SGIX_texture_add_env 1
-#define GL_TEXTURE_ENV_BIAS_SGIX 0x80BE
-#endif /* GL_SGIX_texture_add_env */
-
-#ifndef GL_SGIX_texture_coordinate_clamp
-#define GL_SGIX_texture_coordinate_clamp 1
-#define GL_TEXTURE_MAX_CLAMP_S_SGIX 0x8369
-#define GL_TEXTURE_MAX_CLAMP_T_SGIX 0x836A
-#define GL_TEXTURE_MAX_CLAMP_R_SGIX 0x836B
-#endif /* GL_SGIX_texture_coordinate_clamp */
-
-#ifndef GL_SGIX_texture_lod_bias
-#define GL_SGIX_texture_lod_bias 1
-#define GL_TEXTURE_LOD_BIAS_S_SGIX 0x818E
-#define GL_TEXTURE_LOD_BIAS_T_SGIX 0x818F
-#define GL_TEXTURE_LOD_BIAS_R_SGIX 0x8190
-#endif /* GL_SGIX_texture_lod_bias */
-
-#ifndef GL_SGIX_texture_multi_buffer
-#define GL_SGIX_texture_multi_buffer 1
-#define GL_TEXTURE_MULTI_BUFFER_HINT_SGIX 0x812E
-#endif /* GL_SGIX_texture_multi_buffer */
-
-#ifndef GL_SGIX_texture_scale_bias
-#define GL_SGIX_texture_scale_bias 1
-#define GL_POST_TEXTURE_FILTER_BIAS_SGIX 0x8179
-#define GL_POST_TEXTURE_FILTER_SCALE_SGIX 0x817A
-#define GL_POST_TEXTURE_FILTER_BIAS_RANGE_SGIX 0x817B
-#define GL_POST_TEXTURE_FILTER_SCALE_RANGE_SGIX 0x817C
-#endif /* GL_SGIX_texture_scale_bias */
-
-#ifndef GL_SGIX_vertex_preclip
-#define GL_SGIX_vertex_preclip 1
-#define GL_VERTEX_PRECLIP_SGIX 0x83EE
-#define GL_VERTEX_PRECLIP_HINT_SGIX 0x83EF
-#endif /* GL_SGIX_vertex_preclip */
-
-#ifndef GL_SGIX_ycrcb
-#define GL_SGIX_ycrcb 1
-#define GL_YCRCB_422_SGIX 0x81BB
-#define GL_YCRCB_444_SGIX 0x81BC
-#endif /* GL_SGIX_ycrcb */
-
-#ifndef GL_SGIX_ycrcb_subsample
-#define GL_SGIX_ycrcb_subsample 1
-#endif /* GL_SGIX_ycrcb_subsample */
-
-#ifndef GL_SGIX_ycrcba
-#define GL_SGIX_ycrcba 1
-#define GL_YCRCB_SGIX 0x8318
-#define GL_YCRCBA_SGIX 0x8319
-#endif /* GL_SGIX_ycrcba */
-
-#ifndef GL_SGI_color_matrix
-#define GL_SGI_color_matrix 1
-#define GL_COLOR_MATRIX_SGI 0x80B1
-#define GL_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B2
-#define GL_MAX_COLOR_MATRIX_STACK_DEPTH_SGI 0x80B3
-#define GL_POST_COLOR_MATRIX_RED_SCALE_SGI 0x80B4
-#define GL_POST_COLOR_MATRIX_GREEN_SCALE_SGI 0x80B5
-#define GL_POST_COLOR_MATRIX_BLUE_SCALE_SGI 0x80B6
-#define GL_POST_COLOR_MATRIX_ALPHA_SCALE_SGI 0x80B7
-#define GL_POST_COLOR_MATRIX_RED_BIAS_SGI 0x80B8
-#define GL_POST_COLOR_MATRIX_GREEN_BIAS_SGI 0x80B9
-#define GL_POST_COLOR_MATRIX_BLUE_BIAS_SGI 0x80BA
-#define GL_POST_COLOR_MATRIX_ALPHA_BIAS_SGI 0x80BB
-#endif /* GL_SGI_color_matrix */
-
-#ifndef GL_SGI_color_table
-#define GL_SGI_color_table 1
-#define GL_COLOR_TABLE_SGI 0x80D0
-#define GL_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D1
-#define GL_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D2
-#define GL_PROXY_COLOR_TABLE_SGI 0x80D3
-#define GL_PROXY_POST_CONVOLUTION_COLOR_TABLE_SGI 0x80D4
-#define GL_PROXY_POST_COLOR_MATRIX_COLOR_TABLE_SGI 0x80D5
-#define GL_COLOR_TABLE_SCALE_SGI 0x80D6
-#define GL_COLOR_TABLE_BIAS_SGI 0x80D7
-#define GL_COLOR_TABLE_FORMAT_SGI 0x80D8
-#define GL_COLOR_TABLE_WIDTH_SGI 0x80D9
-#define GL_COLOR_TABLE_RED_SIZE_SGI 0x80DA
-#define GL_COLOR_TABLE_GREEN_SIZE_SGI 0x80DB
-#define GL_COLOR_TABLE_BLUE_SIZE_SGI 0x80DC
-#define GL_COLOR_TABLE_ALPHA_SIZE_SGI 0x80DD
-#define GL_COLOR_TABLE_LUMINANCE_SIZE_SGI 0x80DE
-#define GL_COLOR_TABLE_INTENSITY_SIZE_SGI 0x80DF
-typedef void (APIENTRYP PFNGLCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (APIENTRYP PFNGLCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (APIENTRYP PFNGLCOPYCOLORTABLESGIPROC) (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-typedef void (APIENTRYP PFNGLGETCOLORTABLESGIPROC) (GLenum target, GLenum format, GLenum type, void *table);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERFVSGIPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (APIENTRYP PFNGLGETCOLORTABLEPARAMETERIVSGIPROC) (GLenum target, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColorTableSGI (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const void *table);
-GLAPI void APIENTRY glColorTableParameterfvSGI (GLenum target, GLenum pname, const GLfloat *params);
-GLAPI void APIENTRY glColorTableParameterivSGI (GLenum target, GLenum pname, const GLint *params);
-GLAPI void APIENTRY glCopyColorTableSGI (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width);
-GLAPI void APIENTRY glGetColorTableSGI (GLenum target, GLenum format, GLenum type, void *table);
-GLAPI void APIENTRY glGetColorTableParameterfvSGI (GLenum target, GLenum pname, GLfloat *params);
-GLAPI void APIENTRY glGetColorTableParameterivSGI (GLenum target, GLenum pname, GLint *params);
-#endif
-#endif /* GL_SGI_color_table */
-
-#ifndef GL_SGI_texture_color_table
-#define GL_SGI_texture_color_table 1
-#define GL_TEXTURE_COLOR_TABLE_SGI 0x80BC
-#define GL_PROXY_TEXTURE_COLOR_TABLE_SGI 0x80BD
-#endif /* GL_SGI_texture_color_table */
-
-#ifndef GL_SUNX_constant_data
-#define GL_SUNX_constant_data 1
-#define GL_UNPACK_CONSTANT_DATA_SUNX 0x81D5
-#define GL_TEXTURE_CONSTANT_DATA_SUNX 0x81D6
-typedef void (APIENTRYP PFNGLFINISHTEXTURESUNXPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glFinishTextureSUNX (void);
-#endif
-#endif /* GL_SUNX_constant_data */
-
-#ifndef GL_SUN_convolution_border_modes
-#define GL_SUN_convolution_border_modes 1
-#define GL_WRAP_BORDER_SUN 0x81D4
-#endif /* GL_SUN_convolution_border_modes */
-
-#ifndef GL_SUN_global_alpha
-#define GL_SUN_global_alpha 1
-#define GL_GLOBAL_ALPHA_SUN 0x81D9
-#define GL_GLOBAL_ALPHA_FACTOR_SUN 0x81DA
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORBSUNPROC) (GLbyte factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORSSUNPROC) (GLshort factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORISUNPROC) (GLint factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORFSUNPROC) (GLfloat factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORDSUNPROC) (GLdouble factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUBSUNPROC) (GLubyte factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUSSUNPROC) (GLushort factor);
-typedef void (APIENTRYP PFNGLGLOBALALPHAFACTORUISUNPROC) (GLuint factor);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glGlobalAlphaFactorbSUN (GLbyte factor);
-GLAPI void APIENTRY glGlobalAlphaFactorsSUN (GLshort factor);
-GLAPI void APIENTRY glGlobalAlphaFactoriSUN (GLint factor);
-GLAPI void APIENTRY glGlobalAlphaFactorfSUN (GLfloat factor);
-GLAPI void APIENTRY glGlobalAlphaFactordSUN (GLdouble factor);
-GLAPI void APIENTRY glGlobalAlphaFactorubSUN (GLubyte factor);
-GLAPI void APIENTRY glGlobalAlphaFactorusSUN (GLushort factor);
-GLAPI void APIENTRY glGlobalAlphaFactoruiSUN (GLuint factor);
-#endif
-#endif /* GL_SUN_global_alpha */
-
-#ifndef GL_SUN_mesh_array
-#define GL_SUN_mesh_array 1
-#define GL_QUAD_MESH_SUN 0x8614
-#define GL_TRIANGLE_MESH_SUN 0x8615
-typedef void (APIENTRYP PFNGLDRAWMESHARRAYSSUNPROC) (GLenum mode, GLint first, GLsizei count, GLsizei width);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glDrawMeshArraysSUN (GLenum mode, GLint first, GLsizei count, GLsizei width);
-#endif
-#endif /* GL_SUN_mesh_array */
-
-#ifndef GL_SUN_slice_accum
-#define GL_SUN_slice_accum 1
-#define GL_SLICE_ACCUM_SUN 0x85CC
-#endif /* GL_SUN_slice_accum */
-
-#ifndef GL_SUN_triangle_list
-#define GL_SUN_triangle_list 1
-#define GL_RESTART_SUN 0x0001
-#define GL_REPLACE_MIDDLE_SUN 0x0002
-#define GL_REPLACE_OLDEST_SUN 0x0003
-#define GL_TRIANGLE_LIST_SUN 0x81D7
-#define GL_REPLACEMENT_CODE_SUN 0x81D8
-#define GL_REPLACEMENT_CODE_ARRAY_SUN 0x85C0
-#define GL_REPLACEMENT_CODE_ARRAY_TYPE_SUN 0x85C1
-#define GL_REPLACEMENT_CODE_ARRAY_STRIDE_SUN 0x85C2
-#define GL_REPLACEMENT_CODE_ARRAY_POINTER_SUN 0x85C3
-#define GL_R1UI_V3F_SUN 0x85C4
-#define GL_R1UI_C4UB_V3F_SUN 0x85C5
-#define GL_R1UI_C3F_V3F_SUN 0x85C6
-#define GL_R1UI_N3F_V3F_SUN 0x85C7
-#define GL_R1UI_C4F_N3F_V3F_SUN 0x85C8
-#define GL_R1UI_T2F_V3F_SUN 0x85C9
-#define GL_R1UI_T2F_N3F_V3F_SUN 0x85CA
-#define GL_R1UI_T2F_C4F_N3F_V3F_SUN 0x85CB
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUISUNPROC) (GLuint code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSSUNPROC) (GLushort code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBSUNPROC) (GLubyte code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVSUNPROC) (const GLuint *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUSVSUNPROC) (const GLushort *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUBVSUNPROC) (const GLubyte *code);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEPOINTERSUNPROC) (GLenum type, GLsizei stride, const void **pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glReplacementCodeuiSUN (GLuint code);
-GLAPI void APIENTRY glReplacementCodeusSUN (GLushort code);
-GLAPI void APIENTRY glReplacementCodeubSUN (GLubyte code);
-GLAPI void APIENTRY glReplacementCodeuivSUN (const GLuint *code);
-GLAPI void APIENTRY glReplacementCodeusvSUN (const GLushort *code);
-GLAPI void APIENTRY glReplacementCodeubvSUN (const GLubyte *code);
-GLAPI void APIENTRY glReplacementCodePointerSUN (GLenum type, GLsizei stride, const void **pointer);
-#endif
-#endif /* GL_SUN_triangle_list */
-
-#ifndef GL_SUN_vertex
-#define GL_SUN_vertex 1
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX2FVSUNPROC) (const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FSUNPROC) (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR4UBVERTEX3FVSUNPROC) (const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FSUNPROC) (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLTEXCOORD4FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4UBVERTEX3FVSUNPROC) (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLTEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FSUNPROC) (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (APIENTRYP PFNGLTEXCOORD4FCOLOR4FNORMAL3FVERTEX4FVSUNPROC) (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FSUNPROC) (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUIVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FSUNPROC) (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4UBVERTEX3FVSUNPROC) (const GLuint *rc, const GLubyte *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUINORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUICOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FSUNPROC) (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-typedef void (APIENTRYP PFNGLREPLACEMENTCODEUITEXCOORD2FCOLOR4FNORMAL3FVERTEX3FVSUNPROC) (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-#ifdef GL_GLEXT_PROTOTYPES
-GLAPI void APIENTRY glColor4ubVertex2fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y);
-GLAPI void APIENTRY glColor4ubVertex2fvSUN (const GLubyte *c, const GLfloat *v);
-GLAPI void APIENTRY glColor4ubVertex3fSUN (GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glColor4ubVertex3fvSUN (const GLubyte *c, const GLfloat *v);
-GLAPI void APIENTRY glColor3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glColor3fVertex3fvSUN (const GLfloat *c, const GLfloat *v);
-GLAPI void APIENTRY glNormal3fVertex3fSUN (GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glNormal3fVertex3fvSUN (const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fSUN (GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glColor4fNormal3fVertex3fvSUN (const GLfloat *c, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord2fVertex3fSUN (GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTexCoord2fVertex3fvSUN (const GLfloat *tc, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord4fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glTexCoord4fVertex4fvSUN (const GLfloat *tc, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fSUN (GLfloat s, GLfloat t, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTexCoord2fColor4ubVertex3fvSUN (const GLfloat *tc, const GLubyte *c, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTexCoord2fColor3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTexCoord2fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fSUN (GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glTexCoord2fColor4fNormal3fVertex3fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fSUN (GLfloat s, GLfloat t, GLfloat p, GLfloat q, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GLAPI void APIENTRY glTexCoord4fColor4fNormal3fVertex4fvSUN (const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fSUN (GLuint rc, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiVertex3fvSUN (const GLuint *rc, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fSUN (GLuint rc, GLubyte r, GLubyte g, GLubyte b, GLubyte a, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiColor4ubVertex3fvSUN (const GLuint *rc, const GLubyte *c, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiColor3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fSUN (GLuint rc, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *n, const GLfloat *v);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN (GLuint rc, GLfloat s, GLfloat t, GLfloat r, GLfloat g, GLfloat b, GLfloat a, GLfloat nx, GLfloat ny, GLfloat nz, GLfloat x, GLfloat y, GLfloat z);
-GLAPI void APIENTRY glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN (const GLuint *rc, const GLfloat *tc, const GLfloat *c, const GLfloat *n, const GLfloat *v);
-#endif
-#endif /* GL_SUN_vertex */
-
-#ifndef GL_WIN_phong_shading
-#define GL_WIN_phong_shading 1
-#define GL_PHONG_WIN 0x80EA
-#define GL_PHONG_HINT_WIN 0x80EB
-#endif /* GL_WIN_phong_shading */
-
-#ifndef GL_WIN_specular_fog
-#define GL_WIN_specular_fog 1
-#define GL_FOG_SPECULAR_TEXTURE_WIN 0x80EC
-#endif /* GL_WIN_specular_fog */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GL/glxext.h b/include/GL/glxext.h
deleted file mode 100644
index 4c984ef4b..000000000
--- a/include/GL/glxext.h
+++ /dev/null
@@ -1,953 +0,0 @@
-#ifndef __glx_glxext_h_
-#define __glx_glxext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#define GLX_GLXEXT_VERSION 20180525
-
-/* Generated C header for:
- * API: glx
- * Versions considered: .*
- * Versions emitted: 1\.[3-9]
- * Default extensions included: glx
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GLX_VERSION_1_3
-#define GLX_VERSION_1_3 1
-typedef XID GLXContextID;
-typedef struct __GLXFBConfigRec *GLXFBConfig;
-typedef XID GLXWindow;
-typedef XID GLXPbuffer;
-#define GLX_WINDOW_BIT 0x00000001
-#define GLX_PIXMAP_BIT 0x00000002
-#define GLX_PBUFFER_BIT 0x00000004
-#define GLX_RGBA_BIT 0x00000001
-#define GLX_COLOR_INDEX_BIT 0x00000002
-#define GLX_PBUFFER_CLOBBER_MASK 0x08000000
-#define GLX_FRONT_LEFT_BUFFER_BIT 0x00000001
-#define GLX_FRONT_RIGHT_BUFFER_BIT 0x00000002
-#define GLX_BACK_LEFT_BUFFER_BIT 0x00000004
-#define GLX_BACK_RIGHT_BUFFER_BIT 0x00000008
-#define GLX_AUX_BUFFERS_BIT 0x00000010
-#define GLX_DEPTH_BUFFER_BIT 0x00000020
-#define GLX_STENCIL_BUFFER_BIT 0x00000040
-#define GLX_ACCUM_BUFFER_BIT 0x00000080
-#define GLX_CONFIG_CAVEAT 0x20
-#define GLX_X_VISUAL_TYPE 0x22
-#define GLX_TRANSPARENT_TYPE 0x23
-#define GLX_TRANSPARENT_INDEX_VALUE 0x24
-#define GLX_TRANSPARENT_RED_VALUE 0x25
-#define GLX_TRANSPARENT_GREEN_VALUE 0x26
-#define GLX_TRANSPARENT_BLUE_VALUE 0x27
-#define GLX_TRANSPARENT_ALPHA_VALUE 0x28
-#define GLX_DONT_CARE 0xFFFFFFFF
-#define GLX_NONE 0x8000
-#define GLX_SLOW_CONFIG 0x8001
-#define GLX_TRUE_COLOR 0x8002
-#define GLX_DIRECT_COLOR 0x8003
-#define GLX_PSEUDO_COLOR 0x8004
-#define GLX_STATIC_COLOR 0x8005
-#define GLX_GRAY_SCALE 0x8006
-#define GLX_STATIC_GRAY 0x8007
-#define GLX_TRANSPARENT_RGB 0x8008
-#define GLX_TRANSPARENT_INDEX 0x8009
-#define GLX_VISUAL_ID 0x800B
-#define GLX_SCREEN 0x800C
-#define GLX_NON_CONFORMANT_CONFIG 0x800D
-#define GLX_DRAWABLE_TYPE 0x8010
-#define GLX_RENDER_TYPE 0x8011
-#define GLX_X_RENDERABLE 0x8012
-#define GLX_FBCONFIG_ID 0x8013
-#define GLX_RGBA_TYPE 0x8014
-#define GLX_COLOR_INDEX_TYPE 0x8015
-#define GLX_MAX_PBUFFER_WIDTH 0x8016
-#define GLX_MAX_PBUFFER_HEIGHT 0x8017
-#define GLX_MAX_PBUFFER_PIXELS 0x8018
-#define GLX_PRESERVED_CONTENTS 0x801B
-#define GLX_LARGEST_PBUFFER 0x801C
-#define GLX_WIDTH 0x801D
-#define GLX_HEIGHT 0x801E
-#define GLX_EVENT_MASK 0x801F
-#define GLX_DAMAGED 0x8020
-#define GLX_SAVED 0x8021
-#define GLX_WINDOW 0x8022
-#define GLX_PBUFFER 0x8023
-#define GLX_PBUFFER_HEIGHT 0x8040
-#define GLX_PBUFFER_WIDTH 0x8041
-typedef GLXFBConfig *( *PFNGLXGETFBCONFIGSPROC) (Display *dpy, int screen, int *nelements);
-typedef GLXFBConfig *( *PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements);
-typedef int ( *PFNGLXGETFBCONFIGATTRIBPROC) (Display *dpy, GLXFBConfig config, int attribute, int *value);
-typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGPROC) (Display *dpy, GLXFBConfig config);
-typedef GLXWindow ( *PFNGLXCREATEWINDOWPROC) (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
-typedef void ( *PFNGLXDESTROYWINDOWPROC) (Display *dpy, GLXWindow win);
-typedef GLXPixmap ( *PFNGLXCREATEPIXMAPPROC) (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
-typedef void ( *PFNGLXDESTROYPIXMAPPROC) (Display *dpy, GLXPixmap pixmap);
-typedef GLXPbuffer ( *PFNGLXCREATEPBUFFERPROC) (Display *dpy, GLXFBConfig config, const int *attrib_list);
-typedef void ( *PFNGLXDESTROYPBUFFERPROC) (Display *dpy, GLXPbuffer pbuf);
-typedef void ( *PFNGLXQUERYDRAWABLEPROC) (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
-typedef GLXContext ( *PFNGLXCREATENEWCONTEXTPROC) (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
-typedef Bool ( *PFNGLXMAKECONTEXTCURRENTPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLEPROC) (void);
-typedef int ( *PFNGLXQUERYCONTEXTPROC) (Display *dpy, GLXContext ctx, int attribute, int *value);
-typedef void ( *PFNGLXSELECTEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long event_mask);
-typedef void ( *PFNGLXGETSELECTEDEVENTPROC) (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXFBConfig *glXGetFBConfigs (Display *dpy, int screen, int *nelements);
-GLXFBConfig *glXChooseFBConfig (Display *dpy, int screen, const int *attrib_list, int *nelements);
-int glXGetFBConfigAttrib (Display *dpy, GLXFBConfig config, int attribute, int *value);
-XVisualInfo *glXGetVisualFromFBConfig (Display *dpy, GLXFBConfig config);
-GLXWindow glXCreateWindow (Display *dpy, GLXFBConfig config, Window win, const int *attrib_list);
-void glXDestroyWindow (Display *dpy, GLXWindow win);
-GLXPixmap glXCreatePixmap (Display *dpy, GLXFBConfig config, Pixmap pixmap, const int *attrib_list);
-void glXDestroyPixmap (Display *dpy, GLXPixmap pixmap);
-GLXPbuffer glXCreatePbuffer (Display *dpy, GLXFBConfig config, const int *attrib_list);
-void glXDestroyPbuffer (Display *dpy, GLXPbuffer pbuf);
-void glXQueryDrawable (Display *dpy, GLXDrawable draw, int attribute, unsigned int *value);
-GLXContext glXCreateNewContext (Display *dpy, GLXFBConfig config, int render_type, GLXContext share_list, Bool direct);
-Bool glXMakeContextCurrent (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-GLXDrawable glXGetCurrentReadDrawable (void);
-int glXQueryContext (Display *dpy, GLXContext ctx, int attribute, int *value);
-void glXSelectEvent (Display *dpy, GLXDrawable draw, unsigned long event_mask);
-void glXGetSelectedEvent (Display *dpy, GLXDrawable draw, unsigned long *event_mask);
-#endif
-#endif /* GLX_VERSION_1_3 */
-
-#ifndef GLX_VERSION_1_4
-#define GLX_VERSION_1_4 1
-typedef void ( *__GLXextFuncPtr)(void);
-#define GLX_SAMPLE_BUFFERS 100000
-#define GLX_SAMPLES 100001
-typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSPROC) (const GLubyte *procName);
-#ifdef GLX_GLXEXT_PROTOTYPES
-__GLXextFuncPtr glXGetProcAddress (const GLubyte *procName);
-#endif
-#endif /* GLX_VERSION_1_4 */
-
-#ifndef GLX_ARB_context_flush_control
-#define GLX_ARB_context_flush_control 1
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
-#define GLX_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-#endif /* GLX_ARB_context_flush_control */
-
-#ifndef GLX_ARB_create_context
-#define GLX_ARB_create_context 1
-#define GLX_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define GLX_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define GLX_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define GLX_CONTEXT_FLAGS_ARB 0x2094
-typedef GLXContext ( *PFNGLXCREATECONTEXTATTRIBSARBPROC) (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXContext glXCreateContextAttribsARB (Display *dpy, GLXFBConfig config, GLXContext share_context, Bool direct, const int *attrib_list);
-#endif
-#endif /* GLX_ARB_create_context */
-
-#ifndef GLX_ARB_create_context_no_error
-#define GLX_ARB_create_context_no_error 1
-#define GLX_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
-#endif /* GLX_ARB_create_context_no_error */
-
-#ifndef GLX_ARB_create_context_profile
-#define GLX_ARB_create_context_profile 1
-#define GLX_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126
-#endif /* GLX_ARB_create_context_profile */
-
-#ifndef GLX_ARB_create_context_robustness
-#define GLX_ARB_create_context_robustness 1
-#define GLX_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define GLX_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define GLX_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define GLX_NO_RESET_NOTIFICATION_ARB 0x8261
-#endif /* GLX_ARB_create_context_robustness */
-
-#ifndef GLX_ARB_fbconfig_float
-#define GLX_ARB_fbconfig_float 1
-#define GLX_RGBA_FLOAT_TYPE_ARB 0x20B9
-#define GLX_RGBA_FLOAT_BIT_ARB 0x00000004
-#endif /* GLX_ARB_fbconfig_float */
-
-#ifndef GLX_ARB_framebuffer_sRGB
-#define GLX_ARB_framebuffer_sRGB 1
-#define GLX_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20B2
-#endif /* GLX_ARB_framebuffer_sRGB */
-
-#ifndef GLX_ARB_get_proc_address
-#define GLX_ARB_get_proc_address 1
-typedef __GLXextFuncPtr ( *PFNGLXGETPROCADDRESSARBPROC) (const GLubyte *procName);
-#ifdef GLX_GLXEXT_PROTOTYPES
-__GLXextFuncPtr glXGetProcAddressARB (const GLubyte *procName);
-#endif
-#endif /* GLX_ARB_get_proc_address */
-
-#ifndef GLX_ARB_multisample
-#define GLX_ARB_multisample 1
-#define GLX_SAMPLE_BUFFERS_ARB 100000
-#define GLX_SAMPLES_ARB 100001
-#endif /* GLX_ARB_multisample */
-
-#ifndef GLX_ARB_robustness_application_isolation
-#define GLX_ARB_robustness_application_isolation 1
-#define GLX_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-#endif /* GLX_ARB_robustness_application_isolation */
-
-#ifndef GLX_ARB_robustness_share_group_isolation
-#define GLX_ARB_robustness_share_group_isolation 1
-#endif /* GLX_ARB_robustness_share_group_isolation */
-
-#ifndef GLX_ARB_vertex_buffer_object
-#define GLX_ARB_vertex_buffer_object 1
-#define GLX_CONTEXT_ALLOW_BUFFER_BYTE_ORDER_MISMATCH_ARB 0x2095
-#endif /* GLX_ARB_vertex_buffer_object */
-
-#ifndef GLX_3DFX_multisample
-#define GLX_3DFX_multisample 1
-#define GLX_SAMPLE_BUFFERS_3DFX 0x8050
-#define GLX_SAMPLES_3DFX 0x8051
-#endif /* GLX_3DFX_multisample */
-
-#ifndef GLX_AMD_gpu_association
-#define GLX_AMD_gpu_association 1
-#define GLX_GPU_VENDOR_AMD 0x1F00
-#define GLX_GPU_RENDERER_STRING_AMD 0x1F01
-#define GLX_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
-#define GLX_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
-#define GLX_GPU_RAM_AMD 0x21A3
-#define GLX_GPU_CLOCK_AMD 0x21A4
-#define GLX_GPU_NUM_PIPES_AMD 0x21A5
-#define GLX_GPU_NUM_SIMD_AMD 0x21A6
-#define GLX_GPU_NUM_RB_AMD 0x21A7
-#define GLX_GPU_NUM_SPI_AMD 0x21A8
-typedef unsigned int ( *PFNGLXGETGPUIDSAMDPROC) (unsigned int maxCount, unsigned int *ids);
-typedef int ( *PFNGLXGETGPUINFOAMDPROC) (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
-typedef unsigned int ( *PFNGLXGETCONTEXTGPUIDAMDPROC) (GLXContext ctx);
-typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTAMDPROC) (unsigned int id, GLXContext share_list);
-typedef GLXContext ( *PFNGLXCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (unsigned int id, GLXContext share_context, const int *attribList);
-typedef Bool ( *PFNGLXDELETEASSOCIATEDCONTEXTAMDPROC) (GLXContext ctx);
-typedef Bool ( *PFNGLXMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (GLXContext ctx);
-typedef GLXContext ( *PFNGLXGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
-typedef void ( *PFNGLXBLITCONTEXTFRAMEBUFFERAMDPROC) (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef GLX_GLXEXT_PROTOTYPES
-unsigned int glXGetGPUIDsAMD (unsigned int maxCount, unsigned int *ids);
-int glXGetGPUInfoAMD (unsigned int id, int property, GLenum dataType, unsigned int size, void *data);
-unsigned int glXGetContextGPUIDAMD (GLXContext ctx);
-GLXContext glXCreateAssociatedContextAMD (unsigned int id, GLXContext share_list);
-GLXContext glXCreateAssociatedContextAttribsAMD (unsigned int id, GLXContext share_context, const int *attribList);
-Bool glXDeleteAssociatedContextAMD (GLXContext ctx);
-Bool glXMakeAssociatedContextCurrentAMD (GLXContext ctx);
-GLXContext glXGetCurrentAssociatedContextAMD (void);
-void glXBlitContextFramebufferAMD (GLXContext dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* GLX_AMD_gpu_association */
-
-#ifndef GLX_EXT_buffer_age
-#define GLX_EXT_buffer_age 1
-#define GLX_BACK_BUFFER_AGE_EXT 0x20F4
-#endif /* GLX_EXT_buffer_age */
-
-#ifndef GLX_EXT_create_context_es2_profile
-#define GLX_EXT_create_context_es2_profile 1
-#define GLX_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-#endif /* GLX_EXT_create_context_es2_profile */
-
-#ifndef GLX_EXT_create_context_es_profile
-#define GLX_EXT_create_context_es_profile 1
-#define GLX_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
-#endif /* GLX_EXT_create_context_es_profile */
-
-#ifndef GLX_EXT_fbconfig_packed_float
-#define GLX_EXT_fbconfig_packed_float 1
-#define GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT 0x20B1
-#define GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT 0x00000008
-#endif /* GLX_EXT_fbconfig_packed_float */
-
-#ifndef GLX_EXT_framebuffer_sRGB
-#define GLX_EXT_framebuffer_sRGB 1
-#define GLX_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20B2
-#endif /* GLX_EXT_framebuffer_sRGB */
-
-#ifndef GLX_EXT_import_context
-#define GLX_EXT_import_context 1
-#define GLX_SHARE_CONTEXT_EXT 0x800A
-#define GLX_VISUAL_ID_EXT 0x800B
-#define GLX_SCREEN_EXT 0x800C
-typedef Display *( *PFNGLXGETCURRENTDISPLAYEXTPROC) (void);
-typedef int ( *PFNGLXQUERYCONTEXTINFOEXTPROC) (Display *dpy, GLXContext context, int attribute, int *value);
-typedef GLXContextID ( *PFNGLXGETCONTEXTIDEXTPROC) (const GLXContext context);
-typedef GLXContext ( *PFNGLXIMPORTCONTEXTEXTPROC) (Display *dpy, GLXContextID contextID);
-typedef void ( *PFNGLXFREECONTEXTEXTPROC) (Display *dpy, GLXContext context);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Display *glXGetCurrentDisplayEXT (void);
-int glXQueryContextInfoEXT (Display *dpy, GLXContext context, int attribute, int *value);
-GLXContextID glXGetContextIDEXT (const GLXContext context);
-GLXContext glXImportContextEXT (Display *dpy, GLXContextID contextID);
-void glXFreeContextEXT (Display *dpy, GLXContext context);
-#endif
-#endif /* GLX_EXT_import_context */
-
-#ifndef GLX_EXT_libglvnd
-#define GLX_EXT_libglvnd 1
-#define GLX_VENDOR_NAMES_EXT 0x20F6
-#endif /* GLX_EXT_libglvnd */
-
-#ifndef GLX_EXT_no_config_context
-#define GLX_EXT_no_config_context 1
-#endif /* GLX_EXT_no_config_context */
-
-#ifndef GLX_EXT_stereo_tree
-#define GLX_EXT_stereo_tree 1
-typedef struct {
- int type;
- unsigned long serial;
- Bool send_event;
- Display *display;
- int extension;
- int evtype;
- GLXDrawable window;
- Bool stereo_tree;
-} GLXStereoNotifyEventEXT;
-#define GLX_STEREO_TREE_EXT 0x20F5
-#define GLX_STEREO_NOTIFY_MASK_EXT 0x00000001
-#define GLX_STEREO_NOTIFY_EXT 0x00000000
-#endif /* GLX_EXT_stereo_tree */
-
-#ifndef GLX_EXT_swap_control
-#define GLX_EXT_swap_control 1
-#define GLX_SWAP_INTERVAL_EXT 0x20F1
-#define GLX_MAX_SWAP_INTERVAL_EXT 0x20F2
-typedef void ( *PFNGLXSWAPINTERVALEXTPROC) (Display *dpy, GLXDrawable drawable, int interval);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXSwapIntervalEXT (Display *dpy, GLXDrawable drawable, int interval);
-#endif
-#endif /* GLX_EXT_swap_control */
-
-#ifndef GLX_EXT_swap_control_tear
-#define GLX_EXT_swap_control_tear 1
-#define GLX_LATE_SWAPS_TEAR_EXT 0x20F3
-#endif /* GLX_EXT_swap_control_tear */
-
-#ifndef GLX_EXT_texture_from_pixmap
-#define GLX_EXT_texture_from_pixmap 1
-#define GLX_TEXTURE_1D_BIT_EXT 0x00000001
-#define GLX_TEXTURE_2D_BIT_EXT 0x00000002
-#define GLX_TEXTURE_RECTANGLE_BIT_EXT 0x00000004
-#define GLX_BIND_TO_TEXTURE_RGB_EXT 0x20D0
-#define GLX_BIND_TO_TEXTURE_RGBA_EXT 0x20D1
-#define GLX_BIND_TO_MIPMAP_TEXTURE_EXT 0x20D2
-#define GLX_BIND_TO_TEXTURE_TARGETS_EXT 0x20D3
-#define GLX_Y_INVERTED_EXT 0x20D4
-#define GLX_TEXTURE_FORMAT_EXT 0x20D5
-#define GLX_TEXTURE_TARGET_EXT 0x20D6
-#define GLX_MIPMAP_TEXTURE_EXT 0x20D7
-#define GLX_TEXTURE_FORMAT_NONE_EXT 0x20D8
-#define GLX_TEXTURE_FORMAT_RGB_EXT 0x20D9
-#define GLX_TEXTURE_FORMAT_RGBA_EXT 0x20DA
-#define GLX_TEXTURE_1D_EXT 0x20DB
-#define GLX_TEXTURE_2D_EXT 0x20DC
-#define GLX_TEXTURE_RECTANGLE_EXT 0x20DD
-#define GLX_FRONT_LEFT_EXT 0x20DE
-#define GLX_FRONT_RIGHT_EXT 0x20DF
-#define GLX_BACK_LEFT_EXT 0x20E0
-#define GLX_BACK_RIGHT_EXT 0x20E1
-#define GLX_FRONT_EXT 0x20DE
-#define GLX_BACK_EXT 0x20E0
-#define GLX_AUX0_EXT 0x20E2
-#define GLX_AUX1_EXT 0x20E3
-#define GLX_AUX2_EXT 0x20E4
-#define GLX_AUX3_EXT 0x20E5
-#define GLX_AUX4_EXT 0x20E6
-#define GLX_AUX5_EXT 0x20E7
-#define GLX_AUX6_EXT 0x20E8
-#define GLX_AUX7_EXT 0x20E9
-#define GLX_AUX8_EXT 0x20EA
-#define GLX_AUX9_EXT 0x20EB
-typedef void ( *PFNGLXBINDTEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
-typedef void ( *PFNGLXRELEASETEXIMAGEEXTPROC) (Display *dpy, GLXDrawable drawable, int buffer);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXBindTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer, const int *attrib_list);
-void glXReleaseTexImageEXT (Display *dpy, GLXDrawable drawable, int buffer);
-#endif
-#endif /* GLX_EXT_texture_from_pixmap */
-
-#ifndef GLX_EXT_visual_info
-#define GLX_EXT_visual_info 1
-#define GLX_X_VISUAL_TYPE_EXT 0x22
-#define GLX_TRANSPARENT_TYPE_EXT 0x23
-#define GLX_TRANSPARENT_INDEX_VALUE_EXT 0x24
-#define GLX_TRANSPARENT_RED_VALUE_EXT 0x25
-#define GLX_TRANSPARENT_GREEN_VALUE_EXT 0x26
-#define GLX_TRANSPARENT_BLUE_VALUE_EXT 0x27
-#define GLX_TRANSPARENT_ALPHA_VALUE_EXT 0x28
-#define GLX_NONE_EXT 0x8000
-#define GLX_TRUE_COLOR_EXT 0x8002
-#define GLX_DIRECT_COLOR_EXT 0x8003
-#define GLX_PSEUDO_COLOR_EXT 0x8004
-#define GLX_STATIC_COLOR_EXT 0x8005
-#define GLX_GRAY_SCALE_EXT 0x8006
-#define GLX_STATIC_GRAY_EXT 0x8007
-#define GLX_TRANSPARENT_RGB_EXT 0x8008
-#define GLX_TRANSPARENT_INDEX_EXT 0x8009
-#endif /* GLX_EXT_visual_info */
-
-#ifndef GLX_EXT_visual_rating
-#define GLX_EXT_visual_rating 1
-#define GLX_VISUAL_CAVEAT_EXT 0x20
-#define GLX_SLOW_VISUAL_EXT 0x8001
-#define GLX_NON_CONFORMANT_VISUAL_EXT 0x800D
-#endif /* GLX_EXT_visual_rating */
-
-#ifndef GLX_INTEL_swap_event
-#define GLX_INTEL_swap_event 1
-#define GLX_BUFFER_SWAP_COMPLETE_INTEL_MASK 0x04000000
-#define GLX_EXCHANGE_COMPLETE_INTEL 0x8180
-#define GLX_COPY_COMPLETE_INTEL 0x8181
-#define GLX_FLIP_COMPLETE_INTEL 0x8182
-#endif /* GLX_INTEL_swap_event */
-
-#ifndef GLX_MESA_agp_offset
-#define GLX_MESA_agp_offset 1
-typedef unsigned int ( *PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);
-#ifdef GLX_GLXEXT_PROTOTYPES
-unsigned int glXGetAGPOffsetMESA (const void *pointer);
-#endif
-#endif /* GLX_MESA_agp_offset */
-
-#ifndef GLX_MESA_copy_sub_buffer
-#define GLX_MESA_copy_sub_buffer 1
-typedef void ( *PFNGLXCOPYSUBBUFFERMESAPROC) (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXCopySubBufferMESA (Display *dpy, GLXDrawable drawable, int x, int y, int width, int height);
-#endif
-#endif /* GLX_MESA_copy_sub_buffer */
-
-#ifndef GLX_MESA_pixmap_colormap
-#define GLX_MESA_pixmap_colormap 1
-typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPMESAPROC) (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXPixmap glXCreateGLXPixmapMESA (Display *dpy, XVisualInfo *visual, Pixmap pixmap, Colormap cmap);
-#endif
-#endif /* GLX_MESA_pixmap_colormap */
-
-#ifndef GLX_MESA_query_renderer
-#define GLX_MESA_query_renderer 1
-#define GLX_RENDERER_VENDOR_ID_MESA 0x8183
-#define GLX_RENDERER_DEVICE_ID_MESA 0x8184
-#define GLX_RENDERER_VERSION_MESA 0x8185
-#define GLX_RENDERER_ACCELERATED_MESA 0x8186
-#define GLX_RENDERER_VIDEO_MEMORY_MESA 0x8187
-#define GLX_RENDERER_UNIFIED_MEMORY_ARCHITECTURE_MESA 0x8188
-#define GLX_RENDERER_PREFERRED_PROFILE_MESA 0x8189
-#define GLX_RENDERER_OPENGL_CORE_PROFILE_VERSION_MESA 0x818A
-#define GLX_RENDERER_OPENGL_COMPATIBILITY_PROFILE_VERSION_MESA 0x818B
-#define GLX_RENDERER_OPENGL_ES_PROFILE_VERSION_MESA 0x818C
-#define GLX_RENDERER_OPENGL_ES2_PROFILE_VERSION_MESA 0x818D
-#define GLX_RENDERER_ID_MESA 0x818E
-typedef Bool ( *PFNGLXQUERYCURRENTRENDERERINTEGERMESAPROC) (int attribute, unsigned int *value);
-typedef const char *( *PFNGLXQUERYCURRENTRENDERERSTRINGMESAPROC) (int attribute);
-typedef Bool ( *PFNGLXQUERYRENDERERINTEGERMESAPROC) (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
-typedef const char *( *PFNGLXQUERYRENDERERSTRINGMESAPROC) (Display *dpy, int screen, int renderer, int attribute);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXQueryCurrentRendererIntegerMESA (int attribute, unsigned int *value);
-const char *glXQueryCurrentRendererStringMESA (int attribute);
-Bool glXQueryRendererIntegerMESA (Display *dpy, int screen, int renderer, int attribute, unsigned int *value);
-const char *glXQueryRendererStringMESA (Display *dpy, int screen, int renderer, int attribute);
-#endif
-#endif /* GLX_MESA_query_renderer */
-
-#ifndef GLX_MESA_release_buffers
-#define GLX_MESA_release_buffers 1
-typedef Bool ( *PFNGLXRELEASEBUFFERSMESAPROC) (Display *dpy, GLXDrawable drawable);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXReleaseBuffersMESA (Display *dpy, GLXDrawable drawable);
-#endif
-#endif /* GLX_MESA_release_buffers */
-
-#ifndef GLX_MESA_set_3dfx_mode
-#define GLX_MESA_set_3dfx_mode 1
-#define GLX_3DFX_WINDOW_MODE_MESA 0x1
-#define GLX_3DFX_FULLSCREEN_MODE_MESA 0x2
-typedef Bool ( *PFNGLXSET3DFXMODEMESAPROC) (int mode);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXSet3DfxModeMESA (int mode);
-#endif
-#endif /* GLX_MESA_set_3dfx_mode */
-
-#ifndef GLX_MESA_swap_control
-#define GLX_MESA_swap_control 1
-typedef int ( *PFNGLXGETSWAPINTERVALMESAPROC) (void);
-typedef int ( *PFNGLXSWAPINTERVALMESAPROC) (unsigned int interval);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXGetSwapIntervalMESA (void);
-int glXSwapIntervalMESA (unsigned int interval);
-#endif
-#endif /* GLX_MESA_swap_control */
-
-#ifndef GLX_NV_copy_buffer
-#define GLX_NV_copy_buffer 1
-typedef void ( *PFNGLXCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void ( *PFNGLXNAMEDCOPYBUFFERSUBDATANVPROC) (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-void glXNamedCopyBufferSubDataNV (Display *dpy, GLXContext readCtx, GLXContext writeCtx, GLuint readBuffer, GLuint writeBuffer, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#endif
-#endif /* GLX_NV_copy_buffer */
-
-#ifndef GLX_NV_copy_image
-#define GLX_NV_copy_image 1
-typedef void ( *PFNGLXCOPYIMAGESUBDATANVPROC) (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXCopyImageSubDataNV (Display *dpy, GLXContext srcCtx, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLXContext dstCtx, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* GLX_NV_copy_image */
-
-#ifndef GLX_NV_delay_before_swap
-#define GLX_NV_delay_before_swap 1
-typedef Bool ( *PFNGLXDELAYBEFORESWAPNVPROC) (Display *dpy, GLXDrawable drawable, GLfloat seconds);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXDelayBeforeSwapNV (Display *dpy, GLXDrawable drawable, GLfloat seconds);
-#endif
-#endif /* GLX_NV_delay_before_swap */
-
-#ifndef GLX_NV_float_buffer
-#define GLX_NV_float_buffer 1
-#define GLX_FLOAT_COMPONENTS_NV 0x20B0
-#endif /* GLX_NV_float_buffer */
-
-#ifndef GLX_NV_multisample_coverage
-#define GLX_NV_multisample_coverage 1
-#define GLX_COVERAGE_SAMPLES_NV 100001
-#define GLX_COLOR_SAMPLES_NV 0x20B3
-#endif /* GLX_NV_multisample_coverage */
-
-#ifndef GLX_NV_present_video
-#define GLX_NV_present_video 1
-#define GLX_NUM_VIDEO_SLOTS_NV 0x20F0
-typedef unsigned int *( *PFNGLXENUMERATEVIDEODEVICESNVPROC) (Display *dpy, int screen, int *nelements);
-typedef int ( *PFNGLXBINDVIDEODEVICENVPROC) (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
-#ifdef GLX_GLXEXT_PROTOTYPES
-unsigned int *glXEnumerateVideoDevicesNV (Display *dpy, int screen, int *nelements);
-int glXBindVideoDeviceNV (Display *dpy, unsigned int video_slot, unsigned int video_device, const int *attrib_list);
-#endif
-#endif /* GLX_NV_present_video */
-
-#ifndef GLX_NV_robustness_video_memory_purge
-#define GLX_NV_robustness_video_memory_purge 1
-#define GLX_GENERATE_RESET_ON_VIDEO_MEMORY_PURGE_NV 0x20F7
-#endif /* GLX_NV_robustness_video_memory_purge */
-
-#ifndef GLX_NV_swap_group
-#define GLX_NV_swap_group 1
-typedef Bool ( *PFNGLXJOINSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint group);
-typedef Bool ( *PFNGLXBINDSWAPBARRIERNVPROC) (Display *dpy, GLuint group, GLuint barrier);
-typedef Bool ( *PFNGLXQUERYSWAPGROUPNVPROC) (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
-typedef Bool ( *PFNGLXQUERYMAXSWAPGROUPSNVPROC) (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
-typedef Bool ( *PFNGLXQUERYFRAMECOUNTNVPROC) (Display *dpy, int screen, GLuint *count);
-typedef Bool ( *PFNGLXRESETFRAMECOUNTNVPROC) (Display *dpy, int screen);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXJoinSwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint group);
-Bool glXBindSwapBarrierNV (Display *dpy, GLuint group, GLuint barrier);
-Bool glXQuerySwapGroupNV (Display *dpy, GLXDrawable drawable, GLuint *group, GLuint *barrier);
-Bool glXQueryMaxSwapGroupsNV (Display *dpy, int screen, GLuint *maxGroups, GLuint *maxBarriers);
-Bool glXQueryFrameCountNV (Display *dpy, int screen, GLuint *count);
-Bool glXResetFrameCountNV (Display *dpy, int screen);
-#endif
-#endif /* GLX_NV_swap_group */
-
-#ifndef GLX_NV_video_capture
-#define GLX_NV_video_capture 1
-typedef XID GLXVideoCaptureDeviceNV;
-#define GLX_DEVICE_ID_NV 0x20CD
-#define GLX_UNIQUE_ID_NV 0x20CE
-#define GLX_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
-typedef int ( *PFNGLXBINDVIDEOCAPTUREDEVICENVPROC) (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
-typedef GLXVideoCaptureDeviceNV *( *PFNGLXENUMERATEVIDEOCAPTUREDEVICESNVPROC) (Display *dpy, int screen, int *nelements);
-typedef void ( *PFNGLXLOCKVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
-typedef int ( *PFNGLXQUERYVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
-typedef void ( *PFNGLXRELEASEVIDEOCAPTUREDEVICENVPROC) (Display *dpy, GLXVideoCaptureDeviceNV device);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXBindVideoCaptureDeviceNV (Display *dpy, unsigned int video_capture_slot, GLXVideoCaptureDeviceNV device);
-GLXVideoCaptureDeviceNV *glXEnumerateVideoCaptureDevicesNV (Display *dpy, int screen, int *nelements);
-void glXLockVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
-int glXQueryVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device, int attribute, int *value);
-void glXReleaseVideoCaptureDeviceNV (Display *dpy, GLXVideoCaptureDeviceNV device);
-#endif
-#endif /* GLX_NV_video_capture */
-
-#ifndef GLX_NV_video_out
-#define GLX_NV_video_out 1
-typedef unsigned int GLXVideoDeviceNV;
-#define GLX_VIDEO_OUT_COLOR_NV 0x20C3
-#define GLX_VIDEO_OUT_ALPHA_NV 0x20C4
-#define GLX_VIDEO_OUT_DEPTH_NV 0x20C5
-#define GLX_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
-#define GLX_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
-#define GLX_VIDEO_OUT_FRAME_NV 0x20C8
-#define GLX_VIDEO_OUT_FIELD_1_NV 0x20C9
-#define GLX_VIDEO_OUT_FIELD_2_NV 0x20CA
-#define GLX_VIDEO_OUT_STACKED_FIELDS_1_2_NV 0x20CB
-#define GLX_VIDEO_OUT_STACKED_FIELDS_2_1_NV 0x20CC
-typedef int ( *PFNGLXGETVIDEODEVICENVPROC) (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
-typedef int ( *PFNGLXRELEASEVIDEODEVICENVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
-typedef int ( *PFNGLXBINDVIDEOIMAGENVPROC) (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
-typedef int ( *PFNGLXRELEASEVIDEOIMAGENVPROC) (Display *dpy, GLXPbuffer pbuf);
-typedef int ( *PFNGLXSENDPBUFFERTOVIDEONVPROC) (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
-typedef int ( *PFNGLXGETVIDEOINFONVPROC) (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXGetVideoDeviceNV (Display *dpy, int screen, int numVideoDevices, GLXVideoDeviceNV *pVideoDevice);
-int glXReleaseVideoDeviceNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice);
-int glXBindVideoImageNV (Display *dpy, GLXVideoDeviceNV VideoDevice, GLXPbuffer pbuf, int iVideoBuffer);
-int glXReleaseVideoImageNV (Display *dpy, GLXPbuffer pbuf);
-int glXSendPbufferToVideoNV (Display *dpy, GLXPbuffer pbuf, int iBufferType, unsigned long *pulCounterPbuffer, GLboolean bBlock);
-int glXGetVideoInfoNV (Display *dpy, int screen, GLXVideoDeviceNV VideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-#endif
-#endif /* GLX_NV_video_out */
-
-#ifndef GLX_OML_swap_method
-#define GLX_OML_swap_method 1
-#define GLX_SWAP_METHOD_OML 0x8060
-#define GLX_SWAP_EXCHANGE_OML 0x8061
-#define GLX_SWAP_COPY_OML 0x8062
-#define GLX_SWAP_UNDEFINED_OML 0x8063
-#endif /* GLX_OML_swap_method */
-
-#ifndef GLX_OML_sync_control
-#define GLX_OML_sync_control 1
-#ifndef GLEXT_64_TYPES_DEFINED
-/* This code block is duplicated in glext.h, so must be protected */
-#define GLEXT_64_TYPES_DEFINED
-/* Define int32_t, int64_t, and uint64_t types for UST/MSC */
-/* (as used in the GLX_OML_sync_control extension). */
-#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#include <inttypes.h>
-#elif defined(__sun__) || defined(__digital__)
-#include <inttypes.h>
-#if defined(__STDC__)
-#if defined(__arch64__) || defined(_LP64)
-typedef long int int64_t;
-typedef unsigned long int uint64_t;
-#else
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#endif /* __arch64__ */
-#endif /* __STDC__ */
-#elif defined( __VMS ) || defined(__sgi)
-#include <inttypes.h>
-#elif defined(__SCO__) || defined(__USLC__)
-#include <stdint.h>
-#elif defined(__UNIXOS2__) || defined(__SOL64__)
-typedef long int int32_t;
-typedef long long int int64_t;
-typedef unsigned long long int uint64_t;
-#elif defined(_WIN32) && defined(__GNUC__)
-#include <stdint.h>
-#elif defined(_WIN32)
-typedef __int32 int32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#else
-/* Fallback if nothing above works */
-#include <inttypes.h>
-#endif
-#endif
-typedef Bool ( *PFNGLXGETSYNCVALUESOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
-typedef Bool ( *PFNGLXGETMSCRATEOMLPROC) (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
-typedef int64_t ( *PFNGLXSWAPBUFFERSMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
-typedef Bool ( *PFNGLXWAITFORMSCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
-typedef Bool ( *PFNGLXWAITFORSBCOMLPROC) (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXGetSyncValuesOML (Display *dpy, GLXDrawable drawable, int64_t *ust, int64_t *msc, int64_t *sbc);
-Bool glXGetMscRateOML (Display *dpy, GLXDrawable drawable, int32_t *numerator, int32_t *denominator);
-int64_t glXSwapBuffersMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder);
-Bool glXWaitForMscOML (Display *dpy, GLXDrawable drawable, int64_t target_msc, int64_t divisor, int64_t remainder, int64_t *ust, int64_t *msc, int64_t *sbc);
-Bool glXWaitForSbcOML (Display *dpy, GLXDrawable drawable, int64_t target_sbc, int64_t *ust, int64_t *msc, int64_t *sbc);
-#endif
-#endif /* GLX_OML_sync_control */
-
-#ifndef GLX_SGIS_blended_overlay
-#define GLX_SGIS_blended_overlay 1
-#define GLX_BLENDED_RGBA_SGIS 0x8025
-#endif /* GLX_SGIS_blended_overlay */
-
-#ifndef GLX_SGIS_multisample
-#define GLX_SGIS_multisample 1
-#define GLX_SAMPLE_BUFFERS_SGIS 100000
-#define GLX_SAMPLES_SGIS 100001
-#endif /* GLX_SGIS_multisample */
-
-#ifndef GLX_SGIS_shared_multisample
-#define GLX_SGIS_shared_multisample 1
-#define GLX_MULTISAMPLE_SUB_RECT_WIDTH_SGIS 0x8026
-#define GLX_MULTISAMPLE_SUB_RECT_HEIGHT_SGIS 0x8027
-#endif /* GLX_SGIS_shared_multisample */
-
-#ifndef GLX_SGIX_dmbuffer
-#define GLX_SGIX_dmbuffer 1
-typedef XID GLXPbufferSGIX;
-#ifdef _DM_BUFFER_H_
-#define GLX_DIGITAL_MEDIA_PBUFFER_SGIX 0x8024
-typedef Bool ( *PFNGLXASSOCIATEDMPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXAssociateDMPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuffer, DMparams *params, DMbuffer dmbuffer);
-#endif
-#endif /* _DM_BUFFER_H_ */
-#endif /* GLX_SGIX_dmbuffer */
-
-#ifndef GLX_SGIX_fbconfig
-#define GLX_SGIX_fbconfig 1
-typedef struct __GLXFBConfigRec *GLXFBConfigSGIX;
-#define GLX_WINDOW_BIT_SGIX 0x00000001
-#define GLX_PIXMAP_BIT_SGIX 0x00000002
-#define GLX_RGBA_BIT_SGIX 0x00000001
-#define GLX_COLOR_INDEX_BIT_SGIX 0x00000002
-#define GLX_DRAWABLE_TYPE_SGIX 0x8010
-#define GLX_RENDER_TYPE_SGIX 0x8011
-#define GLX_X_RENDERABLE_SGIX 0x8012
-#define GLX_FBCONFIG_ID_SGIX 0x8013
-#define GLX_RGBA_TYPE_SGIX 0x8014
-#define GLX_COLOR_INDEX_TYPE_SGIX 0x8015
-typedef int ( *PFNGLXGETFBCONFIGATTRIBSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
-typedef GLXFBConfigSGIX *( *PFNGLXCHOOSEFBCONFIGSGIXPROC) (Display *dpy, int screen, int *attrib_list, int *nelements);
-typedef GLXPixmap ( *PFNGLXCREATEGLXPIXMAPWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
-typedef GLXContext ( *PFNGLXCREATECONTEXTWITHCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
-typedef XVisualInfo *( *PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLXFBConfigSGIX config);
-typedef GLXFBConfigSGIX ( *PFNGLXGETFBCONFIGFROMVISUALSGIXPROC) (Display *dpy, XVisualInfo *vis);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXGetFBConfigAttribSGIX (Display *dpy, GLXFBConfigSGIX config, int attribute, int *value);
-GLXFBConfigSGIX *glXChooseFBConfigSGIX (Display *dpy, int screen, int *attrib_list, int *nelements);
-GLXPixmap glXCreateGLXPixmapWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, Pixmap pixmap);
-GLXContext glXCreateContextWithConfigSGIX (Display *dpy, GLXFBConfigSGIX config, int render_type, GLXContext share_list, Bool direct);
-XVisualInfo *glXGetVisualFromFBConfigSGIX (Display *dpy, GLXFBConfigSGIX config);
-GLXFBConfigSGIX glXGetFBConfigFromVisualSGIX (Display *dpy, XVisualInfo *vis);
-#endif
-#endif /* GLX_SGIX_fbconfig */
-
-#ifndef GLX_SGIX_hyperpipe
-#define GLX_SGIX_hyperpipe 1
-typedef struct {
- char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
- int networkId;
-} GLXHyperpipeNetworkSGIX;
-typedef struct {
- char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
- int channel;
- unsigned int participationType;
- int timeSlice;
-} GLXHyperpipeConfigSGIX;
-typedef struct {
- char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
- int srcXOrigin, srcYOrigin, srcWidth, srcHeight;
- int destXOrigin, destYOrigin, destWidth, destHeight;
-} GLXPipeRect;
-typedef struct {
- char pipeName[80]; /* Should be [GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX] */
- int XOrigin, YOrigin, maxHeight, maxWidth;
-} GLXPipeRectLimits;
-#define GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX 80
-#define GLX_BAD_HYPERPIPE_CONFIG_SGIX 91
-#define GLX_BAD_HYPERPIPE_SGIX 92
-#define GLX_HYPERPIPE_DISPLAY_PIPE_SGIX 0x00000001
-#define GLX_HYPERPIPE_RENDER_PIPE_SGIX 0x00000002
-#define GLX_PIPE_RECT_SGIX 0x00000001
-#define GLX_PIPE_RECT_LIMITS_SGIX 0x00000002
-#define GLX_HYPERPIPE_STEREO_SGIX 0x00000003
-#define GLX_HYPERPIPE_PIXEL_AVERAGE_SGIX 0x00000004
-#define GLX_HYPERPIPE_ID_SGIX 0x8030
-typedef GLXHyperpipeNetworkSGIX *( *PFNGLXQUERYHYPERPIPENETWORKSGIXPROC) (Display *dpy, int *npipes);
-typedef int ( *PFNGLXHYPERPIPECONFIGSGIXPROC) (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
-typedef GLXHyperpipeConfigSGIX *( *PFNGLXQUERYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId, int *npipes);
-typedef int ( *PFNGLXDESTROYHYPERPIPECONFIGSGIXPROC) (Display *dpy, int hpId);
-typedef int ( *PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId);
-typedef int ( *PFNGLXQUERYHYPERPIPEBESTATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
-typedef int ( *PFNGLXHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
-typedef int ( *PFNGLXQUERYHYPERPIPEATTRIBSGIXPROC) (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXHyperpipeNetworkSGIX *glXQueryHyperpipeNetworkSGIX (Display *dpy, int *npipes);
-int glXHyperpipeConfigSGIX (Display *dpy, int networkId, int npipes, GLXHyperpipeConfigSGIX *cfg, int *hpId);
-GLXHyperpipeConfigSGIX *glXQueryHyperpipeConfigSGIX (Display *dpy, int hpId, int *npipes);
-int glXDestroyHyperpipeConfigSGIX (Display *dpy, int hpId);
-int glXBindHyperpipeSGIX (Display *dpy, int hpId);
-int glXQueryHyperpipeBestAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList, void *returnAttribList);
-int glXHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *attribList);
-int glXQueryHyperpipeAttribSGIX (Display *dpy, int timeSlice, int attrib, int size, void *returnAttribList);
-#endif
-#endif /* GLX_SGIX_hyperpipe */
-
-#ifndef GLX_SGIX_pbuffer
-#define GLX_SGIX_pbuffer 1
-#define GLX_PBUFFER_BIT_SGIX 0x00000004
-#define GLX_BUFFER_CLOBBER_MASK_SGIX 0x08000000
-#define GLX_FRONT_LEFT_BUFFER_BIT_SGIX 0x00000001
-#define GLX_FRONT_RIGHT_BUFFER_BIT_SGIX 0x00000002
-#define GLX_BACK_LEFT_BUFFER_BIT_SGIX 0x00000004
-#define GLX_BACK_RIGHT_BUFFER_BIT_SGIX 0x00000008
-#define GLX_AUX_BUFFERS_BIT_SGIX 0x00000010
-#define GLX_DEPTH_BUFFER_BIT_SGIX 0x00000020
-#define GLX_STENCIL_BUFFER_BIT_SGIX 0x00000040
-#define GLX_ACCUM_BUFFER_BIT_SGIX 0x00000080
-#define GLX_SAMPLE_BUFFERS_BIT_SGIX 0x00000100
-#define GLX_MAX_PBUFFER_WIDTH_SGIX 0x8016
-#define GLX_MAX_PBUFFER_HEIGHT_SGIX 0x8017
-#define GLX_MAX_PBUFFER_PIXELS_SGIX 0x8018
-#define GLX_OPTIMAL_PBUFFER_WIDTH_SGIX 0x8019
-#define GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX 0x801A
-#define GLX_PRESERVED_CONTENTS_SGIX 0x801B
-#define GLX_LARGEST_PBUFFER_SGIX 0x801C
-#define GLX_WIDTH_SGIX 0x801D
-#define GLX_HEIGHT_SGIX 0x801E
-#define GLX_EVENT_MASK_SGIX 0x801F
-#define GLX_DAMAGED_SGIX 0x8020
-#define GLX_SAVED_SGIX 0x8021
-#define GLX_WINDOW_SGIX 0x8022
-#define GLX_PBUFFER_SGIX 0x8023
-typedef GLXPbufferSGIX ( *PFNGLXCREATEGLXPBUFFERSGIXPROC) (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
-typedef void ( *PFNGLXDESTROYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf);
-typedef int ( *PFNGLXQUERYGLXPBUFFERSGIXPROC) (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
-typedef void ( *PFNGLXSELECTEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long mask);
-typedef void ( *PFNGLXGETSELECTEDEVENTSGIXPROC) (Display *dpy, GLXDrawable drawable, unsigned long *mask);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXPbufferSGIX glXCreateGLXPbufferSGIX (Display *dpy, GLXFBConfigSGIX config, unsigned int width, unsigned int height, int *attrib_list);
-void glXDestroyGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf);
-int glXQueryGLXPbufferSGIX (Display *dpy, GLXPbufferSGIX pbuf, int attribute, unsigned int *value);
-void glXSelectEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long mask);
-void glXGetSelectedEventSGIX (Display *dpy, GLXDrawable drawable, unsigned long *mask);
-#endif
-#endif /* GLX_SGIX_pbuffer */
-
-#ifndef GLX_SGIX_swap_barrier
-#define GLX_SGIX_swap_barrier 1
-typedef void ( *PFNGLXBINDSWAPBARRIERSGIXPROC) (Display *dpy, GLXDrawable drawable, int barrier);
-typedef Bool ( *PFNGLXQUERYMAXSWAPBARRIERSSGIXPROC) (Display *dpy, int screen, int *max);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXBindSwapBarrierSGIX (Display *dpy, GLXDrawable drawable, int barrier);
-Bool glXQueryMaxSwapBarriersSGIX (Display *dpy, int screen, int *max);
-#endif
-#endif /* GLX_SGIX_swap_barrier */
-
-#ifndef GLX_SGIX_swap_group
-#define GLX_SGIX_swap_group 1
-typedef void ( *PFNGLXJOINSWAPGROUPSGIXPROC) (Display *dpy, GLXDrawable drawable, GLXDrawable member);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXJoinSwapGroupSGIX (Display *dpy, GLXDrawable drawable, GLXDrawable member);
-#endif
-#endif /* GLX_SGIX_swap_group */
-
-#ifndef GLX_SGIX_video_resize
-#define GLX_SGIX_video_resize 1
-#define GLX_SYNC_FRAME_SGIX 0x00000000
-#define GLX_SYNC_SWAP_SGIX 0x00000001
-typedef int ( *PFNGLXBINDCHANNELTOWINDOWSGIXPROC) (Display *display, int screen, int channel, Window window);
-typedef int ( *PFNGLXCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int x, int y, int w, int h);
-typedef int ( *PFNGLXQUERYCHANNELRECTSGIXPROC) (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
-typedef int ( *PFNGLXQUERYCHANNELDELTASSGIXPROC) (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
-typedef int ( *PFNGLXCHANNELRECTSYNCSGIXPROC) (Display *display, int screen, int channel, GLenum synctype);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXBindChannelToWindowSGIX (Display *display, int screen, int channel, Window window);
-int glXChannelRectSGIX (Display *display, int screen, int channel, int x, int y, int w, int h);
-int glXQueryChannelRectSGIX (Display *display, int screen, int channel, int *dx, int *dy, int *dw, int *dh);
-int glXQueryChannelDeltasSGIX (Display *display, int screen, int channel, int *x, int *y, int *w, int *h);
-int glXChannelRectSyncSGIX (Display *display, int screen, int channel, GLenum synctype);
-#endif
-#endif /* GLX_SGIX_video_resize */
-
-#ifndef GLX_SGIX_video_source
-#define GLX_SGIX_video_source 1
-typedef XID GLXVideoSourceSGIX;
-#ifdef _VL_H
-typedef GLXVideoSourceSGIX ( *PFNGLXCREATEGLXVIDEOSOURCESGIXPROC) (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
-typedef void ( *PFNGLXDESTROYGLXVIDEOSOURCESGIXPROC) (Display *dpy, GLXVideoSourceSGIX glxvideosource);
-#ifdef GLX_GLXEXT_PROTOTYPES
-GLXVideoSourceSGIX glXCreateGLXVideoSourceSGIX (Display *display, int screen, VLServer server, VLPath path, int nodeClass, VLNode drainNode);
-void glXDestroyGLXVideoSourceSGIX (Display *dpy, GLXVideoSourceSGIX glxvideosource);
-#endif
-#endif /* _VL_H */
-#endif /* GLX_SGIX_video_source */
-
-#ifndef GLX_SGIX_visual_select_group
-#define GLX_SGIX_visual_select_group 1
-#define GLX_VISUAL_SELECT_GROUP_SGIX 0x8028
-#endif /* GLX_SGIX_visual_select_group */
-
-#ifndef GLX_SGI_cushion
-#define GLX_SGI_cushion 1
-typedef void ( *PFNGLXCUSHIONSGIPROC) (Display *dpy, Window window, float cushion);
-#ifdef GLX_GLXEXT_PROTOTYPES
-void glXCushionSGI (Display *dpy, Window window, float cushion);
-#endif
-#endif /* GLX_SGI_cushion */
-
-#ifndef GLX_SGI_make_current_read
-#define GLX_SGI_make_current_read 1
-typedef Bool ( *PFNGLXMAKECURRENTREADSGIPROC) (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-typedef GLXDrawable ( *PFNGLXGETCURRENTREADDRAWABLESGIPROC) (void);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Bool glXMakeCurrentReadSGI (Display *dpy, GLXDrawable draw, GLXDrawable read, GLXContext ctx);
-GLXDrawable glXGetCurrentReadDrawableSGI (void);
-#endif
-#endif /* GLX_SGI_make_current_read */
-
-#ifndef GLX_SGI_swap_control
-#define GLX_SGI_swap_control 1
-typedef int ( *PFNGLXSWAPINTERVALSGIPROC) (int interval);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXSwapIntervalSGI (int interval);
-#endif
-#endif /* GLX_SGI_swap_control */
-
-#ifndef GLX_SGI_video_sync
-#define GLX_SGI_video_sync 1
-typedef int ( *PFNGLXGETVIDEOSYNCSGIPROC) (unsigned int *count);
-typedef int ( *PFNGLXWAITVIDEOSYNCSGIPROC) (int divisor, int remainder, unsigned int *count);
-#ifdef GLX_GLXEXT_PROTOTYPES
-int glXGetVideoSyncSGI (unsigned int *count);
-int glXWaitVideoSyncSGI (int divisor, int remainder, unsigned int *count);
-#endif
-#endif /* GLX_SGI_video_sync */
-
-#ifndef GLX_SUN_get_transparent_index
-#define GLX_SUN_get_transparent_index 1
-typedef Status ( *PFNGLXGETTRANSPARENTINDEXSUNPROC) (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
-#ifdef GLX_GLXEXT_PROTOTYPES
-Status glXGetTransparentIndexSUN (Display *dpy, Window overlay, Window underlay, long *pTransparentIndex);
-#endif
-#endif /* GLX_SUN_get_transparent_index */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GL/wglext.h b/include/GL/wglext.h
deleted file mode 100644
index 2d528f77a..000000000
--- a/include/GL/wglext.h
+++ /dev/null
@@ -1,850 +0,0 @@
-#ifndef __wgl_wglext_h_
-#define __wgl_wglext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
-#define WIN32_LEAN_AND_MEAN 1
-#include <windows.h>
-#endif
-
-#define WGL_WGLEXT_VERSION 20180525
-
-/* Generated C header for:
- * API: wgl
- * Versions considered: .*
- * Versions emitted: _nomatch_^
- * Default extensions included: wgl
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef WGL_ARB_buffer_region
-#define WGL_ARB_buffer_region 1
-#define WGL_FRONT_COLOR_BUFFER_BIT_ARB 0x00000001
-#define WGL_BACK_COLOR_BUFFER_BIT_ARB 0x00000002
-#define WGL_DEPTH_BUFFER_BIT_ARB 0x00000004
-#define WGL_STENCIL_BUFFER_BIT_ARB 0x00000008
-typedef HANDLE (WINAPI * PFNWGLCREATEBUFFERREGIONARBPROC) (HDC hDC, int iLayerPlane, UINT uType);
-typedef VOID (WINAPI * PFNWGLDELETEBUFFERREGIONARBPROC) (HANDLE hRegion);
-typedef BOOL (WINAPI * PFNWGLSAVEBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height);
-typedef BOOL (WINAPI * PFNWGLRESTOREBUFFERREGIONARBPROC) (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
-#ifdef WGL_WGLEXT_PROTOTYPES
-HANDLE WINAPI wglCreateBufferRegionARB (HDC hDC, int iLayerPlane, UINT uType);
-VOID WINAPI wglDeleteBufferRegionARB (HANDLE hRegion);
-BOOL WINAPI wglSaveBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height);
-BOOL WINAPI wglRestoreBufferRegionARB (HANDLE hRegion, int x, int y, int width, int height, int xSrc, int ySrc);
-#endif
-#endif /* WGL_ARB_buffer_region */
-
-#ifndef WGL_ARB_context_flush_control
-#define WGL_ARB_context_flush_control 1
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_ARB 0x2097
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_NONE_ARB 0
-#define WGL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_ARB 0x2098
-#endif /* WGL_ARB_context_flush_control */
-
-#ifndef WGL_ARB_create_context
-#define WGL_ARB_create_context 1
-#define WGL_CONTEXT_DEBUG_BIT_ARB 0x00000001
-#define WGL_CONTEXT_FORWARD_COMPATIBLE_BIT_ARB 0x00000002
-#define WGL_CONTEXT_MAJOR_VERSION_ARB 0x2091
-#define WGL_CONTEXT_MINOR_VERSION_ARB 0x2092
-#define WGL_CONTEXT_LAYER_PLANE_ARB 0x2093
-#define WGL_CONTEXT_FLAGS_ARB 0x2094
-#define ERROR_INVALID_VERSION_ARB 0x2095
-typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShareContext, const int *attribList);
-#ifdef WGL_WGLEXT_PROTOTYPES
-HGLRC WINAPI wglCreateContextAttribsARB (HDC hDC, HGLRC hShareContext, const int *attribList);
-#endif
-#endif /* WGL_ARB_create_context */
-
-#ifndef WGL_ARB_create_context_no_error
-#define WGL_ARB_create_context_no_error 1
-#define WGL_CONTEXT_OPENGL_NO_ERROR_ARB 0x31B3
-#endif /* WGL_ARB_create_context_no_error */
-
-#ifndef WGL_ARB_create_context_profile
-#define WGL_ARB_create_context_profile 1
-#define WGL_CONTEXT_PROFILE_MASK_ARB 0x9126
-#define WGL_CONTEXT_CORE_PROFILE_BIT_ARB 0x00000001
-#define WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB 0x00000002
-#define ERROR_INVALID_PROFILE_ARB 0x2096
-#endif /* WGL_ARB_create_context_profile */
-
-#ifndef WGL_ARB_create_context_robustness
-#define WGL_ARB_create_context_robustness 1
-#define WGL_CONTEXT_ROBUST_ACCESS_BIT_ARB 0x00000004
-#define WGL_LOSE_CONTEXT_ON_RESET_ARB 0x8252
-#define WGL_CONTEXT_RESET_NOTIFICATION_STRATEGY_ARB 0x8256
-#define WGL_NO_RESET_NOTIFICATION_ARB 0x8261
-#endif /* WGL_ARB_create_context_robustness */
-
-#ifndef WGL_ARB_extensions_string
-#define WGL_ARB_extensions_string 1
-typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGARBPROC) (HDC hdc);
-#ifdef WGL_WGLEXT_PROTOTYPES
-const char *WINAPI wglGetExtensionsStringARB (HDC hdc);
-#endif
-#endif /* WGL_ARB_extensions_string */
-
-#ifndef WGL_ARB_framebuffer_sRGB
-#define WGL_ARB_framebuffer_sRGB 1
-#define WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB 0x20A9
-#endif /* WGL_ARB_framebuffer_sRGB */
-
-#ifndef WGL_ARB_make_current_read
-#define WGL_ARB_make_current_read 1
-#define ERROR_INVALID_PIXEL_TYPE_ARB 0x2043
-#define ERROR_INCOMPATIBLE_DEVICE_CONTEXTS_ARB 0x2054
-typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTARBPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCARBPROC) (void);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglMakeContextCurrentARB (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-HDC WINAPI wglGetCurrentReadDCARB (void);
-#endif
-#endif /* WGL_ARB_make_current_read */
-
-#ifndef WGL_ARB_multisample
-#define WGL_ARB_multisample 1
-#define WGL_SAMPLE_BUFFERS_ARB 0x2041
-#define WGL_SAMPLES_ARB 0x2042
-#endif /* WGL_ARB_multisample */
-
-#ifndef WGL_ARB_pbuffer
-#define WGL_ARB_pbuffer 1
-DECLARE_HANDLE(HPBUFFERARB);
-#define WGL_DRAW_TO_PBUFFER_ARB 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_ARB 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_ARB 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_ARB 0x2030
-#define WGL_PBUFFER_LARGEST_ARB 0x2033
-#define WGL_PBUFFER_WIDTH_ARB 0x2034
-#define WGL_PBUFFER_HEIGHT_ARB 0x2035
-#define WGL_PBUFFER_LOST_ARB 0x2036
-typedef HPBUFFERARB (WINAPI * PFNWGLCREATEPBUFFERARBPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
-typedef HDC (WINAPI * PFNWGLGETPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer);
-typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCARBPROC) (HPBUFFERARB hPbuffer, HDC hDC);
-typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFERARBPROC) (HPBUFFERARB hPbuffer);
-typedef BOOL (WINAPI * PFNWGLQUERYPBUFFERARBPROC) (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
-#ifdef WGL_WGLEXT_PROTOTYPES
-HPBUFFERARB WINAPI wglCreatePbufferARB (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
-HDC WINAPI wglGetPbufferDCARB (HPBUFFERARB hPbuffer);
-int WINAPI wglReleasePbufferDCARB (HPBUFFERARB hPbuffer, HDC hDC);
-BOOL WINAPI wglDestroyPbufferARB (HPBUFFERARB hPbuffer);
-BOOL WINAPI wglQueryPbufferARB (HPBUFFERARB hPbuffer, int iAttribute, int *piValue);
-#endif
-#endif /* WGL_ARB_pbuffer */
-
-#ifndef WGL_ARB_pixel_format
-#define WGL_ARB_pixel_format 1
-#define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000
-#define WGL_DRAW_TO_WINDOW_ARB 0x2001
-#define WGL_DRAW_TO_BITMAP_ARB 0x2002
-#define WGL_ACCELERATION_ARB 0x2003
-#define WGL_NEED_PALETTE_ARB 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_ARB 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_ARB 0x2006
-#define WGL_SWAP_METHOD_ARB 0x2007
-#define WGL_NUMBER_OVERLAYS_ARB 0x2008
-#define WGL_NUMBER_UNDERLAYS_ARB 0x2009
-#define WGL_TRANSPARENT_ARB 0x200A
-#define WGL_TRANSPARENT_RED_VALUE_ARB 0x2037
-#define WGL_TRANSPARENT_GREEN_VALUE_ARB 0x2038
-#define WGL_TRANSPARENT_BLUE_VALUE_ARB 0x2039
-#define WGL_TRANSPARENT_ALPHA_VALUE_ARB 0x203A
-#define WGL_TRANSPARENT_INDEX_VALUE_ARB 0x203B
-#define WGL_SHARE_DEPTH_ARB 0x200C
-#define WGL_SHARE_STENCIL_ARB 0x200D
-#define WGL_SHARE_ACCUM_ARB 0x200E
-#define WGL_SUPPORT_GDI_ARB 0x200F
-#define WGL_SUPPORT_OPENGL_ARB 0x2010
-#define WGL_DOUBLE_BUFFER_ARB 0x2011
-#define WGL_STEREO_ARB 0x2012
-#define WGL_PIXEL_TYPE_ARB 0x2013
-#define WGL_COLOR_BITS_ARB 0x2014
-#define WGL_RED_BITS_ARB 0x2015
-#define WGL_RED_SHIFT_ARB 0x2016
-#define WGL_GREEN_BITS_ARB 0x2017
-#define WGL_GREEN_SHIFT_ARB 0x2018
-#define WGL_BLUE_BITS_ARB 0x2019
-#define WGL_BLUE_SHIFT_ARB 0x201A
-#define WGL_ALPHA_BITS_ARB 0x201B
-#define WGL_ALPHA_SHIFT_ARB 0x201C
-#define WGL_ACCUM_BITS_ARB 0x201D
-#define WGL_ACCUM_RED_BITS_ARB 0x201E
-#define WGL_ACCUM_GREEN_BITS_ARB 0x201F
-#define WGL_ACCUM_BLUE_BITS_ARB 0x2020
-#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021
-#define WGL_DEPTH_BITS_ARB 0x2022
-#define WGL_STENCIL_BITS_ARB 0x2023
-#define WGL_AUX_BUFFERS_ARB 0x2024
-#define WGL_NO_ACCELERATION_ARB 0x2025
-#define WGL_GENERIC_ACCELERATION_ARB 0x2026
-#define WGL_FULL_ACCELERATION_ARB 0x2027
-#define WGL_SWAP_EXCHANGE_ARB 0x2028
-#define WGL_SWAP_COPY_ARB 0x2029
-#define WGL_SWAP_UNDEFINED_ARB 0x202A
-#define WGL_TYPE_RGBA_ARB 0x202B
-#define WGL_TYPE_COLORINDEX_ARB 0x202C
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVARBPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
-typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATARBPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetPixelFormatAttribivARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, int *piValues);
-BOOL WINAPI wglGetPixelFormatAttribfvARB (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, const int *piAttributes, FLOAT *pfValues);
-BOOL WINAPI wglChoosePixelFormatARB (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-#endif
-#endif /* WGL_ARB_pixel_format */
-
-#ifndef WGL_ARB_pixel_format_float
-#define WGL_ARB_pixel_format_float 1
-#define WGL_TYPE_RGBA_FLOAT_ARB 0x21A0
-#endif /* WGL_ARB_pixel_format_float */
-
-#ifndef WGL_ARB_render_texture
-#define WGL_ARB_render_texture 1
-#define WGL_BIND_TO_TEXTURE_RGB_ARB 0x2070
-#define WGL_BIND_TO_TEXTURE_RGBA_ARB 0x2071
-#define WGL_TEXTURE_FORMAT_ARB 0x2072
-#define WGL_TEXTURE_TARGET_ARB 0x2073
-#define WGL_MIPMAP_TEXTURE_ARB 0x2074
-#define WGL_TEXTURE_RGB_ARB 0x2075
-#define WGL_TEXTURE_RGBA_ARB 0x2076
-#define WGL_NO_TEXTURE_ARB 0x2077
-#define WGL_TEXTURE_CUBE_MAP_ARB 0x2078
-#define WGL_TEXTURE_1D_ARB 0x2079
-#define WGL_TEXTURE_2D_ARB 0x207A
-#define WGL_MIPMAP_LEVEL_ARB 0x207B
-#define WGL_CUBE_MAP_FACE_ARB 0x207C
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_X_ARB 0x207D
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_X_ARB 0x207E
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Y_ARB 0x207F
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Y_ARB 0x2080
-#define WGL_TEXTURE_CUBE_MAP_POSITIVE_Z_ARB 0x2081
-#define WGL_TEXTURE_CUBE_MAP_NEGATIVE_Z_ARB 0x2082
-#define WGL_FRONT_LEFT_ARB 0x2083
-#define WGL_FRONT_RIGHT_ARB 0x2084
-#define WGL_BACK_LEFT_ARB 0x2085
-#define WGL_BACK_RIGHT_ARB 0x2086
-#define WGL_AUX0_ARB 0x2087
-#define WGL_AUX1_ARB 0x2088
-#define WGL_AUX2_ARB 0x2089
-#define WGL_AUX3_ARB 0x208A
-#define WGL_AUX4_ARB 0x208B
-#define WGL_AUX5_ARB 0x208C
-#define WGL_AUX6_ARB 0x208D
-#define WGL_AUX7_ARB 0x208E
-#define WGL_AUX8_ARB 0x208F
-#define WGL_AUX9_ARB 0x2090
-typedef BOOL (WINAPI * PFNWGLBINDTEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (WINAPI * PFNWGLRELEASETEXIMAGEARBPROC) (HPBUFFERARB hPbuffer, int iBuffer);
-typedef BOOL (WINAPI * PFNWGLSETPBUFFERATTRIBARBPROC) (HPBUFFERARB hPbuffer, const int *piAttribList);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglBindTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
-BOOL WINAPI wglReleaseTexImageARB (HPBUFFERARB hPbuffer, int iBuffer);
-BOOL WINAPI wglSetPbufferAttribARB (HPBUFFERARB hPbuffer, const int *piAttribList);
-#endif
-#endif /* WGL_ARB_render_texture */
-
-#ifndef WGL_ARB_robustness_application_isolation
-#define WGL_ARB_robustness_application_isolation 1
-#define WGL_CONTEXT_RESET_ISOLATION_BIT_ARB 0x00000008
-#endif /* WGL_ARB_robustness_application_isolation */
-
-#ifndef WGL_ARB_robustness_share_group_isolation
-#define WGL_ARB_robustness_share_group_isolation 1
-#endif /* WGL_ARB_robustness_share_group_isolation */
-
-#ifndef WGL_3DFX_multisample
-#define WGL_3DFX_multisample 1
-#define WGL_SAMPLE_BUFFERS_3DFX 0x2060
-#define WGL_SAMPLES_3DFX 0x2061
-#endif /* WGL_3DFX_multisample */
-
-#ifndef WGL_3DL_stereo_control
-#define WGL_3DL_stereo_control 1
-#define WGL_STEREO_EMITTER_ENABLE_3DL 0x2055
-#define WGL_STEREO_EMITTER_DISABLE_3DL 0x2056
-#define WGL_STEREO_POLARITY_NORMAL_3DL 0x2057
-#define WGL_STEREO_POLARITY_INVERT_3DL 0x2058
-typedef BOOL (WINAPI * PFNWGLSETSTEREOEMITTERSTATE3DLPROC) (HDC hDC, UINT uState);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglSetStereoEmitterState3DL (HDC hDC, UINT uState);
-#endif
-#endif /* WGL_3DL_stereo_control */
-
-#ifndef WGL_AMD_gpu_association
-#define WGL_AMD_gpu_association 1
-#define WGL_GPU_VENDOR_AMD 0x1F00
-#define WGL_GPU_RENDERER_STRING_AMD 0x1F01
-#define WGL_GPU_OPENGL_VERSION_STRING_AMD 0x1F02
-#define WGL_GPU_FASTEST_TARGET_GPUS_AMD 0x21A2
-#define WGL_GPU_RAM_AMD 0x21A3
-#define WGL_GPU_CLOCK_AMD 0x21A4
-#define WGL_GPU_NUM_PIPES_AMD 0x21A5
-#define WGL_GPU_NUM_SIMD_AMD 0x21A6
-#define WGL_GPU_NUM_RB_AMD 0x21A7
-#define WGL_GPU_NUM_SPI_AMD 0x21A8
-typedef UINT (WINAPI * PFNWGLGETGPUIDSAMDPROC) (UINT maxCount, UINT *ids);
-typedef INT (WINAPI * PFNWGLGETGPUINFOAMDPROC) (UINT id, int property, GLenum dataType, UINT size, void *data);
-typedef UINT (WINAPI * PFNWGLGETCONTEXTGPUIDAMDPROC) (HGLRC hglrc);
-typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTAMDPROC) (UINT id);
-typedef HGLRC (WINAPI * PFNWGLCREATEASSOCIATEDCONTEXTATTRIBSAMDPROC) (UINT id, HGLRC hShareContext, const int *attribList);
-typedef BOOL (WINAPI * PFNWGLDELETEASSOCIATEDCONTEXTAMDPROC) (HGLRC hglrc);
-typedef BOOL (WINAPI * PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC) (HGLRC hglrc);
-typedef HGLRC (WINAPI * PFNWGLGETCURRENTASSOCIATEDCONTEXTAMDPROC) (void);
-typedef VOID (WINAPI * PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC) (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef WGL_WGLEXT_PROTOTYPES
-UINT WINAPI wglGetGPUIDsAMD (UINT maxCount, UINT *ids);
-INT WINAPI wglGetGPUInfoAMD (UINT id, int property, GLenum dataType, UINT size, void *data);
-UINT WINAPI wglGetContextGPUIDAMD (HGLRC hglrc);
-HGLRC WINAPI wglCreateAssociatedContextAMD (UINT id);
-HGLRC WINAPI wglCreateAssociatedContextAttribsAMD (UINT id, HGLRC hShareContext, const int *attribList);
-BOOL WINAPI wglDeleteAssociatedContextAMD (HGLRC hglrc);
-BOOL WINAPI wglMakeAssociatedContextCurrentAMD (HGLRC hglrc);
-HGLRC WINAPI wglGetCurrentAssociatedContextAMD (void);
-VOID WINAPI wglBlitContextFramebufferAMD (HGLRC dstCtx, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* WGL_AMD_gpu_association */
-
-#ifndef WGL_ATI_pixel_format_float
-#define WGL_ATI_pixel_format_float 1
-#define WGL_TYPE_RGBA_FLOAT_ATI 0x21A0
-#endif /* WGL_ATI_pixel_format_float */
-
-#ifndef WGL_EXT_colorspace
-#define WGL_EXT_colorspace 1
-#define WGL_COLORSPACE_EXT 0x3087
-#define WGL_COLORSPACE_SRGB_EXT 0x3089
-#define WGL_COLORSPACE_LINEAR_EXT 0x308A
-#endif /* WGL_EXT_colorspace */
-
-#ifndef WGL_EXT_create_context_es2_profile
-#define WGL_EXT_create_context_es2_profile 1
-#define WGL_CONTEXT_ES2_PROFILE_BIT_EXT 0x00000004
-#endif /* WGL_EXT_create_context_es2_profile */
-
-#ifndef WGL_EXT_create_context_es_profile
-#define WGL_EXT_create_context_es_profile 1
-#define WGL_CONTEXT_ES_PROFILE_BIT_EXT 0x00000004
-#endif /* WGL_EXT_create_context_es_profile */
-
-#ifndef WGL_EXT_depth_float
-#define WGL_EXT_depth_float 1
-#define WGL_DEPTH_FLOAT_EXT 0x2040
-#endif /* WGL_EXT_depth_float */
-
-#ifndef WGL_EXT_display_color_table
-#define WGL_EXT_display_color_table 1
-typedef GLboolean (WINAPI * PFNWGLCREATEDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-typedef GLboolean (WINAPI * PFNWGLLOADDISPLAYCOLORTABLEEXTPROC) (const GLushort *table, GLuint length);
-typedef GLboolean (WINAPI * PFNWGLBINDDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-typedef VOID (WINAPI * PFNWGLDESTROYDISPLAYCOLORTABLEEXTPROC) (GLushort id);
-#ifdef WGL_WGLEXT_PROTOTYPES
-GLboolean WINAPI wglCreateDisplayColorTableEXT (GLushort id);
-GLboolean WINAPI wglLoadDisplayColorTableEXT (const GLushort *table, GLuint length);
-GLboolean WINAPI wglBindDisplayColorTableEXT (GLushort id);
-VOID WINAPI wglDestroyDisplayColorTableEXT (GLushort id);
-#endif
-#endif /* WGL_EXT_display_color_table */
-
-#ifndef WGL_EXT_extensions_string
-#define WGL_EXT_extensions_string 1
-typedef const char *(WINAPI * PFNWGLGETEXTENSIONSSTRINGEXTPROC) (void);
-#ifdef WGL_WGLEXT_PROTOTYPES
-const char *WINAPI wglGetExtensionsStringEXT (void);
-#endif
-#endif /* WGL_EXT_extensions_string */
-
-#ifndef WGL_EXT_framebuffer_sRGB
-#define WGL_EXT_framebuffer_sRGB 1
-#define WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x20A9
-#endif /* WGL_EXT_framebuffer_sRGB */
-
-#ifndef WGL_EXT_make_current_read
-#define WGL_EXT_make_current_read 1
-#define ERROR_INVALID_PIXEL_TYPE_EXT 0x2043
-typedef BOOL (WINAPI * PFNWGLMAKECONTEXTCURRENTEXTPROC) (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-typedef HDC (WINAPI * PFNWGLGETCURRENTREADDCEXTPROC) (void);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglMakeContextCurrentEXT (HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
-HDC WINAPI wglGetCurrentReadDCEXT (void);
-#endif
-#endif /* WGL_EXT_make_current_read */
-
-#ifndef WGL_EXT_multisample
-#define WGL_EXT_multisample 1
-#define WGL_SAMPLE_BUFFERS_EXT 0x2041
-#define WGL_SAMPLES_EXT 0x2042
-#endif /* WGL_EXT_multisample */
-
-#ifndef WGL_EXT_pbuffer
-#define WGL_EXT_pbuffer 1
-DECLARE_HANDLE(HPBUFFEREXT);
-#define WGL_DRAW_TO_PBUFFER_EXT 0x202D
-#define WGL_MAX_PBUFFER_PIXELS_EXT 0x202E
-#define WGL_MAX_PBUFFER_WIDTH_EXT 0x202F
-#define WGL_MAX_PBUFFER_HEIGHT_EXT 0x2030
-#define WGL_OPTIMAL_PBUFFER_WIDTH_EXT 0x2031
-#define WGL_OPTIMAL_PBUFFER_HEIGHT_EXT 0x2032
-#define WGL_PBUFFER_LARGEST_EXT 0x2033
-#define WGL_PBUFFER_WIDTH_EXT 0x2034
-#define WGL_PBUFFER_HEIGHT_EXT 0x2035
-typedef HPBUFFEREXT (WINAPI * PFNWGLCREATEPBUFFEREXTPROC) (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
-typedef HDC (WINAPI * PFNWGLGETPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer);
-typedef int (WINAPI * PFNWGLRELEASEPBUFFERDCEXTPROC) (HPBUFFEREXT hPbuffer, HDC hDC);
-typedef BOOL (WINAPI * PFNWGLDESTROYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer);
-typedef BOOL (WINAPI * PFNWGLQUERYPBUFFEREXTPROC) (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
-#ifdef WGL_WGLEXT_PROTOTYPES
-HPBUFFEREXT WINAPI wglCreatePbufferEXT (HDC hDC, int iPixelFormat, int iWidth, int iHeight, const int *piAttribList);
-HDC WINAPI wglGetPbufferDCEXT (HPBUFFEREXT hPbuffer);
-int WINAPI wglReleasePbufferDCEXT (HPBUFFEREXT hPbuffer, HDC hDC);
-BOOL WINAPI wglDestroyPbufferEXT (HPBUFFEREXT hPbuffer);
-BOOL WINAPI wglQueryPbufferEXT (HPBUFFEREXT hPbuffer, int iAttribute, int *piValue);
-#endif
-#endif /* WGL_EXT_pbuffer */
-
-#ifndef WGL_EXT_pixel_format
-#define WGL_EXT_pixel_format 1
-#define WGL_NUMBER_PIXEL_FORMATS_EXT 0x2000
-#define WGL_DRAW_TO_WINDOW_EXT 0x2001
-#define WGL_DRAW_TO_BITMAP_EXT 0x2002
-#define WGL_ACCELERATION_EXT 0x2003
-#define WGL_NEED_PALETTE_EXT 0x2004
-#define WGL_NEED_SYSTEM_PALETTE_EXT 0x2005
-#define WGL_SWAP_LAYER_BUFFERS_EXT 0x2006
-#define WGL_SWAP_METHOD_EXT 0x2007
-#define WGL_NUMBER_OVERLAYS_EXT 0x2008
-#define WGL_NUMBER_UNDERLAYS_EXT 0x2009
-#define WGL_TRANSPARENT_EXT 0x200A
-#define WGL_TRANSPARENT_VALUE_EXT 0x200B
-#define WGL_SHARE_DEPTH_EXT 0x200C
-#define WGL_SHARE_STENCIL_EXT 0x200D
-#define WGL_SHARE_ACCUM_EXT 0x200E
-#define WGL_SUPPORT_GDI_EXT 0x200F
-#define WGL_SUPPORT_OPENGL_EXT 0x2010
-#define WGL_DOUBLE_BUFFER_EXT 0x2011
-#define WGL_STEREO_EXT 0x2012
-#define WGL_PIXEL_TYPE_EXT 0x2013
-#define WGL_COLOR_BITS_EXT 0x2014
-#define WGL_RED_BITS_EXT 0x2015
-#define WGL_RED_SHIFT_EXT 0x2016
-#define WGL_GREEN_BITS_EXT 0x2017
-#define WGL_GREEN_SHIFT_EXT 0x2018
-#define WGL_BLUE_BITS_EXT 0x2019
-#define WGL_BLUE_SHIFT_EXT 0x201A
-#define WGL_ALPHA_BITS_EXT 0x201B
-#define WGL_ALPHA_SHIFT_EXT 0x201C
-#define WGL_ACCUM_BITS_EXT 0x201D
-#define WGL_ACCUM_RED_BITS_EXT 0x201E
-#define WGL_ACCUM_GREEN_BITS_EXT 0x201F
-#define WGL_ACCUM_BLUE_BITS_EXT 0x2020
-#define WGL_ACCUM_ALPHA_BITS_EXT 0x2021
-#define WGL_DEPTH_BITS_EXT 0x2022
-#define WGL_STENCIL_BITS_EXT 0x2023
-#define WGL_AUX_BUFFERS_EXT 0x2024
-#define WGL_NO_ACCELERATION_EXT 0x2025
-#define WGL_GENERIC_ACCELERATION_EXT 0x2026
-#define WGL_FULL_ACCELERATION_EXT 0x2027
-#define WGL_SWAP_EXCHANGE_EXT 0x2028
-#define WGL_SWAP_COPY_EXT 0x2029
-#define WGL_SWAP_UNDEFINED_EXT 0x202A
-#define WGL_TYPE_RGBA_EXT 0x202B
-#define WGL_TYPE_COLORINDEX_EXT 0x202C
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBIVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
-typedef BOOL (WINAPI * PFNWGLGETPIXELFORMATATTRIBFVEXTPROC) (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
-typedef BOOL (WINAPI * PFNWGLCHOOSEPIXELFORMATEXTPROC) (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetPixelFormatAttribivEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, int *piValues);
-BOOL WINAPI wglGetPixelFormatAttribfvEXT (HDC hdc, int iPixelFormat, int iLayerPlane, UINT nAttributes, int *piAttributes, FLOAT *pfValues);
-BOOL WINAPI wglChoosePixelFormatEXT (HDC hdc, const int *piAttribIList, const FLOAT *pfAttribFList, UINT nMaxFormats, int *piFormats, UINT *nNumFormats);
-#endif
-#endif /* WGL_EXT_pixel_format */
-
-#ifndef WGL_EXT_pixel_format_packed_float
-#define WGL_EXT_pixel_format_packed_float 1
-#define WGL_TYPE_RGBA_UNSIGNED_FLOAT_EXT 0x20A8
-#endif /* WGL_EXT_pixel_format_packed_float */
-
-#ifndef WGL_EXT_swap_control
-#define WGL_EXT_swap_control 1
-typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
-typedef int (WINAPI * PFNWGLGETSWAPINTERVALEXTPROC) (void);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglSwapIntervalEXT (int interval);
-int WINAPI wglGetSwapIntervalEXT (void);
-#endif
-#endif /* WGL_EXT_swap_control */
-
-#ifndef WGL_EXT_swap_control_tear
-#define WGL_EXT_swap_control_tear 1
-#endif /* WGL_EXT_swap_control_tear */
-
-#ifndef WGL_I3D_digital_video_control
-#define WGL_I3D_digital_video_control 1
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_FRAMEBUFFER_I3D 0x2050
-#define WGL_DIGITAL_VIDEO_CURSOR_ALPHA_VALUE_I3D 0x2051
-#define WGL_DIGITAL_VIDEO_CURSOR_INCLUDED_I3D 0x2052
-#define WGL_DIGITAL_VIDEO_GAMMA_CORRECTED_I3D 0x2053
-typedef BOOL (WINAPI * PFNWGLGETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
-typedef BOOL (WINAPI * PFNWGLSETDIGITALVIDEOPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetDigitalVideoParametersI3D (HDC hDC, int iAttribute, int *piValue);
-BOOL WINAPI wglSetDigitalVideoParametersI3D (HDC hDC, int iAttribute, const int *piValue);
-#endif
-#endif /* WGL_I3D_digital_video_control */
-
-#ifndef WGL_I3D_gamma
-#define WGL_I3D_gamma 1
-#define WGL_GAMMA_TABLE_SIZE_I3D 0x204E
-#define WGL_GAMMA_EXCLUDE_DESKTOP_I3D 0x204F
-typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, int *piValue);
-typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEPARAMETERSI3DPROC) (HDC hDC, int iAttribute, const int *piValue);
-typedef BOOL (WINAPI * PFNWGLGETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
-typedef BOOL (WINAPI * PFNWGLSETGAMMATABLEI3DPROC) (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetGammaTableParametersI3D (HDC hDC, int iAttribute, int *piValue);
-BOOL WINAPI wglSetGammaTableParametersI3D (HDC hDC, int iAttribute, const int *piValue);
-BOOL WINAPI wglGetGammaTableI3D (HDC hDC, int iEntries, USHORT *puRed, USHORT *puGreen, USHORT *puBlue);
-BOOL WINAPI wglSetGammaTableI3D (HDC hDC, int iEntries, const USHORT *puRed, const USHORT *puGreen, const USHORT *puBlue);
-#endif
-#endif /* WGL_I3D_gamma */
-
-#ifndef WGL_I3D_genlock
-#define WGL_I3D_genlock 1
-#define WGL_GENLOCK_SOURCE_MULTIVIEW_I3D 0x2044
-#define WGL_GENLOCK_SOURCE_EXTERNAL_SYNC_I3D 0x2045
-#define WGL_GENLOCK_SOURCE_EXTERNAL_FIELD_I3D 0x2046
-#define WGL_GENLOCK_SOURCE_EXTERNAL_TTL_I3D 0x2047
-#define WGL_GENLOCK_SOURCE_DIGITAL_SYNC_I3D 0x2048
-#define WGL_GENLOCK_SOURCE_DIGITAL_FIELD_I3D 0x2049
-#define WGL_GENLOCK_SOURCE_EDGE_FALLING_I3D 0x204A
-#define WGL_GENLOCK_SOURCE_EDGE_RISING_I3D 0x204B
-#define WGL_GENLOCK_SOURCE_EDGE_BOTH_I3D 0x204C
-typedef BOOL (WINAPI * PFNWGLENABLEGENLOCKI3DPROC) (HDC hDC);
-typedef BOOL (WINAPI * PFNWGLDISABLEGENLOCKI3DPROC) (HDC hDC);
-typedef BOOL (WINAPI * PFNWGLISENABLEDGENLOCKI3DPROC) (HDC hDC, BOOL *pFlag);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEI3DPROC) (HDC hDC, UINT uSource);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEI3DPROC) (HDC hDC, UINT *uSource);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT uEdge);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEEDGEI3DPROC) (HDC hDC, UINT *uEdge);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT uRate);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSAMPLERATEI3DPROC) (HDC hDC, UINT *uRate);
-typedef BOOL (WINAPI * PFNWGLGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT uDelay);
-typedef BOOL (WINAPI * PFNWGLGETGENLOCKSOURCEDELAYI3DPROC) (HDC hDC, UINT *uDelay);
-typedef BOOL (WINAPI * PFNWGLQUERYGENLOCKMAXSOURCEDELAYI3DPROC) (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglEnableGenlockI3D (HDC hDC);
-BOOL WINAPI wglDisableGenlockI3D (HDC hDC);
-BOOL WINAPI wglIsEnabledGenlockI3D (HDC hDC, BOOL *pFlag);
-BOOL WINAPI wglGenlockSourceI3D (HDC hDC, UINT uSource);
-BOOL WINAPI wglGetGenlockSourceI3D (HDC hDC, UINT *uSource);
-BOOL WINAPI wglGenlockSourceEdgeI3D (HDC hDC, UINT uEdge);
-BOOL WINAPI wglGetGenlockSourceEdgeI3D (HDC hDC, UINT *uEdge);
-BOOL WINAPI wglGenlockSampleRateI3D (HDC hDC, UINT uRate);
-BOOL WINAPI wglGetGenlockSampleRateI3D (HDC hDC, UINT *uRate);
-BOOL WINAPI wglGenlockSourceDelayI3D (HDC hDC, UINT uDelay);
-BOOL WINAPI wglGetGenlockSourceDelayI3D (HDC hDC, UINT *uDelay);
-BOOL WINAPI wglQueryGenlockMaxSourceDelayI3D (HDC hDC, UINT *uMaxLineDelay, UINT *uMaxPixelDelay);
-#endif
-#endif /* WGL_I3D_genlock */
-
-#ifndef WGL_I3D_image_buffer
-#define WGL_I3D_image_buffer 1
-#define WGL_IMAGE_BUFFER_MIN_ACCESS_I3D 0x00000001
-#define WGL_IMAGE_BUFFER_LOCK_I3D 0x00000002
-typedef LPVOID (WINAPI * PFNWGLCREATEIMAGEBUFFERI3DPROC) (HDC hDC, DWORD dwSize, UINT uFlags);
-typedef BOOL (WINAPI * PFNWGLDESTROYIMAGEBUFFERI3DPROC) (HDC hDC, LPVOID pAddress);
-typedef BOOL (WINAPI * PFNWGLASSOCIATEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
-typedef BOOL (WINAPI * PFNWGLRELEASEIMAGEBUFFEREVENTSI3DPROC) (HDC hDC, const LPVOID *pAddress, UINT count);
-#ifdef WGL_WGLEXT_PROTOTYPES
-LPVOID WINAPI wglCreateImageBufferI3D (HDC hDC, DWORD dwSize, UINT uFlags);
-BOOL WINAPI wglDestroyImageBufferI3D (HDC hDC, LPVOID pAddress);
-BOOL WINAPI wglAssociateImageBufferEventsI3D (HDC hDC, const HANDLE *pEvent, const LPVOID *pAddress, const DWORD *pSize, UINT count);
-BOOL WINAPI wglReleaseImageBufferEventsI3D (HDC hDC, const LPVOID *pAddress, UINT count);
-#endif
-#endif /* WGL_I3D_image_buffer */
-
-#ifndef WGL_I3D_swap_frame_lock
-#define WGL_I3D_swap_frame_lock 1
-typedef BOOL (WINAPI * PFNWGLENABLEFRAMELOCKI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLDISABLEFRAMELOCKI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLISENABLEDFRAMELOCKI3DPROC) (BOOL *pFlag);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMELOCKMASTERI3DPROC) (BOOL *pFlag);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglEnableFrameLockI3D (void);
-BOOL WINAPI wglDisableFrameLockI3D (void);
-BOOL WINAPI wglIsEnabledFrameLockI3D (BOOL *pFlag);
-BOOL WINAPI wglQueryFrameLockMasterI3D (BOOL *pFlag);
-#endif
-#endif /* WGL_I3D_swap_frame_lock */
-
-#ifndef WGL_I3D_swap_frame_usage
-#define WGL_I3D_swap_frame_usage 1
-typedef BOOL (WINAPI * PFNWGLGETFRAMEUSAGEI3DPROC) (float *pUsage);
-typedef BOOL (WINAPI * PFNWGLBEGINFRAMETRACKINGI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLENDFRAMETRACKINGI3DPROC) (void);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMETRACKINGI3DPROC) (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetFrameUsageI3D (float *pUsage);
-BOOL WINAPI wglBeginFrameTrackingI3D (void);
-BOOL WINAPI wglEndFrameTrackingI3D (void);
-BOOL WINAPI wglQueryFrameTrackingI3D (DWORD *pFrameCount, DWORD *pMissedFrames, float *pLastMissedUsage);
-#endif
-#endif /* WGL_I3D_swap_frame_usage */
-
-#ifndef WGL_NV_DX_interop
-#define WGL_NV_DX_interop 1
-#define WGL_ACCESS_READ_ONLY_NV 0x00000000
-#define WGL_ACCESS_READ_WRITE_NV 0x00000001
-#define WGL_ACCESS_WRITE_DISCARD_NV 0x00000002
-typedef BOOL (WINAPI * PFNWGLDXSETRESOURCESHAREHANDLENVPROC) (void *dxObject, HANDLE shareHandle);
-typedef HANDLE (WINAPI * PFNWGLDXOPENDEVICENVPROC) (void *dxDevice);
-typedef BOOL (WINAPI * PFNWGLDXCLOSEDEVICENVPROC) (HANDLE hDevice);
-typedef HANDLE (WINAPI * PFNWGLDXREGISTEROBJECTNVPROC) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
-typedef BOOL (WINAPI * PFNWGLDXUNREGISTEROBJECTNVPROC) (HANDLE hDevice, HANDLE hObject);
-typedef BOOL (WINAPI * PFNWGLDXOBJECTACCESSNVPROC) (HANDLE hObject, GLenum access);
-typedef BOOL (WINAPI * PFNWGLDXLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
-typedef BOOL (WINAPI * PFNWGLDXUNLOCKOBJECTSNVPROC) (HANDLE hDevice, GLint count, HANDLE *hObjects);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglDXSetResourceShareHandleNV (void *dxObject, HANDLE shareHandle);
-HANDLE WINAPI wglDXOpenDeviceNV (void *dxDevice);
-BOOL WINAPI wglDXCloseDeviceNV (HANDLE hDevice);
-HANDLE WINAPI wglDXRegisterObjectNV (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
-BOOL WINAPI wglDXUnregisterObjectNV (HANDLE hDevice, HANDLE hObject);
-BOOL WINAPI wglDXObjectAccessNV (HANDLE hObject, GLenum access);
-BOOL WINAPI wglDXLockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
-BOOL WINAPI wglDXUnlockObjectsNV (HANDLE hDevice, GLint count, HANDLE *hObjects);
-#endif
-#endif /* WGL_NV_DX_interop */
-
-#ifndef WGL_NV_DX_interop2
-#define WGL_NV_DX_interop2 1
-#endif /* WGL_NV_DX_interop2 */
-
-#ifndef WGL_NV_copy_image
-#define WGL_NV_copy_image 1
-typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglCopyImageSubDataNV (HGLRC hSrcRC, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, HGLRC hDstRC, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* WGL_NV_copy_image */
-
-#ifndef WGL_NV_delay_before_swap
-#define WGL_NV_delay_before_swap 1
-typedef BOOL (WINAPI * PFNWGLDELAYBEFORESWAPNVPROC) (HDC hDC, GLfloat seconds);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglDelayBeforeSwapNV (HDC hDC, GLfloat seconds);
-#endif
-#endif /* WGL_NV_delay_before_swap */
-
-#ifndef WGL_NV_float_buffer
-#define WGL_NV_float_buffer 1
-#define WGL_FLOAT_COMPONENTS_NV 0x20B0
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_R_NV 0x20B1
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RG_NV 0x20B2
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGB_NV 0x20B3
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_FLOAT_RGBA_NV 0x20B4
-#define WGL_TEXTURE_FLOAT_R_NV 0x20B5
-#define WGL_TEXTURE_FLOAT_RG_NV 0x20B6
-#define WGL_TEXTURE_FLOAT_RGB_NV 0x20B7
-#define WGL_TEXTURE_FLOAT_RGBA_NV 0x20B8
-#endif /* WGL_NV_float_buffer */
-
-#ifndef WGL_NV_gpu_affinity
-#define WGL_NV_gpu_affinity 1
-DECLARE_HANDLE(HGPUNV);
-struct _GPU_DEVICE {
- DWORD cb;
- CHAR DeviceName[32];
- CHAR DeviceString[128];
- DWORD Flags;
- RECT rcVirtualScreen;
-};
-typedef struct _GPU_DEVICE *PGPU_DEVICE;
-#define ERROR_INCOMPATIBLE_AFFINITY_MASKS_NV 0x20D0
-#define ERROR_MISSING_AFFINITY_MASK_NV 0x20D1
-typedef BOOL (WINAPI * PFNWGLENUMGPUSNVPROC) (UINT iGpuIndex, HGPUNV *phGpu);
-typedef BOOL (WINAPI * PFNWGLENUMGPUDEVICESNVPROC) (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
-typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList);
-typedef BOOL (WINAPI * PFNWGLENUMGPUSFROMAFFINITYDCNVPROC) (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
-typedef BOOL (WINAPI * PFNWGLDELETEDCNVPROC) (HDC hdc);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglEnumGpusNV (UINT iGpuIndex, HGPUNV *phGpu);
-BOOL WINAPI wglEnumGpuDevicesNV (HGPUNV hGpu, UINT iDeviceIndex, PGPU_DEVICE lpGpuDevice);
-HDC WINAPI wglCreateAffinityDCNV (const HGPUNV *phGpuList);
-BOOL WINAPI wglEnumGpusFromAffinityDCNV (HDC hAffinityDC, UINT iGpuIndex, HGPUNV *hGpu);
-BOOL WINAPI wglDeleteDCNV (HDC hdc);
-#endif
-#endif /* WGL_NV_gpu_affinity */
-
-#ifndef WGL_NV_multisample_coverage
-#define WGL_NV_multisample_coverage 1
-#define WGL_COVERAGE_SAMPLES_NV 0x2042
-#define WGL_COLOR_SAMPLES_NV 0x20B9
-#endif /* WGL_NV_multisample_coverage */
-
-#ifndef WGL_NV_present_video
-#define WGL_NV_present_video 1
-DECLARE_HANDLE(HVIDEOOUTPUTDEVICENV);
-#define WGL_NUM_VIDEO_SLOTS_NV 0x20F0
-typedef int (WINAPI * PFNWGLENUMERATEVIDEODEVICESNVPROC) (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
-typedef BOOL (WINAPI * PFNWGLBINDVIDEODEVICENVPROC) (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
-typedef BOOL (WINAPI * PFNWGLQUERYCURRENTCONTEXTNVPROC) (int iAttribute, int *piValue);
-#ifdef WGL_WGLEXT_PROTOTYPES
-int WINAPI wglEnumerateVideoDevicesNV (HDC hDC, HVIDEOOUTPUTDEVICENV *phDeviceList);
-BOOL WINAPI wglBindVideoDeviceNV (HDC hDC, unsigned int uVideoSlot, HVIDEOOUTPUTDEVICENV hVideoDevice, const int *piAttribList);
-BOOL WINAPI wglQueryCurrentContextNV (int iAttribute, int *piValue);
-#endif
-#endif /* WGL_NV_present_video */
-
-#ifndef WGL_NV_render_depth_texture
-#define WGL_NV_render_depth_texture 1
-#define WGL_BIND_TO_TEXTURE_DEPTH_NV 0x20A3
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_DEPTH_NV 0x20A4
-#define WGL_DEPTH_TEXTURE_FORMAT_NV 0x20A5
-#define WGL_TEXTURE_DEPTH_COMPONENT_NV 0x20A6
-#define WGL_DEPTH_COMPONENT_NV 0x20A7
-#endif /* WGL_NV_render_depth_texture */
-
-#ifndef WGL_NV_render_texture_rectangle
-#define WGL_NV_render_texture_rectangle 1
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGB_NV 0x20A0
-#define WGL_BIND_TO_TEXTURE_RECTANGLE_RGBA_NV 0x20A1
-#define WGL_TEXTURE_RECTANGLE_NV 0x20A2
-#endif /* WGL_NV_render_texture_rectangle */
-
-#ifndef WGL_NV_swap_group
-#define WGL_NV_swap_group 1
-typedef BOOL (WINAPI * PFNWGLJOINSWAPGROUPNVPROC) (HDC hDC, GLuint group);
-typedef BOOL (WINAPI * PFNWGLBINDSWAPBARRIERNVPROC) (GLuint group, GLuint barrier);
-typedef BOOL (WINAPI * PFNWGLQUERYSWAPGROUPNVPROC) (HDC hDC, GLuint *group, GLuint *barrier);
-typedef BOOL (WINAPI * PFNWGLQUERYMAXSWAPGROUPSNVPROC) (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
-typedef BOOL (WINAPI * PFNWGLQUERYFRAMECOUNTNVPROC) (HDC hDC, GLuint *count);
-typedef BOOL (WINAPI * PFNWGLRESETFRAMECOUNTNVPROC) (HDC hDC);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglJoinSwapGroupNV (HDC hDC, GLuint group);
-BOOL WINAPI wglBindSwapBarrierNV (GLuint group, GLuint barrier);
-BOOL WINAPI wglQuerySwapGroupNV (HDC hDC, GLuint *group, GLuint *barrier);
-BOOL WINAPI wglQueryMaxSwapGroupsNV (HDC hDC, GLuint *maxGroups, GLuint *maxBarriers);
-BOOL WINAPI wglQueryFrameCountNV (HDC hDC, GLuint *count);
-BOOL WINAPI wglResetFrameCountNV (HDC hDC);
-#endif
-#endif /* WGL_NV_swap_group */
-
-#ifndef WGL_NV_vertex_array_range
-#define WGL_NV_vertex_array_range 1
-typedef void *(WINAPI * PFNWGLALLOCATEMEMORYNVPROC) (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
-typedef void (WINAPI * PFNWGLFREEMEMORYNVPROC) (void *pointer);
-#ifdef WGL_WGLEXT_PROTOTYPES
-void *WINAPI wglAllocateMemoryNV (GLsizei size, GLfloat readfreq, GLfloat writefreq, GLfloat priority);
-void WINAPI wglFreeMemoryNV (void *pointer);
-#endif
-#endif /* WGL_NV_vertex_array_range */
-
-#ifndef WGL_NV_video_capture
-#define WGL_NV_video_capture 1
-DECLARE_HANDLE(HVIDEOINPUTDEVICENV);
-#define WGL_UNIQUE_ID_NV 0x20CE
-#define WGL_NUM_VIDEO_CAPTURE_SLOTS_NV 0x20CF
-typedef BOOL (WINAPI * PFNWGLBINDVIDEOCAPTUREDEVICENVPROC) (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
-typedef UINT (WINAPI * PFNWGLENUMERATEVIDEOCAPTUREDEVICESNVPROC) (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
-typedef BOOL (WINAPI * PFNWGLLOCKVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-typedef BOOL (WINAPI * PFNWGLQUERYVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOCAPTUREDEVICENVPROC) (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglBindVideoCaptureDeviceNV (UINT uVideoSlot, HVIDEOINPUTDEVICENV hDevice);
-UINT WINAPI wglEnumerateVideoCaptureDevicesNV (HDC hDc, HVIDEOINPUTDEVICENV *phDeviceList);
-BOOL WINAPI wglLockVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-BOOL WINAPI wglQueryVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice, int iAttribute, int *piValue);
-BOOL WINAPI wglReleaseVideoCaptureDeviceNV (HDC hDc, HVIDEOINPUTDEVICENV hDevice);
-#endif
-#endif /* WGL_NV_video_capture */
-
-#ifndef WGL_NV_video_output
-#define WGL_NV_video_output 1
-DECLARE_HANDLE(HPVIDEODEV);
-#define WGL_BIND_TO_VIDEO_RGB_NV 0x20C0
-#define WGL_BIND_TO_VIDEO_RGBA_NV 0x20C1
-#define WGL_BIND_TO_VIDEO_RGB_AND_DEPTH_NV 0x20C2
-#define WGL_VIDEO_OUT_COLOR_NV 0x20C3
-#define WGL_VIDEO_OUT_ALPHA_NV 0x20C4
-#define WGL_VIDEO_OUT_DEPTH_NV 0x20C5
-#define WGL_VIDEO_OUT_COLOR_AND_ALPHA_NV 0x20C6
-#define WGL_VIDEO_OUT_COLOR_AND_DEPTH_NV 0x20C7
-#define WGL_VIDEO_OUT_FRAME 0x20C8
-#define WGL_VIDEO_OUT_FIELD_1 0x20C9
-#define WGL_VIDEO_OUT_FIELD_2 0x20CA
-#define WGL_VIDEO_OUT_STACKED_FIELDS_1_2 0x20CB
-#define WGL_VIDEO_OUT_STACKED_FIELDS_2_1 0x20CC
-typedef BOOL (WINAPI * PFNWGLGETVIDEODEVICENVPROC) (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEODEVICENVPROC) (HPVIDEODEV hVideoDevice);
-typedef BOOL (WINAPI * PFNWGLBINDVIDEOIMAGENVPROC) (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
-typedef BOOL (WINAPI * PFNWGLRELEASEVIDEOIMAGENVPROC) (HPBUFFERARB hPbuffer, int iVideoBuffer);
-typedef BOOL (WINAPI * PFNWGLSENDPBUFFERTOVIDEONVPROC) (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
-typedef BOOL (WINAPI * PFNWGLGETVIDEOINFONVPROC) (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetVideoDeviceNV (HDC hDC, int numDevices, HPVIDEODEV *hVideoDevice);
-BOOL WINAPI wglReleaseVideoDeviceNV (HPVIDEODEV hVideoDevice);
-BOOL WINAPI wglBindVideoImageNV (HPVIDEODEV hVideoDevice, HPBUFFERARB hPbuffer, int iVideoBuffer);
-BOOL WINAPI wglReleaseVideoImageNV (HPBUFFERARB hPbuffer, int iVideoBuffer);
-BOOL WINAPI wglSendPbufferToVideoNV (HPBUFFERARB hPbuffer, int iBufferType, unsigned long *pulCounterPbuffer, BOOL bBlock);
-BOOL WINAPI wglGetVideoInfoNV (HPVIDEODEV hpVideoDevice, unsigned long *pulCounterOutputPbuffer, unsigned long *pulCounterOutputVideo);
-#endif
-#endif /* WGL_NV_video_output */
-
-#ifndef WGL_OML_sync_control
-#define WGL_OML_sync_control 1
-typedef BOOL (WINAPI * PFNWGLGETSYNCVALUESOMLPROC) (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
-typedef BOOL (WINAPI * PFNWGLGETMSCRATEOMLPROC) (HDC hdc, INT32 *numerator, INT32 *denominator);
-typedef INT64 (WINAPI * PFNWGLSWAPBUFFERSMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
-typedef INT64 (WINAPI * PFNWGLSWAPLAYERBUFFERSMSCOMLPROC) (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
-typedef BOOL (WINAPI * PFNWGLWAITFORMSCOMLPROC) (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
-typedef BOOL (WINAPI * PFNWGLWAITFORSBCOMLPROC) (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
-#ifdef WGL_WGLEXT_PROTOTYPES
-BOOL WINAPI wglGetSyncValuesOML (HDC hdc, INT64 *ust, INT64 *msc, INT64 *sbc);
-BOOL WINAPI wglGetMscRateOML (HDC hdc, INT32 *numerator, INT32 *denominator);
-INT64 WINAPI wglSwapBuffersMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder);
-INT64 WINAPI wglSwapLayerBuffersMscOML (HDC hdc, int fuPlanes, INT64 target_msc, INT64 divisor, INT64 remainder);
-BOOL WINAPI wglWaitForMscOML (HDC hdc, INT64 target_msc, INT64 divisor, INT64 remainder, INT64 *ust, INT64 *msc, INT64 *sbc);
-BOOL WINAPI wglWaitForSbcOML (HDC hdc, INT64 target_sbc, INT64 *ust, INT64 *msc, INT64 *sbc);
-#endif
-#endif /* WGL_OML_sync_control */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES/gl.h b/include/GLES/gl.h
deleted file mode 100644
index 6955f6a2a..000000000
--- a/include/GLES/gl.h
+++ /dev/null
@@ -1,590 +0,0 @@
-#ifndef __gles1_gl_h_
-#define __gles1_gl_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#include <GLES/glplatform.h>
-
-/* Generated on date 20180525 */
-
-/* Generated C header for:
- * API: gles1
- * Profile: common
- * Versions considered: .*
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_VERSION_ES_CM_1_0
-#define GL_VERSION_ES_CM_1_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef unsigned int GLenum;
-typedef khronos_float_t GLfloat;
-typedef khronos_int32_t GLfixed;
-typedef unsigned int GLuint;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef khronos_uint8_t GLubyte;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_int32_t GLclampx;
-#define GL_VERSION_ES_CL_1_0 1
-#define GL_VERSION_ES_CM_1_1 1
-#define GL_VERSION_ES_CL_1_1 1
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_CLIP_PLANE0 0x3000
-#define GL_CLIP_PLANE1 0x3001
-#define GL_CLIP_PLANE2 0x3002
-#define GL_CLIP_PLANE3 0x3003
-#define GL_CLIP_PLANE4 0x3004
-#define GL_CLIP_PLANE5 0x3005
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_FOG 0x0B60
-#define GL_LIGHTING 0x0B50
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_ALPHA_TEST 0x0BC0
-#define GL_BLEND 0x0BE2
-#define GL_COLOR_LOGIC_OP 0x0BF2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_POINT_SMOOTH 0x0B10
-#define GL_LINE_SMOOTH 0x0B20
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_COLOR_MATERIAL 0x0B57
-#define GL_NORMALIZE 0x0BA1
-#define GL_RESCALE_NORMAL 0x803A
-#define GL_VERTEX_ARRAY 0x8074
-#define GL_NORMAL_ARRAY 0x8075
-#define GL_COLOR_ARRAY 0x8076
-#define GL_TEXTURE_COORD_ARRAY 0x8078
-#define GL_MULTISAMPLE 0x809D
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_ALPHA_TO_ONE 0x809F
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_STACK_OVERFLOW 0x0503
-#define GL_STACK_UNDERFLOW 0x0504
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_EXP 0x0800
-#define GL_EXP2 0x0801
-#define GL_FOG_DENSITY 0x0B62
-#define GL_FOG_START 0x0B63
-#define GL_FOG_END 0x0B64
-#define GL_FOG_MODE 0x0B65
-#define GL_FOG_COLOR 0x0B66
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_CURRENT_COLOR 0x0B00
-#define GL_CURRENT_NORMAL 0x0B02
-#define GL_CURRENT_TEXTURE_COORDS 0x0B03
-#define GL_POINT_SIZE 0x0B11
-#define GL_POINT_SIZE_MIN 0x8126
-#define GL_POINT_SIZE_MAX 0x8127
-#define GL_POINT_FADE_THRESHOLD_SIZE 0x8128
-#define GL_POINT_DISTANCE_ATTENUATION 0x8129
-#define GL_SMOOTH_POINT_SIZE_RANGE 0x0B12
-#define GL_LINE_WIDTH 0x0B21
-#define GL_SMOOTH_LINE_WIDTH_RANGE 0x0B22
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_SHADE_MODEL 0x0B54
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_MATRIX_MODE 0x0BA0
-#define GL_VIEWPORT 0x0BA2
-#define GL_MODELVIEW_STACK_DEPTH 0x0BA3
-#define GL_PROJECTION_STACK_DEPTH 0x0BA4
-#define GL_TEXTURE_STACK_DEPTH 0x0BA5
-#define GL_MODELVIEW_MATRIX 0x0BA6
-#define GL_PROJECTION_MATRIX 0x0BA7
-#define GL_TEXTURE_MATRIX 0x0BA8
-#define GL_ALPHA_TEST_FUNC 0x0BC1
-#define GL_ALPHA_TEST_REF 0x0BC2
-#define GL_BLEND_DST 0x0BE0
-#define GL_BLEND_SRC 0x0BE1
-#define GL_LOGIC_OP_MODE 0x0BF0
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_MAX_LIGHTS 0x0D31
-#define GL_MAX_CLIP_PLANES 0x0D32
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_MODELVIEW_STACK_DEPTH 0x0D36
-#define GL_MAX_PROJECTION_STACK_DEPTH 0x0D38
-#define GL_MAX_TEXTURE_STACK_DEPTH 0x0D39
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_MAX_TEXTURE_UNITS 0x84E2
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_VERTEX_ARRAY_SIZE 0x807A
-#define GL_VERTEX_ARRAY_TYPE 0x807B
-#define GL_VERTEX_ARRAY_STRIDE 0x807C
-#define GL_NORMAL_ARRAY_TYPE 0x807E
-#define GL_NORMAL_ARRAY_STRIDE 0x807F
-#define GL_COLOR_ARRAY_SIZE 0x8081
-#define GL_COLOR_ARRAY_TYPE 0x8082
-#define GL_COLOR_ARRAY_STRIDE 0x8083
-#define GL_TEXTURE_COORD_ARRAY_SIZE 0x8088
-#define GL_TEXTURE_COORD_ARRAY_TYPE 0x8089
-#define GL_TEXTURE_COORD_ARRAY_STRIDE 0x808A
-#define GL_VERTEX_ARRAY_POINTER 0x808E
-#define GL_NORMAL_ARRAY_POINTER 0x808F
-#define GL_COLOR_ARRAY_POINTER 0x8090
-#define GL_TEXTURE_COORD_ARRAY_POINTER 0x8092
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_PERSPECTIVE_CORRECTION_HINT 0x0C50
-#define GL_POINT_SMOOTH_HINT 0x0C51
-#define GL_LINE_SMOOTH_HINT 0x0C52
-#define GL_FOG_HINT 0x0C54
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_LIGHT_MODEL_AMBIENT 0x0B53
-#define GL_LIGHT_MODEL_TWO_SIDE 0x0B52
-#define GL_AMBIENT 0x1200
-#define GL_DIFFUSE 0x1201
-#define GL_SPECULAR 0x1202
-#define GL_POSITION 0x1203
-#define GL_SPOT_DIRECTION 0x1204
-#define GL_SPOT_EXPONENT 0x1205
-#define GL_SPOT_CUTOFF 0x1206
-#define GL_CONSTANT_ATTENUATION 0x1207
-#define GL_LINEAR_ATTENUATION 0x1208
-#define GL_QUADRATIC_ATTENUATION 0x1209
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-#define GL_CLEAR 0x1500
-#define GL_AND 0x1501
-#define GL_AND_REVERSE 0x1502
-#define GL_COPY 0x1503
-#define GL_AND_INVERTED 0x1504
-#define GL_NOOP 0x1505
-#define GL_XOR 0x1506
-#define GL_OR 0x1507
-#define GL_NOR 0x1508
-#define GL_EQUIV 0x1509
-#define GL_INVERT 0x150A
-#define GL_OR_REVERSE 0x150B
-#define GL_COPY_INVERTED 0x150C
-#define GL_OR_INVERTED 0x150D
-#define GL_NAND 0x150E
-#define GL_SET 0x150F
-#define GL_EMISSION 0x1600
-#define GL_SHININESS 0x1601
-#define GL_AMBIENT_AND_DIFFUSE 0x1602
-#define GL_MODELVIEW 0x1700
-#define GL_PROJECTION 0x1701
-#define GL_TEXTURE 0x1702
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_FLAT 0x1D00
-#define GL_SMOOTH 0x1D01
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_MODULATE 0x2100
-#define GL_DECAL 0x2101
-#define GL_ADD 0x0104
-#define GL_TEXTURE_ENV_MODE 0x2200
-#define GL_TEXTURE_ENV_COLOR 0x2201
-#define GL_TEXTURE_ENV 0x2300
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_GENERATE_MIPMAP 0x8191
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_CLIENT_ACTIVE_TEXTURE 0x84E1
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_LIGHT0 0x4000
-#define GL_LIGHT1 0x4001
-#define GL_LIGHT2 0x4002
-#define GL_LIGHT3 0x4003
-#define GL_LIGHT4 0x4004
-#define GL_LIGHT5 0x4005
-#define GL_LIGHT6 0x4006
-#define GL_LIGHT7 0x4007
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_VERTEX_ARRAY_BUFFER_BINDING 0x8896
-#define GL_NORMAL_ARRAY_BUFFER_BINDING 0x8897
-#define GL_COLOR_ARRAY_BUFFER_BINDING 0x8898
-#define GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING 0x889A
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_SUBTRACT 0x84E7
-#define GL_COMBINE 0x8570
-#define GL_COMBINE_RGB 0x8571
-#define GL_COMBINE_ALPHA 0x8572
-#define GL_RGB_SCALE 0x8573
-#define GL_ADD_SIGNED 0x8574
-#define GL_INTERPOLATE 0x8575
-#define GL_CONSTANT 0x8576
-#define GL_PRIMARY_COLOR 0x8577
-#define GL_PREVIOUS 0x8578
-#define GL_OPERAND0_RGB 0x8590
-#define GL_OPERAND1_RGB 0x8591
-#define GL_OPERAND2_RGB 0x8592
-#define GL_OPERAND0_ALPHA 0x8598
-#define GL_OPERAND1_ALPHA 0x8599
-#define GL_OPERAND2_ALPHA 0x859A
-#define GL_ALPHA_SCALE 0x0D1C
-#define GL_SRC0_RGB 0x8580
-#define GL_SRC1_RGB 0x8581
-#define GL_SRC2_RGB 0x8582
-#define GL_SRC0_ALPHA 0x8588
-#define GL_SRC1_ALPHA 0x8589
-#define GL_SRC2_ALPHA 0x858A
-#define GL_DOT3_RGB 0x86AE
-#define GL_DOT3_RGBA 0x86AF
-GL_API void GL_APIENTRY glAlphaFunc (GLenum func, GLfloat ref);
-GL_API void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_API void GL_APIENTRY glClearDepthf (GLfloat d);
-GL_API void GL_APIENTRY glClipPlanef (GLenum p, const GLfloat *eqn);
-GL_API void GL_APIENTRY glColor4f (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_API void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
-GL_API void GL_APIENTRY glFogf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glFogfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glFrustumf (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-GL_API void GL_APIENTRY glGetClipPlanef (GLenum plane, GLfloat *equation);
-GL_API void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
-GL_API void GL_APIENTRY glGetLightfv (GLenum light, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetMaterialfv (GLenum face, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexEnvfv (GLenum target, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glLightModelf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightModelfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLightf (GLenum light, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glLightfv (GLenum light, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glLineWidth (GLfloat width);
-GL_API void GL_APIENTRY glLoadMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMaterialf (GLenum face, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glMaterialfv (GLenum face, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glMultMatrixf (const GLfloat *m);
-GL_API void GL_APIENTRY glMultiTexCoord4f (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q);
-GL_API void GL_APIENTRY glNormal3f (GLfloat nx, GLfloat ny, GLfloat nz);
-GL_API void GL_APIENTRY glOrthof (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-GL_API void GL_APIENTRY glPointParameterf (GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glPointParameterfv (GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glPointSize (GLfloat size);
-GL_API void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_API void GL_APIENTRY glRotatef (GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glScalef (GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glTexEnvf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexEnvfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTranslatef (GLfloat x, GLfloat y, GLfloat z);
-GL_API void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLfixed ref);
-GL_API void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_API void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_API void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_API void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_API void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_API void GL_APIENTRY glClear (GLbitfield mask);
-GL_API void GL_APIENTRY glClearColorx (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glClearDepthx (GLfixed depth);
-GL_API void GL_APIENTRY glClearStencil (GLint s);
-GL_API void GL_APIENTRY glClientActiveTexture (GLenum texture);
-GL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4ub (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha);
-GL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_API void GL_APIENTRY glColorPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_API void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GL_API void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GL_API void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_API void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glCullFace (GLenum mode);
-GL_API void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GL_API void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GL_API void GL_APIENTRY glDepthFunc (GLenum func);
-GL_API void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_API void GL_APIENTRY glDepthRangex (GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glDisable (GLenum cap);
-GL_API void GL_APIENTRY glDisableClientState (GLenum array);
-GL_API void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_API void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
-GL_API void GL_APIENTRY glEnable (GLenum cap);
-GL_API void GL_APIENTRY glEnableClientState (GLenum array);
-GL_API void GL_APIENTRY glFinish (void);
-GL_API void GL_APIENTRY glFlush (void);
-GL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glFrontFace (GLenum mode);
-GL_API void GL_APIENTRY glFrustumx (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-GL_API void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetClipPlanex (GLenum plane, GLfixed *equation);
-GL_API void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GL_API void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GL_API GLenum GL_APIENTRY glGetError (void);
-GL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-GL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetPointerv (GLenum pname, void **params);
-GL_API const GLubyte *GL_APIENTRY glGetString (GLenum name);
-GL_API void GL_APIENTRY glGetTexEnviv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexEnvxv (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_API GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_API GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_API GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthx (GLfixed width);
-GL_API void GL_APIENTRY glLoadIdentity (void);
-GL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glLogicOp (GLenum opcode);
-GL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glMatrixMode (GLenum mode);
-GL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4x (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glNormalPointer (GLenum type, GLsizei stride, const void *pointer);
-GL_API void GL_APIENTRY glOrthox (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizex (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glPopMatrix (void);
-GL_API void GL_APIENTRY glPushMatrix (void);
-GL_API void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-GL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
-GL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glShadeModel (GLenum mode);
-GL_API void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_API void GL_APIENTRY glStencilMask (GLuint mask);
-GL_API void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_API void GL_APIENTRY glTexCoordPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_API void GL_APIENTRY glTexEnvi (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnviv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_API void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glVertexPointer (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_API void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif /* GL_VERSION_ES_CM_1_0 */
-
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif /* GL_OES_compressed_paletted_texture */
-
-#ifndef GL_OES_point_size_array
-#define GL_OES_point_size_array 1
-#define GL_POINT_SIZE_ARRAY_OES 0x8B9C
-#define GL_POINT_SIZE_ARRAY_TYPE_OES 0x898A
-#define GL_POINT_SIZE_ARRAY_STRIDE_OES 0x898B
-#define GL_POINT_SIZE_ARRAY_POINTER_OES 0x898C
-#define GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES 0x8B9F
-GL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const void *pointer);
-#endif /* GL_OES_point_size_array */
-
-#ifndef GL_OES_point_sprite
-#define GL_OES_point_sprite 1
-#define GL_POINT_SPRITE_OES 0x8861
-#define GL_COORD_REPLACE_OES 0x8862
-#endif /* GL_OES_point_sprite */
-
-#ifndef GL_OES_read_format
-#define GL_OES_read_format 1
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE_OES 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES 0x8B9B
-#endif /* GL_OES_read_format */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES/glext.h b/include/GLES/glext.h
deleted file mode 100644
index 6c9c9d2c7..000000000
--- a/include/GLES/glext.h
+++ /dev/null
@@ -1,973 +0,0 @@
-#ifndef __gles1_glext_h_
-#define __gles1_glext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* Generated on date 20180525 */
-
-/* Generated C header for:
- * API: gles1
- * Profile: common
- * Versions considered: .*
- * Versions emitted: _nomatch_^
- * Default extensions included: gles1
- * Additional extensions included: _nomatch_^
- * Extensions removed: ^(GL_OES_read_format|GL_OES_compressed_paletted_texture|GL_OES_point_size_array|GL_OES_point_sprite)$
- */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-#endif /* GL_KHR_debug */
-
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-typedef void *GLeglImageOES;
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_API void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-#endif /* GL_OES_EGL_image */
-
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#endif /* GL_OES_EGL_image_external */
-
-#ifndef GL_OES_blend_equation_separate
-#define GL_OES_blend_equation_separate 1
-#define GL_BLEND_EQUATION_RGB_OES 0x8009
-#define GL_BLEND_EQUATION_ALPHA_OES 0x883D
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEOESPROC) (GLenum modeRGB, GLenum modeAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationSeparateOES (GLenum modeRGB, GLenum modeAlpha);
-#endif
-#endif /* GL_OES_blend_equation_separate */
-
-#ifndef GL_OES_blend_func_separate
-#define GL_OES_blend_func_separate 1
-#define GL_BLEND_DST_RGB_OES 0x80C8
-#define GL_BLEND_SRC_RGB_OES 0x80C9
-#define GL_BLEND_DST_ALPHA_OES 0x80CA
-#define GL_BLEND_SRC_ALPHA_OES 0x80CB
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEOESPROC) (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendFuncSeparateOES (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-#endif
-#endif /* GL_OES_blend_func_separate */
-
-#ifndef GL_OES_blend_subtract
-#define GL_OES_blend_subtract 1
-#define GL_BLEND_EQUATION_OES 0x8009
-#define GL_FUNC_ADD_OES 0x8006
-#define GL_FUNC_SUBTRACT_OES 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT_OES 0x800B
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONOESPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBlendEquationOES (GLenum mode);
-#endif
-#endif /* GL_OES_blend_subtract */
-
-#ifndef GL_OES_byte_coordinates
-#define GL_OES_byte_coordinates 1
-#endif /* GL_OES_byte_coordinates */
-
-#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
-#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
-#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
-
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif /* GL_OES_compressed_ETC1_RGB8_texture */
-
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif /* GL_OES_depth24 */
-
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif /* GL_OES_depth32 */
-
-#ifndef GL_OES_draw_texture
-#define GL_OES_draw_texture 1
-#define GL_TEXTURE_CROP_RECT_OES 0x8B9D
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSOESPROC) (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIOESPROC) (GLint x, GLint y, GLint z, GLint width, GLint height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXOESPROC) (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXSVOESPROC) (const GLshort *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXIVOESPROC) (const GLint *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXXVOESPROC) (const GLfixed *coords);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFOESPROC) (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-typedef void (GL_APIENTRYP PFNGLDRAWTEXFVOESPROC) (const GLfloat *coords);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDrawTexsOES (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height);
-GL_API void GL_APIENTRY glDrawTexiOES (GLint x, GLint y, GLint z, GLint width, GLint height);
-GL_API void GL_APIENTRY glDrawTexxOES (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height);
-GL_API void GL_APIENTRY glDrawTexsvOES (const GLshort *coords);
-GL_API void GL_APIENTRY glDrawTexivOES (const GLint *coords);
-GL_API void GL_APIENTRY glDrawTexxvOES (const GLfixed *coords);
-GL_API void GL_APIENTRY glDrawTexfOES (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height);
-GL_API void GL_APIENTRY glDrawTexfvOES (const GLfloat *coords);
-#endif
-#endif /* GL_OES_draw_texture */
-
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#define GL_UNSIGNED_INT 0x1405
-#endif /* GL_OES_element_index_uint */
-
-#ifndef GL_OES_extended_matrix_palette
-#define GL_OES_extended_matrix_palette 1
-#endif /* GL_OES_extended_matrix_palette */
-
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif /* GL_OES_fbo_render_mipmap */
-
-#ifndef GL_OES_fixed_point
-#define GL_OES_fixed_point 1
-#define GL_FIXED_OES 0x140C
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCXOESPROC) (GLenum func, GLfixed ref);
-typedef void (GL_APIENTRYP PFNGLCLEARCOLORXOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHXOESPROC) (GLfixed depth);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXOESPROC) (GLenum plane, const GLfixed *equation);
-typedef void (GL_APIENTRYP PFNGLCOLOR4XOESPROC) (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEXOESPROC) (GLfixed n, GLfixed f);
-typedef void (GL_APIENTRYP PFNGLFOGXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLFOGXVOESPROC) (GLenum pname, const GLfixed *param);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEXOESPROC) (GLenum plane, GLfixed *equation);
-typedef void (GL_APIENTRYP PFNGLGETFIXEDVOESPROC) (GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXENVXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTMODELXVOESPROC) (GLenum pname, const GLfixed *param);
-typedef void (GL_APIENTRYP PFNGLLIGHTXOESPROC) (GLenum light, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLLIGHTXVOESPROC) (GLenum light, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLLINEWIDTHXOESPROC) (GLfixed width);
-typedef void (GL_APIENTRYP PFNGLLOADMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMATERIALXOESPROC) (GLenum face, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLMATERIALXVOESPROC) (GLenum face, GLenum pname, const GLfixed *param);
-typedef void (GL_APIENTRYP PFNGLMULTMATRIXXOESPROC) (const GLfixed *m);
-typedef void (GL_APIENTRYP PFNGLMULTITEXCOORD4XOESPROC) (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-typedef void (GL_APIENTRYP PFNGLNORMAL3XOESPROC) (GLfixed nx, GLfixed ny, GLfixed nz);
-typedef void (GL_APIENTRYP PFNGLORTHOXOESPROC) (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXVOESPROC) (GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLPOINTSIZEXOESPROC) (GLfixed size);
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETXOESPROC) (GLfixed factor, GLfixed units);
-typedef void (GL_APIENTRYP PFNGLROTATEXOESPROC) (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLSCALEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLTEXENVXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXENVXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXOESPROC) (GLenum target, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERXVOESPROC) (GLenum target, GLenum pname, const GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTRANSLATEXOESPROC) (GLfixed x, GLfixed y, GLfixed z);
-typedef void (GL_APIENTRYP PFNGLGETLIGHTXVOESPROC) (GLenum light, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLGETMATERIALXVOESPROC) (GLenum face, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLPOINTPARAMETERXOESPROC) (GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEXOESPROC) (GLclampx value, GLboolean invert);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENXVOESPROC) (GLenum coord, GLenum pname, GLfixed *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENXOESPROC) (GLenum coord, GLenum pname, GLfixed param);
-typedef void (GL_APIENTRYP PFNGLTEXGENXVOESPROC) (GLenum coord, GLenum pname, const GLfixed *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glAlphaFuncxOES (GLenum func, GLfixed ref);
-GL_API void GL_APIENTRY glClearColorxOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glClearDepthxOES (GLfixed depth);
-GL_API void GL_APIENTRY glClipPlanexOES (GLenum plane, const GLfixed *equation);
-GL_API void GL_APIENTRY glColor4xOES (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha);
-GL_API void GL_APIENTRY glDepthRangexOES (GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glFogxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glFogxvOES (GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glFrustumxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glGetClipPlanexOES (GLenum plane, GLfixed *equation);
-GL_API void GL_APIENTRY glGetFixedvOES (GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexEnvxvOES (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetTexParameterxvOES (GLenum target, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glLightModelxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightModelxvOES (GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glLightxOES (GLenum light, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glLightxvOES (GLenum light, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glLineWidthxOES (GLfixed width);
-GL_API void GL_APIENTRY glLoadMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMaterialxOES (GLenum face, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glMaterialxvOES (GLenum face, GLenum pname, const GLfixed *param);
-GL_API void GL_APIENTRY glMultMatrixxOES (const GLfixed *m);
-GL_API void GL_APIENTRY glMultiTexCoord4xOES (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q);
-GL_API void GL_APIENTRY glNormal3xOES (GLfixed nx, GLfixed ny, GLfixed nz);
-GL_API void GL_APIENTRY glOrthoxOES (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f);
-GL_API void GL_APIENTRY glPointParameterxvOES (GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glPointSizexOES (GLfixed size);
-GL_API void GL_APIENTRY glPolygonOffsetxOES (GLfixed factor, GLfixed units);
-GL_API void GL_APIENTRY glRotatexOES (GLfixed angle, GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glScalexOES (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glTexEnvxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexEnvxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTexParameterxOES (GLenum target, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexParameterxvOES (GLenum target, GLenum pname, const GLfixed *params);
-GL_API void GL_APIENTRY glTranslatexOES (GLfixed x, GLfixed y, GLfixed z);
-GL_API void GL_APIENTRY glGetLightxvOES (GLenum light, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glGetMaterialxvOES (GLenum face, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glPointParameterxOES (GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glSampleCoveragexOES (GLclampx value, GLboolean invert);
-GL_API void GL_APIENTRY glGetTexGenxvOES (GLenum coord, GLenum pname, GLfixed *params);
-GL_API void GL_APIENTRY glTexGenxOES (GLenum coord, GLenum pname, GLfixed param);
-GL_API void GL_APIENTRY glTexGenxvOES (GLenum coord, GLenum pname, const GLfixed *params);
-#endif
-#endif /* GL_OES_fixed_point */
-
-#ifndef GL_OES_framebuffer_object
-#define GL_OES_framebuffer_object 1
-#define GL_NONE_OES 0
-#define GL_FRAMEBUFFER_OES 0x8D40
-#define GL_RENDERBUFFER_OES 0x8D41
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-#define GL_RENDERBUFFER_WIDTH_OES 0x8D42
-#define GL_RENDERBUFFER_HEIGHT_OES 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT_OES 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE_OES 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE_OES 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE_OES 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE_OES 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE_OES 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE_OES 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES 0x8CD3
-#define GL_COLOR_ATTACHMENT0_OES 0x8CE0
-#define GL_DEPTH_ATTACHMENT_OES 0x8D00
-#define GL_STENCIL_ATTACHMENT_OES 0x8D20
-#define GL_FRAMEBUFFER_COMPLETE_OES 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES 0x8CD9
-#define GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES 0x8CDA
-#define GL_FRAMEBUFFER_UNSUPPORTED_OES 0x8CDD
-#define GL_FRAMEBUFFER_BINDING_OES 0x8CA6
-#define GL_RENDERBUFFER_BINDING_OES 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE_OES 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION_OES 0x0506
-typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFEROESPROC) (GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFEROESPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSOESPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSOESPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVOESPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFEROESPROC) (GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFEROESPROC) (GLenum target, GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSOESPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSOESPROC) (GLsizei n, GLuint *framebuffers);
-typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSOESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFEROESPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVOESPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPOESPROC) (GLenum target);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLboolean GL_APIENTRY glIsRenderbufferOES (GLuint renderbuffer);
-GL_API void GL_APIENTRY glBindRenderbufferOES (GLenum target, GLuint renderbuffer);
-GL_API void GL_APIENTRY glDeleteRenderbuffersOES (GLsizei n, const GLuint *renderbuffers);
-GL_API void GL_APIENTRY glGenRenderbuffersOES (GLsizei n, GLuint *renderbuffers);
-GL_API void GL_APIENTRY glRenderbufferStorageOES (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glGetRenderbufferParameterivOES (GLenum target, GLenum pname, GLint *params);
-GL_API GLboolean GL_APIENTRY glIsFramebufferOES (GLuint framebuffer);
-GL_API void GL_APIENTRY glBindFramebufferOES (GLenum target, GLuint framebuffer);
-GL_API void GL_APIENTRY glDeleteFramebuffersOES (GLsizei n, const GLuint *framebuffers);
-GL_API void GL_APIENTRY glGenFramebuffersOES (GLsizei n, GLuint *framebuffers);
-GL_API GLenum GL_APIENTRY glCheckFramebufferStatusOES (GLenum target);
-GL_API void GL_APIENTRY glFramebufferRenderbufferOES (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_API void GL_APIENTRY glFramebufferTexture2DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_API void GL_APIENTRY glGetFramebufferAttachmentParameterivOES (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glGenerateMipmapOES (GLenum target);
-#endif
-#endif /* GL_OES_framebuffer_object */
-
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#define GL_WRITE_ONLY_OES 0x88B9
-#define GL_BUFFER_ACCESS_OES 0x88BB
-#define GL_BUFFER_MAPPED_OES 0x88BC
-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_API GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_API void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_OES_mapbuffer */
-
-#ifndef GL_OES_matrix_get
-#define GL_OES_matrix_get 1
-#define GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES 0x898D
-#define GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES 0x898E
-#define GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES 0x898F
-#endif /* GL_OES_matrix_get */
-
-#ifndef GL_OES_matrix_palette
-#define GL_OES_matrix_palette 1
-#define GL_MAX_VERTEX_UNITS_OES 0x86A4
-#define GL_MAX_PALETTE_MATRICES_OES 0x8842
-#define GL_MATRIX_PALETTE_OES 0x8840
-#define GL_MATRIX_INDEX_ARRAY_OES 0x8844
-#define GL_WEIGHT_ARRAY_OES 0x86AD
-#define GL_CURRENT_PALETTE_MATRIX_OES 0x8843
-#define GL_MATRIX_INDEX_ARRAY_SIZE_OES 0x8846
-#define GL_MATRIX_INDEX_ARRAY_TYPE_OES 0x8847
-#define GL_MATRIX_INDEX_ARRAY_STRIDE_OES 0x8848
-#define GL_MATRIX_INDEX_ARRAY_POINTER_OES 0x8849
-#define GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES 0x8B9E
-#define GL_WEIGHT_ARRAY_SIZE_OES 0x86AB
-#define GL_WEIGHT_ARRAY_TYPE_OES 0x86A9
-#define GL_WEIGHT_ARRAY_STRIDE_OES 0x86AA
-#define GL_WEIGHT_ARRAY_POINTER_OES 0x86AC
-#define GL_WEIGHT_ARRAY_BUFFER_BINDING_OES 0x889E
-typedef void (GL_APIENTRYP PFNGLCURRENTPALETTEMATRIXOESPROC) (GLuint matrixpaletteindex);
-typedef void (GL_APIENTRYP PFNGLLOADPALETTEFROMMODELVIEWMATRIXOESPROC) (void);
-typedef void (GL_APIENTRYP PFNGLMATRIXINDEXPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (GL_APIENTRYP PFNGLWEIGHTPOINTEROESPROC) (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glCurrentPaletteMatrixOES (GLuint matrixpaletteindex);
-GL_API void GL_APIENTRY glLoadPaletteFromModelViewMatrixOES (void);
-GL_API void GL_APIENTRY glMatrixIndexPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_API void GL_APIENTRY glWeightPointerOES (GLint size, GLenum type, GLsizei stride, const void *pointer);
-#endif
-#endif /* GL_OES_matrix_palette */
-
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif /* GL_OES_packed_depth_stencil */
-
-#ifndef GL_OES_query_matrix
-#define GL_OES_query_matrix 1
-typedef GLbitfield (GL_APIENTRYP PFNGLQUERYMATRIXXOESPROC) (GLfixed *mantissa, GLint *exponent);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLbitfield GL_APIENTRY glQueryMatrixxOES (GLfixed *mantissa, GLint *exponent);
-#endif
-#endif /* GL_OES_query_matrix */
-
-#ifndef GL_OES_required_internalformat
-#define GL_OES_required_internalformat 1
-#define GL_ALPHA8_OES 0x803C
-#define GL_LUMINANCE4_ALPHA4_OES 0x8043
-#define GL_LUMINANCE8_ALPHA8_OES 0x8045
-#define GL_LUMINANCE8_OES 0x8040
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB10_A2_EXT 0x8059
-#endif /* GL_OES_required_internalformat */
-
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif /* GL_OES_rgb8_rgba8 */
-
-#ifndef GL_OES_single_precision
-#define GL_OES_single_precision 1
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFOESPROC) (GLclampf depth);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFOESPROC) (GLenum plane, const GLfloat *equation);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFOESPROC) (GLclampf n, GLclampf f);
-typedef void (GL_APIENTRYP PFNGLFRUSTUMFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-typedef void (GL_APIENTRYP PFNGLGETCLIPPLANEFOESPROC) (GLenum plane, GLfloat *equation);
-typedef void (GL_APIENTRYP PFNGLORTHOFOESPROC) (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glClearDepthfOES (GLclampf depth);
-GL_API void GL_APIENTRY glClipPlanefOES (GLenum plane, const GLfloat *equation);
-GL_API void GL_APIENTRY glDepthRangefOES (GLclampf n, GLclampf f);
-GL_API void GL_APIENTRY glFrustumfOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-GL_API void GL_APIENTRY glGetClipPlanefOES (GLenum plane, GLfloat *equation);
-GL_API void GL_APIENTRY glOrthofOES (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f);
-#endif
-#endif /* GL_OES_single_precision */
-
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif /* GL_OES_stencil1 */
-
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif /* GL_OES_stencil4 */
-
-#ifndef GL_OES_stencil8
-#define GL_OES_stencil8 1
-#define GL_STENCIL_INDEX8_OES 0x8D48
-#endif /* GL_OES_stencil8 */
-
-#ifndef GL_OES_stencil_wrap
-#define GL_OES_stencil_wrap 1
-#define GL_INCR_WRAP_OES 0x8507
-#define GL_DECR_WRAP_OES 0x8508
-#endif /* GL_OES_stencil_wrap */
-
-#ifndef GL_OES_surfaceless_context
-#define GL_OES_surfaceless_context 1
-#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
-#endif /* GL_OES_surfaceless_context */
-
-#ifndef GL_OES_texture_cube_map
-#define GL_OES_texture_cube_map 1
-#define GL_NORMAL_MAP_OES 0x8511
-#define GL_REFLECTION_MAP_OES 0x8512
-#define GL_TEXTURE_CUBE_MAP_OES 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP_OES 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES 0x851C
-#define GL_TEXTURE_GEN_MODE_OES 0x2500
-#define GL_TEXTURE_GEN_STR_OES 0x8D60
-typedef void (GL_APIENTRYP PFNGLTEXGENFOESPROC) (GLenum coord, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLTEXGENFVOESPROC) (GLenum coord, GLenum pname, const GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLTEXGENIOESPROC) (GLenum coord, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLTEXGENIVOESPROC) (GLenum coord, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENFVOESPROC) (GLenum coord, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXGENIVOESPROC) (GLenum coord, GLenum pname, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glTexGenfOES (GLenum coord, GLenum pname, GLfloat param);
-GL_API void GL_APIENTRY glTexGenfvOES (GLenum coord, GLenum pname, const GLfloat *params);
-GL_API void GL_APIENTRY glTexGeniOES (GLenum coord, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glTexGenivOES (GLenum coord, GLenum pname, const GLint *params);
-GL_API void GL_APIENTRY glGetTexGenfvOES (GLenum coord, GLenum pname, GLfloat *params);
-GL_API void GL_APIENTRY glGetTexGenivOES (GLenum coord, GLenum pname, GLint *params);
-#endif
-#endif /* GL_OES_texture_cube_map */
-
-#ifndef GL_OES_texture_env_crossbar
-#define GL_OES_texture_env_crossbar 1
-#endif /* GL_OES_texture_env_crossbar */
-
-#ifndef GL_OES_texture_mirrored_repeat
-#define GL_OES_texture_mirrored_repeat 1
-#define GL_MIRRORED_REPEAT_OES 0x8370
-#endif /* GL_OES_texture_mirrored_repeat */
-
-#ifndef GL_OES_texture_npot
-#define GL_OES_texture_npot 1
-#endif /* GL_OES_texture_npot */
-
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_API void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_API void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_API GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
-#endif
-#endif /* GL_OES_vertex_array_object */
-
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif /* GL_AMD_compressed_3DC_texture */
-
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#define GL_ATC_RGB_AMD 0x8C92
-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
-#endif /* GL_AMD_compressed_ATC_texture */
-
-#ifndef GL_APPLE_copy_texture_levels
-#define GL_APPLE_copy_texture_levels 1
-typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#endif
-#endif /* GL_APPLE_copy_texture_levels */
-
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
-#define GL_MAX_SAMPLES_APPLE 0x8D57
-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif
-#endif /* GL_APPLE_framebuffer_multisample */
-
-#ifndef GL_APPLE_sync
-#define GL_APPLE_sync 1
-typedef struct __GLsync *GLsync;
-typedef khronos_uint64_t GLuint64;
-typedef khronos_int64_t GLint64;
-#define GL_SYNC_OBJECT_APPLE 0x8A53
-#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
-#define GL_OBJECT_TYPE_APPLE 0x9112
-#define GL_SYNC_CONDITION_APPLE 0x9113
-#define GL_SYNC_STATUS_APPLE 0x9114
-#define GL_SYNC_FLAGS_APPLE 0x9115
-#define GL_SYNC_FENCE_APPLE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
-#define GL_UNSIGNALED_APPLE 0x9118
-#define GL_SIGNALED_APPLE 0x9119
-#define GL_ALREADY_SIGNALED_APPLE 0x911A
-#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
-#define GL_CONDITION_SATISFIED_APPLE 0x911C
-#define GL_WAIT_FAILED_APPLE 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
-#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
-typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
-GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
-GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
-GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
-GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#endif
-#endif /* GL_APPLE_sync */
-
-#ifndef GL_APPLE_texture_2D_limited_npot
-#define GL_APPLE_texture_2D_limited_npot 1
-#endif /* GL_APPLE_texture_2D_limited_npot */
-
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#define GL_BGRA_EXT 0x80E1
-#define GL_BGRA8_EXT 0x93A1
-#endif /* GL_APPLE_texture_format_BGRA8888 */
-
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif /* GL_APPLE_texture_max_level */
-
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif /* GL_ARM_rgba8 */
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif /* GL_EXT_blend_minmax */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-typedef char GLchar;
-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GL_API void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GL_API void GL_APIENTRY glPopGroupMarkerEXT (void);
-#endif
-#endif /* GL_EXT_debug_marker */
-
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-#endif /* GL_EXT_discard_framebuffer */
-
-#ifndef GL_EXT_map_buffer_range
-#define GL_EXT_map_buffer_range 1
-#define GL_MAP_READ_BIT_EXT 0x0001
-#define GL_MAP_WRITE_BIT_EXT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
-#endif
-#endif /* GL_EXT_map_buffer_range */
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_multi_draw_arrays */
-
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_EXT_multisampled_render_to_texture */
-
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
-#endif /* GL_EXT_read_format_bgra */
-
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_API void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_API void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GL_API void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_EXT_robustness */
-
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif /* GL_EXT_sRGB */
-
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif /* GL_EXT_texture_compression_dxt1 */
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif /* GL_EXT_texture_format_BGRA8888 */
-
-#ifndef GL_EXT_texture_lod_bias
-#define GL_EXT_texture_lod_bias 1
-#define GL_MAX_TEXTURE_LOD_BIAS_EXT 0x84FD
-#define GL_TEXTURE_FILTER_CONTROL_EXT 0x8500
-#define GL_TEXTURE_LOD_BIAS_EXT 0x8501
-#endif /* GL_EXT_texture_lod_bias */
-
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-#define GL_RGBA16F_EXT 0x881A
-#define GL_RGB16F_EXT 0x881B
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#define GL_R32F_EXT 0x822E
-#define GL_RG32F_EXT 0x8230
-#define GL_R16F_EXT 0x822D
-#define GL_RG16F_EXT 0x822F
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_API void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_API void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_API void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* GL_EXT_texture_storage */
-
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
-#define GL_MAX_SAMPLES_IMG 0x9135
-#define GL_TEXTURE_SAMPLES_IMG 0x9136
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_IMG_multisampled_render_to_texture */
-
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif /* GL_IMG_read_format */
-
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
-#endif /* GL_IMG_texture_compression_pvrtc */
-
-#ifndef GL_IMG_texture_env_enhanced_fixed_function
-#define GL_IMG_texture_env_enhanced_fixed_function 1
-#define GL_MODULATE_COLOR_IMG 0x8C04
-#define GL_RECIP_ADD_SIGNED_ALPHA_IMG 0x8C05
-#define GL_TEXTURE_ALPHA_MODULATE_IMG 0x8C06
-#define GL_FACTOR_ALPHA_MODULATE_IMG 0x8C07
-#define GL_FRAGMENT_ALPHA_MODULATE_IMG 0x8C08
-#define GL_ADD_BLEND_IMG 0x8C09
-#define GL_DOT3_RGBA_IMG 0x86AF
-#endif /* GL_IMG_texture_env_enhanced_fixed_function */
-
-#ifndef GL_IMG_user_clip_plane
-#define GL_IMG_user_clip_plane 1
-#define GL_CLIP_PLANE0_IMG 0x3000
-#define GL_CLIP_PLANE1_IMG 0x3001
-#define GL_CLIP_PLANE2_IMG 0x3002
-#define GL_CLIP_PLANE3_IMG 0x3003
-#define GL_CLIP_PLANE4_IMG 0x3004
-#define GL_CLIP_PLANE5_IMG 0x3005
-#define GL_MAX_CLIP_PLANES_IMG 0x0D32
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn);
-typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glClipPlanefIMG (GLenum p, const GLfloat *eqn);
-GL_API void GL_APIENTRY glClipPlanexIMG (GLenum p, const GLfixed *eqn);
-#endif
-#endif /* GL_IMG_user_clip_plane */
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GL_API void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
-GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
-GL_API void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glFinishFenceNV (GLuint fence);
-GL_API void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-#endif /* GL_NV_fence */
-
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_API void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_API void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_API void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
-#endif
-#endif /* GL_QCOM_driver_control */
-
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
-#define GL_STATE_RESTORE 0x8BDC
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_API void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_API void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_API void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_API void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_API void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_API void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
-GL_API void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
-#endif
-#endif /* GL_QCOM_extended_get */
-
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_API void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_API GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_API void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-#endif /* GL_QCOM_extended_get2 */
-
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif /* GL_QCOM_perfmon_global_mode */
-
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_API void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_API void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
-#endif
-#endif /* GL_QCOM_tiled_rendering */
-
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif /* GL_QCOM_writeonly_rendering */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES/glplatform.h b/include/GLES/glplatform.h
deleted file mode 100644
index 16060a9a7..000000000
--- a/include/GLES/glplatform.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __glplatform_h_
-#define __glplatform_h_
-
-/*
-** Copyright (c) 2017 The Khronos Group Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-/* Platform-specific types and definitions for OpenGL ES 1.X gl.h
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * Please contribute modifications back to Khronos as pull requests on the
- * public github repository:
- * https://github.com/KhronosGroup/OpenGL-Registry
- */
-
-#include <KHR/khrplatform.h>
-
-#ifndef GL_API
-#define GL_API KHRONOS_APICALL
-#endif
-
-#ifndef GL_APIENTRY
-#define GL_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#endif /* __glplatform_h_ */
diff --git a/include/GLES2/gl2.h b/include/GLES2/gl2.h
deleted file mode 100644
index 5e8e4c5d1..000000000
--- a/include/GLES2/gl2.h
+++ /dev/null
@@ -1,675 +0,0 @@
-#ifndef __gles2_gl2_h_
-#define __gles2_gl2_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#include <GLES2/gl2platform.h>
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-#ifndef GL_GLES_PROTOTYPES
-#define GL_GLES_PROTOTYPES 1
-#endif
-
-/* Generated on date 20180525 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_DELETE_STATUS 0x8B80
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_INVERT 0x150A
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_TEXTURE 0x1702
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGB565 0x8D62
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_STENCIL_INDEX8 0x8D48
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-#define GL_NONE 0
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
-typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
-typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
-typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
-typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
-typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
-typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
-typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
-typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
-typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
-typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
-typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
-typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
-typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
-typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
-typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
-typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
-typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
-typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
-typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
-typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
-typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
-typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
-typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
-typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-#if GL_GLES_PROTOTYPES
-GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
-GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
-GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
-GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
-GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
-GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
-GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glFinish (void);
-GL_APICALL void GL_APIENTRY glFlush (void);
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
-GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
-GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL GLenum GL_APIENTRY glGetError (void);
-GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
-GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
-GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
-GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_ES_VERSION_2_0 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES2/gl2ext.h b/include/GLES2/gl2ext.h
deleted file mode 100644
index 94d5dba3f..000000000
--- a/include/GLES2/gl2ext.h
+++ /dev/null
@@ -1,3619 +0,0 @@
-#ifndef __gles2_gl2ext_h_
-#define __gles2_gl2ext_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-/* Generated on date 20180525 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]
- * Versions emitted: _nomatch_^
- * Default extensions included: gles2
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_KHR_blend_equation_advanced
-#define GL_KHR_blend_equation_advanced 1
-#define GL_MULTIPLY_KHR 0x9294
-#define GL_SCREEN_KHR 0x9295
-#define GL_OVERLAY_KHR 0x9296
-#define GL_DARKEN_KHR 0x9297
-#define GL_LIGHTEN_KHR 0x9298
-#define GL_COLORDODGE_KHR 0x9299
-#define GL_COLORBURN_KHR 0x929A
-#define GL_HARDLIGHT_KHR 0x929B
-#define GL_SOFTLIGHT_KHR 0x929C
-#define GL_DIFFERENCE_KHR 0x929E
-#define GL_EXCLUSION_KHR 0x92A0
-#define GL_HSL_HUE_KHR 0x92AD
-#define GL_HSL_SATURATION_KHR 0x92AE
-#define GL_HSL_COLOR_KHR 0x92AF
-#define GL_HSL_LUMINOSITY_KHR 0x92B0
-typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void);
-#endif
-#endif /* GL_KHR_blend_equation_advanced */
-
-#ifndef GL_KHR_blend_equation_advanced_coherent
-#define GL_KHR_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285
-#endif /* GL_KHR_blend_equation_advanced_coherent */
-
-#ifndef GL_KHR_context_flush_control
-#define GL_KHR_context_flush_control 1
-#define GL_CONTEXT_RELEASE_BEHAVIOR_KHR 0x82FB
-#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH_KHR 0x82FC
-#endif /* GL_KHR_context_flush_control */
-
-#ifndef GL_KHR_debug
-#define GL_KHR_debug 1
-typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam);
-#define GL_SAMPLER 0x82E6
-#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242
-#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243
-#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244
-#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245
-#define GL_DEBUG_SOURCE_API_KHR 0x8246
-#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247
-#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248
-#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249
-#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A
-#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B
-#define GL_DEBUG_TYPE_ERROR_KHR 0x824C
-#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D
-#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E
-#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F
-#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250
-#define GL_DEBUG_TYPE_OTHER_KHR 0x8251
-#define GL_DEBUG_TYPE_MARKER_KHR 0x8268
-#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269
-#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A
-#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B
-#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C
-#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D
-#define GL_BUFFER_KHR 0x82E0
-#define GL_SHADER_KHR 0x82E1
-#define GL_PROGRAM_KHR 0x82E2
-#define GL_VERTEX_ARRAY_KHR 0x8074
-#define GL_QUERY_KHR 0x82E3
-#define GL_PROGRAM_PIPELINE_KHR 0x82E4
-#define GL_SAMPLER_KHR 0x82E6
-#define GL_MAX_LABEL_LENGTH_KHR 0x82E8
-#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143
-#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144
-#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145
-#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146
-#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147
-#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148
-#define GL_DEBUG_OUTPUT_KHR 0x92E0
-#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002
-#define GL_STACK_OVERFLOW_KHR 0x0503
-#define GL_STACK_UNDERFLOW_KHR 0x0504
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam);
-typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void);
-typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled);
-GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf);
-GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam);
-GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog);
-GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message);
-GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void);
-GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label);
-GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params);
-#endif
-#endif /* GL_KHR_debug */
-
-#ifndef GL_KHR_no_error
-#define GL_KHR_no_error 1
-#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
-#endif /* GL_KHR_no_error */
-
-#ifndef GL_KHR_parallel_shader_compile
-#define GL_KHR_parallel_shader_compile 1
-#define GL_MAX_SHADER_COMPILER_THREADS_KHR 0x91B0
-#define GL_COMPLETION_STATUS_KHR 0x91B1
-typedef void (GL_APIENTRYP PFNGLMAXSHADERCOMPILERTHREADSKHRPROC) (GLuint count);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMaxShaderCompilerThreadsKHR (GLuint count);
-#endif
-#endif /* GL_KHR_parallel_shader_compile */
-
-#ifndef GL_KHR_robust_buffer_access_behavior
-#define GL_KHR_robust_buffer_access_behavior 1
-#endif /* GL_KHR_robust_buffer_access_behavior */
-
-#ifndef GL_KHR_robustness
-#define GL_KHR_robustness 1
-#define GL_CONTEXT_ROBUST_ACCESS_KHR 0x90F3
-#define GL_LOSE_CONTEXT_ON_RESET_KHR 0x8252
-#define GL_GUILTY_CONTEXT_RESET_KHR 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_KHR 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_KHR 0x8255
-#define GL_RESET_NOTIFICATION_STRATEGY_KHR 0x8256
-#define GL_NO_RESET_NOTIFICATION_KHR 0x8261
-#define GL_CONTEXT_LOST_KHR 0x0507
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSKHRPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSKHRPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMUIVKHRPROC) (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusKHR (void);
-GL_APICALL void GL_APIENTRY glReadnPixelsKHR (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_APICALL void GL_APIENTRY glGetnUniformfvKHR (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetnUniformivKHR (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-GL_APICALL void GL_APIENTRY glGetnUniformuivKHR (GLuint program, GLint location, GLsizei bufSize, GLuint *params);
-#endif
-#endif /* GL_KHR_robustness */
-
-#ifndef GL_KHR_texture_compression_astc_hdr
-#define GL_KHR_texture_compression_astc_hdr 1
-#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0
-#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1
-#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2
-#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3
-#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4
-#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5
-#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6
-#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7
-#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8
-#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9
-#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA
-#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB
-#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC
-#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD
-#endif /* GL_KHR_texture_compression_astc_hdr */
-
-#ifndef GL_KHR_texture_compression_astc_ldr
-#define GL_KHR_texture_compression_astc_ldr 1
-#endif /* GL_KHR_texture_compression_astc_ldr */
-
-#ifndef GL_KHR_texture_compression_astc_sliced_3d
-#define GL_KHR_texture_compression_astc_sliced_3d 1
-#endif /* GL_KHR_texture_compression_astc_sliced_3d */
-
-#ifndef GL_OES_EGL_image
-#define GL_OES_EGL_image 1
-typedef void *GLeglImageOES;
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image);
-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image);
-#endif
-#endif /* GL_OES_EGL_image */
-
-#ifndef GL_OES_EGL_image_external
-#define GL_OES_EGL_image_external 1
-#define GL_TEXTURE_EXTERNAL_OES 0x8D65
-#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67
-#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68
-#define GL_SAMPLER_EXTERNAL_OES 0x8D66
-#endif /* GL_OES_EGL_image_external */
-
-#ifndef GL_OES_EGL_image_external_essl3
-#define GL_OES_EGL_image_external_essl3 1
-#endif /* GL_OES_EGL_image_external_essl3 */
-
-#ifndef GL_OES_compressed_ETC1_RGB8_sub_texture
-#define GL_OES_compressed_ETC1_RGB8_sub_texture 1
-#endif /* GL_OES_compressed_ETC1_RGB8_sub_texture */
-
-#ifndef GL_OES_compressed_ETC1_RGB8_texture
-#define GL_OES_compressed_ETC1_RGB8_texture 1
-#define GL_ETC1_RGB8_OES 0x8D64
-#endif /* GL_OES_compressed_ETC1_RGB8_texture */
-
-#ifndef GL_OES_compressed_paletted_texture
-#define GL_OES_compressed_paletted_texture 1
-#define GL_PALETTE4_RGB8_OES 0x8B90
-#define GL_PALETTE4_RGBA8_OES 0x8B91
-#define GL_PALETTE4_R5_G6_B5_OES 0x8B92
-#define GL_PALETTE4_RGBA4_OES 0x8B93
-#define GL_PALETTE4_RGB5_A1_OES 0x8B94
-#define GL_PALETTE8_RGB8_OES 0x8B95
-#define GL_PALETTE8_RGBA8_OES 0x8B96
-#define GL_PALETTE8_R5_G6_B5_OES 0x8B97
-#define GL_PALETTE8_RGBA4_OES 0x8B98
-#define GL_PALETTE8_RGB5_A1_OES 0x8B99
-#endif /* GL_OES_compressed_paletted_texture */
-
-#ifndef GL_OES_copy_image
-#define GL_OES_copy_image 1
-typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAOESPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyImageSubDataOES (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#endif
-#endif /* GL_OES_copy_image */
-
-#ifndef GL_OES_depth24
-#define GL_OES_depth24 1
-#define GL_DEPTH_COMPONENT24_OES 0x81A6
-#endif /* GL_OES_depth24 */
-
-#ifndef GL_OES_depth32
-#define GL_OES_depth32 1
-#define GL_DEPTH_COMPONENT32_OES 0x81A7
-#endif /* GL_OES_depth32 */
-
-#ifndef GL_OES_depth_texture
-#define GL_OES_depth_texture 1
-#endif /* GL_OES_depth_texture */
-
-#ifndef GL_OES_draw_buffers_indexed
-#define GL_OES_draw_buffers_indexed 1
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-typedef void (GL_APIENTRYP PFNGLENABLEIOESPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLDISABLEIOESPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIOESPROC) (GLuint buf, GLenum mode);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIOESPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCIOESPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIOESPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (GL_APIENTRYP PFNGLCOLORMASKIOESPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIOESPROC) (GLenum target, GLuint index);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEnableiOES (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glDisableiOES (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glBlendEquationiOES (GLuint buf, GLenum mode);
-GL_APICALL void GL_APIENTRY glBlendEquationSeparateiOES (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunciOES (GLuint buf, GLenum src, GLenum dst);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparateiOES (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glColorMaskiOES (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-GL_APICALL GLboolean GL_APIENTRY glIsEnablediOES (GLenum target, GLuint index);
-#endif
-#endif /* GL_OES_draw_buffers_indexed */
-
-#ifndef GL_OES_draw_elements_base_vertex
-#define GL_OES_draw_elements_base_vertex 1
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXOESPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXOESPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexOES (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexOES (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsBaseVertexEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount, const GLint *basevertex);
-#endif
-#endif /* GL_OES_draw_elements_base_vertex */
-
-#ifndef GL_OES_element_index_uint
-#define GL_OES_element_index_uint 1
-#endif /* GL_OES_element_index_uint */
-
-#ifndef GL_OES_fbo_render_mipmap
-#define GL_OES_fbo_render_mipmap 1
-#endif /* GL_OES_fbo_render_mipmap */
-
-#ifndef GL_OES_fragment_precision_high
-#define GL_OES_fragment_precision_high 1
-#endif /* GL_OES_fragment_precision_high */
-
-#ifndef GL_OES_geometry_point_size
-#define GL_OES_geometry_point_size 1
-#endif /* GL_OES_geometry_point_size */
-
-#ifndef GL_OES_geometry_shader
-#define GL_OES_geometry_shader 1
-#define GL_GEOMETRY_SHADER_OES 0x8DD9
-#define GL_GEOMETRY_SHADER_BIT_OES 0x00000004
-#define GL_GEOMETRY_LINKED_VERTICES_OUT_OES 0x8916
-#define GL_GEOMETRY_LINKED_INPUT_TYPE_OES 0x8917
-#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_OES 0x8918
-#define GL_GEOMETRY_SHADER_INVOCATIONS_OES 0x887F
-#define GL_LAYER_PROVOKING_VERTEX_OES 0x825E
-#define GL_LINES_ADJACENCY_OES 0x000A
-#define GL_LINE_STRIP_ADJACENCY_OES 0x000B
-#define GL_TRIANGLES_ADJACENCY_OES 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_OES 0x000D
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8DDF
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_OES 0x8A2C
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_OES 0x8A32
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_OES 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_OES 0x9124
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_OES 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_OES 0x8DE1
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_OES 0x8E5A
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_OES 0x8C29
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_OES 0x92CF
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_OES 0x92D5
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_OES 0x90CD
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_OES 0x90D7
-#define GL_FIRST_VERTEX_CONVENTION_OES 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION_OES 0x8E4E
-#define GL_UNDEFINED_VERTEX_OES 0x8260
-#define GL_PRIMITIVES_GENERATED_OES 0x8C87
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS_OES 0x9312
-#define GL_MAX_FRAMEBUFFER_LAYERS_OES 0x9317
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_OES 0x8DA8
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_OES 0x8DA7
-#define GL_REFERENCED_BY_GEOMETRY_SHADER_OES 0x9309
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREOESPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTextureOES (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#endif
-#endif /* GL_OES_geometry_shader */
-
-#ifndef GL_OES_get_program_binary
-#define GL_OES_get_program_binary 1
-#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length);
-#endif
-#endif /* GL_OES_get_program_binary */
-
-#ifndef GL_OES_gpu_shader5
-#define GL_OES_gpu_shader5 1
-#endif /* GL_OES_gpu_shader5 */
-
-#ifndef GL_OES_mapbuffer
-#define GL_OES_mapbuffer 1
-#define GL_WRITE_ONLY_OES 0x88B9
-#define GL_BUFFER_ACCESS_OES 0x88BB
-#define GL_BUFFER_MAPPED_OES 0x88BC
-#define GL_BUFFER_MAP_POINTER_OES 0x88BD
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params);
-#endif
-#endif /* GL_OES_mapbuffer */
-
-#ifndef GL_OES_packed_depth_stencil
-#define GL_OES_packed_depth_stencil 1
-#define GL_DEPTH_STENCIL_OES 0x84F9
-#define GL_UNSIGNED_INT_24_8_OES 0x84FA
-#define GL_DEPTH24_STENCIL8_OES 0x88F0
-#endif /* GL_OES_packed_depth_stencil */
-
-#ifndef GL_OES_primitive_bounding_box
-#define GL_OES_primitive_bounding_box 1
-#define GL_PRIMITIVE_BOUNDING_BOX_OES 0x92BE
-typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXOESPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxOES (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#endif
-#endif /* GL_OES_primitive_bounding_box */
-
-#ifndef GL_OES_required_internalformat
-#define GL_OES_required_internalformat 1
-#define GL_ALPHA8_OES 0x803C
-#define GL_DEPTH_COMPONENT16_OES 0x81A5
-#define GL_LUMINANCE4_ALPHA4_OES 0x8043
-#define GL_LUMINANCE8_ALPHA8_OES 0x8045
-#define GL_LUMINANCE8_OES 0x8040
-#define GL_RGBA4_OES 0x8056
-#define GL_RGB5_A1_OES 0x8057
-#define GL_RGB565_OES 0x8D62
-#define GL_RGB8_OES 0x8051
-#define GL_RGBA8_OES 0x8058
-#define GL_RGB10_EXT 0x8052
-#define GL_RGB10_A2_EXT 0x8059
-#endif /* GL_OES_required_internalformat */
-
-#ifndef GL_OES_rgb8_rgba8
-#define GL_OES_rgb8_rgba8 1
-#endif /* GL_OES_rgb8_rgba8 */
-
-#ifndef GL_OES_sample_shading
-#define GL_OES_sample_shading 1
-#define GL_SAMPLE_SHADING_OES 0x8C36
-#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37
-typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value);
-#endif
-#endif /* GL_OES_sample_shading */
-
-#ifndef GL_OES_sample_variables
-#define GL_OES_sample_variables 1
-#endif /* GL_OES_sample_variables */
-
-#ifndef GL_OES_shader_image_atomic
-#define GL_OES_shader_image_atomic 1
-#endif /* GL_OES_shader_image_atomic */
-
-#ifndef GL_OES_shader_io_blocks
-#define GL_OES_shader_io_blocks 1
-#endif /* GL_OES_shader_io_blocks */
-
-#ifndef GL_OES_shader_multisample_interpolation
-#define GL_OES_shader_multisample_interpolation 1
-#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B
-#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C
-#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D
-#endif /* GL_OES_shader_multisample_interpolation */
-
-#ifndef GL_OES_standard_derivatives
-#define GL_OES_standard_derivatives 1
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B
-#endif /* GL_OES_standard_derivatives */
-
-#ifndef GL_OES_stencil1
-#define GL_OES_stencil1 1
-#define GL_STENCIL_INDEX1_OES 0x8D46
-#endif /* GL_OES_stencil1 */
-
-#ifndef GL_OES_stencil4
-#define GL_OES_stencil4 1
-#define GL_STENCIL_INDEX4_OES 0x8D47
-#endif /* GL_OES_stencil4 */
-
-#ifndef GL_OES_surfaceless_context
-#define GL_OES_surfaceless_context 1
-#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219
-#endif /* GL_OES_surfaceless_context */
-
-#ifndef GL_OES_tessellation_point_size
-#define GL_OES_tessellation_point_size 1
-#endif /* GL_OES_tessellation_point_size */
-
-#ifndef GL_OES_tessellation_shader
-#define GL_OES_tessellation_shader 1
-#define GL_PATCHES_OES 0x000E
-#define GL_PATCH_VERTICES_OES 0x8E72
-#define GL_TESS_CONTROL_OUTPUT_VERTICES_OES 0x8E75
-#define GL_TESS_GEN_MODE_OES 0x8E76
-#define GL_TESS_GEN_SPACING_OES 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER_OES 0x8E78
-#define GL_TESS_GEN_POINT_MODE_OES 0x8E79
-#define GL_ISOLINES_OES 0x8E7A
-#define GL_QUADS_OES 0x0007
-#define GL_FRACTIONAL_ODD_OES 0x8E7B
-#define GL_FRACTIONAL_EVEN_OES 0x8E7C
-#define GL_MAX_PATCH_VERTICES_OES 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL_OES 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_OES 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_OES 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_OES 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS_OES 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_OES 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_OES 0x8E86
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_OES 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_OES 0x8E8A
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_OES 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_OES 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_OES 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_OES 0x8E1F
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_OES 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_OES 0x92CE
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_OES 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_OES 0x92D4
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_OES 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_OES 0x90CC
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_OES 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_OES 0x90D9
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED_OES 0x8221
-#define GL_IS_PER_PATCH_OES 0x92E7
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_OES 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_OES 0x9308
-#define GL_TESS_CONTROL_SHADER_OES 0x8E88
-#define GL_TESS_EVALUATION_SHADER_OES 0x8E87
-#define GL_TESS_CONTROL_SHADER_BIT_OES 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT_OES 0x00000010
-typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIOESPROC) (GLenum pname, GLint value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPatchParameteriOES (GLenum pname, GLint value);
-#endif
-#endif /* GL_OES_tessellation_shader */
-
-#ifndef GL_OES_texture_3D
-#define GL_OES_texture_3D 1
-#define GL_TEXTURE_WRAP_R_OES 0x8072
-#define GL_TEXTURE_3D_OES 0x806F
-#define GL_TEXTURE_BINDING_3D_OES 0x806A
-#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073
-#define GL_SAMPLER_3D_OES 0x8B5F
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
-#endif
-#endif /* GL_OES_texture_3D */
-
-#ifndef GL_OES_texture_border_clamp
-#define GL_OES_texture_border_clamp 1
-#define GL_TEXTURE_BORDER_COLOR_OES 0x1004
-#define GL_CLAMP_TO_BORDER_OES 0x812D
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVOESPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVOESPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, const GLuint *param);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVOESPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVOESPROC) (GLuint sampler, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexParameterIivOES (GLenum target, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glTexParameterIuivOES (GLenum target, GLenum pname, const GLuint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIivOES (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIuivOES (GLenum target, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glSamplerParameterIivOES (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterIuivOES (GLuint sampler, GLenum pname, const GLuint *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIivOES (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivOES (GLuint sampler, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_OES_texture_border_clamp */
-
-#ifndef GL_OES_texture_buffer
-#define GL_OES_texture_buffer 1
-#define GL_TEXTURE_BUFFER_OES 0x8C2A
-#define GL_TEXTURE_BUFFER_BINDING_OES 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_OES 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_OES 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_OES 0x8C2D
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_OES 0x919F
-#define GL_SAMPLER_BUFFER_OES 0x8DC2
-#define GL_INT_SAMPLER_BUFFER_OES 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_OES 0x8DD8
-#define GL_IMAGE_BUFFER_OES 0x9051
-#define GL_INT_IMAGE_BUFFER_OES 0x905C
-#define GL_UNSIGNED_INT_IMAGE_BUFFER_OES 0x9067
-#define GL_TEXTURE_BUFFER_OFFSET_OES 0x919D
-#define GL_TEXTURE_BUFFER_SIZE_OES 0x919E
-typedef void (GL_APIENTRYP PFNGLTEXBUFFEROESPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEOESPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexBufferOES (GLenum target, GLenum internalformat, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTexBufferRangeOES (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#endif
-#endif /* GL_OES_texture_buffer */
-
-#ifndef GL_OES_texture_compression_astc
-#define GL_OES_texture_compression_astc 1
-#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0
-#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1
-#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2
-#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3
-#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4
-#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5
-#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6
-#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7
-#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8
-#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8
-#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9
-#endif /* GL_OES_texture_compression_astc */
-
-#ifndef GL_OES_texture_cube_map_array
-#define GL_OES_texture_cube_map_array 1
-#define GL_TEXTURE_CUBE_MAP_ARRAY_OES 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_OES 0x900A
-#define GL_SAMPLER_CUBE_MAP_ARRAY_OES 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_OES 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_OES 0x900F
-#define GL_IMAGE_CUBE_MAP_ARRAY_OES 0x9054
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x905F
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_OES 0x906A
-#endif /* GL_OES_texture_cube_map_array */
-
-#ifndef GL_OES_texture_float
-#define GL_OES_texture_float 1
-#endif /* GL_OES_texture_float */
-
-#ifndef GL_OES_texture_float_linear
-#define GL_OES_texture_float_linear 1
-#endif /* GL_OES_texture_float_linear */
-
-#ifndef GL_OES_texture_half_float
-#define GL_OES_texture_half_float 1
-#define GL_HALF_FLOAT_OES 0x8D61
-#endif /* GL_OES_texture_half_float */
-
-#ifndef GL_OES_texture_half_float_linear
-#define GL_OES_texture_half_float_linear 1
-#endif /* GL_OES_texture_half_float_linear */
-
-#ifndef GL_OES_texture_npot
-#define GL_OES_texture_npot 1
-#endif /* GL_OES_texture_npot */
-
-#ifndef GL_OES_texture_stencil8
-#define GL_OES_texture_stencil8 1
-#define GL_STENCIL_INDEX_OES 0x1901
-#define GL_STENCIL_INDEX8_OES 0x8D48
-#endif /* GL_OES_texture_stencil8 */
-
-#ifndef GL_OES_texture_storage_multisample_2d_array
-#define GL_OES_texture_storage_multisample_2d_array 1
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102
-#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105
-#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B
-#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C
-#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations);
-#endif
-#endif /* GL_OES_texture_storage_multisample_2d_array */
-
-#ifndef GL_OES_texture_view
-#define GL_OES_texture_view 1
-#define GL_TEXTURE_VIEW_MIN_LEVEL_OES 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS_OES 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER_OES 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS_OES 0x82DE
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWOESPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTextureViewOES (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#endif
-#endif /* GL_OES_texture_view */
-
-#ifndef GL_OES_vertex_array_object
-#define GL_OES_vertex_array_object 1
-#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array);
-#endif
-#endif /* GL_OES_vertex_array_object */
-
-#ifndef GL_OES_vertex_half_float
-#define GL_OES_vertex_half_float 1
-#endif /* GL_OES_vertex_half_float */
-
-#ifndef GL_OES_vertex_type_10_10_10_2
-#define GL_OES_vertex_type_10_10_10_2 1
-#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6
-#define GL_INT_10_10_10_2_OES 0x8DF7
-#endif /* GL_OES_vertex_type_10_10_10_2 */
-
-#ifndef GL_OES_viewport_array
-#define GL_OES_viewport_array 1
-#define GL_MAX_VIEWPORTS_OES 0x825B
-#define GL_VIEWPORT_SUBPIXEL_BITS_OES 0x825C
-#define GL_VIEWPORT_BOUNDS_RANGE_OES 0x825D
-#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_OES 0x825F
-typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFOESPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVOESPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVOESPROC) (GLuint first, GLsizei count, const GLint *v);
-typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDOESPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVOESPROC) (GLuint index, const GLint *v);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVOESPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFOESPROC) (GLuint index, GLfloat n, GLfloat f);
-typedef void (GL_APIENTRYP PFNGLGETFLOATI_VOESPROC) (GLenum target, GLuint index, GLfloat *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glViewportArrayvOES (GLuint first, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glViewportIndexedfOES (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-GL_APICALL void GL_APIENTRY glViewportIndexedfvOES (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glScissorArrayvOES (GLuint first, GLsizei count, const GLint *v);
-GL_APICALL void GL_APIENTRY glScissorIndexedOES (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glScissorIndexedvOES (GLuint index, const GLint *v);
-GL_APICALL void GL_APIENTRY glDepthRangeArrayfvOES (GLuint first, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glDepthRangeIndexedfOES (GLuint index, GLfloat n, GLfloat f);
-GL_APICALL void GL_APIENTRY glGetFloati_vOES (GLenum target, GLuint index, GLfloat *data);
-#endif
-#endif /* GL_OES_viewport_array */
-
-#ifndef GL_AMD_compressed_3DC_texture
-#define GL_AMD_compressed_3DC_texture 1
-#define GL_3DC_X_AMD 0x87F9
-#define GL_3DC_XY_AMD 0x87FA
-#endif /* GL_AMD_compressed_3DC_texture */
-
-#ifndef GL_AMD_compressed_ATC_texture
-#define GL_AMD_compressed_ATC_texture 1
-#define GL_ATC_RGB_AMD 0x8C92
-#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
-#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE
-#endif /* GL_AMD_compressed_ATC_texture */
-
-#ifndef GL_AMD_performance_monitor
-#define GL_AMD_performance_monitor 1
-#define GL_COUNTER_TYPE_AMD 0x8BC0
-#define GL_COUNTER_RANGE_AMD 0x8BC1
-#define GL_UNSIGNED_INT64_AMD 0x8BC2
-#define GL_PERCENTAGE_AMD 0x8BC3
-#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4
-#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5
-#define GL_PERFMON_RESULT_AMD 0x8BC6
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data);
-typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors);
-typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor);
-typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data);
-GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors);
-GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList);
-GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor);
-GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten);
-#endif
-#endif /* GL_AMD_performance_monitor */
-
-#ifndef GL_AMD_program_binary_Z400
-#define GL_AMD_program_binary_Z400 1
-#define GL_Z400_BINARY_AMD 0x8740
-#endif /* GL_AMD_program_binary_Z400 */
-
-#ifndef GL_ANDROID_extension_pack_es31a
-#define GL_ANDROID_extension_pack_es31a 1
-#endif /* GL_ANDROID_extension_pack_es31a */
-
-#ifndef GL_ANGLE_depth_texture
-#define GL_ANGLE_depth_texture 1
-#endif /* GL_ANGLE_depth_texture */
-
-#ifndef GL_ANGLE_framebuffer_blit
-#define GL_ANGLE_framebuffer_blit 1
-#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* GL_ANGLE_framebuffer_blit */
-
-#ifndef GL_ANGLE_framebuffer_multisample
-#define GL_ANGLE_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56
-#define GL_MAX_SAMPLES_ANGLE 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_ANGLE_framebuffer_multisample */
-
-#ifndef GL_ANGLE_instanced_arrays
-#define GL_ANGLE_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_ANGLE_instanced_arrays */
-
-#ifndef GL_ANGLE_pack_reverse_row_order
-#define GL_ANGLE_pack_reverse_row_order 1
-#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
-#endif /* GL_ANGLE_pack_reverse_row_order */
-
-#ifndef GL_ANGLE_program_binary
-#define GL_ANGLE_program_binary 1
-#define GL_PROGRAM_BINARY_ANGLE 0x93A6
-#endif /* GL_ANGLE_program_binary */
-
-#ifndef GL_ANGLE_texture_compression_dxt3
-#define GL_ANGLE_texture_compression_dxt3 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2
-#endif /* GL_ANGLE_texture_compression_dxt3 */
-
-#ifndef GL_ANGLE_texture_compression_dxt5
-#define GL_ANGLE_texture_compression_dxt5 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3
-#endif /* GL_ANGLE_texture_compression_dxt5 */
-
-#ifndef GL_ANGLE_texture_usage
-#define GL_ANGLE_texture_usage 1
-#define GL_TEXTURE_USAGE_ANGLE 0x93A2
-#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3
-#endif /* GL_ANGLE_texture_usage */
-
-#ifndef GL_ANGLE_translated_shader_source
-#define GL_ANGLE_translated_shader_source 1
-#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0
-typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source);
-#endif
-#endif /* GL_ANGLE_translated_shader_source */
-
-#ifndef GL_APPLE_clip_distance
-#define GL_APPLE_clip_distance 1
-#define GL_MAX_CLIP_DISTANCES_APPLE 0x0D32
-#define GL_CLIP_DISTANCE0_APPLE 0x3000
-#define GL_CLIP_DISTANCE1_APPLE 0x3001
-#define GL_CLIP_DISTANCE2_APPLE 0x3002
-#define GL_CLIP_DISTANCE3_APPLE 0x3003
-#define GL_CLIP_DISTANCE4_APPLE 0x3004
-#define GL_CLIP_DISTANCE5_APPLE 0x3005
-#define GL_CLIP_DISTANCE6_APPLE 0x3006
-#define GL_CLIP_DISTANCE7_APPLE 0x3007
-#endif /* GL_APPLE_clip_distance */
-
-#ifndef GL_APPLE_color_buffer_packed_float
-#define GL_APPLE_color_buffer_packed_float 1
-#endif /* GL_APPLE_color_buffer_packed_float */
-
-#ifndef GL_APPLE_copy_texture_levels
-#define GL_APPLE_copy_texture_levels 1
-typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount);
-#endif
-#endif /* GL_APPLE_copy_texture_levels */
-
-#ifndef GL_APPLE_framebuffer_multisample
-#define GL_APPLE_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56
-#define GL_MAX_SAMPLES_APPLE 0x8D57
-#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void);
-#endif
-#endif /* GL_APPLE_framebuffer_multisample */
-
-#ifndef GL_APPLE_rgb_422
-#define GL_APPLE_rgb_422 1
-#define GL_RGB_422_APPLE 0x8A1F
-#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA
-#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB
-#define GL_RGB_RAW_422_APPLE 0x8A51
-#endif /* GL_APPLE_rgb_422 */
-
-#ifndef GL_APPLE_sync
-#define GL_APPLE_sync 1
-#define GL_SYNC_OBJECT_APPLE 0x8A53
-#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111
-#define GL_OBJECT_TYPE_APPLE 0x9112
-#define GL_SYNC_CONDITION_APPLE 0x9113
-#define GL_SYNC_STATUS_APPLE 0x9114
-#define GL_SYNC_FLAGS_APPLE 0x9115
-#define GL_SYNC_FENCE_APPLE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117
-#define GL_UNSIGNALED_APPLE 0x9118
-#define GL_SIGNALED_APPLE 0x9119
-#define GL_ALREADY_SIGNALED_APPLE 0x911A
-#define GL_TIMEOUT_EXPIRED_APPLE 0x911B
-#define GL_CONDITION_SATISFIED_APPLE 0x911C
-#define GL_WAIT_FAILED_APPLE 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001
-#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull
-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync);
-typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync);
-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-#endif
-#endif /* GL_APPLE_sync */
-
-#ifndef GL_APPLE_texture_format_BGRA8888
-#define GL_APPLE_texture_format_BGRA8888 1
-#define GL_BGRA_EXT 0x80E1
-#define GL_BGRA8_EXT 0x93A1
-#endif /* GL_APPLE_texture_format_BGRA8888 */
-
-#ifndef GL_APPLE_texture_max_level
-#define GL_APPLE_texture_max_level 1
-#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D
-#endif /* GL_APPLE_texture_max_level */
-
-#ifndef GL_APPLE_texture_packed_float
-#define GL_APPLE_texture_packed_float 1
-#define GL_UNSIGNED_INT_10F_11F_11F_REV_APPLE 0x8C3B
-#define GL_UNSIGNED_INT_5_9_9_9_REV_APPLE 0x8C3E
-#define GL_R11F_G11F_B10F_APPLE 0x8C3A
-#define GL_RGB9_E5_APPLE 0x8C3D
-#endif /* GL_APPLE_texture_packed_float */
-
-#ifndef GL_ARM_mali_program_binary
-#define GL_ARM_mali_program_binary 1
-#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61
-#endif /* GL_ARM_mali_program_binary */
-
-#ifndef GL_ARM_mali_shader_binary
-#define GL_ARM_mali_shader_binary 1
-#define GL_MALI_SHADER_BINARY_ARM 0x8F60
-#endif /* GL_ARM_mali_shader_binary */
-
-#ifndef GL_ARM_rgba8
-#define GL_ARM_rgba8 1
-#endif /* GL_ARM_rgba8 */
-
-#ifndef GL_ARM_shader_framebuffer_fetch
-#define GL_ARM_shader_framebuffer_fetch 1
-#define GL_FETCH_PER_SAMPLE_ARM 0x8F65
-#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66
-#endif /* GL_ARM_shader_framebuffer_fetch */
-
-#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil
-#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1
-#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */
-
-#ifndef GL_DMP_program_binary
-#define GL_DMP_program_binary 1
-#define GL_SMAPHS30_PROGRAM_BINARY_DMP 0x9251
-#define GL_SMAPHS_PROGRAM_BINARY_DMP 0x9252
-#define GL_DMP_PROGRAM_BINARY_DMP 0x9253
-#endif /* GL_DMP_program_binary */
-
-#ifndef GL_DMP_shader_binary
-#define GL_DMP_shader_binary 1
-#define GL_SHADER_BINARY_DMP 0x9250
-#endif /* GL_DMP_shader_binary */
-
-#ifndef GL_EXT_EGL_image_array
-#define GL_EXT_EGL_image_array 1
-#endif /* GL_EXT_EGL_image_array */
-
-#ifndef GL_EXT_EGL_image_storage
-#define GL_EXT_EGL_image_storage 1
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXSTORAGEEXTPROC) (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURESTORAGEEXTPROC) (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexStorageEXT (GLenum target, GLeglImageOES image, const GLint* attrib_list);
-GL_APICALL void GL_APIENTRY glEGLImageTargetTextureStorageEXT (GLuint texture, GLeglImageOES image, const GLint* attrib_list);
-#endif
-#endif /* GL_EXT_EGL_image_storage */
-
-#ifndef GL_EXT_YUV_target
-#define GL_EXT_YUV_target 1
-#define GL_SAMPLER_EXTERNAL_2D_Y2Y_EXT 0x8BE7
-#endif /* GL_EXT_YUV_target */
-
-#ifndef GL_EXT_base_instance
-#define GL_EXT_base_instance 1
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedBaseInstanceEXT (GLenum mode, GLint first, GLsizei count, GLsizei instancecount, GLuint baseinstance);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLuint baseinstance);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexBaseInstanceEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex, GLuint baseinstance);
-#endif
-#endif /* GL_EXT_base_instance */
-
-#ifndef GL_EXT_blend_func_extended
-#define GL_EXT_blend_func_extended 1
-#define GL_SRC1_COLOR_EXT 0x88F9
-#define GL_SRC1_ALPHA_EXT 0x8589
-#define GL_ONE_MINUS_SRC1_COLOR_EXT 0x88FA
-#define GL_ONE_MINUS_SRC1_ALPHA_EXT 0x88FB
-#define GL_SRC_ALPHA_SATURATE_EXT 0x0308
-#define GL_LOCATION_INDEX_EXT 0x930F
-#define GL_MAX_DUAL_SOURCE_DRAW_BUFFERS_EXT 0x88FC
-typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONINDEXEDEXTPROC) (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLBINDFRAGDATALOCATIONEXTPROC) (GLuint program, GLuint color, const GLchar *name);
-typedef GLint (GL_APIENTRYP PFNGLGETPROGRAMRESOURCELOCATIONINDEXEXTPROC) (GLuint program, GLenum programInterface, const GLchar *name);
-typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATAINDEXEXTPROC) (GLuint program, const GLchar *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBindFragDataLocationIndexedEXT (GLuint program, GLuint colorNumber, GLuint index, const GLchar *name);
-GL_APICALL void GL_APIENTRY glBindFragDataLocationEXT (GLuint program, GLuint color, const GLchar *name);
-GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocationIndexEXT (GLuint program, GLenum programInterface, const GLchar *name);
-GL_APICALL GLint GL_APIENTRY glGetFragDataIndexEXT (GLuint program, const GLchar *name);
-#endif
-#endif /* GL_EXT_blend_func_extended */
-
-#ifndef GL_EXT_blend_minmax
-#define GL_EXT_blend_minmax 1
-#define GL_MIN_EXT 0x8007
-#define GL_MAX_EXT 0x8008
-#endif /* GL_EXT_blend_minmax */
-
-#ifndef GL_EXT_buffer_storage
-#define GL_EXT_buffer_storage 1
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_PERSISTENT_BIT_EXT 0x0040
-#define GL_MAP_COHERENT_BIT_EXT 0x0080
-#define GL_DYNAMIC_STORAGE_BIT_EXT 0x0100
-#define GL_CLIENT_STORAGE_BIT_EXT 0x0200
-#define GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT_EXT 0x00004000
-#define GL_BUFFER_IMMUTABLE_STORAGE_EXT 0x821F
-#define GL_BUFFER_STORAGE_FLAGS_EXT 0x8220
-typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTPROC) (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBufferStorageEXT (GLenum target, GLsizeiptr size, const void *data, GLbitfield flags);
-#endif
-#endif /* GL_EXT_buffer_storage */
-
-#ifndef GL_EXT_clear_texture
-#define GL_EXT_clear_texture 1
-typedef void (GL_APIENTRYP PFNGLCLEARTEXIMAGEEXTPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-typedef void (GL_APIENTRYP PFNGLCLEARTEXSUBIMAGEEXTPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glClearTexImageEXT (GLuint texture, GLint level, GLenum format, GLenum type, const void *data);
-GL_APICALL void GL_APIENTRY glClearTexSubImageEXT (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
-#endif
-#endif /* GL_EXT_clear_texture */
-
-#ifndef GL_EXT_clip_control
-#define GL_EXT_clip_control 1
-#define GL_LOWER_LEFT_EXT 0x8CA1
-#define GL_UPPER_LEFT_EXT 0x8CA2
-#define GL_NEGATIVE_ONE_TO_ONE_EXT 0x935E
-#define GL_ZERO_TO_ONE_EXT 0x935F
-#define GL_CLIP_ORIGIN_EXT 0x935C
-#define GL_CLIP_DEPTH_MODE_EXT 0x935D
-typedef void (GL_APIENTRYP PFNGLCLIPCONTROLEXTPROC) (GLenum origin, GLenum depth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glClipControlEXT (GLenum origin, GLenum depth);
-#endif
-#endif /* GL_EXT_clip_control */
-
-#ifndef GL_EXT_clip_cull_distance
-#define GL_EXT_clip_cull_distance 1
-#define GL_MAX_CLIP_DISTANCES_EXT 0x0D32
-#define GL_MAX_CULL_DISTANCES_EXT 0x82F9
-#define GL_MAX_COMBINED_CLIP_AND_CULL_DISTANCES_EXT 0x82FA
-#define GL_CLIP_DISTANCE0_EXT 0x3000
-#define GL_CLIP_DISTANCE1_EXT 0x3001
-#define GL_CLIP_DISTANCE2_EXT 0x3002
-#define GL_CLIP_DISTANCE3_EXT 0x3003
-#define GL_CLIP_DISTANCE4_EXT 0x3004
-#define GL_CLIP_DISTANCE5_EXT 0x3005
-#define GL_CLIP_DISTANCE6_EXT 0x3006
-#define GL_CLIP_DISTANCE7_EXT 0x3007
-#endif /* GL_EXT_clip_cull_distance */
-
-#ifndef GL_EXT_color_buffer_float
-#define GL_EXT_color_buffer_float 1
-#endif /* GL_EXT_color_buffer_float */
-
-#ifndef GL_EXT_color_buffer_half_float
-#define GL_EXT_color_buffer_half_float 1
-#define GL_RGBA16F_EXT 0x881A
-#define GL_RGB16F_EXT 0x881B
-#define GL_RG16F_EXT 0x822F
-#define GL_R16F_EXT 0x822D
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211
-#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17
-#endif /* GL_EXT_color_buffer_half_float */
-
-#ifndef GL_EXT_conservative_depth
-#define GL_EXT_conservative_depth 1
-#endif /* GL_EXT_conservative_depth */
-
-#ifndef GL_EXT_copy_image
-#define GL_EXT_copy_image 1
-typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth);
-#endif
-#endif /* GL_EXT_copy_image */
-
-#ifndef GL_EXT_debug_label
-#define GL_EXT_debug_label 1
-#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F
-#define GL_PROGRAM_OBJECT_EXT 0x8B40
-#define GL_SHADER_OBJECT_EXT 0x8B48
-#define GL_BUFFER_OBJECT_EXT 0x9151
-#define GL_QUERY_OBJECT_EXT 0x9153
-#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label);
-GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label);
-#endif
-#endif /* GL_EXT_debug_label */
-
-#ifndef GL_EXT_debug_marker
-#define GL_EXT_debug_marker 1
-typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker);
-typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker);
-GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void);
-#endif
-#endif /* GL_EXT_debug_marker */
-
-#ifndef GL_EXT_discard_framebuffer
-#define GL_EXT_discard_framebuffer 1
-#define GL_COLOR_EXT 0x1800
-#define GL_DEPTH_EXT 0x1801
-#define GL_STENCIL_EXT 0x1802
-typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-#endif
-#endif /* GL_EXT_discard_framebuffer */
-
-#ifndef GL_EXT_disjoint_timer_query
-#define GL_EXT_disjoint_timer_query 1
-#define GL_QUERY_COUNTER_BITS_EXT 0x8864
-#define GL_CURRENT_QUERY_EXT 0x8865
-#define GL_QUERY_RESULT_EXT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867
-#define GL_TIME_ELAPSED_EXT 0x88BF
-#define GL_TIMESTAMP_EXT 0x8E28
-#define GL_GPU_DISJOINT_EXT 0x8FBB
-typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target);
-GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params);
-#endif
-#endif /* GL_EXT_disjoint_timer_query */
-
-#ifndef GL_EXT_draw_buffers
-#define GL_EXT_draw_buffers 1
-#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF
-#define GL_MAX_DRAW_BUFFERS_EXT 0x8824
-#define GL_DRAW_BUFFER0_EXT 0x8825
-#define GL_DRAW_BUFFER1_EXT 0x8826
-#define GL_DRAW_BUFFER2_EXT 0x8827
-#define GL_DRAW_BUFFER3_EXT 0x8828
-#define GL_DRAW_BUFFER4_EXT 0x8829
-#define GL_DRAW_BUFFER5_EXT 0x882A
-#define GL_DRAW_BUFFER6_EXT 0x882B
-#define GL_DRAW_BUFFER7_EXT 0x882C
-#define GL_DRAW_BUFFER8_EXT 0x882D
-#define GL_DRAW_BUFFER9_EXT 0x882E
-#define GL_DRAW_BUFFER10_EXT 0x882F
-#define GL_DRAW_BUFFER11_EXT 0x8830
-#define GL_DRAW_BUFFER12_EXT 0x8831
-#define GL_DRAW_BUFFER13_EXT 0x8832
-#define GL_DRAW_BUFFER14_EXT 0x8833
-#define GL_DRAW_BUFFER15_EXT 0x8834
-#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0
-#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1
-#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2
-#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3
-#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4
-#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5
-#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6
-#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7
-#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8
-#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9
-#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA
-#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB
-#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC
-#define GL_COLOR_ATTACHMENT13_EXT 0x8CED
-#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE
-#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_EXT_draw_buffers */
-
-#ifndef GL_EXT_draw_buffers_indexed
-#define GL_EXT_draw_buffers_indexed 1
-typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode);
-GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
-GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a);
-GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index);
-#endif
-#endif /* GL_EXT_draw_buffers_indexed */
-
-#ifndef GL_EXT_draw_elements_base_vertex
-#define GL_EXT_draw_elements_base_vertex 1
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSBASEVERTEXEXTPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawElementsBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GL_APICALL void GL_APIENTRY glDrawRangeElementsBaseVertexEXT (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLint basevertex);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedBaseVertexEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount, GLint basevertex);
-#endif
-#endif /* GL_EXT_draw_elements_base_vertex */
-
-#ifndef GL_EXT_draw_instanced
-#define GL_EXT_draw_instanced 1
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_draw_instanced */
-
-#ifndef GL_EXT_draw_transform_feedback
-#define GL_EXT_draw_transform_feedback 1
-typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKEXTPROC) (GLenum mode, GLuint id);
-typedef void (GL_APIENTRYP PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDEXTPROC) (GLenum mode, GLuint id, GLsizei instancecount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawTransformFeedbackEXT (GLenum mode, GLuint id);
-GL_APICALL void GL_APIENTRY glDrawTransformFeedbackInstancedEXT (GLenum mode, GLuint id, GLsizei instancecount);
-#endif
-#endif /* GL_EXT_draw_transform_feedback */
-
-#ifndef GL_EXT_external_buffer
-#define GL_EXT_external_buffer 1
-typedef void *GLeglClientBufferEXT;
-typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEEXTERNALEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEEXTERNALEXTPROC) (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBufferStorageExternalEXT (GLenum target, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-GL_APICALL void GL_APIENTRY glNamedBufferStorageExternalEXT (GLuint buffer, GLintptr offset, GLsizeiptr size, GLeglClientBufferEXT clientBuffer, GLbitfield flags);
-#endif
-#endif /* GL_EXT_external_buffer */
-
-#ifndef GL_EXT_float_blend
-#define GL_EXT_float_blend 1
-#endif /* GL_EXT_float_blend */
-
-#ifndef GL_EXT_geometry_point_size
-#define GL_EXT_geometry_point_size 1
-#endif /* GL_EXT_geometry_point_size */
-
-#ifndef GL_EXT_geometry_shader
-#define GL_EXT_geometry_shader 1
-#define GL_GEOMETRY_SHADER_EXT 0x8DD9
-#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004
-#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916
-#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917
-#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918
-#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F
-#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E
-#define GL_LINES_ADJACENCY_EXT 0x000A
-#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B
-#define GL_TRIANGLES_ADJACENCY_EXT 0x000C
-#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D
-#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF
-#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C
-#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32
-#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123
-#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124
-#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0
-#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1
-#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A
-#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF
-#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5
-#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD
-#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7
-#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D
-#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E
-#define GL_UNDEFINED_VERTEX_EXT 0x8260
-#define GL_PRIMITIVES_GENERATED_EXT 0x8C87
-#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312
-#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317
-#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8
-#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7
-#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level);
-#endif
-#endif /* GL_EXT_geometry_shader */
-
-#ifndef GL_EXT_gpu_shader5
-#define GL_EXT_gpu_shader5 1
-#endif /* GL_EXT_gpu_shader5 */
-
-#ifndef GL_EXT_instanced_arrays
-#define GL_EXT_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_EXT_instanced_arrays */
-
-#ifndef GL_EXT_map_buffer_range
-#define GL_EXT_map_buffer_range 1
-#define GL_MAP_READ_BIT_EXT 0x0001
-#define GL_MAP_WRITE_BIT_EXT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length);
-#endif
-#endif /* GL_EXT_map_buffer_range */
-
-#ifndef GL_EXT_memory_object
-#define GL_EXT_memory_object 1
-#define GL_TEXTURE_TILING_EXT 0x9580
-#define GL_DEDICATED_MEMORY_OBJECT_EXT 0x9581
-#define GL_PROTECTED_MEMORY_OBJECT_EXT 0x959B
-#define GL_NUM_TILING_TYPES_EXT 0x9582
-#define GL_TILING_TYPES_EXT 0x9583
-#define GL_OPTIMAL_TILING_EXT 0x9584
-#define GL_LINEAR_TILING_EXT 0x9585
-#define GL_NUM_DEVICE_UUIDS_EXT 0x9596
-#define GL_DEVICE_UUID_EXT 0x9597
-#define GL_DRIVER_UUID_EXT 0x9598
-#define GL_UUID_SIZE_EXT 16
-typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEVEXTPROC) (GLenum pname, GLubyte *data);
-typedef void (GL_APIENTRYP PFNGLGETUNSIGNEDBYTEI_VEXTPROC) (GLenum target, GLuint index, GLubyte *data);
-typedef void (GL_APIENTRYP PFNGLDELETEMEMORYOBJECTSEXTPROC) (GLsizei n, const GLuint *memoryObjects);
-typedef GLboolean (GL_APIENTRYP PFNGLISMEMORYOBJECTEXTPROC) (GLuint memoryObject);
-typedef void (GL_APIENTRYP PFNGLCREATEMEMORYOBJECTSEXTPROC) (GLsizei n, GLuint *memoryObjects);
-typedef void (GL_APIENTRYP PFNGLMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETMEMORYOBJECTPARAMETERIVEXTPROC) (GLuint memoryObject, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM2DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGEMEM3DMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLBUFFERSTORAGEMEMEXTPROC) (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM2DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DEXTPROC) (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGEMEM3DMULTISAMPLEEXTPROC) (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-typedef void (GL_APIENTRYP PFNGLNAMEDBUFFERSTORAGEMEMEXTPROC) (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetUnsignedBytevEXT (GLenum pname, GLubyte *data);
-GL_APICALL void GL_APIENTRY glGetUnsignedBytei_vEXT (GLenum target, GLuint index, GLubyte *data);
-GL_APICALL void GL_APIENTRY glDeleteMemoryObjectsEXT (GLsizei n, const GLuint *memoryObjects);
-GL_APICALL GLboolean GL_APIENTRY glIsMemoryObjectEXT (GLuint memoryObject);
-GL_APICALL void GL_APIENTRY glCreateMemoryObjectsEXT (GLsizei n, GLuint *memoryObjects);
-GL_APICALL void GL_APIENTRY glMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glGetMemoryObjectParameterivEXT (GLuint memoryObject, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glTexStorageMem2DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTexStorageMem2DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTexStorageMem3DEXT (GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTexStorageMem3DMultisampleEXT (GLenum target, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glBufferStorageMemEXT (GLenum target, GLsizeiptr size, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTextureStorageMem2DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTextureStorageMem2DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTextureStorageMem3DEXT (GLuint texture, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glTextureStorageMem3DMultisampleEXT (GLuint texture, GLsizei samples, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedSampleLocations, GLuint memory, GLuint64 offset);
-GL_APICALL void GL_APIENTRY glNamedBufferStorageMemEXT (GLuint buffer, GLsizeiptr size, GLuint memory, GLuint64 offset);
-#endif
-#endif /* GL_EXT_memory_object */
-
-#ifndef GL_EXT_memory_object_fd
-#define GL_EXT_memory_object_fd 1
-#define GL_HANDLE_TYPE_OPAQUE_FD_EXT 0x9586
-typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYFDEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glImportMemoryFdEXT (GLuint memory, GLuint64 size, GLenum handleType, GLint fd);
-#endif
-#endif /* GL_EXT_memory_object_fd */
-
-#ifndef GL_EXT_memory_object_win32
-#define GL_EXT_memory_object_win32 1
-#define GL_HANDLE_TYPE_OPAQUE_WIN32_EXT 0x9587
-#define GL_HANDLE_TYPE_OPAQUE_WIN32_KMT_EXT 0x9588
-#define GL_DEVICE_LUID_EXT 0x9599
-#define GL_DEVICE_NODE_MASK_EXT 0x959A
-#define GL_LUID_SIZE_EXT 8
-#define GL_HANDLE_TYPE_D3D12_TILEPOOL_EXT 0x9589
-#define GL_HANDLE_TYPE_D3D12_RESOURCE_EXT 0x958A
-#define GL_HANDLE_TYPE_D3D11_IMAGE_EXT 0x958B
-#define GL_HANDLE_TYPE_D3D11_IMAGE_KMT_EXT 0x958C
-typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32HANDLEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
-typedef void (GL_APIENTRYP PFNGLIMPORTMEMORYWIN32NAMEEXTPROC) (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glImportMemoryWin32HandleEXT (GLuint memory, GLuint64 size, GLenum handleType, void *handle);
-GL_APICALL void GL_APIENTRY glImportMemoryWin32NameEXT (GLuint memory, GLuint64 size, GLenum handleType, const void *name);
-#endif
-#endif /* GL_EXT_memory_object_win32 */
-
-#ifndef GL_EXT_multi_draw_arrays
-#define GL_EXT_multi_draw_arrays 1
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount);
-#endif
-#endif /* GL_EXT_multi_draw_arrays */
-
-#ifndef GL_EXT_multi_draw_indirect
-#define GL_EXT_multi_draw_indirect 1
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSINDIRECTEXTPROC) (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSINDIRECTEXTPROC) (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glMultiDrawArraysIndirectEXT (GLenum mode, const void *indirect, GLsizei drawcount, GLsizei stride);
-GL_APICALL void GL_APIENTRY glMultiDrawElementsIndirectEXT (GLenum mode, GLenum type, const void *indirect, GLsizei drawcount, GLsizei stride);
-#endif
-#endif /* GL_EXT_multi_draw_indirect */
-
-#ifndef GL_EXT_multisampled_compatibility
-#define GL_EXT_multisampled_compatibility 1
-#define GL_MULTISAMPLE_EXT 0x809D
-#define GL_SAMPLE_ALPHA_TO_ONE_EXT 0x809F
-#endif /* GL_EXT_multisampled_compatibility */
-
-#ifndef GL_EXT_multisampled_render_to_texture
-#define GL_EXT_multisampled_render_to_texture 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
-#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56
-#define GL_MAX_SAMPLES_EXT 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_EXT_multisampled_render_to_texture */
-
-#ifndef GL_EXT_multiview_draw_buffers
-#define GL_EXT_multiview_draw_buffers 1
-#define GL_COLOR_ATTACHMENT_EXT 0x90F0
-#define GL_MULTIVIEW_EXT 0x90F1
-#define GL_DRAW_BUFFER_EXT 0x0C01
-#define GL_READ_BUFFER_EXT 0x0C02
-#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2
-typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index);
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index);
-GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices);
-GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data);
-#endif
-#endif /* GL_EXT_multiview_draw_buffers */
-
-#ifndef GL_EXT_occlusion_query_boolean
-#define GL_EXT_occlusion_query_boolean 1
-#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A
-#endif /* GL_EXT_occlusion_query_boolean */
-
-#ifndef GL_EXT_polygon_offset_clamp
-#define GL_EXT_polygon_offset_clamp 1
-#define GL_POLYGON_OFFSET_CLAMP_EXT 0x8E1B
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETCLAMPEXTPROC) (GLfloat factor, GLfloat units, GLfloat clamp);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPolygonOffsetClampEXT (GLfloat factor, GLfloat units, GLfloat clamp);
-#endif
-#endif /* GL_EXT_polygon_offset_clamp */
-
-#ifndef GL_EXT_post_depth_coverage
-#define GL_EXT_post_depth_coverage 1
-#endif /* GL_EXT_post_depth_coverage */
-
-#ifndef GL_EXT_primitive_bounding_box
-#define GL_EXT_primitive_bounding_box 1
-#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE
-typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW);
-#endif
-#endif /* GL_EXT_primitive_bounding_box */
-
-#ifndef GL_EXT_protected_textures
-#define GL_EXT_protected_textures 1
-#define GL_CONTEXT_FLAG_PROTECTED_CONTENT_BIT_EXT 0x00000010
-#define GL_TEXTURE_PROTECTED_EXT 0x8BFA
-#endif /* GL_EXT_protected_textures */
-
-#ifndef GL_EXT_pvrtc_sRGB
-#define GL_EXT_pvrtc_sRGB 1
-#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54
-#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0
-#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1
-#endif /* GL_EXT_pvrtc_sRGB */
-
-#ifndef GL_EXT_raster_multisample
-#define GL_EXT_raster_multisample 1
-#define GL_RASTER_MULTISAMPLE_EXT 0x9327
-#define GL_RASTER_SAMPLES_EXT 0x9328
-#define GL_MAX_RASTER_SAMPLES_EXT 0x9329
-#define GL_RASTER_FIXED_SAMPLE_LOCATIONS_EXT 0x932A
-#define GL_MULTISAMPLE_RASTERIZATION_ALLOWED_EXT 0x932B
-#define GL_EFFECTIVE_RASTER_SAMPLES_EXT 0x932C
-typedef void (GL_APIENTRYP PFNGLRASTERSAMPLESEXTPROC) (GLuint samples, GLboolean fixedsamplelocations);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRasterSamplesEXT (GLuint samples, GLboolean fixedsamplelocations);
-#endif
-#endif /* GL_EXT_raster_multisample */
-
-#ifndef GL_EXT_read_format_bgra
-#define GL_EXT_read_format_bgra 1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365
-#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366
-#endif /* GL_EXT_read_format_bgra */
-
-#ifndef GL_EXT_render_snorm
-#define GL_EXT_render_snorm 1
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_R16_SNORM_EXT 0x8F98
-#define GL_RG16_SNORM_EXT 0x8F99
-#define GL_RGBA16_SNORM_EXT 0x8F9B
-#endif /* GL_EXT_render_snorm */
-
-#ifndef GL_EXT_robustness
-#define GL_EXT_robustness 1
-#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253
-#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254
-#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255
-#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3
-#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256
-#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252
-#define GL_NO_RESET_NOTIFICATION_EXT 0x8261
-typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void);
-typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void);
-GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data);
-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_EXT_robustness */
-
-#ifndef GL_EXT_sRGB
-#define GL_EXT_sRGB 1
-#define GL_SRGB_EXT 0x8C40
-#define GL_SRGB_ALPHA_EXT 0x8C42
-#define GL_SRGB8_ALPHA8_EXT 0x8C43
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210
-#endif /* GL_EXT_sRGB */
-
-#ifndef GL_EXT_sRGB_write_control
-#define GL_EXT_sRGB_write_control 1
-#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9
-#endif /* GL_EXT_sRGB_write_control */
-
-#ifndef GL_EXT_semaphore
-#define GL_EXT_semaphore 1
-#define GL_LAYOUT_GENERAL_EXT 0x958D
-#define GL_LAYOUT_COLOR_ATTACHMENT_EXT 0x958E
-#define GL_LAYOUT_DEPTH_STENCIL_ATTACHMENT_EXT 0x958F
-#define GL_LAYOUT_DEPTH_STENCIL_READ_ONLY_EXT 0x9590
-#define GL_LAYOUT_SHADER_READ_ONLY_EXT 0x9591
-#define GL_LAYOUT_TRANSFER_SRC_EXT 0x9592
-#define GL_LAYOUT_TRANSFER_DST_EXT 0x9593
-#define GL_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_EXT 0x9530
-#define GL_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_EXT 0x9531
-typedef void (GL_APIENTRYP PFNGLGENSEMAPHORESEXTPROC) (GLsizei n, GLuint *semaphores);
-typedef void (GL_APIENTRYP PFNGLDELETESEMAPHORESEXTPROC) (GLsizei n, const GLuint *semaphores);
-typedef GLboolean (GL_APIENTRYP PFNGLISSEMAPHOREEXTPROC) (GLuint semaphore);
-typedef void (GL_APIENTRYP PFNGLSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, const GLuint64 *params);
-typedef void (GL_APIENTRYP PFNGLGETSEMAPHOREPARAMETERUI64VEXTPROC) (GLuint semaphore, GLenum pname, GLuint64 *params);
-typedef void (GL_APIENTRYP PFNGLWAITSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
-typedef void (GL_APIENTRYP PFNGLSIGNALSEMAPHOREEXTPROC) (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGenSemaphoresEXT (GLsizei n, GLuint *semaphores);
-GL_APICALL void GL_APIENTRY glDeleteSemaphoresEXT (GLsizei n, const GLuint *semaphores);
-GL_APICALL GLboolean GL_APIENTRY glIsSemaphoreEXT (GLuint semaphore);
-GL_APICALL void GL_APIENTRY glSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, const GLuint64 *params);
-GL_APICALL void GL_APIENTRY glGetSemaphoreParameterui64vEXT (GLuint semaphore, GLenum pname, GLuint64 *params);
-GL_APICALL void GL_APIENTRY glWaitSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *srcLayouts);
-GL_APICALL void GL_APIENTRY glSignalSemaphoreEXT (GLuint semaphore, GLuint numBufferBarriers, const GLuint *buffers, GLuint numTextureBarriers, const GLuint *textures, const GLenum *dstLayouts);
-#endif
-#endif /* GL_EXT_semaphore */
-
-#ifndef GL_EXT_semaphore_fd
-#define GL_EXT_semaphore_fd 1
-typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREFDEXTPROC) (GLuint semaphore, GLenum handleType, GLint fd);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glImportSemaphoreFdEXT (GLuint semaphore, GLenum handleType, GLint fd);
-#endif
-#endif /* GL_EXT_semaphore_fd */
-
-#ifndef GL_EXT_semaphore_win32
-#define GL_EXT_semaphore_win32 1
-#define GL_HANDLE_TYPE_D3D12_FENCE_EXT 0x9594
-#define GL_D3D12_FENCE_VALUE_EXT 0x9595
-typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32HANDLEEXTPROC) (GLuint semaphore, GLenum handleType, void *handle);
-typedef void (GL_APIENTRYP PFNGLIMPORTSEMAPHOREWIN32NAMEEXTPROC) (GLuint semaphore, GLenum handleType, const void *name);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glImportSemaphoreWin32HandleEXT (GLuint semaphore, GLenum handleType, void *handle);
-GL_APICALL void GL_APIENTRY glImportSemaphoreWin32NameEXT (GLuint semaphore, GLenum handleType, const void *name);
-#endif
-#endif /* GL_EXT_semaphore_win32 */
-
-#ifndef GL_EXT_separate_shader_objects
-#define GL_EXT_separate_shader_objects 1
-#define GL_ACTIVE_PROGRAM_EXT 0x8259
-#define GL_VERTEX_SHADER_BIT_EXT 0x00000001
-#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002
-#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF
-#define GL_PROGRAM_SEPARABLE_EXT 0x8258
-#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A
-typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program);
-typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program);
-GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline);
-GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings);
-GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params);
-GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline);
-GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_EXT_separate_shader_objects */
-
-#ifndef GL_EXT_shader_framebuffer_fetch
-#define GL_EXT_shader_framebuffer_fetch 1
-#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52
-#endif /* GL_EXT_shader_framebuffer_fetch */
-
-#ifndef GL_EXT_shader_framebuffer_fetch_non_coherent
-#define GL_EXT_shader_framebuffer_fetch_non_coherent 1
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIEREXTPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierEXT (void);
-#endif
-#endif /* GL_EXT_shader_framebuffer_fetch_non_coherent */
-
-#ifndef GL_EXT_shader_group_vote
-#define GL_EXT_shader_group_vote 1
-#endif /* GL_EXT_shader_group_vote */
-
-#ifndef GL_EXT_shader_implicit_conversions
-#define GL_EXT_shader_implicit_conversions 1
-#endif /* GL_EXT_shader_implicit_conversions */
-
-#ifndef GL_EXT_shader_integer_mix
-#define GL_EXT_shader_integer_mix 1
-#endif /* GL_EXT_shader_integer_mix */
-
-#ifndef GL_EXT_shader_io_blocks
-#define GL_EXT_shader_io_blocks 1
-#endif /* GL_EXT_shader_io_blocks */
-
-#ifndef GL_EXT_shader_non_constant_global_initializers
-#define GL_EXT_shader_non_constant_global_initializers 1
-#endif /* GL_EXT_shader_non_constant_global_initializers */
-
-#ifndef GL_EXT_shader_pixel_local_storage
-#define GL_EXT_shader_pixel_local_storage 1
-#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63
-#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67
-#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64
-#endif /* GL_EXT_shader_pixel_local_storage */
-
-#ifndef GL_EXT_shader_pixel_local_storage2
-#define GL_EXT_shader_pixel_local_storage2 1
-#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_FAST_SIZE_EXT 0x9650
-#define GL_MAX_SHADER_COMBINED_LOCAL_STORAGE_SIZE_EXT 0x9651
-#define GL_FRAMEBUFFER_INCOMPLETE_INSUFFICIENT_SHADER_COMBINED_LOCAL_STORAGE_EXT 0x9652
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target, GLsizei size);
-typedef GLsizei (GL_APIENTRYP PFNGLGETFRAMEBUFFERPIXELLOCALSTORAGESIZEEXTPROC) (GLuint target);
-typedef void (GL_APIENTRYP PFNGLCLEARPIXELLOCALSTORAGEUIEXTPROC) (GLsizei offset, GLsizei n, const GLuint *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferPixelLocalStorageSizeEXT (GLuint target, GLsizei size);
-GL_APICALL GLsizei GL_APIENTRY glGetFramebufferPixelLocalStorageSizeEXT (GLuint target);
-GL_APICALL void GL_APIENTRY glClearPixelLocalStorageuiEXT (GLsizei offset, GLsizei n, const GLuint *values);
-#endif
-#endif /* GL_EXT_shader_pixel_local_storage2 */
-
-#ifndef GL_EXT_shader_texture_lod
-#define GL_EXT_shader_texture_lod 1
-#endif /* GL_EXT_shader_texture_lod */
-
-#ifndef GL_EXT_shadow_samplers
-#define GL_EXT_shadow_samplers 1
-#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C
-#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D
-#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E
-#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62
-#endif /* GL_EXT_shadow_samplers */
-
-#ifndef GL_EXT_sparse_texture
-#define GL_EXT_sparse_texture 1
-#define GL_TEXTURE_SPARSE_EXT 0x91A6
-#define GL_VIRTUAL_PAGE_SIZE_INDEX_EXT 0x91A7
-#define GL_NUM_SPARSE_LEVELS_EXT 0x91AA
-#define GL_NUM_VIRTUAL_PAGE_SIZES_EXT 0x91A8
-#define GL_VIRTUAL_PAGE_SIZE_X_EXT 0x9195
-#define GL_VIRTUAL_PAGE_SIZE_Y_EXT 0x9196
-#define GL_VIRTUAL_PAGE_SIZE_Z_EXT 0x9197
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_TEXTURE_3D 0x806F
-#define GL_MAX_SPARSE_TEXTURE_SIZE_EXT 0x9198
-#define GL_MAX_SPARSE_3D_TEXTURE_SIZE_EXT 0x9199
-#define GL_MAX_SPARSE_ARRAY_TEXTURE_LAYERS_EXT 0x919A
-#define GL_SPARSE_TEXTURE_FULL_ARRAY_CUBE_MIPMAPS_EXT 0x91A9
-typedef void (GL_APIENTRYP PFNGLTEXPAGECOMMITMENTEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexPageCommitmentEXT (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLboolean commit);
-#endif
-#endif /* GL_EXT_sparse_texture */
-
-#ifndef GL_EXT_sparse_texture2
-#define GL_EXT_sparse_texture2 1
-#endif /* GL_EXT_sparse_texture2 */
-
-#ifndef GL_EXT_tessellation_point_size
-#define GL_EXT_tessellation_point_size 1
-#endif /* GL_EXT_tessellation_point_size */
-
-#ifndef GL_EXT_tessellation_shader
-#define GL_EXT_tessellation_shader 1
-#define GL_PATCHES_EXT 0x000E
-#define GL_PATCH_VERTICES_EXT 0x8E72
-#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75
-#define GL_TESS_GEN_MODE_EXT 0x8E76
-#define GL_TESS_GEN_SPACING_EXT 0x8E77
-#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78
-#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79
-#define GL_ISOLINES_EXT 0x8E7A
-#define GL_QUADS_EXT 0x0007
-#define GL_FRACTIONAL_ODD_EXT 0x8E7B
-#define GL_FRACTIONAL_EVEN_EXT 0x8E7C
-#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D
-#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E
-#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F
-#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80
-#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81
-#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82
-#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83
-#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84
-#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85
-#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86
-#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89
-#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A
-#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C
-#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D
-#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E
-#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE
-#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3
-#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4
-#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB
-#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC
-#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8
-#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9
-#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221
-#define GL_IS_PER_PATCH_EXT 0x92E7
-#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307
-#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308
-#define GL_TESS_CONTROL_SHADER_EXT 0x8E88
-#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87
-#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008
-#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010
-typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value);
-#endif
-#endif /* GL_EXT_tessellation_shader */
-
-#ifndef GL_EXT_texture_border_clamp
-#define GL_EXT_texture_border_clamp 1
-#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004
-#define GL_CLAMP_TO_BORDER_EXT 0x812D
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params);
-#endif
-#endif /* GL_EXT_texture_border_clamp */
-
-#ifndef GL_EXT_texture_buffer
-#define GL_EXT_texture_buffer 1
-#define GL_TEXTURE_BUFFER_EXT 0x8C2A
-#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A
-#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B
-#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C
-#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D
-#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F
-#define GL_SAMPLER_BUFFER_EXT 0x8DC2
-#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0
-#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8
-#define GL_IMAGE_BUFFER_EXT 0x9051
-#define GL_INT_IMAGE_BUFFER_EXT 0x905C
-#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067
-#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D
-#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E
-typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size);
-#endif
-#endif /* GL_EXT_texture_buffer */
-
-#ifndef GL_EXT_texture_compression_astc_decode_mode
-#define GL_EXT_texture_compression_astc_decode_mode 1
-#define GL_TEXTURE_ASTC_DECODE_PRECISION_EXT 0x8F69
-#endif /* GL_EXT_texture_compression_astc_decode_mode */
-
-#ifndef GL_EXT_texture_compression_bptc
-#define GL_EXT_texture_compression_bptc 1
-#define GL_COMPRESSED_RGBA_BPTC_UNORM_EXT 0x8E8C
-#define GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT 0x8E8D
-#define GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT 0x8E8E
-#define GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT 0x8E8F
-#endif /* GL_EXT_texture_compression_bptc */
-
-#ifndef GL_EXT_texture_compression_dxt1
-#define GL_EXT_texture_compression_dxt1 1
-#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0
-#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1
-#endif /* GL_EXT_texture_compression_dxt1 */
-
-#ifndef GL_EXT_texture_compression_rgtc
-#define GL_EXT_texture_compression_rgtc 1
-#define GL_COMPRESSED_RED_RGTC1_EXT 0x8DBB
-#define GL_COMPRESSED_SIGNED_RED_RGTC1_EXT 0x8DBC
-#define GL_COMPRESSED_RED_GREEN_RGTC2_EXT 0x8DBD
-#define GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT 0x8DBE
-#endif /* GL_EXT_texture_compression_rgtc */
-
-#ifndef GL_EXT_texture_compression_s3tc
-#define GL_EXT_texture_compression_s3tc 1
-#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2
-#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3
-#endif /* GL_EXT_texture_compression_s3tc */
-
-#ifndef GL_EXT_texture_compression_s3tc_srgb
-#define GL_EXT_texture_compression_s3tc_srgb 1
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_EXT 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT 0x8C4F
-#endif /* GL_EXT_texture_compression_s3tc_srgb */
-
-#ifndef GL_EXT_texture_cube_map_array
-#define GL_EXT_texture_cube_map_array 1
-#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009
-#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A
-#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C
-#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D
-#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E
-#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F
-#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054
-#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F
-#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A
-#endif /* GL_EXT_texture_cube_map_array */
-
-#ifndef GL_EXT_texture_filter_anisotropic
-#define GL_EXT_texture_filter_anisotropic 1
-#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE
-#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF
-#endif /* GL_EXT_texture_filter_anisotropic */
-
-#ifndef GL_EXT_texture_filter_minmax
-#define GL_EXT_texture_filter_minmax 1
-#define GL_TEXTURE_REDUCTION_MODE_EXT 0x9366
-#define GL_WEIGHTED_AVERAGE_EXT 0x9367
-#endif /* GL_EXT_texture_filter_minmax */
-
-#ifndef GL_EXT_texture_format_BGRA8888
-#define GL_EXT_texture_format_BGRA8888 1
-#endif /* GL_EXT_texture_format_BGRA8888 */
-
-#ifndef GL_EXT_texture_format_sRGB_override
-#define GL_EXT_texture_format_sRGB_override 1
-#define GL_TEXTURE_FORMAT_SRGB_OVERRIDE_EXT 0x8FBF
-#endif /* GL_EXT_texture_format_sRGB_override */
-
-#ifndef GL_EXT_texture_mirror_clamp_to_edge
-#define GL_EXT_texture_mirror_clamp_to_edge 1
-#define GL_MIRROR_CLAMP_TO_EDGE_EXT 0x8743
-#endif /* GL_EXT_texture_mirror_clamp_to_edge */
-
-#ifndef GL_EXT_texture_norm16
-#define GL_EXT_texture_norm16 1
-#define GL_R16_EXT 0x822A
-#define GL_RG16_EXT 0x822C
-#define GL_RGBA16_EXT 0x805B
-#define GL_RGB16_EXT 0x8054
-#define GL_RGB16_SNORM_EXT 0x8F9A
-#endif /* GL_EXT_texture_norm16 */
-
-#ifndef GL_EXT_texture_rg
-#define GL_EXT_texture_rg 1
-#define GL_RED_EXT 0x1903
-#define GL_RG_EXT 0x8227
-#define GL_R8_EXT 0x8229
-#define GL_RG8_EXT 0x822B
-#endif /* GL_EXT_texture_rg */
-
-#ifndef GL_EXT_texture_sRGB_R8
-#define GL_EXT_texture_sRGB_R8 1
-#define GL_SR8_EXT 0x8FBD
-#endif /* GL_EXT_texture_sRGB_R8 */
-
-#ifndef GL_EXT_texture_sRGB_RG8
-#define GL_EXT_texture_sRGB_RG8 1
-#define GL_SRG8_EXT 0x8FBE
-#endif /* GL_EXT_texture_sRGB_RG8 */
-
-#ifndef GL_EXT_texture_sRGB_decode
-#define GL_EXT_texture_sRGB_decode 1
-#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48
-#define GL_DECODE_EXT 0x8A49
-#define GL_SKIP_DECODE_EXT 0x8A4A
-#endif /* GL_EXT_texture_sRGB_decode */
-
-#ifndef GL_EXT_texture_storage
-#define GL_EXT_texture_storage 1
-#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F
-#define GL_ALPHA8_EXT 0x803C
-#define GL_LUMINANCE8_EXT 0x8040
-#define GL_LUMINANCE8_ALPHA8_EXT 0x8045
-#define GL_RGBA32F_EXT 0x8814
-#define GL_RGB32F_EXT 0x8815
-#define GL_ALPHA32F_EXT 0x8816
-#define GL_LUMINANCE32F_EXT 0x8818
-#define GL_LUMINANCE_ALPHA32F_EXT 0x8819
-#define GL_ALPHA16F_EXT 0x881C
-#define GL_LUMINANCE16F_EXT 0x881E
-#define GL_LUMINANCE_ALPHA16F_EXT 0x881F
-#define GL_R32F_EXT 0x822E
-#define GL_RG32F_EXT 0x8230
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glTextureStorage1DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width);
-GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-#endif
-#endif /* GL_EXT_texture_storage */
-
-#ifndef GL_EXT_texture_type_2_10_10_10_REV
-#define GL_EXT_texture_type_2_10_10_10_REV 1
-#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368
-#endif /* GL_EXT_texture_type_2_10_10_10_REV */
-
-#ifndef GL_EXT_texture_view
-#define GL_EXT_texture_view 1
-#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB
-#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC
-#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD
-#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE
-typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers);
-#endif
-#endif /* GL_EXT_texture_view */
-
-#ifndef GL_EXT_unpack_subimage
-#define GL_EXT_unpack_subimage 1
-#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2
-#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4
-#endif /* GL_EXT_unpack_subimage */
-
-#ifndef GL_EXT_win32_keyed_mutex
-#define GL_EXT_win32_keyed_mutex 1
-typedef GLboolean (GL_APIENTRYP PFNGLACQUIREKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key, GLuint timeout);
-typedef GLboolean (GL_APIENTRYP PFNGLRELEASEKEYEDMUTEXWIN32EXTPROC) (GLuint memory, GLuint64 key);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLboolean GL_APIENTRY glAcquireKeyedMutexWin32EXT (GLuint memory, GLuint64 key, GLuint timeout);
-GL_APICALL GLboolean GL_APIENTRY glReleaseKeyedMutexWin32EXT (GLuint memory, GLuint64 key);
-#endif
-#endif /* GL_EXT_win32_keyed_mutex */
-
-#ifndef GL_EXT_window_rectangles
-#define GL_EXT_window_rectangles 1
-#define GL_INCLUSIVE_EXT 0x8F10
-#define GL_EXCLUSIVE_EXT 0x8F11
-#define GL_WINDOW_RECTANGLE_EXT 0x8F12
-#define GL_WINDOW_RECTANGLE_MODE_EXT 0x8F13
-#define GL_MAX_WINDOW_RECTANGLES_EXT 0x8F14
-#define GL_NUM_WINDOW_RECTANGLES_EXT 0x8F15
-typedef void (GL_APIENTRYP PFNGLWINDOWRECTANGLESEXTPROC) (GLenum mode, GLsizei count, const GLint *box);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glWindowRectanglesEXT (GLenum mode, GLsizei count, const GLint *box);
-#endif
-#endif /* GL_EXT_window_rectangles */
-
-#ifndef GL_FJ_shader_binary_GCCSO
-#define GL_FJ_shader_binary_GCCSO 1
-#define GL_GCCSO_SHADER_BINARY_FJ 0x9260
-#endif /* GL_FJ_shader_binary_GCCSO */
-
-#ifndef GL_IMG_bindless_texture
-#define GL_IMG_bindless_texture 1
-typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLEIMGPROC) (GLuint texture);
-typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLEIMGPROC) (GLuint texture, GLuint sampler);
-typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64IMGPROC) (GLint location, GLuint64 value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VIMGPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64IMGPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VIMGPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleIMG (GLuint texture);
-GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleIMG (GLuint texture, GLuint sampler);
-GL_APICALL void GL_APIENTRY glUniformHandleui64IMG (GLint location, GLuint64 value);
-GL_APICALL void GL_APIENTRY glUniformHandleui64vIMG (GLint location, GLsizei count, const GLuint64 *value);
-GL_APICALL void GL_APIENTRY glProgramUniformHandleui64IMG (GLuint program, GLint location, GLuint64 value);
-GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vIMG (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-#endif
-#endif /* GL_IMG_bindless_texture */
-
-#ifndef GL_IMG_framebuffer_downsample
-#define GL_IMG_framebuffer_downsample 1
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_AND_DOWNSAMPLE_IMG 0x913C
-#define GL_NUM_DOWNSAMPLE_SCALES_IMG 0x913D
-#define GL_DOWNSAMPLE_SCALES_IMG 0x913E
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SCALE_IMG 0x913F
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERDOWNSAMPLEIMGPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DDownsampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint xscale, GLint yscale);
-GL_APICALL void GL_APIENTRY glFramebufferTextureLayerDownsampleIMG (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer, GLint xscale, GLint yscale);
-#endif
-#endif /* GL_IMG_framebuffer_downsample */
-
-#ifndef GL_IMG_multisampled_render_to_texture
-#define GL_IMG_multisampled_render_to_texture 1
-#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134
-#define GL_MAX_SAMPLES_IMG 0x9135
-#define GL_TEXTURE_SAMPLES_IMG 0x9136
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples);
-#endif
-#endif /* GL_IMG_multisampled_render_to_texture */
-
-#ifndef GL_IMG_program_binary
-#define GL_IMG_program_binary 1
-#define GL_SGX_PROGRAM_BINARY_IMG 0x9130
-#endif /* GL_IMG_program_binary */
-
-#ifndef GL_IMG_read_format
-#define GL_IMG_read_format 1
-#define GL_BGRA_IMG 0x80E1
-#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365
-#endif /* GL_IMG_read_format */
-
-#ifndef GL_IMG_shader_binary
-#define GL_IMG_shader_binary 1
-#define GL_SGX_BINARY_IMG 0x8C0A
-#endif /* GL_IMG_shader_binary */
-
-#ifndef GL_IMG_texture_compression_pvrtc
-#define GL_IMG_texture_compression_pvrtc 1
-#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00
-#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03
-#endif /* GL_IMG_texture_compression_pvrtc */
-
-#ifndef GL_IMG_texture_compression_pvrtc2
-#define GL_IMG_texture_compression_pvrtc2 1
-#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137
-#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138
-#endif /* GL_IMG_texture_compression_pvrtc2 */
-
-#ifndef GL_IMG_texture_filter_cubic
-#define GL_IMG_texture_filter_cubic 1
-#define GL_CUBIC_IMG 0x9139
-#define GL_CUBIC_MIPMAP_NEAREST_IMG 0x913A
-#define GL_CUBIC_MIPMAP_LINEAR_IMG 0x913B
-#endif /* GL_IMG_texture_filter_cubic */
-
-#ifndef GL_INTEL_blackhole_render
-#define GL_INTEL_blackhole_render 1
-#define GL_BLACKHOLE_RENDER_INTEL 0x83FC
-#endif /* GL_INTEL_blackhole_render */
-
-#ifndef GL_INTEL_conservative_rasterization
-#define GL_INTEL_conservative_rasterization 1
-#define GL_CONSERVATIVE_RASTERIZATION_INTEL 0x83FE
-#endif /* GL_INTEL_conservative_rasterization */
-
-#ifndef GL_INTEL_framebuffer_CMAA
-#define GL_INTEL_framebuffer_CMAA 1
-typedef void (GL_APIENTRYP PFNGLAPPLYFRAMEBUFFERATTACHMENTCMAAINTELPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glApplyFramebufferAttachmentCMAAINTEL (void);
-#endif
-#endif /* GL_INTEL_framebuffer_CMAA */
-
-#ifndef GL_INTEL_performance_query
-#define GL_INTEL_performance_query 1
-#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000
-#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001
-#define GL_PERFQUERY_WAIT_INTEL 0x83FB
-#define GL_PERFQUERY_FLUSH_INTEL 0x83FA
-#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9
-#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0
-#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1
-#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2
-#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3
-#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4
-#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5
-#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8
-#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9
-#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA
-#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB
-#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC
-#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD
-#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE
-#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF
-#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500
-typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle);
-typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle);
-typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId);
-typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId);
-typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId);
-typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle);
-GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle);
-GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId);
-GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId);
-GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue);
-GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, void *data, GLuint *bytesWritten);
-GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId);
-GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask);
-#endif
-#endif /* GL_INTEL_performance_query */
-
-#ifndef GL_MESA_program_binary_formats
-#define GL_MESA_program_binary_formats 1
-#define GL_PROGRAM_BINARY_FORMAT_MESA 0x875F
-#endif /* GL_MESA_program_binary_formats */
-
-#ifndef GL_MESA_shader_integer_functions
-#define GL_MESA_shader_integer_functions 1
-#endif /* GL_MESA_shader_integer_functions */
-
-#ifndef GL_NVX_blend_equation_advanced_multi_draw_buffers
-#define GL_NVX_blend_equation_advanced_multi_draw_buffers 1
-#endif /* GL_NVX_blend_equation_advanced_multi_draw_buffers */
-
-#ifndef GL_NV_bindless_texture
-#define GL_NV_bindless_texture 1
-typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTUREHANDLENVPROC) (GLuint texture);
-typedef GLuint64 (GL_APIENTRYP PFNGLGETTEXTURESAMPLERHANDLENVPROC) (GLuint texture, GLuint sampler);
-typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef void (GL_APIENTRYP PFNGLMAKETEXTUREHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef GLuint64 (GL_APIENTRYP PFNGLGETIMAGEHANDLENVPROC) (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle, GLenum access);
-typedef void (GL_APIENTRYP PFNGLMAKEIMAGEHANDLENONRESIDENTNVPROC) (GLuint64 handle);
-typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64NVPROC) (GLint location, GLuint64 value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMHANDLEUI64VNVPROC) (GLint location, GLsizei count, const GLuint64 *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64NVPROC) (GLuint program, GLint location, GLuint64 value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMHANDLEUI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREHANDLERESIDENTNVPROC) (GLuint64 handle);
-typedef GLboolean (GL_APIENTRYP PFNGLISIMAGEHANDLERESIDENTNVPROC) (GLuint64 handle);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLuint64 GL_APIENTRY glGetTextureHandleNV (GLuint texture);
-GL_APICALL GLuint64 GL_APIENTRY glGetTextureSamplerHandleNV (GLuint texture, GLuint sampler);
-GL_APICALL void GL_APIENTRY glMakeTextureHandleResidentNV (GLuint64 handle);
-GL_APICALL void GL_APIENTRY glMakeTextureHandleNonResidentNV (GLuint64 handle);
-GL_APICALL GLuint64 GL_APIENTRY glGetImageHandleNV (GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum format);
-GL_APICALL void GL_APIENTRY glMakeImageHandleResidentNV (GLuint64 handle, GLenum access);
-GL_APICALL void GL_APIENTRY glMakeImageHandleNonResidentNV (GLuint64 handle);
-GL_APICALL void GL_APIENTRY glUniformHandleui64NV (GLint location, GLuint64 value);
-GL_APICALL void GL_APIENTRY glUniformHandleui64vNV (GLint location, GLsizei count, const GLuint64 *value);
-GL_APICALL void GL_APIENTRY glProgramUniformHandleui64NV (GLuint program, GLint location, GLuint64 value);
-GL_APICALL void GL_APIENTRY glProgramUniformHandleui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64 *values);
-GL_APICALL GLboolean GL_APIENTRY glIsTextureHandleResidentNV (GLuint64 handle);
-GL_APICALL GLboolean GL_APIENTRY glIsImageHandleResidentNV (GLuint64 handle);
-#endif
-#endif /* GL_NV_bindless_texture */
-
-#ifndef GL_NV_blend_equation_advanced
-#define GL_NV_blend_equation_advanced 1
-#define GL_BLEND_OVERLAP_NV 0x9281
-#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280
-#define GL_BLUE_NV 0x1905
-#define GL_COLORBURN_NV 0x929A
-#define GL_COLORDODGE_NV 0x9299
-#define GL_CONJOINT_NV 0x9284
-#define GL_CONTRAST_NV 0x92A1
-#define GL_DARKEN_NV 0x9297
-#define GL_DIFFERENCE_NV 0x929E
-#define GL_DISJOINT_NV 0x9283
-#define GL_DST_ATOP_NV 0x928F
-#define GL_DST_IN_NV 0x928B
-#define GL_DST_NV 0x9287
-#define GL_DST_OUT_NV 0x928D
-#define GL_DST_OVER_NV 0x9289
-#define GL_EXCLUSION_NV 0x92A0
-#define GL_GREEN_NV 0x1904
-#define GL_HARDLIGHT_NV 0x929B
-#define GL_HARDMIX_NV 0x92A9
-#define GL_HSL_COLOR_NV 0x92AF
-#define GL_HSL_HUE_NV 0x92AD
-#define GL_HSL_LUMINOSITY_NV 0x92B0
-#define GL_HSL_SATURATION_NV 0x92AE
-#define GL_INVERT_OVG_NV 0x92B4
-#define GL_INVERT_RGB_NV 0x92A3
-#define GL_LIGHTEN_NV 0x9298
-#define GL_LINEARBURN_NV 0x92A5
-#define GL_LINEARDODGE_NV 0x92A4
-#define GL_LINEARLIGHT_NV 0x92A7
-#define GL_MINUS_CLAMPED_NV 0x92B3
-#define GL_MINUS_NV 0x929F
-#define GL_MULTIPLY_NV 0x9294
-#define GL_OVERLAY_NV 0x9296
-#define GL_PINLIGHT_NV 0x92A8
-#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2
-#define GL_PLUS_CLAMPED_NV 0x92B1
-#define GL_PLUS_DARKER_NV 0x9292
-#define GL_PLUS_NV 0x9291
-#define GL_RED_NV 0x1903
-#define GL_SCREEN_NV 0x9295
-#define GL_SOFTLIGHT_NV 0x929C
-#define GL_SRC_ATOP_NV 0x928E
-#define GL_SRC_IN_NV 0x928A
-#define GL_SRC_NV 0x9286
-#define GL_SRC_OUT_NV 0x928C
-#define GL_SRC_OVER_NV 0x9288
-#define GL_UNCORRELATED_NV 0x9282
-#define GL_VIVIDLIGHT_NV 0x92A6
-#define GL_XOR_NV 0x1506
-typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glBlendBarrierNV (void);
-#endif
-#endif /* GL_NV_blend_equation_advanced */
-
-#ifndef GL_NV_blend_equation_advanced_coherent
-#define GL_NV_blend_equation_advanced_coherent 1
-#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285
-#endif /* GL_NV_blend_equation_advanced_coherent */
-
-#ifndef GL_NV_blend_minmax_factor
-#define GL_NV_blend_minmax_factor 1
-#define GL_FACTOR_MIN_AMD 0x901C
-#define GL_FACTOR_MAX_AMD 0x901D
-#endif /* GL_NV_blend_minmax_factor */
-
-#ifndef GL_NV_clip_space_w_scaling
-#define GL_NV_clip_space_w_scaling 1
-#define GL_VIEWPORT_POSITION_W_SCALE_NV 0x937C
-#define GL_VIEWPORT_POSITION_W_SCALE_X_COEFF_NV 0x937D
-#define GL_VIEWPORT_POSITION_W_SCALE_Y_COEFF_NV 0x937E
-typedef void (GL_APIENTRYP PFNGLVIEWPORTPOSITIONWSCALENVPROC) (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glViewportPositionWScaleNV (GLuint index, GLfloat xcoeff, GLfloat ycoeff);
-#endif
-#endif /* GL_NV_clip_space_w_scaling */
-
-#ifndef GL_NV_conditional_render
-#define GL_NV_conditional_render 1
-#define GL_QUERY_WAIT_NV 0x8E13
-#define GL_QUERY_NO_WAIT_NV 0x8E14
-#define GL_QUERY_BY_REGION_WAIT_NV 0x8E15
-#define GL_QUERY_BY_REGION_NO_WAIT_NV 0x8E16
-typedef void (GL_APIENTRYP PFNGLBEGINCONDITIONALRENDERNVPROC) (GLuint id, GLenum mode);
-typedef void (GL_APIENTRYP PFNGLENDCONDITIONALRENDERNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBeginConditionalRenderNV (GLuint id, GLenum mode);
-GL_APICALL void GL_APIENTRY glEndConditionalRenderNV (void);
-#endif
-#endif /* GL_NV_conditional_render */
-
-#ifndef GL_NV_conservative_raster
-#define GL_NV_conservative_raster 1
-#define GL_CONSERVATIVE_RASTERIZATION_NV 0x9346
-#define GL_SUBPIXEL_PRECISION_BIAS_X_BITS_NV 0x9347
-#define GL_SUBPIXEL_PRECISION_BIAS_Y_BITS_NV 0x9348
-#define GL_MAX_SUBPIXEL_PRECISION_BIAS_BITS_NV 0x9349
-typedef void (GL_APIENTRYP PFNGLSUBPIXELPRECISIONBIASNVPROC) (GLuint xbits, GLuint ybits);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glSubpixelPrecisionBiasNV (GLuint xbits, GLuint ybits);
-#endif
-#endif /* GL_NV_conservative_raster */
-
-#ifndef GL_NV_conservative_raster_pre_snap
-#define GL_NV_conservative_raster_pre_snap 1
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_NV 0x9550
-#endif /* GL_NV_conservative_raster_pre_snap */
-
-#ifndef GL_NV_conservative_raster_pre_snap_triangles
-#define GL_NV_conservative_raster_pre_snap_triangles 1
-#define GL_CONSERVATIVE_RASTER_MODE_NV 0x954D
-#define GL_CONSERVATIVE_RASTER_MODE_POST_SNAP_NV 0x954E
-#define GL_CONSERVATIVE_RASTER_MODE_PRE_SNAP_TRIANGLES_NV 0x954F
-typedef void (GL_APIENTRYP PFNGLCONSERVATIVERASTERPARAMETERINVPROC) (GLenum pname, GLint param);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glConservativeRasterParameteriNV (GLenum pname, GLint param);
-#endif
-#endif /* GL_NV_conservative_raster_pre_snap_triangles */
-
-#ifndef GL_NV_copy_buffer
-#define GL_NV_copy_buffer 1
-#define GL_COPY_READ_BUFFER_NV 0x8F36
-#define GL_COPY_WRITE_BUFFER_NV 0x8F37
-typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-#endif
-#endif /* GL_NV_copy_buffer */
-
-#ifndef GL_NV_coverage_sample
-#define GL_NV_coverage_sample 1
-#define GL_COVERAGE_COMPONENT_NV 0x8ED0
-#define GL_COVERAGE_COMPONENT4_NV 0x8ED1
-#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2
-#define GL_COVERAGE_BUFFERS_NV 0x8ED3
-#define GL_COVERAGE_SAMPLES_NV 0x8ED4
-#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5
-#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6
-#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7
-#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask);
-typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask);
-GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation);
-#endif
-#endif /* GL_NV_coverage_sample */
-
-#ifndef GL_NV_depth_nonlinear
-#define GL_NV_depth_nonlinear 1
-#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C
-#endif /* GL_NV_depth_nonlinear */
-
-#ifndef GL_NV_draw_buffers
-#define GL_NV_draw_buffers 1
-#define GL_MAX_DRAW_BUFFERS_NV 0x8824
-#define GL_DRAW_BUFFER0_NV 0x8825
-#define GL_DRAW_BUFFER1_NV 0x8826
-#define GL_DRAW_BUFFER2_NV 0x8827
-#define GL_DRAW_BUFFER3_NV 0x8828
-#define GL_DRAW_BUFFER4_NV 0x8829
-#define GL_DRAW_BUFFER5_NV 0x882A
-#define GL_DRAW_BUFFER6_NV 0x882B
-#define GL_DRAW_BUFFER7_NV 0x882C
-#define GL_DRAW_BUFFER8_NV 0x882D
-#define GL_DRAW_BUFFER9_NV 0x882E
-#define GL_DRAW_BUFFER10_NV 0x882F
-#define GL_DRAW_BUFFER11_NV 0x8830
-#define GL_DRAW_BUFFER12_NV 0x8831
-#define GL_DRAW_BUFFER13_NV 0x8832
-#define GL_DRAW_BUFFER14_NV 0x8833
-#define GL_DRAW_BUFFER15_NV 0x8834
-#define GL_COLOR_ATTACHMENT0_NV 0x8CE0
-#define GL_COLOR_ATTACHMENT1_NV 0x8CE1
-#define GL_COLOR_ATTACHMENT2_NV 0x8CE2
-#define GL_COLOR_ATTACHMENT3_NV 0x8CE3
-#define GL_COLOR_ATTACHMENT4_NV 0x8CE4
-#define GL_COLOR_ATTACHMENT5_NV 0x8CE5
-#define GL_COLOR_ATTACHMENT6_NV 0x8CE6
-#define GL_COLOR_ATTACHMENT7_NV 0x8CE7
-#define GL_COLOR_ATTACHMENT8_NV 0x8CE8
-#define GL_COLOR_ATTACHMENT9_NV 0x8CE9
-#define GL_COLOR_ATTACHMENT10_NV 0x8CEA
-#define GL_COLOR_ATTACHMENT11_NV 0x8CEB
-#define GL_COLOR_ATTACHMENT12_NV 0x8CEC
-#define GL_COLOR_ATTACHMENT13_NV 0x8CED
-#define GL_COLOR_ATTACHMENT14_NV 0x8CEE
-#define GL_COLOR_ATTACHMENT15_NV 0x8CEF
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs);
-#endif
-#endif /* GL_NV_draw_buffers */
-
-#ifndef GL_NV_draw_instanced
-#define GL_NV_draw_instanced 1
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount);
-#endif
-#endif /* GL_NV_draw_instanced */
-
-#ifndef GL_NV_draw_vulkan_image
-#define GL_NV_draw_vulkan_image 1
-typedef void (GL_APIENTRY *GLVULKANPROCNV)(void);
-typedef void (GL_APIENTRYP PFNGLDRAWVKIMAGENVPROC) (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-typedef GLVULKANPROCNV (GL_APIENTRYP PFNGLGETVKPROCADDRNVPROC) (const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLWAITVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (GL_APIENTRYP PFNGLSIGNALVKSEMAPHORENVPROC) (GLuint64 vkSemaphore);
-typedef void (GL_APIENTRYP PFNGLSIGNALVKFENCENVPROC) (GLuint64 vkFence);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDrawVkImageNV (GLuint64 vkImage, GLuint sampler, GLfloat x0, GLfloat y0, GLfloat x1, GLfloat y1, GLfloat z, GLfloat s0, GLfloat t0, GLfloat s1, GLfloat t1);
-GL_APICALL GLVULKANPROCNV GL_APIENTRY glGetVkProcAddrNV (const GLchar *name);
-GL_APICALL void GL_APIENTRY glWaitVkSemaphoreNV (GLuint64 vkSemaphore);
-GL_APICALL void GL_APIENTRY glSignalVkSemaphoreNV (GLuint64 vkSemaphore);
-GL_APICALL void GL_APIENTRY glSignalVkFenceNV (GLuint64 vkFence);
-#endif
-#endif /* GL_NV_draw_vulkan_image */
-
-#ifndef GL_NV_explicit_attrib_location
-#define GL_NV_explicit_attrib_location 1
-#endif /* GL_NV_explicit_attrib_location */
-
-#ifndef GL_NV_fbo_color_attachments
-#define GL_NV_fbo_color_attachments 1
-#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF
-#endif /* GL_NV_fbo_color_attachments */
-
-#ifndef GL_NV_fence
-#define GL_NV_fence 1
-#define GL_ALL_COMPLETED_NV 0x84F2
-#define GL_FENCE_STATUS_NV 0x84F3
-#define GL_FENCE_CONDITION_NV 0x84F4
-typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences);
-typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences);
-typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence);
-typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence);
-typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences);
-GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences);
-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV (GLuint fence);
-GL_APICALL GLboolean GL_APIENTRY glTestFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence);
-GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition);
-#endif
-#endif /* GL_NV_fence */
-
-#ifndef GL_NV_fill_rectangle
-#define GL_NV_fill_rectangle 1
-#define GL_FILL_RECTANGLE_NV 0x933C
-#endif /* GL_NV_fill_rectangle */
-
-#ifndef GL_NV_fragment_coverage_to_color
-#define GL_NV_fragment_coverage_to_color 1
-#define GL_FRAGMENT_COVERAGE_TO_COLOR_NV 0x92DD
-#define GL_FRAGMENT_COVERAGE_COLOR_NV 0x92DE
-typedef void (GL_APIENTRYP PFNGLFRAGMENTCOVERAGECOLORNVPROC) (GLuint color);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFragmentCoverageColorNV (GLuint color);
-#endif
-#endif /* GL_NV_fragment_coverage_to_color */
-
-#ifndef GL_NV_fragment_shader_interlock
-#define GL_NV_fragment_shader_interlock 1
-#endif /* GL_NV_fragment_shader_interlock */
-
-#ifndef GL_NV_framebuffer_blit
-#define GL_NV_framebuffer_blit 1
-#define GL_READ_FRAMEBUFFER_NV 0x8CA8
-#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9
-#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6
-#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-#endif
-#endif /* GL_NV_framebuffer_blit */
-
-#ifndef GL_NV_framebuffer_mixed_samples
-#define GL_NV_framebuffer_mixed_samples 1
-#define GL_COVERAGE_MODULATION_TABLE_NV 0x9331
-#define GL_COLOR_SAMPLES_NV 0x8E20
-#define GL_DEPTH_SAMPLES_NV 0x932D
-#define GL_STENCIL_SAMPLES_NV 0x932E
-#define GL_MIXED_DEPTH_SAMPLES_SUPPORTED_NV 0x932F
-#define GL_MIXED_STENCIL_SAMPLES_SUPPORTED_NV 0x9330
-#define GL_COVERAGE_MODULATION_NV 0x9332
-#define GL_COVERAGE_MODULATION_TABLE_SIZE_NV 0x9333
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONTABLENVPROC) (GLsizei n, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLGETCOVERAGEMODULATIONTABLENVPROC) (GLsizei bufsize, GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLCOVERAGEMODULATIONNVPROC) (GLenum components);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glCoverageModulationTableNV (GLsizei n, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glGetCoverageModulationTableNV (GLsizei bufsize, GLfloat *v);
-GL_APICALL void GL_APIENTRY glCoverageModulationNV (GLenum components);
-#endif
-#endif /* GL_NV_framebuffer_mixed_samples */
-
-#ifndef GL_NV_framebuffer_multisample
-#define GL_NV_framebuffer_multisample 1
-#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56
-#define GL_MAX_SAMPLES_NV 0x8D57
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_NV_framebuffer_multisample */
-
-#ifndef GL_NV_generate_mipmap_sRGB
-#define GL_NV_generate_mipmap_sRGB 1
-#endif /* GL_NV_generate_mipmap_sRGB */
-
-#ifndef GL_NV_geometry_shader_passthrough
-#define GL_NV_geometry_shader_passthrough 1
-#endif /* GL_NV_geometry_shader_passthrough */
-
-#ifndef GL_NV_gpu_shader5
-#define GL_NV_gpu_shader5 1
-typedef khronos_int64_t GLint64EXT;
-typedef khronos_uint64_t GLuint64EXT;
-#define GL_INT64_NV 0x140E
-#define GL_UNSIGNED_INT64_NV 0x140F
-#define GL_INT8_NV 0x8FE0
-#define GL_INT8_VEC2_NV 0x8FE1
-#define GL_INT8_VEC3_NV 0x8FE2
-#define GL_INT8_VEC4_NV 0x8FE3
-#define GL_INT16_NV 0x8FE4
-#define GL_INT16_VEC2_NV 0x8FE5
-#define GL_INT16_VEC3_NV 0x8FE6
-#define GL_INT16_VEC4_NV 0x8FE7
-#define GL_INT64_VEC2_NV 0x8FE9
-#define GL_INT64_VEC3_NV 0x8FEA
-#define GL_INT64_VEC4_NV 0x8FEB
-#define GL_UNSIGNED_INT8_NV 0x8FEC
-#define GL_UNSIGNED_INT8_VEC2_NV 0x8FED
-#define GL_UNSIGNED_INT8_VEC3_NV 0x8FEE
-#define GL_UNSIGNED_INT8_VEC4_NV 0x8FEF
-#define GL_UNSIGNED_INT16_NV 0x8FF0
-#define GL_UNSIGNED_INT16_VEC2_NV 0x8FF1
-#define GL_UNSIGNED_INT16_VEC3_NV 0x8FF2
-#define GL_UNSIGNED_INT16_VEC4_NV 0x8FF3
-#define GL_UNSIGNED_INT64_VEC2_NV 0x8FF5
-#define GL_UNSIGNED_INT64_VEC3_NV 0x8FF6
-#define GL_UNSIGNED_INT64_VEC4_NV 0x8FF7
-#define GL_FLOAT16_NV 0x8FF8
-#define GL_FLOAT16_VEC2_NV 0x8FF9
-#define GL_FLOAT16_VEC3_NV 0x8FFA
-#define GL_FLOAT16_VEC4_NV 0x8FFB
-#define GL_PATCHES 0x000E
-typedef void (GL_APIENTRYP PFNGLUNIFORM1I64NVPROC) (GLint location, GLint64EXT x);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4I64NVPROC) (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4I64VNVPROC) (GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64NVPROC) (GLint location, GLuint64EXT x);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64NVPROC) (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4UI64VNVPROC) (GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMI64VNVPROC) (GLuint program, GLint location, GLint64EXT *params);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64NVPROC) (GLuint program, GLint location, GLint64EXT x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64NVPROC) (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4I64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64NVPROC) (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UI64VNVPROC) (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glUniform1i64NV (GLint location, GLint64EXT x);
-GL_APICALL void GL_APIENTRY glUniform2i64NV (GLint location, GLint64EXT x, GLint64EXT y);
-GL_APICALL void GL_APIENTRY glUniform3i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GL_APICALL void GL_APIENTRY glUniform4i64NV (GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GL_APICALL void GL_APIENTRY glUniform1i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform2i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform3i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform4i64vNV (GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform1ui64NV (GLint location, GLuint64EXT x);
-GL_APICALL void GL_APIENTRY glUniform2ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y);
-GL_APICALL void GL_APIENTRY glUniform3ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GL_APICALL void GL_APIENTRY glUniform4ui64NV (GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GL_APICALL void GL_APIENTRY glUniform1ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform2ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform3ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glUniform4ui64vNV (GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glGetUniformi64vNV (GLuint program, GLint location, GLint64EXT *params);
-GL_APICALL void GL_APIENTRY glProgramUniform1i64NV (GLuint program, GLint location, GLint64EXT x);
-GL_APICALL void GL_APIENTRY glProgramUniform2i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y);
-GL_APICALL void GL_APIENTRY glProgramUniform3i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z);
-GL_APICALL void GL_APIENTRY glProgramUniform4i64NV (GLuint program, GLint location, GLint64EXT x, GLint64EXT y, GLint64EXT z, GLint64EXT w);
-GL_APICALL void GL_APIENTRY glProgramUniform1i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4i64vNV (GLuint program, GLint location, GLsizei count, const GLint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform1ui64NV (GLuint program, GLint location, GLuint64EXT x);
-GL_APICALL void GL_APIENTRY glProgramUniform2ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y);
-GL_APICALL void GL_APIENTRY glProgramUniform3ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z);
-GL_APICALL void GL_APIENTRY glProgramUniform4ui64NV (GLuint program, GLint location, GLuint64EXT x, GLuint64EXT y, GLuint64EXT z, GLuint64EXT w);
-GL_APICALL void GL_APIENTRY glProgramUniform1ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform2ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform3ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-GL_APICALL void GL_APIENTRY glProgramUniform4ui64vNV (GLuint program, GLint location, GLsizei count, const GLuint64EXT *value);
-#endif
-#endif /* GL_NV_gpu_shader5 */
-
-#ifndef GL_NV_image_formats
-#define GL_NV_image_formats 1
-#endif /* GL_NV_image_formats */
-
-#ifndef GL_NV_instanced_arrays
-#define GL_NV_instanced_arrays 1
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor);
-#endif
-#endif /* GL_NV_instanced_arrays */
-
-#ifndef GL_NV_internalformat_sample_query
-#define GL_NV_internalformat_sample_query 1
-#define GL_TEXTURE_2D_MULTISAMPLE 0x9100
-#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY 0x9102
-#define GL_MULTISAMPLES_NV 0x9371
-#define GL_SUPERSAMPLE_SCALE_X_NV 0x9372
-#define GL_SUPERSAMPLE_SCALE_Y_NV 0x9373
-#define GL_CONFORMANT_NV 0x9374
-typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATSAMPLEIVNVPROC) (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetInternalformatSampleivNV (GLenum target, GLenum internalformat, GLsizei samples, GLenum pname, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_NV_internalformat_sample_query */
-
-#ifndef GL_NV_non_square_matrices
-#define GL_NV_non_square_matrices 1
-#define GL_FLOAT_MAT2x3_NV 0x8B65
-#define GL_FLOAT_MAT2x4_NV 0x8B66
-#define GL_FLOAT_MAT3x2_NV 0x8B67
-#define GL_FLOAT_MAT3x4_NV 0x8B68
-#define GL_FLOAT_MAT4x2_NV 0x8B69
-#define GL_FLOAT_MAT4x3_NV 0x8B6A
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-#endif
-#endif /* GL_NV_non_square_matrices */
-
-#ifndef GL_NV_path_rendering
-#define GL_NV_path_rendering 1
-typedef double GLdouble;
-#define GL_PATH_FORMAT_SVG_NV 0x9070
-#define GL_PATH_FORMAT_PS_NV 0x9071
-#define GL_STANDARD_FONT_NAME_NV 0x9072
-#define GL_SYSTEM_FONT_NAME_NV 0x9073
-#define GL_FILE_NAME_NV 0x9074
-#define GL_PATH_STROKE_WIDTH_NV 0x9075
-#define GL_PATH_END_CAPS_NV 0x9076
-#define GL_PATH_INITIAL_END_CAP_NV 0x9077
-#define GL_PATH_TERMINAL_END_CAP_NV 0x9078
-#define GL_PATH_JOIN_STYLE_NV 0x9079
-#define GL_PATH_MITER_LIMIT_NV 0x907A
-#define GL_PATH_DASH_CAPS_NV 0x907B
-#define GL_PATH_INITIAL_DASH_CAP_NV 0x907C
-#define GL_PATH_TERMINAL_DASH_CAP_NV 0x907D
-#define GL_PATH_DASH_OFFSET_NV 0x907E
-#define GL_PATH_CLIENT_LENGTH_NV 0x907F
-#define GL_PATH_FILL_MODE_NV 0x9080
-#define GL_PATH_FILL_MASK_NV 0x9081
-#define GL_PATH_FILL_COVER_MODE_NV 0x9082
-#define GL_PATH_STROKE_COVER_MODE_NV 0x9083
-#define GL_PATH_STROKE_MASK_NV 0x9084
-#define GL_COUNT_UP_NV 0x9088
-#define GL_COUNT_DOWN_NV 0x9089
-#define GL_PATH_OBJECT_BOUNDING_BOX_NV 0x908A
-#define GL_CONVEX_HULL_NV 0x908B
-#define GL_BOUNDING_BOX_NV 0x908D
-#define GL_TRANSLATE_X_NV 0x908E
-#define GL_TRANSLATE_Y_NV 0x908F
-#define GL_TRANSLATE_2D_NV 0x9090
-#define GL_TRANSLATE_3D_NV 0x9091
-#define GL_AFFINE_2D_NV 0x9092
-#define GL_AFFINE_3D_NV 0x9094
-#define GL_TRANSPOSE_AFFINE_2D_NV 0x9096
-#define GL_TRANSPOSE_AFFINE_3D_NV 0x9098
-#define GL_UTF8_NV 0x909A
-#define GL_UTF16_NV 0x909B
-#define GL_BOUNDING_BOX_OF_BOUNDING_BOXES_NV 0x909C
-#define GL_PATH_COMMAND_COUNT_NV 0x909D
-#define GL_PATH_COORD_COUNT_NV 0x909E
-#define GL_PATH_DASH_ARRAY_COUNT_NV 0x909F
-#define GL_PATH_COMPUTED_LENGTH_NV 0x90A0
-#define GL_PATH_FILL_BOUNDING_BOX_NV 0x90A1
-#define GL_PATH_STROKE_BOUNDING_BOX_NV 0x90A2
-#define GL_SQUARE_NV 0x90A3
-#define GL_ROUND_NV 0x90A4
-#define GL_TRIANGULAR_NV 0x90A5
-#define GL_BEVEL_NV 0x90A6
-#define GL_MITER_REVERT_NV 0x90A7
-#define GL_MITER_TRUNCATE_NV 0x90A8
-#define GL_SKIP_MISSING_GLYPH_NV 0x90A9
-#define GL_USE_MISSING_GLYPH_NV 0x90AA
-#define GL_PATH_ERROR_POSITION_NV 0x90AB
-#define GL_ACCUM_ADJACENT_PAIRS_NV 0x90AD
-#define GL_ADJACENT_PAIRS_NV 0x90AE
-#define GL_FIRST_TO_REST_NV 0x90AF
-#define GL_PATH_GEN_MODE_NV 0x90B0
-#define GL_PATH_GEN_COEFF_NV 0x90B1
-#define GL_PATH_GEN_COMPONENTS_NV 0x90B3
-#define GL_PATH_STENCIL_FUNC_NV 0x90B7
-#define GL_PATH_STENCIL_REF_NV 0x90B8
-#define GL_PATH_STENCIL_VALUE_MASK_NV 0x90B9
-#define GL_PATH_STENCIL_DEPTH_OFFSET_FACTOR_NV 0x90BD
-#define GL_PATH_STENCIL_DEPTH_OFFSET_UNITS_NV 0x90BE
-#define GL_PATH_COVER_DEPTH_FUNC_NV 0x90BF
-#define GL_PATH_DASH_OFFSET_RESET_NV 0x90B4
-#define GL_MOVE_TO_RESETS_NV 0x90B5
-#define GL_MOVE_TO_CONTINUES_NV 0x90B6
-#define GL_CLOSE_PATH_NV 0x00
-#define GL_MOVE_TO_NV 0x02
-#define GL_RELATIVE_MOVE_TO_NV 0x03
-#define GL_LINE_TO_NV 0x04
-#define GL_RELATIVE_LINE_TO_NV 0x05
-#define GL_HORIZONTAL_LINE_TO_NV 0x06
-#define GL_RELATIVE_HORIZONTAL_LINE_TO_NV 0x07
-#define GL_VERTICAL_LINE_TO_NV 0x08
-#define GL_RELATIVE_VERTICAL_LINE_TO_NV 0x09
-#define GL_QUADRATIC_CURVE_TO_NV 0x0A
-#define GL_RELATIVE_QUADRATIC_CURVE_TO_NV 0x0B
-#define GL_CUBIC_CURVE_TO_NV 0x0C
-#define GL_RELATIVE_CUBIC_CURVE_TO_NV 0x0D
-#define GL_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0E
-#define GL_RELATIVE_SMOOTH_QUADRATIC_CURVE_TO_NV 0x0F
-#define GL_SMOOTH_CUBIC_CURVE_TO_NV 0x10
-#define GL_RELATIVE_SMOOTH_CUBIC_CURVE_TO_NV 0x11
-#define GL_SMALL_CCW_ARC_TO_NV 0x12
-#define GL_RELATIVE_SMALL_CCW_ARC_TO_NV 0x13
-#define GL_SMALL_CW_ARC_TO_NV 0x14
-#define GL_RELATIVE_SMALL_CW_ARC_TO_NV 0x15
-#define GL_LARGE_CCW_ARC_TO_NV 0x16
-#define GL_RELATIVE_LARGE_CCW_ARC_TO_NV 0x17
-#define GL_LARGE_CW_ARC_TO_NV 0x18
-#define GL_RELATIVE_LARGE_CW_ARC_TO_NV 0x19
-#define GL_RESTART_PATH_NV 0xF0
-#define GL_DUP_FIRST_CUBIC_CURVE_TO_NV 0xF2
-#define GL_DUP_LAST_CUBIC_CURVE_TO_NV 0xF4
-#define GL_RECT_NV 0xF6
-#define GL_CIRCULAR_CCW_ARC_TO_NV 0xF8
-#define GL_CIRCULAR_CW_ARC_TO_NV 0xFA
-#define GL_CIRCULAR_TANGENT_ARC_TO_NV 0xFC
-#define GL_ARC_TO_NV 0xFE
-#define GL_RELATIVE_ARC_TO_NV 0xFF
-#define GL_BOLD_BIT_NV 0x01
-#define GL_ITALIC_BIT_NV 0x02
-#define GL_GLYPH_WIDTH_BIT_NV 0x01
-#define GL_GLYPH_HEIGHT_BIT_NV 0x02
-#define GL_GLYPH_HORIZONTAL_BEARING_X_BIT_NV 0x04
-#define GL_GLYPH_HORIZONTAL_BEARING_Y_BIT_NV 0x08
-#define GL_GLYPH_HORIZONTAL_BEARING_ADVANCE_BIT_NV 0x10
-#define GL_GLYPH_VERTICAL_BEARING_X_BIT_NV 0x20
-#define GL_GLYPH_VERTICAL_BEARING_Y_BIT_NV 0x40
-#define GL_GLYPH_VERTICAL_BEARING_ADVANCE_BIT_NV 0x80
-#define GL_GLYPH_HAS_KERNING_BIT_NV 0x100
-#define GL_FONT_X_MIN_BOUNDS_BIT_NV 0x00010000
-#define GL_FONT_Y_MIN_BOUNDS_BIT_NV 0x00020000
-#define GL_FONT_X_MAX_BOUNDS_BIT_NV 0x00040000
-#define GL_FONT_Y_MAX_BOUNDS_BIT_NV 0x00080000
-#define GL_FONT_UNITS_PER_EM_BIT_NV 0x00100000
-#define GL_FONT_ASCENDER_BIT_NV 0x00200000
-#define GL_FONT_DESCENDER_BIT_NV 0x00400000
-#define GL_FONT_HEIGHT_BIT_NV 0x00800000
-#define GL_FONT_MAX_ADVANCE_WIDTH_BIT_NV 0x01000000
-#define GL_FONT_MAX_ADVANCE_HEIGHT_BIT_NV 0x02000000
-#define GL_FONT_UNDERLINE_POSITION_BIT_NV 0x04000000
-#define GL_FONT_UNDERLINE_THICKNESS_BIT_NV 0x08000000
-#define GL_FONT_HAS_KERNING_BIT_NV 0x10000000
-#define GL_ROUNDED_RECT_NV 0xE8
-#define GL_RELATIVE_ROUNDED_RECT_NV 0xE9
-#define GL_ROUNDED_RECT2_NV 0xEA
-#define GL_RELATIVE_ROUNDED_RECT2_NV 0xEB
-#define GL_ROUNDED_RECT4_NV 0xEC
-#define GL_RELATIVE_ROUNDED_RECT4_NV 0xED
-#define GL_ROUNDED_RECT8_NV 0xEE
-#define GL_RELATIVE_ROUNDED_RECT8_NV 0xEF
-#define GL_RELATIVE_RECT_NV 0xF7
-#define GL_FONT_GLYPHS_AVAILABLE_NV 0x9368
-#define GL_FONT_TARGET_UNAVAILABLE_NV 0x9369
-#define GL_FONT_UNAVAILABLE_NV 0x936A
-#define GL_FONT_UNINTELLIGIBLE_NV 0x936B
-#define GL_CONIC_CURVE_TO_NV 0x1A
-#define GL_RELATIVE_CONIC_CURVE_TO_NV 0x1B
-#define GL_FONT_NUM_GLYPH_INDICES_BIT_NV 0x20000000
-#define GL_STANDARD_FONT_FORMAT_NV 0x936C
-#define GL_PATH_PROJECTION_NV 0x1701
-#define GL_PATH_MODELVIEW_NV 0x1700
-#define GL_PATH_MODELVIEW_STACK_DEPTH_NV 0x0BA3
-#define GL_PATH_MODELVIEW_MATRIX_NV 0x0BA6
-#define GL_PATH_MAX_MODELVIEW_STACK_DEPTH_NV 0x0D36
-#define GL_PATH_TRANSPOSE_MODELVIEW_MATRIX_NV 0x84E3
-#define GL_PATH_PROJECTION_STACK_DEPTH_NV 0x0BA4
-#define GL_PATH_PROJECTION_MATRIX_NV 0x0BA7
-#define GL_PATH_MAX_PROJECTION_STACK_DEPTH_NV 0x0D38
-#define GL_PATH_TRANSPOSE_PROJECTION_MATRIX_NV 0x84E4
-#define GL_FRAGMENT_INPUT_NV 0x936D
-typedef GLuint (GL_APIENTRYP PFNGLGENPATHSNVPROC) (GLsizei range);
-typedef void (GL_APIENTRYP PFNGLDELETEPATHSNVPROC) (GLuint path, GLsizei range);
-typedef GLboolean (GL_APIENTRYP PFNGLISPATHNVPROC) (GLuint path);
-typedef void (GL_APIENTRYP PFNGLPATHCOMMANDSNVPROC) (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GL_APIENTRYP PFNGLPATHCOORDSNVPROC) (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GL_APIENTRYP PFNGLPATHSUBCOMMANDSNVPROC) (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GL_APIENTRYP PFNGLPATHSUBCOORDSNVPROC) (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-typedef void (GL_APIENTRYP PFNGLPATHSTRINGNVPROC) (GLuint path, GLenum format, GLsizei length, const void *pathString);
-typedef void (GL_APIENTRYP PFNGLPATHGLYPHSNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (GL_APIENTRYP PFNGLPATHGLYPHRANGENVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (GL_APIENTRYP PFNGLWEIGHTPATHSNVPROC) (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-typedef void (GL_APIENTRYP PFNGLCOPYPATHNVPROC) (GLuint resultPath, GLuint srcPath);
-typedef void (GL_APIENTRYP PFNGLINTERPOLATEPATHSNVPROC) (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-typedef void (GL_APIENTRYP PFNGLTRANSFORMPATHNVPROC) (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLPATHPARAMETERINVPROC) (GLuint path, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLPATHPARAMETERFNVPROC) (GLuint path, GLenum pname, GLfloat value);
-typedef void (GL_APIENTRYP PFNGLPATHDASHARRAYNVPROC) (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-typedef void (GL_APIENTRYP PFNGLPATHSTENCILFUNCNVPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLPATHSTENCILDEPTHOFFSETNVPROC) (GLfloat factor, GLfloat units);
-typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLSTENCILSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLPATHCOVERDEPTHFUNCNVPROC) (GLenum func);
-typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHNVPROC) (GLuint path, GLenum coverMode);
-typedef void (GL_APIENTRYP PFNGLCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERIVNVPROC) (GLuint path, GLenum pname, GLint *value);
-typedef void (GL_APIENTRYP PFNGLGETPATHPARAMETERFVNVPROC) (GLuint path, GLenum pname, GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLGETPATHCOMMANDSNVPROC) (GLuint path, GLubyte *commands);
-typedef void (GL_APIENTRYP PFNGLGETPATHCOORDSNVPROC) (GLuint path, GLfloat *coords);
-typedef void (GL_APIENTRYP PFNGLGETPATHDASHARRAYNVPROC) (GLuint path, GLfloat *dashArray);
-typedef void (GL_APIENTRYP PFNGLGETPATHMETRICSNVPROC) (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-typedef void (GL_APIENTRYP PFNGLGETPATHMETRICRANGENVPROC) (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-typedef void (GL_APIENTRYP PFNGLGETPATHSPACINGNVPROC) (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINFILLPATHNVPROC) (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-typedef GLboolean (GL_APIENTRYP PFNGLISPOINTINSTROKEPATHNVPROC) (GLuint path, GLfloat x, GLfloat y);
-typedef GLfloat (GL_APIENTRYP PFNGLGETPATHLENGTHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments);
-typedef GLboolean (GL_APIENTRYP PFNGLPOINTALONGPATHNVPROC) (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOAD3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X2FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULT3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSE3X3FNVPROC) (GLenum matrixMode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHNVPROC) (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHNVPROC) (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERFILLPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef void (GL_APIENTRYP PFNGLSTENCILTHENCOVERSTROKEPATHINSTANCEDNVPROC) (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXRANGENVPROC) (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-typedef GLenum (GL_APIENTRYP PFNGLPATHGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef GLenum (GL_APIENTRYP PFNGLPATHMEMORYGLYPHINDEXARRAYNVPROC) (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPATHFRAGMENTINPUTGENNVPROC) (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMRESOURCEFVNVPROC) (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLMATRIXFRUSTUMEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADIDENTITYEXTPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXLOADDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULTTRANSPOSEDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULTFEXTPROC) (GLenum mode, const GLfloat *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXMULTDEXTPROC) (GLenum mode, const GLdouble *m);
-typedef void (GL_APIENTRYP PFNGLMATRIXORTHOEXTPROC) (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-typedef void (GL_APIENTRYP PFNGLMATRIXPOPEXTPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLMATRIXPUSHEXTPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLMATRIXROTATEFEXTPROC) (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLMATRIXROTATEDEXTPROC) (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GL_APIENTRYP PFNGLMATRIXSCALEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLMATRIXSCALEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEFEXTPROC) (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLMATRIXTRANSLATEDEXTPROC) (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL GLuint GL_APIENTRY glGenPathsNV (GLsizei range);
-GL_APICALL void GL_APIENTRY glDeletePathsNV (GLuint path, GLsizei range);
-GL_APICALL GLboolean GL_APIENTRY glIsPathNV (GLuint path);
-GL_APICALL void GL_APIENTRY glPathCommandsNV (GLuint path, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GL_APICALL void GL_APIENTRY glPathCoordsNV (GLuint path, GLsizei numCoords, GLenum coordType, const void *coords);
-GL_APICALL void GL_APIENTRY glPathSubCommandsNV (GLuint path, GLsizei commandStart, GLsizei commandsToDelete, GLsizei numCommands, const GLubyte *commands, GLsizei numCoords, GLenum coordType, const void *coords);
-GL_APICALL void GL_APIENTRY glPathSubCoordsNV (GLuint path, GLsizei coordStart, GLsizei numCoords, GLenum coordType, const void *coords);
-GL_APICALL void GL_APIENTRY glPathStringNV (GLuint path, GLenum format, GLsizei length, const void *pathString);
-GL_APICALL void GL_APIENTRY glPathGlyphsNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLsizei numGlyphs, GLenum type, const void *charcodes, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GL_APICALL void GL_APIENTRY glPathGlyphRangeNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyph, GLsizei numGlyphs, GLenum handleMissingGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GL_APICALL void GL_APIENTRY glWeightPathsNV (GLuint resultPath, GLsizei numPaths, const GLuint *paths, const GLfloat *weights);
-GL_APICALL void GL_APIENTRY glCopyPathNV (GLuint resultPath, GLuint srcPath);
-GL_APICALL void GL_APIENTRY glInterpolatePathsNV (GLuint resultPath, GLuint pathA, GLuint pathB, GLfloat weight);
-GL_APICALL void GL_APIENTRY glTransformPathNV (GLuint resultPath, GLuint srcPath, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glPathParameterivNV (GLuint path, GLenum pname, const GLint *value);
-GL_APICALL void GL_APIENTRY glPathParameteriNV (GLuint path, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glPathParameterfvNV (GLuint path, GLenum pname, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glPathParameterfNV (GLuint path, GLenum pname, GLfloat value);
-GL_APICALL void GL_APIENTRY glPathDashArrayNV (GLuint path, GLsizei dashCount, const GLfloat *dashArray);
-GL_APICALL void GL_APIENTRY glPathStencilFuncNV (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glPathStencilDepthOffsetNV (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glStencilFillPathNV (GLuint path, GLenum fillMode, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilStrokePathNV (GLuint path, GLint reference, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glStencilStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glPathCoverDepthFuncNV (GLenum func);
-GL_APICALL void GL_APIENTRY glCoverFillPathNV (GLuint path, GLenum coverMode);
-GL_APICALL void GL_APIENTRY glCoverStrokePathNV (GLuint path, GLenum coverMode);
-GL_APICALL void GL_APIENTRY glCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glGetPathParameterivNV (GLuint path, GLenum pname, GLint *value);
-GL_APICALL void GL_APIENTRY glGetPathParameterfvNV (GLuint path, GLenum pname, GLfloat *value);
-GL_APICALL void GL_APIENTRY glGetPathCommandsNV (GLuint path, GLubyte *commands);
-GL_APICALL void GL_APIENTRY glGetPathCoordsNV (GLuint path, GLfloat *coords);
-GL_APICALL void GL_APIENTRY glGetPathDashArrayNV (GLuint path, GLfloat *dashArray);
-GL_APICALL void GL_APIENTRY glGetPathMetricsNV (GLbitfield metricQueryMask, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLsizei stride, GLfloat *metrics);
-GL_APICALL void GL_APIENTRY glGetPathMetricRangeNV (GLbitfield metricQueryMask, GLuint firstPathName, GLsizei numPaths, GLsizei stride, GLfloat *metrics);
-GL_APICALL void GL_APIENTRY glGetPathSpacingNV (GLenum pathListMode, GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLfloat advanceScale, GLfloat kerningScale, GLenum transformType, GLfloat *returnedSpacing);
-GL_APICALL GLboolean GL_APIENTRY glIsPointInFillPathNV (GLuint path, GLuint mask, GLfloat x, GLfloat y);
-GL_APICALL GLboolean GL_APIENTRY glIsPointInStrokePathNV (GLuint path, GLfloat x, GLfloat y);
-GL_APICALL GLfloat GL_APIENTRY glGetPathLengthNV (GLuint path, GLsizei startSegment, GLsizei numSegments);
-GL_APICALL GLboolean GL_APIENTRY glPointAlongPathNV (GLuint path, GLsizei startSegment, GLsizei numSegments, GLfloat distance, GLfloat *x, GLfloat *y, GLfloat *tangentX, GLfloat *tangentY);
-GL_APICALL void GL_APIENTRY glMatrixLoad3x2fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixLoad3x3fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixLoadTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixMult3x2fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixMult3x3fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixMultTranspose3x3fNV (GLenum matrixMode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathNV (GLuint path, GLenum fillMode, GLuint mask, GLenum coverMode);
-GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathNV (GLuint path, GLint reference, GLuint mask, GLenum coverMode);
-GL_APICALL void GL_APIENTRY glStencilThenCoverFillPathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLenum fillMode, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL void GL_APIENTRY glStencilThenCoverStrokePathInstancedNV (GLsizei numPaths, GLenum pathNameType, const void *paths, GLuint pathBase, GLint reference, GLuint mask, GLenum coverMode, GLenum transformType, const GLfloat *transformValues);
-GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexRangeNV (GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint pathParameterTemplate, GLfloat emScale, GLuint baseAndCount[2]);
-GL_APICALL GLenum GL_APIENTRY glPathGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, const void *fontName, GLbitfield fontStyle, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GL_APICALL GLenum GL_APIENTRY glPathMemoryGlyphIndexArrayNV (GLuint firstPathName, GLenum fontTarget, GLsizeiptr fontSize, const void *fontData, GLsizei faceIndex, GLuint firstGlyphIndex, GLsizei numGlyphs, GLuint pathParameterTemplate, GLfloat emScale);
-GL_APICALL void GL_APIENTRY glProgramPathFragmentInputGenNV (GLuint program, GLint location, GLenum genMode, GLint components, const GLfloat *coeffs);
-GL_APICALL void GL_APIENTRY glGetProgramResourcefvNV (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLfloat *params);
-GL_APICALL void GL_APIENTRY glMatrixFrustumEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GL_APICALL void GL_APIENTRY glMatrixLoadIdentityEXT (GLenum mode);
-GL_APICALL void GL_APIENTRY glMatrixLoadTransposefEXT (GLenum mode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixLoadTransposedEXT (GLenum mode, const GLdouble *m);
-GL_APICALL void GL_APIENTRY glMatrixLoadfEXT (GLenum mode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixLoaddEXT (GLenum mode, const GLdouble *m);
-GL_APICALL void GL_APIENTRY glMatrixMultTransposefEXT (GLenum mode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixMultTransposedEXT (GLenum mode, const GLdouble *m);
-GL_APICALL void GL_APIENTRY glMatrixMultfEXT (GLenum mode, const GLfloat *m);
-GL_APICALL void GL_APIENTRY glMatrixMultdEXT (GLenum mode, const GLdouble *m);
-GL_APICALL void GL_APIENTRY glMatrixOrthoEXT (GLenum mode, GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar);
-GL_APICALL void GL_APIENTRY glMatrixPopEXT (GLenum mode);
-GL_APICALL void GL_APIENTRY glMatrixPushEXT (GLenum mode);
-GL_APICALL void GL_APIENTRY glMatrixRotatefEXT (GLenum mode, GLfloat angle, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glMatrixRotatedEXT (GLenum mode, GLdouble angle, GLdouble x, GLdouble y, GLdouble z);
-GL_APICALL void GL_APIENTRY glMatrixScalefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glMatrixScaledEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-GL_APICALL void GL_APIENTRY glMatrixTranslatefEXT (GLenum mode, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glMatrixTranslatedEXT (GLenum mode, GLdouble x, GLdouble y, GLdouble z);
-#endif
-#endif /* GL_NV_path_rendering */
-
-#ifndef GL_NV_path_rendering_shared_edge
-#define GL_NV_path_rendering_shared_edge 1
-#define GL_SHARED_EDGE_NV 0xC0
-#endif /* GL_NV_path_rendering_shared_edge */
-
-#ifndef GL_NV_pixel_buffer_object
-#define GL_NV_pixel_buffer_object 1
-#define GL_PIXEL_PACK_BUFFER_NV 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER_NV 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING_NV 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING_NV 0x88EF
-#endif /* GL_NV_pixel_buffer_object */
-
-#ifndef GL_NV_polygon_mode
-#define GL_NV_polygon_mode 1
-#define GL_POLYGON_MODE_NV 0x0B40
-#define GL_POLYGON_OFFSET_POINT_NV 0x2A01
-#define GL_POLYGON_OFFSET_LINE_NV 0x2A02
-#define GL_POINT_NV 0x1B00
-#define GL_LINE_NV 0x1B01
-#define GL_FILL_NV 0x1B02
-typedef void (GL_APIENTRYP PFNGLPOLYGONMODENVPROC) (GLenum face, GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glPolygonModeNV (GLenum face, GLenum mode);
-#endif
-#endif /* GL_NV_polygon_mode */
-
-#ifndef GL_NV_read_buffer
-#define GL_NV_read_buffer 1
-#define GL_READ_BUFFER_NV 0x0C02
-typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode);
-#endif
-#endif /* GL_NV_read_buffer */
-
-#ifndef GL_NV_read_buffer_front
-#define GL_NV_read_buffer_front 1
-#endif /* GL_NV_read_buffer_front */
-
-#ifndef GL_NV_read_depth
-#define GL_NV_read_depth 1
-#endif /* GL_NV_read_depth */
-
-#ifndef GL_NV_read_depth_stencil
-#define GL_NV_read_depth_stencil 1
-#endif /* GL_NV_read_depth_stencil */
-
-#ifndef GL_NV_read_stencil
-#define GL_NV_read_stencil 1
-#endif /* GL_NV_read_stencil */
-
-#ifndef GL_NV_sRGB_formats
-#define GL_NV_sRGB_formats 1
-#define GL_SLUMINANCE_NV 0x8C46
-#define GL_SLUMINANCE_ALPHA_NV 0x8C44
-#define GL_SRGB8_NV 0x8C41
-#define GL_SLUMINANCE8_NV 0x8C47
-#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45
-#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E
-#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F
-#define GL_ETC1_SRGB8_NV 0x88EE
-#endif /* GL_NV_sRGB_formats */
-
-#ifndef GL_NV_sample_locations
-#define GL_NV_sample_locations 1
-#define GL_SAMPLE_LOCATION_SUBPIXEL_BITS_NV 0x933D
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_WIDTH_NV 0x933E
-#define GL_SAMPLE_LOCATION_PIXEL_GRID_HEIGHT_NV 0x933F
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_TABLE_SIZE_NV 0x9340
-#define GL_SAMPLE_LOCATION_NV 0x8E50
-#define GL_PROGRAMMABLE_SAMPLE_LOCATION_NV 0x9341
-#define GL_FRAMEBUFFER_PROGRAMMABLE_SAMPLE_LOCATIONS_NV 0x9342
-#define GL_FRAMEBUFFER_SAMPLE_LOCATION_PIXEL_GRID_NV 0x9343
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLNAMEDFRAMEBUFFERSAMPLELOCATIONSFVNVPROC) (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLRESOLVEDEPTHVALUESNVPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferSampleLocationsfvNV (GLenum target, GLuint start, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glNamedFramebufferSampleLocationsfvNV (GLuint framebuffer, GLuint start, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glResolveDepthValuesNV (void);
-#endif
-#endif /* GL_NV_sample_locations */
-
-#ifndef GL_NV_sample_mask_override_coverage
-#define GL_NV_sample_mask_override_coverage 1
-#endif /* GL_NV_sample_mask_override_coverage */
-
-#ifndef GL_NV_shader_atomic_fp16_vector
-#define GL_NV_shader_atomic_fp16_vector 1
-#endif /* GL_NV_shader_atomic_fp16_vector */
-
-#ifndef GL_NV_shader_noperspective_interpolation
-#define GL_NV_shader_noperspective_interpolation 1
-#endif /* GL_NV_shader_noperspective_interpolation */
-
-#ifndef GL_NV_shadow_samplers_array
-#define GL_NV_shadow_samplers_array 1
-#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4
-#endif /* GL_NV_shadow_samplers_array */
-
-#ifndef GL_NV_shadow_samplers_cube
-#define GL_NV_shadow_samplers_cube 1
-#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5
-#endif /* GL_NV_shadow_samplers_cube */
-
-#ifndef GL_NV_stereo_view_rendering
-#define GL_NV_stereo_view_rendering 1
-#endif /* GL_NV_stereo_view_rendering */
-
-#ifndef GL_NV_texture_border_clamp
-#define GL_NV_texture_border_clamp 1
-#define GL_TEXTURE_BORDER_COLOR_NV 0x1004
-#define GL_CLAMP_TO_BORDER_NV 0x812D
-#endif /* GL_NV_texture_border_clamp */
-
-#ifndef GL_NV_texture_compression_s3tc_update
-#define GL_NV_texture_compression_s3tc_update 1
-#endif /* GL_NV_texture_compression_s3tc_update */
-
-#ifndef GL_NV_texture_npot_2D_mipmap
-#define GL_NV_texture_npot_2D_mipmap 1
-#endif /* GL_NV_texture_npot_2D_mipmap */
-
-#ifndef GL_NV_viewport_array
-#define GL_NV_viewport_array 1
-#define GL_MAX_VIEWPORTS_NV 0x825B
-#define GL_VIEWPORT_SUBPIXEL_BITS_NV 0x825C
-#define GL_VIEWPORT_BOUNDS_RANGE_NV 0x825D
-#define GL_VIEWPORT_INDEX_PROVOKING_VERTEX_NV 0x825F
-typedef void (GL_APIENTRYP PFNGLVIEWPORTARRAYVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFNVPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTINDEXEDFVNVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLSCISSORARRAYVNVPROC) (GLuint first, GLsizei count, const GLint *v);
-typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDNVPROC) (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSCISSORINDEXEDVNVPROC) (GLuint index, const GLint *v);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEARRAYFVNVPROC) (GLuint first, GLsizei count, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEINDEXEDFNVPROC) (GLuint index, GLfloat n, GLfloat f);
-typedef void (GL_APIENTRYP PFNGLGETFLOATI_VNVPROC) (GLenum target, GLuint index, GLfloat *data);
-typedef void (GL_APIENTRYP PFNGLENABLEINVPROC) (GLenum target, GLuint index);
-typedef void (GL_APIENTRYP PFNGLDISABLEINVPROC) (GLenum target, GLuint index);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDINVPROC) (GLenum target, GLuint index);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glViewportArrayvNV (GLuint first, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glViewportIndexedfNV (GLuint index, GLfloat x, GLfloat y, GLfloat w, GLfloat h);
-GL_APICALL void GL_APIENTRY glViewportIndexedfvNV (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glScissorArrayvNV (GLuint first, GLsizei count, const GLint *v);
-GL_APICALL void GL_APIENTRY glScissorIndexedNV (GLuint index, GLint left, GLint bottom, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glScissorIndexedvNV (GLuint index, const GLint *v);
-GL_APICALL void GL_APIENTRY glDepthRangeArrayfvNV (GLuint first, GLsizei count, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glDepthRangeIndexedfNV (GLuint index, GLfloat n, GLfloat f);
-GL_APICALL void GL_APIENTRY glGetFloati_vNV (GLenum target, GLuint index, GLfloat *data);
-GL_APICALL void GL_APIENTRY glEnableiNV (GLenum target, GLuint index);
-GL_APICALL void GL_APIENTRY glDisableiNV (GLenum target, GLuint index);
-GL_APICALL GLboolean GL_APIENTRY glIsEnablediNV (GLenum target, GLuint index);
-#endif
-#endif /* GL_NV_viewport_array */
-
-#ifndef GL_NV_viewport_array2
-#define GL_NV_viewport_array2 1
-#endif /* GL_NV_viewport_array2 */
-
-#ifndef GL_NV_viewport_swizzle
-#define GL_NV_viewport_swizzle 1
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_X_NV 0x9350
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_X_NV 0x9351
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Y_NV 0x9352
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Y_NV 0x9353
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_Z_NV 0x9354
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_Z_NV 0x9355
-#define GL_VIEWPORT_SWIZZLE_POSITIVE_W_NV 0x9356
-#define GL_VIEWPORT_SWIZZLE_NEGATIVE_W_NV 0x9357
-#define GL_VIEWPORT_SWIZZLE_X_NV 0x9358
-#define GL_VIEWPORT_SWIZZLE_Y_NV 0x9359
-#define GL_VIEWPORT_SWIZZLE_Z_NV 0x935A
-#define GL_VIEWPORT_SWIZZLE_W_NV 0x935B
-typedef void (GL_APIENTRYP PFNGLVIEWPORTSWIZZLENVPROC) (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glViewportSwizzleNV (GLuint index, GLenum swizzlex, GLenum swizzley, GLenum swizzlez, GLenum swizzlew);
-#endif
-#endif /* GL_NV_viewport_swizzle */
-
-#ifndef GL_OVR_multiview
-#define GL_OVR_multiview 1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_NUM_VIEWS_OVR 0x9630
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_BASE_VIEW_INDEX_OVR 0x9632
-#define GL_MAX_VIEWS_OVR 0x9631
-#define GL_FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR 0x9633
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTextureMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint baseViewIndex, GLsizei numViews);
-#endif
-#endif /* GL_OVR_multiview */
-
-#ifndef GL_OVR_multiview2
-#define GL_OVR_multiview2 1
-#endif /* GL_OVR_multiview2 */
-
-#ifndef GL_OVR_multiview_multisampled_render_to_texture
-#define GL_OVR_multiview_multisampled_render_to_texture 1
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREMULTISAMPLEMULTIVIEWOVRPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferTextureMultisampleMultiviewOVR (GLenum target, GLenum attachment, GLuint texture, GLint level, GLsizei samples, GLint baseViewIndex, GLsizei numViews);
-#endif
-#endif /* GL_OVR_multiview_multisampled_render_to_texture */
-
-#ifndef GL_QCOM_alpha_test
-#define GL_QCOM_alpha_test 1
-#define GL_ALPHA_TEST_QCOM 0x0BC0
-#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1
-#define GL_ALPHA_TEST_REF_QCOM 0x0BC2
-typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref);
-#endif
-#endif /* GL_QCOM_alpha_test */
-
-#ifndef GL_QCOM_binning_control
-#define GL_QCOM_binning_control 1
-#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0
-#define GL_CPU_OPTIMIZED_QCOM 0x8FB1
-#define GL_GPU_OPTIMIZED_QCOM 0x8FB2
-#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3
-#endif /* GL_QCOM_binning_control */
-
-#ifndef GL_QCOM_driver_control
-#define GL_QCOM_driver_control 1
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls);
-typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls);
-GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString);
-GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl);
-GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl);
-#endif
-#endif /* GL_QCOM_driver_control */
-
-#ifndef GL_QCOM_extended_get
-#define GL_QCOM_extended_get 1
-#define GL_TEXTURE_WIDTH_QCOM 0x8BD2
-#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3
-#define GL_TEXTURE_DEPTH_QCOM 0x8BD4
-#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5
-#define GL_TEXTURE_FORMAT_QCOM 0x8BD6
-#define GL_TEXTURE_TYPE_QCOM 0x8BD7
-#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8
-#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9
-#define GL_TEXTURE_TARGET_QCOM 0x8BDA
-#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB
-#define GL_STATE_RESTORE 0x8BDC
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
-typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures);
-GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers);
-GL_APICALL void GL_APIENTRY glExtGetRenderbuffersQCOM (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers);
-GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers);
-GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels);
-GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params);
-#endif
-#endif /* GL_QCOM_extended_get */
-
-#ifndef GL_QCOM_extended_get2
-#define GL_QCOM_extended_get2 1
-typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders);
-GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms);
-GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program);
-GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length);
-#endif
-#endif /* GL_QCOM_extended_get2 */
-
-#ifndef GL_QCOM_framebuffer_foveated
-#define GL_QCOM_framebuffer_foveated 1
-#define GL_FOVEATION_ENABLE_BIT_QCOM 0x00000001
-#define GL_FOVEATION_SCALED_BIN_METHOD_BIT_QCOM 0x00000002
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONCONFIGQCOMPROC) (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFOVEATIONPARAMETERSQCOMPROC) (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferFoveationConfigQCOM (GLuint framebuffer, GLuint numLayers, GLuint focalPointsPerLayer, GLuint requestedFeatures, GLuint *providedFeatures);
-GL_APICALL void GL_APIENTRY glFramebufferFoveationParametersQCOM (GLuint framebuffer, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
-#endif
-#endif /* GL_QCOM_framebuffer_foveated */
-
-#ifndef GL_QCOM_perfmon_global_mode
-#define GL_QCOM_perfmon_global_mode 1
-#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0
-#endif /* GL_QCOM_perfmon_global_mode */
-
-#ifndef GL_QCOM_shader_framebuffer_fetch_noncoherent
-#define GL_QCOM_shader_framebuffer_fetch_noncoherent 1
-#define GL_FRAMEBUFFER_FETCH_NONCOHERENT_QCOM 0x96A2
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERFETCHBARRIERQCOMPROC) (void);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glFramebufferFetchBarrierQCOM (void);
-#endif
-#endif /* GL_QCOM_shader_framebuffer_fetch_noncoherent */
-
-#ifndef GL_QCOM_texture_foveated
-#define GL_QCOM_texture_foveated 1
-#define GL_TEXTURE_FOVEATED_FEATURE_BITS_QCOM 0x8BFB
-#define GL_TEXTURE_FOVEATED_MIN_PIXEL_DENSITY_QCOM 0x8BFC
-#define GL_TEXTURE_FOVEATED_FEATURE_QUERY_QCOM 0x8BFD
-#define GL_TEXTURE_FOVEATED_NUM_FOCAL_POINTS_QUERY_QCOM 0x8BFE
-#define GL_FRAMEBUFFER_INCOMPLETE_FOVEATION_QCOM 0x8BFF
-typedef void (GL_APIENTRYP PFNGLTEXTUREFOVEATIONPARAMETERSQCOMPROC) (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glTextureFoveationParametersQCOM (GLuint texture, GLuint layer, GLuint focalPoint, GLfloat focalX, GLfloat focalY, GLfloat gainX, GLfloat gainY, GLfloat foveaArea);
-#endif
-#endif /* GL_QCOM_texture_foveated */
-
-#ifndef GL_QCOM_tiled_rendering
-#define GL_QCOM_tiled_rendering 1
-#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001
-#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002
-#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004
-#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008
-#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010
-#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020
-#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040
-#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080
-#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100
-#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200
-#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400
-#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800
-#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000
-#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000
-#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000
-#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000
-#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000
-#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000
-#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000
-#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000
-#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000
-#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000
-#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000
-#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000
-#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000
-#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000
-#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000
-#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000
-#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000
-#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000
-#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000
-#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000
-typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask);
-#ifdef GL_GLEXT_PROTOTYPES
-GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask);
-GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask);
-#endif
-#endif /* GL_QCOM_tiled_rendering */
-
-#ifndef GL_QCOM_writeonly_rendering
-#define GL_QCOM_writeonly_rendering 1
-#define GL_WRITEONLY_RENDERING_QCOM 0x8823
-#endif /* GL_QCOM_writeonly_rendering */
-
-#ifndef GL_VIV_shader_binary
-#define GL_VIV_shader_binary 1
-#define GL_SHADER_BINARY_VIV 0x8FC4
-#endif /* GL_VIV_shader_binary */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES2/gl2platform.h b/include/GLES2/gl2platform.h
deleted file mode 100644
index eb318dc3a..000000000
--- a/include/GLES2/gl2platform.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __gl2platform_h_
-#define __gl2platform_h_
-
-/*
-** Copyright (c) 2017 The Khronos Group Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-/* Platform-specific types and definitions for OpenGL ES 2.X gl2.h
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * Please contribute modifications back to Khronos as pull requests on the
- * public github repository:
- * https://github.com/KhronosGroup/OpenGL-Registry
- */
-
-#include <KHR/khrplatform.h>
-
-#ifndef GL_APICALL
-#define GL_APICALL KHRONOS_APICALL
-#endif
-
-#ifndef GL_APIENTRY
-#define GL_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#endif /* __gl2platform_h_ */
diff --git a/include/GLES3/gl3.h b/include/GLES3/gl3.h
deleted file mode 100644
index 639df8c05..000000000
--- a/include/GLES3/gl3.h
+++ /dev/null
@@ -1,1211 +0,0 @@
-#ifndef __gles2_gl3_h_
-#define __gles2_gl3_h_ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
-** Copyright (c) 2013-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-/*
-** This header is generated from the Khronos OpenGL / OpenGL ES XML
-** API Registry. The current version of the Registry, generator scripts
-** used to make the header, and the header can be found at
-** https://github.com/KhronosGroup/OpenGL-Registry
-*/
-
-#include <GLES3/gl3platform.h>
-
-#ifndef GL_APIENTRYP
-#define GL_APIENTRYP GL_APIENTRY*
-#endif
-
-#ifndef GL_GLES_PROTOTYPES
-#define GL_GLES_PROTOTYPES 1
-#endif
-
-/* Generated on date 20180525 */
-
-/* Generated C header for:
- * API: gles2
- * Profile: common
- * Versions considered: 2\.[0-9]|3\.0
- * Versions emitted: .*
- * Default extensions included: None
- * Additional extensions included: _nomatch_^
- * Extensions removed: _nomatch_^
- */
-
-#ifndef GL_ES_VERSION_2_0
-#define GL_ES_VERSION_2_0 1
-#include <KHR/khrplatform.h>
-typedef khronos_int8_t GLbyte;
-typedef khronos_float_t GLclampf;
-typedef khronos_int32_t GLfixed;
-typedef short GLshort;
-typedef unsigned short GLushort;
-typedef void GLvoid;
-typedef struct __GLsync *GLsync;
-typedef khronos_int64_t GLint64;
-typedef khronos_uint64_t GLuint64;
-typedef unsigned int GLenum;
-typedef unsigned int GLuint;
-typedef char GLchar;
-typedef khronos_float_t GLfloat;
-typedef khronos_ssize_t GLsizeiptr;
-typedef khronos_intptr_t GLintptr;
-typedef unsigned int GLbitfield;
-typedef int GLint;
-typedef unsigned char GLboolean;
-typedef int GLsizei;
-typedef khronos_uint8_t GLubyte;
-#define GL_DEPTH_BUFFER_BIT 0x00000100
-#define GL_STENCIL_BUFFER_BIT 0x00000400
-#define GL_COLOR_BUFFER_BIT 0x00004000
-#define GL_FALSE 0
-#define GL_TRUE 1
-#define GL_POINTS 0x0000
-#define GL_LINES 0x0001
-#define GL_LINE_LOOP 0x0002
-#define GL_LINE_STRIP 0x0003
-#define GL_TRIANGLES 0x0004
-#define GL_TRIANGLE_STRIP 0x0005
-#define GL_TRIANGLE_FAN 0x0006
-#define GL_ZERO 0
-#define GL_ONE 1
-#define GL_SRC_COLOR 0x0300
-#define GL_ONE_MINUS_SRC_COLOR 0x0301
-#define GL_SRC_ALPHA 0x0302
-#define GL_ONE_MINUS_SRC_ALPHA 0x0303
-#define GL_DST_ALPHA 0x0304
-#define GL_ONE_MINUS_DST_ALPHA 0x0305
-#define GL_DST_COLOR 0x0306
-#define GL_ONE_MINUS_DST_COLOR 0x0307
-#define GL_SRC_ALPHA_SATURATE 0x0308
-#define GL_FUNC_ADD 0x8006
-#define GL_BLEND_EQUATION 0x8009
-#define GL_BLEND_EQUATION_RGB 0x8009
-#define GL_BLEND_EQUATION_ALPHA 0x883D
-#define GL_FUNC_SUBTRACT 0x800A
-#define GL_FUNC_REVERSE_SUBTRACT 0x800B
-#define GL_BLEND_DST_RGB 0x80C8
-#define GL_BLEND_SRC_RGB 0x80C9
-#define GL_BLEND_DST_ALPHA 0x80CA
-#define GL_BLEND_SRC_ALPHA 0x80CB
-#define GL_CONSTANT_COLOR 0x8001
-#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002
-#define GL_CONSTANT_ALPHA 0x8003
-#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004
-#define GL_BLEND_COLOR 0x8005
-#define GL_ARRAY_BUFFER 0x8892
-#define GL_ELEMENT_ARRAY_BUFFER 0x8893
-#define GL_ARRAY_BUFFER_BINDING 0x8894
-#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895
-#define GL_STREAM_DRAW 0x88E0
-#define GL_STATIC_DRAW 0x88E4
-#define GL_DYNAMIC_DRAW 0x88E8
-#define GL_BUFFER_SIZE 0x8764
-#define GL_BUFFER_USAGE 0x8765
-#define GL_CURRENT_VERTEX_ATTRIB 0x8626
-#define GL_FRONT 0x0404
-#define GL_BACK 0x0405
-#define GL_FRONT_AND_BACK 0x0408
-#define GL_TEXTURE_2D 0x0DE1
-#define GL_CULL_FACE 0x0B44
-#define GL_BLEND 0x0BE2
-#define GL_DITHER 0x0BD0
-#define GL_STENCIL_TEST 0x0B90
-#define GL_DEPTH_TEST 0x0B71
-#define GL_SCISSOR_TEST 0x0C11
-#define GL_POLYGON_OFFSET_FILL 0x8037
-#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E
-#define GL_SAMPLE_COVERAGE 0x80A0
-#define GL_NO_ERROR 0
-#define GL_INVALID_ENUM 0x0500
-#define GL_INVALID_VALUE 0x0501
-#define GL_INVALID_OPERATION 0x0502
-#define GL_OUT_OF_MEMORY 0x0505
-#define GL_CW 0x0900
-#define GL_CCW 0x0901
-#define GL_LINE_WIDTH 0x0B21
-#define GL_ALIASED_POINT_SIZE_RANGE 0x846D
-#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E
-#define GL_CULL_FACE_MODE 0x0B45
-#define GL_FRONT_FACE 0x0B46
-#define GL_DEPTH_RANGE 0x0B70
-#define GL_DEPTH_WRITEMASK 0x0B72
-#define GL_DEPTH_CLEAR_VALUE 0x0B73
-#define GL_DEPTH_FUNC 0x0B74
-#define GL_STENCIL_CLEAR_VALUE 0x0B91
-#define GL_STENCIL_FUNC 0x0B92
-#define GL_STENCIL_FAIL 0x0B94
-#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95
-#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96
-#define GL_STENCIL_REF 0x0B97
-#define GL_STENCIL_VALUE_MASK 0x0B93
-#define GL_STENCIL_WRITEMASK 0x0B98
-#define GL_STENCIL_BACK_FUNC 0x8800
-#define GL_STENCIL_BACK_FAIL 0x8801
-#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802
-#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803
-#define GL_STENCIL_BACK_REF 0x8CA3
-#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4
-#define GL_STENCIL_BACK_WRITEMASK 0x8CA5
-#define GL_VIEWPORT 0x0BA2
-#define GL_SCISSOR_BOX 0x0C10
-#define GL_COLOR_CLEAR_VALUE 0x0C22
-#define GL_COLOR_WRITEMASK 0x0C23
-#define GL_UNPACK_ALIGNMENT 0x0CF5
-#define GL_PACK_ALIGNMENT 0x0D05
-#define GL_MAX_TEXTURE_SIZE 0x0D33
-#define GL_MAX_VIEWPORT_DIMS 0x0D3A
-#define GL_SUBPIXEL_BITS 0x0D50
-#define GL_RED_BITS 0x0D52
-#define GL_GREEN_BITS 0x0D53
-#define GL_BLUE_BITS 0x0D54
-#define GL_ALPHA_BITS 0x0D55
-#define GL_DEPTH_BITS 0x0D56
-#define GL_STENCIL_BITS 0x0D57
-#define GL_POLYGON_OFFSET_UNITS 0x2A00
-#define GL_POLYGON_OFFSET_FACTOR 0x8038
-#define GL_TEXTURE_BINDING_2D 0x8069
-#define GL_SAMPLE_BUFFERS 0x80A8
-#define GL_SAMPLES 0x80A9
-#define GL_SAMPLE_COVERAGE_VALUE 0x80AA
-#define GL_SAMPLE_COVERAGE_INVERT 0x80AB
-#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2
-#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3
-#define GL_DONT_CARE 0x1100
-#define GL_FASTEST 0x1101
-#define GL_NICEST 0x1102
-#define GL_GENERATE_MIPMAP_HINT 0x8192
-#define GL_BYTE 0x1400
-#define GL_UNSIGNED_BYTE 0x1401
-#define GL_SHORT 0x1402
-#define GL_UNSIGNED_SHORT 0x1403
-#define GL_INT 0x1404
-#define GL_UNSIGNED_INT 0x1405
-#define GL_FLOAT 0x1406
-#define GL_FIXED 0x140C
-#define GL_DEPTH_COMPONENT 0x1902
-#define GL_ALPHA 0x1906
-#define GL_RGB 0x1907
-#define GL_RGBA 0x1908
-#define GL_LUMINANCE 0x1909
-#define GL_LUMINANCE_ALPHA 0x190A
-#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033
-#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034
-#define GL_UNSIGNED_SHORT_5_6_5 0x8363
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-#define GL_MAX_VERTEX_ATTRIBS 0x8869
-#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB
-#define GL_MAX_VARYING_VECTORS 0x8DFC
-#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D
-#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C
-#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872
-#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD
-#define GL_SHADER_TYPE 0x8B4F
-#define GL_DELETE_STATUS 0x8B80
-#define GL_LINK_STATUS 0x8B82
-#define GL_VALIDATE_STATUS 0x8B83
-#define GL_ATTACHED_SHADERS 0x8B85
-#define GL_ACTIVE_UNIFORMS 0x8B86
-#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87
-#define GL_ACTIVE_ATTRIBUTES 0x8B89
-#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A
-#define GL_SHADING_LANGUAGE_VERSION 0x8B8C
-#define GL_CURRENT_PROGRAM 0x8B8D
-#define GL_NEVER 0x0200
-#define GL_LESS 0x0201
-#define GL_EQUAL 0x0202
-#define GL_LEQUAL 0x0203
-#define GL_GREATER 0x0204
-#define GL_NOTEQUAL 0x0205
-#define GL_GEQUAL 0x0206
-#define GL_ALWAYS 0x0207
-#define GL_KEEP 0x1E00
-#define GL_REPLACE 0x1E01
-#define GL_INCR 0x1E02
-#define GL_DECR 0x1E03
-#define GL_INVERT 0x150A
-#define GL_INCR_WRAP 0x8507
-#define GL_DECR_WRAP 0x8508
-#define GL_VENDOR 0x1F00
-#define GL_RENDERER 0x1F01
-#define GL_VERSION 0x1F02
-#define GL_EXTENSIONS 0x1F03
-#define GL_NEAREST 0x2600
-#define GL_LINEAR 0x2601
-#define GL_NEAREST_MIPMAP_NEAREST 0x2700
-#define GL_LINEAR_MIPMAP_NEAREST 0x2701
-#define GL_NEAREST_MIPMAP_LINEAR 0x2702
-#define GL_LINEAR_MIPMAP_LINEAR 0x2703
-#define GL_TEXTURE_MAG_FILTER 0x2800
-#define GL_TEXTURE_MIN_FILTER 0x2801
-#define GL_TEXTURE_WRAP_S 0x2802
-#define GL_TEXTURE_WRAP_T 0x2803
-#define GL_TEXTURE 0x1702
-#define GL_TEXTURE_CUBE_MAP 0x8513
-#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518
-#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519
-#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A
-#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C
-#define GL_TEXTURE0 0x84C0
-#define GL_TEXTURE1 0x84C1
-#define GL_TEXTURE2 0x84C2
-#define GL_TEXTURE3 0x84C3
-#define GL_TEXTURE4 0x84C4
-#define GL_TEXTURE5 0x84C5
-#define GL_TEXTURE6 0x84C6
-#define GL_TEXTURE7 0x84C7
-#define GL_TEXTURE8 0x84C8
-#define GL_TEXTURE9 0x84C9
-#define GL_TEXTURE10 0x84CA
-#define GL_TEXTURE11 0x84CB
-#define GL_TEXTURE12 0x84CC
-#define GL_TEXTURE13 0x84CD
-#define GL_TEXTURE14 0x84CE
-#define GL_TEXTURE15 0x84CF
-#define GL_TEXTURE16 0x84D0
-#define GL_TEXTURE17 0x84D1
-#define GL_TEXTURE18 0x84D2
-#define GL_TEXTURE19 0x84D3
-#define GL_TEXTURE20 0x84D4
-#define GL_TEXTURE21 0x84D5
-#define GL_TEXTURE22 0x84D6
-#define GL_TEXTURE23 0x84D7
-#define GL_TEXTURE24 0x84D8
-#define GL_TEXTURE25 0x84D9
-#define GL_TEXTURE26 0x84DA
-#define GL_TEXTURE27 0x84DB
-#define GL_TEXTURE28 0x84DC
-#define GL_TEXTURE29 0x84DD
-#define GL_TEXTURE30 0x84DE
-#define GL_TEXTURE31 0x84DF
-#define GL_ACTIVE_TEXTURE 0x84E0
-#define GL_REPEAT 0x2901
-#define GL_CLAMP_TO_EDGE 0x812F
-#define GL_MIRRORED_REPEAT 0x8370
-#define GL_FLOAT_VEC2 0x8B50
-#define GL_FLOAT_VEC3 0x8B51
-#define GL_FLOAT_VEC4 0x8B52
-#define GL_INT_VEC2 0x8B53
-#define GL_INT_VEC3 0x8B54
-#define GL_INT_VEC4 0x8B55
-#define GL_BOOL 0x8B56
-#define GL_BOOL_VEC2 0x8B57
-#define GL_BOOL_VEC3 0x8B58
-#define GL_BOOL_VEC4 0x8B59
-#define GL_FLOAT_MAT2 0x8B5A
-#define GL_FLOAT_MAT3 0x8B5B
-#define GL_FLOAT_MAT4 0x8B5C
-#define GL_SAMPLER_2D 0x8B5E
-#define GL_SAMPLER_CUBE 0x8B60
-#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622
-#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623
-#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624
-#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625
-#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A
-#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645
-#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F
-#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A
-#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B
-#define GL_COMPILE_STATUS 0x8B81
-#define GL_INFO_LOG_LENGTH 0x8B84
-#define GL_SHADER_SOURCE_LENGTH 0x8B88
-#define GL_SHADER_COMPILER 0x8DFA
-#define GL_SHADER_BINARY_FORMATS 0x8DF8
-#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9
-#define GL_LOW_FLOAT 0x8DF0
-#define GL_MEDIUM_FLOAT 0x8DF1
-#define GL_HIGH_FLOAT 0x8DF2
-#define GL_LOW_INT 0x8DF3
-#define GL_MEDIUM_INT 0x8DF4
-#define GL_HIGH_INT 0x8DF5
-#define GL_FRAMEBUFFER 0x8D40
-#define GL_RENDERBUFFER 0x8D41
-#define GL_RGBA4 0x8056
-#define GL_RGB5_A1 0x8057
-#define GL_RGB565 0x8D62
-#define GL_DEPTH_COMPONENT16 0x81A5
-#define GL_STENCIL_INDEX8 0x8D48
-#define GL_RENDERBUFFER_WIDTH 0x8D42
-#define GL_RENDERBUFFER_HEIGHT 0x8D43
-#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44
-#define GL_RENDERBUFFER_RED_SIZE 0x8D50
-#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51
-#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52
-#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53
-#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54
-#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0
-#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3
-#define GL_COLOR_ATTACHMENT0 0x8CE0
-#define GL_DEPTH_ATTACHMENT 0x8D00
-#define GL_STENCIL_ATTACHMENT 0x8D20
-#define GL_NONE 0
-#define GL_FRAMEBUFFER_COMPLETE 0x8CD5
-#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6
-#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7
-#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9
-#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD
-#define GL_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_RENDERBUFFER_BINDING 0x8CA7
-#define GL_MAX_RENDERBUFFER_SIZE 0x84E8
-#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506
-typedef void (GL_APIENTRYP PFNGLACTIVETEXTUREPROC) (GLenum texture);
-typedef void (GL_APIENTRYP PFNGLATTACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GL_APIENTRYP PFNGLBINDATTRIBLOCATIONPROC) (GLuint program, GLuint index, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLBINDBUFFERPROC) (GLenum target, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLBINDFRAMEBUFFERPROC) (GLenum target, GLuint framebuffer);
-typedef void (GL_APIENTRYP PFNGLBINDRENDERBUFFERPROC) (GLenum target, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLBINDTEXTUREPROC) (GLenum target, GLuint texture);
-typedef void (GL_APIENTRYP PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEPROC) (GLenum modeRGB, GLenum modeAlpha);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCPROC) (GLenum sfactor, GLenum dfactor);
-typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEPROC) (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-typedef void (GL_APIENTRYP PFNGLBUFFERDATAPROC) (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-typedef void (GL_APIENTRYP PFNGLBUFFERSUBDATAPROC) (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-typedef GLenum (GL_APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLCLEARPROC) (GLbitfield mask);
-typedef void (GL_APIENTRYP PFNGLCLEARCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-typedef void (GL_APIENTRYP PFNGLCLEARDEPTHFPROC) (GLfloat d);
-typedef void (GL_APIENTRYP PFNGLCLEARSTENCILPROC) (GLint s);
-typedef void (GL_APIENTRYP PFNGLCOLORMASKPROC) (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-typedef void (GL_APIENTRYP PFNGLCOMPILESHADERPROC) (GLuint shader);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXIMAGE2DPROC) (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef GLuint (GL_APIENTRYP PFNGLCREATEPROGRAMPROC) (void);
-typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROC) (GLenum type);
-typedef void (GL_APIENTRYP PFNGLCULLFACEPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLDELETEBUFFERSPROC) (GLsizei n, const GLuint *buffers);
-typedef void (GL_APIENTRYP PFNGLDELETEFRAMEBUFFERSPROC) (GLsizei n, const GLuint *framebuffers);
-typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLDELETERENDERBUFFERSPROC) (GLsizei n, const GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLDELETESHADERPROC) (GLuint shader);
-typedef void (GL_APIENTRYP PFNGLDELETETEXTURESPROC) (GLsizei n, const GLuint *textures);
-typedef void (GL_APIENTRYP PFNGLDEPTHFUNCPROC) (GLenum func);
-typedef void (GL_APIENTRYP PFNGLDEPTHMASKPROC) (GLboolean flag);
-typedef void (GL_APIENTRYP PFNGLDEPTHRANGEFPROC) (GLfloat n, GLfloat f);
-typedef void (GL_APIENTRYP PFNGLDETACHSHADERPROC) (GLuint program, GLuint shader);
-typedef void (GL_APIENTRYP PFNGLDISABLEPROC) (GLenum cap);
-typedef void (GL_APIENTRYP PFNGLDISABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSPROC) (GLenum mode, GLint first, GLsizei count);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices);
-typedef void (GL_APIENTRYP PFNGLENABLEPROC) (GLenum cap);
-typedef void (GL_APIENTRYP PFNGLENABLEVERTEXATTRIBARRAYPROC) (GLuint index);
-typedef void (GL_APIENTRYP PFNGLFINISHPROC) (void);
-typedef void (GL_APIENTRYP PFNGLFLUSHPROC) (void);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERRENDERBUFFERPROC) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-typedef void (GL_APIENTRYP PFNGLFRONTFACEPROC) (GLenum mode);
-typedef void (GL_APIENTRYP PFNGLGENBUFFERSPROC) (GLsizei n, GLuint *buffers);
-typedef void (GL_APIENTRYP PFNGLGENERATEMIPMAPPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGENFRAMEBUFFERSPROC) (GLsizei n, GLuint *framebuffers);
-typedef void (GL_APIENTRYP PFNGLGENRENDERBUFFERSPROC) (GLsizei n, GLuint *renderbuffers);
-typedef void (GL_APIENTRYP PFNGLGENTEXTURESPROC) (GLsizei n, GLuint *textures);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEATTRIBPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETATTACHEDSHADERSPROC) (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-typedef GLint (GL_APIENTRYP PFNGLGETATTRIBLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETBOOLEANVPROC) (GLenum pname, GLboolean *data);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef GLenum (GL_APIENTRYP PFNGLGETERRORPROC) (void);
-typedef void (GL_APIENTRYP PFNGLGETFLOATVPROC) (GLenum pname, GLfloat *data);
-typedef void (GL_APIENTRYP PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC) (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERVPROC) (GLenum pname, GLint *data);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMIVPROC) (GLuint program, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMINFOLOGPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETRENDERBUFFERPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSHADERIVPROC) (GLuint shader, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSHADERINFOLOGPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-typedef void (GL_APIENTRYP PFNGLGETSHADERPRECISIONFORMATPROC) (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-typedef void (GL_APIENTRYP PFNGLGETSHADERSOURCEPROC) (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGPROC) (GLenum name);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERFVPROC) (GLenum target, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMFVPROC) (GLuint program, GLint location, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMIVPROC) (GLuint program, GLint location, GLint *params);
-typedef GLint (GL_APIENTRYP PFNGLGETUNIFORMLOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBFVPROC) (GLuint index, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBPOINTERVPROC) (GLuint index, GLenum pname, void **pointer);
-typedef void (GL_APIENTRYP PFNGLHINTPROC) (GLenum target, GLenum mode);
-typedef GLboolean (GL_APIENTRYP PFNGLISBUFFERPROC) (GLuint buffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDPROC) (GLenum cap);
-typedef GLboolean (GL_APIENTRYP PFNGLISFRAMEBUFFERPROC) (GLuint framebuffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPROC) (GLuint program);
-typedef GLboolean (GL_APIENTRYP PFNGLISRENDERBUFFERPROC) (GLuint renderbuffer);
-typedef GLboolean (GL_APIENTRYP PFNGLISSHADERPROC) (GLuint shader);
-typedef GLboolean (GL_APIENTRYP PFNGLISTEXTUREPROC) (GLuint texture);
-typedef void (GL_APIENTRYP PFNGLLINEWIDTHPROC) (GLfloat width);
-typedef void (GL_APIENTRYP PFNGLLINKPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLPIXELSTOREIPROC) (GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLPOLYGONOFFSETPROC) (GLfloat factor, GLfloat units);
-typedef void (GL_APIENTRYP PFNGLREADPIXELSPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-typedef void (GL_APIENTRYP PFNGLRELEASESHADERCOMPILERPROC) (void);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEPROC) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSAMPLECOVERAGEPROC) (GLfloat value, GLboolean invert);
-typedef void (GL_APIENTRYP PFNGLSCISSORPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLSHADERBINARYPROC) (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-typedef void (GL_APIENTRYP PFNGLSHADERSOURCEPROC) (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-typedef void (GL_APIENTRYP PFNGLSTENCILFUNCPROC) (GLenum func, GLint ref, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILFUNCSEPARATEPROC) (GLenum face, GLenum func, GLint ref, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILMASKPROC) (GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILMASKSEPARATEPROC) (GLenum face, GLuint mask);
-typedef void (GL_APIENTRYP PFNGLSTENCILOPPROC) (GLenum fail, GLenum zfail, GLenum zpass);
-typedef void (GL_APIENTRYP PFNGLSTENCILOPSEPARATEPROC) (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE2DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFPROC) (GLenum target, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERFVPROC) (GLenum target, GLenum pname, const GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIPROC) (GLenum target, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIVPROC) (GLenum target, GLenum pname, const GLint *params);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE2DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1FPROC) (GLint location, GLfloat v0);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1IPROC) (GLint location, GLint v0);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2FPROC) (GLint location, GLfloat v0, GLfloat v1);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2IPROC) (GLint location, GLint v0, GLint v1);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3IPROC) (GLint location, GLint v0, GLint v1, GLint v2);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4FPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4FVPROC) (GLint location, GLsizei count, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4IPROC) (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUSEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FPROC) (GLuint index, GLfloat x);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB1FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FPROC) (GLuint index, GLfloat x, GLfloat y);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB2FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB3FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FPROC) (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-typedef void (GL_APIENTRYP PFNGLVIEWPORTPROC) (GLint x, GLint y, GLsizei width, GLsizei height);
-#if GL_GLES_PROTOTYPES
-GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture);
-GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name);
-GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer);
-GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer);
-GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture);
-GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode);
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha);
-GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor);
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha);
-GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage);
-GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data);
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target);
-GL_APICALL void GL_APIENTRY glClear (GLbitfield mask);
-GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha);
-GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d);
-GL_APICALL void GL_APIENTRY glClearStencil (GLint s);
-GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
-GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL GLuint GL_APIENTRY glCreateProgram (void);
-GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type);
-GL_APICALL void GL_APIENTRY glCullFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers);
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers);
-GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers);
-GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader);
-GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures);
-GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func);
-GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag);
-GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f);
-GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader);
-GL_APICALL void GL_APIENTRY glDisable (GLenum cap);
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count);
-GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices);
-GL_APICALL void GL_APIENTRY glEnable (GLenum cap);
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index);
-GL_APICALL void GL_APIENTRY glFinish (void);
-GL_APICALL void GL_APIENTRY glFlush (void);
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
-GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode);
-GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers);
-GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target);
-GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers);
-GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers);
-GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures);
-GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders);
-GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data);
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL GLenum GL_APIENTRY glGetError (void);
-GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data);
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data);
-GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog);
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision);
-GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source);
-GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name);
-GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params);
-GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer);
-GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode);
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer);
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap);
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program);
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer);
-GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader);
-GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture);
-GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width);
-GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units);
-GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels);
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void);
-GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert);
-GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length);
-GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask);
-GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass);
-GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass);
-GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params);
-GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params);
-GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0);
-GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0);
-GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1);
-GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1);
-GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
-GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2);
-GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
-GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3);
-GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUseProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program);
-GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x);
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y);
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z);
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v);
-GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height);
-#endif
-#endif /* GL_ES_VERSION_2_0 */
-
-#ifndef GL_ES_VERSION_3_0
-#define GL_ES_VERSION_3_0 1
-typedef unsigned short GLhalf;
-#define GL_READ_BUFFER 0x0C02
-#define GL_UNPACK_ROW_LENGTH 0x0CF2
-#define GL_UNPACK_SKIP_ROWS 0x0CF3
-#define GL_UNPACK_SKIP_PIXELS 0x0CF4
-#define GL_PACK_ROW_LENGTH 0x0D02
-#define GL_PACK_SKIP_ROWS 0x0D03
-#define GL_PACK_SKIP_PIXELS 0x0D04
-#define GL_COLOR 0x1800
-#define GL_DEPTH 0x1801
-#define GL_STENCIL 0x1802
-#define GL_RED 0x1903
-#define GL_RGB8 0x8051
-#define GL_RGBA8 0x8058
-#define GL_RGB10_A2 0x8059
-#define GL_TEXTURE_BINDING_3D 0x806A
-#define GL_UNPACK_SKIP_IMAGES 0x806D
-#define GL_UNPACK_IMAGE_HEIGHT 0x806E
-#define GL_TEXTURE_3D 0x806F
-#define GL_TEXTURE_WRAP_R 0x8072
-#define GL_MAX_3D_TEXTURE_SIZE 0x8073
-#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368
-#define GL_MAX_ELEMENTS_VERTICES 0x80E8
-#define GL_MAX_ELEMENTS_INDICES 0x80E9
-#define GL_TEXTURE_MIN_LOD 0x813A
-#define GL_TEXTURE_MAX_LOD 0x813B
-#define GL_TEXTURE_BASE_LEVEL 0x813C
-#define GL_TEXTURE_MAX_LEVEL 0x813D
-#define GL_MIN 0x8007
-#define GL_MAX 0x8008
-#define GL_DEPTH_COMPONENT24 0x81A6
-#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD
-#define GL_TEXTURE_COMPARE_MODE 0x884C
-#define GL_TEXTURE_COMPARE_FUNC 0x884D
-#define GL_CURRENT_QUERY 0x8865
-#define GL_QUERY_RESULT 0x8866
-#define GL_QUERY_RESULT_AVAILABLE 0x8867
-#define GL_BUFFER_MAPPED 0x88BC
-#define GL_BUFFER_MAP_POINTER 0x88BD
-#define GL_STREAM_READ 0x88E1
-#define GL_STREAM_COPY 0x88E2
-#define GL_STATIC_READ 0x88E5
-#define GL_STATIC_COPY 0x88E6
-#define GL_DYNAMIC_READ 0x88E9
-#define GL_DYNAMIC_COPY 0x88EA
-#define GL_MAX_DRAW_BUFFERS 0x8824
-#define GL_DRAW_BUFFER0 0x8825
-#define GL_DRAW_BUFFER1 0x8826
-#define GL_DRAW_BUFFER2 0x8827
-#define GL_DRAW_BUFFER3 0x8828
-#define GL_DRAW_BUFFER4 0x8829
-#define GL_DRAW_BUFFER5 0x882A
-#define GL_DRAW_BUFFER6 0x882B
-#define GL_DRAW_BUFFER7 0x882C
-#define GL_DRAW_BUFFER8 0x882D
-#define GL_DRAW_BUFFER9 0x882E
-#define GL_DRAW_BUFFER10 0x882F
-#define GL_DRAW_BUFFER11 0x8830
-#define GL_DRAW_BUFFER12 0x8831
-#define GL_DRAW_BUFFER13 0x8832
-#define GL_DRAW_BUFFER14 0x8833
-#define GL_DRAW_BUFFER15 0x8834
-#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49
-#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A
-#define GL_SAMPLER_3D 0x8B5F
-#define GL_SAMPLER_2D_SHADOW 0x8B62
-#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B
-#define GL_PIXEL_PACK_BUFFER 0x88EB
-#define GL_PIXEL_UNPACK_BUFFER 0x88EC
-#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED
-#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF
-#define GL_FLOAT_MAT2x3 0x8B65
-#define GL_FLOAT_MAT2x4 0x8B66
-#define GL_FLOAT_MAT3x2 0x8B67
-#define GL_FLOAT_MAT3x4 0x8B68
-#define GL_FLOAT_MAT4x2 0x8B69
-#define GL_FLOAT_MAT4x3 0x8B6A
-#define GL_SRGB 0x8C40
-#define GL_SRGB8 0x8C41
-#define GL_SRGB8_ALPHA8 0x8C43
-#define GL_COMPARE_REF_TO_TEXTURE 0x884E
-#define GL_MAJOR_VERSION 0x821B
-#define GL_MINOR_VERSION 0x821C
-#define GL_NUM_EXTENSIONS 0x821D
-#define GL_RGBA32F 0x8814
-#define GL_RGB32F 0x8815
-#define GL_RGBA16F 0x881A
-#define GL_RGB16F 0x881B
-#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD
-#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF
-#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904
-#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905
-#define GL_MAX_VARYING_COMPONENTS 0x8B4B
-#define GL_TEXTURE_2D_ARRAY 0x8C1A
-#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D
-#define GL_R11F_G11F_B10F 0x8C3A
-#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B
-#define GL_RGB9_E5 0x8C3D
-#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E
-#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76
-#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80
-#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83
-#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84
-#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85
-#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88
-#define GL_RASTERIZER_DISCARD 0x8C89
-#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A
-#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B
-#define GL_INTERLEAVED_ATTRIBS 0x8C8C
-#define GL_SEPARATE_ATTRIBS 0x8C8D
-#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E
-#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F
-#define GL_RGBA32UI 0x8D70
-#define GL_RGB32UI 0x8D71
-#define GL_RGBA16UI 0x8D76
-#define GL_RGB16UI 0x8D77
-#define GL_RGBA8UI 0x8D7C
-#define GL_RGB8UI 0x8D7D
-#define GL_RGBA32I 0x8D82
-#define GL_RGB32I 0x8D83
-#define GL_RGBA16I 0x8D88
-#define GL_RGB16I 0x8D89
-#define GL_RGBA8I 0x8D8E
-#define GL_RGB8I 0x8D8F
-#define GL_RED_INTEGER 0x8D94
-#define GL_RGB_INTEGER 0x8D98
-#define GL_RGBA_INTEGER 0x8D99
-#define GL_SAMPLER_2D_ARRAY 0x8DC1
-#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4
-#define GL_SAMPLER_CUBE_SHADOW 0x8DC5
-#define GL_UNSIGNED_INT_VEC2 0x8DC6
-#define GL_UNSIGNED_INT_VEC3 0x8DC7
-#define GL_UNSIGNED_INT_VEC4 0x8DC8
-#define GL_INT_SAMPLER_2D 0x8DCA
-#define GL_INT_SAMPLER_3D 0x8DCB
-#define GL_INT_SAMPLER_CUBE 0x8DCC
-#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF
-#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2
-#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3
-#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4
-#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7
-#define GL_BUFFER_ACCESS_FLAGS 0x911F
-#define GL_BUFFER_MAP_LENGTH 0x9120
-#define GL_BUFFER_MAP_OFFSET 0x9121
-#define GL_DEPTH_COMPONENT32F 0x8CAC
-#define GL_DEPTH32F_STENCIL8 0x8CAD
-#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD
-#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210
-#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211
-#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212
-#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213
-#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214
-#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215
-#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216
-#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217
-#define GL_FRAMEBUFFER_DEFAULT 0x8218
-#define GL_FRAMEBUFFER_UNDEFINED 0x8219
-#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A
-#define GL_DEPTH_STENCIL 0x84F9
-#define GL_UNSIGNED_INT_24_8 0x84FA
-#define GL_DEPTH24_STENCIL8 0x88F0
-#define GL_UNSIGNED_NORMALIZED 0x8C17
-#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6
-#define GL_READ_FRAMEBUFFER 0x8CA8
-#define GL_DRAW_FRAMEBUFFER 0x8CA9
-#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA
-#define GL_RENDERBUFFER_SAMPLES 0x8CAB
-#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4
-#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF
-#define GL_COLOR_ATTACHMENT1 0x8CE1
-#define GL_COLOR_ATTACHMENT2 0x8CE2
-#define GL_COLOR_ATTACHMENT3 0x8CE3
-#define GL_COLOR_ATTACHMENT4 0x8CE4
-#define GL_COLOR_ATTACHMENT5 0x8CE5
-#define GL_COLOR_ATTACHMENT6 0x8CE6
-#define GL_COLOR_ATTACHMENT7 0x8CE7
-#define GL_COLOR_ATTACHMENT8 0x8CE8
-#define GL_COLOR_ATTACHMENT9 0x8CE9
-#define GL_COLOR_ATTACHMENT10 0x8CEA
-#define GL_COLOR_ATTACHMENT11 0x8CEB
-#define GL_COLOR_ATTACHMENT12 0x8CEC
-#define GL_COLOR_ATTACHMENT13 0x8CED
-#define GL_COLOR_ATTACHMENT14 0x8CEE
-#define GL_COLOR_ATTACHMENT15 0x8CEF
-#define GL_COLOR_ATTACHMENT16 0x8CF0
-#define GL_COLOR_ATTACHMENT17 0x8CF1
-#define GL_COLOR_ATTACHMENT18 0x8CF2
-#define GL_COLOR_ATTACHMENT19 0x8CF3
-#define GL_COLOR_ATTACHMENT20 0x8CF4
-#define GL_COLOR_ATTACHMENT21 0x8CF5
-#define GL_COLOR_ATTACHMENT22 0x8CF6
-#define GL_COLOR_ATTACHMENT23 0x8CF7
-#define GL_COLOR_ATTACHMENT24 0x8CF8
-#define GL_COLOR_ATTACHMENT25 0x8CF9
-#define GL_COLOR_ATTACHMENT26 0x8CFA
-#define GL_COLOR_ATTACHMENT27 0x8CFB
-#define GL_COLOR_ATTACHMENT28 0x8CFC
-#define GL_COLOR_ATTACHMENT29 0x8CFD
-#define GL_COLOR_ATTACHMENT30 0x8CFE
-#define GL_COLOR_ATTACHMENT31 0x8CFF
-#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56
-#define GL_MAX_SAMPLES 0x8D57
-#define GL_HALF_FLOAT 0x140B
-#define GL_MAP_READ_BIT 0x0001
-#define GL_MAP_WRITE_BIT 0x0002
-#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004
-#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008
-#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010
-#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020
-#define GL_RG 0x8227
-#define GL_RG_INTEGER 0x8228
-#define GL_R8 0x8229
-#define GL_RG8 0x822B
-#define GL_R16F 0x822D
-#define GL_R32F 0x822E
-#define GL_RG16F 0x822F
-#define GL_RG32F 0x8230
-#define GL_R8I 0x8231
-#define GL_R8UI 0x8232
-#define GL_R16I 0x8233
-#define GL_R16UI 0x8234
-#define GL_R32I 0x8235
-#define GL_R32UI 0x8236
-#define GL_RG8I 0x8237
-#define GL_RG8UI 0x8238
-#define GL_RG16I 0x8239
-#define GL_RG16UI 0x823A
-#define GL_RG32I 0x823B
-#define GL_RG32UI 0x823C
-#define GL_VERTEX_ARRAY_BINDING 0x85B5
-#define GL_R8_SNORM 0x8F94
-#define GL_RG8_SNORM 0x8F95
-#define GL_RGB8_SNORM 0x8F96
-#define GL_RGBA8_SNORM 0x8F97
-#define GL_SIGNED_NORMALIZED 0x8F9C
-#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69
-#define GL_COPY_READ_BUFFER 0x8F36
-#define GL_COPY_WRITE_BUFFER 0x8F37
-#define GL_COPY_READ_BUFFER_BINDING 0x8F36
-#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37
-#define GL_UNIFORM_BUFFER 0x8A11
-#define GL_UNIFORM_BUFFER_BINDING 0x8A28
-#define GL_UNIFORM_BUFFER_START 0x8A29
-#define GL_UNIFORM_BUFFER_SIZE 0x8A2A
-#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B
-#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D
-#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E
-#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F
-#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30
-#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31
-#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33
-#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34
-#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35
-#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36
-#define GL_UNIFORM_TYPE 0x8A37
-#define GL_UNIFORM_SIZE 0x8A38
-#define GL_UNIFORM_NAME_LENGTH 0x8A39
-#define GL_UNIFORM_BLOCK_INDEX 0x8A3A
-#define GL_UNIFORM_OFFSET 0x8A3B
-#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C
-#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D
-#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E
-#define GL_UNIFORM_BLOCK_BINDING 0x8A3F
-#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40
-#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42
-#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44
-#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46
-#define GL_INVALID_INDEX 0xFFFFFFFFu
-#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122
-#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125
-#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111
-#define GL_OBJECT_TYPE 0x9112
-#define GL_SYNC_CONDITION 0x9113
-#define GL_SYNC_STATUS 0x9114
-#define GL_SYNC_FLAGS 0x9115
-#define GL_SYNC_FENCE 0x9116
-#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117
-#define GL_UNSIGNALED 0x9118
-#define GL_SIGNALED 0x9119
-#define GL_ALREADY_SIGNALED 0x911A
-#define GL_TIMEOUT_EXPIRED 0x911B
-#define GL_CONDITION_SATISFIED 0x911C
-#define GL_WAIT_FAILED 0x911D
-#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001
-#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull
-#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE
-#define GL_ANY_SAMPLES_PASSED 0x8C2F
-#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A
-#define GL_SAMPLER_BINDING 0x8919
-#define GL_RGB10_A2UI 0x906F
-#define GL_TEXTURE_SWIZZLE_R 0x8E42
-#define GL_TEXTURE_SWIZZLE_G 0x8E43
-#define GL_TEXTURE_SWIZZLE_B 0x8E44
-#define GL_TEXTURE_SWIZZLE_A 0x8E45
-#define GL_GREEN 0x1904
-#define GL_BLUE 0x1905
-#define GL_INT_2_10_10_10_REV 0x8D9F
-#define GL_TRANSFORM_FEEDBACK 0x8E22
-#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23
-#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24
-#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25
-#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257
-#define GL_PROGRAM_BINARY_LENGTH 0x8741
-#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE
-#define GL_PROGRAM_BINARY_FORMATS 0x87FF
-#define GL_COMPRESSED_R11_EAC 0x9270
-#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271
-#define GL_COMPRESSED_RG11_EAC 0x9272
-#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273
-#define GL_COMPRESSED_RGB8_ETC2 0x9274
-#define GL_COMPRESSED_SRGB8_ETC2 0x9275
-#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276
-#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277
-#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278
-#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279
-#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F
-#define GL_MAX_ELEMENT_INDEX 0x8D6B
-#define GL_NUM_SAMPLE_COUNTS 0x9380
-#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF
-typedef void (GL_APIENTRYP PFNGLREADBUFFERPROC) (GLenum src);
-typedef void (GL_APIENTRYP PFNGLDRAWRANGEELEMENTSPROC) (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DPROC) (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-typedef void (GL_APIENTRYP PFNGLGENQUERIESPROC) (GLsizei n, GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLDELETEQUERIESPROC) (GLsizei n, const GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISQUERYPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLBEGINQUERYPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLENDQUERYPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETQUERYIVPROC) (GLenum target, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVPROC) (GLuint id, GLenum pname, GLuint *params);
-typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFERPROC) (GLenum target);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVPROC) (GLenum target, GLenum pname, void **params);
-typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSPROC) (GLsizei n, const GLenum *bufs);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURELAYERPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEPROC) (GLenum target, GLintptr offset, GLsizeiptr length);
-typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSPROC) (GLsizei n, const GLuint *arrays);
-typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSPROC) (GLsizei n, GLuint *arrays);
-typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYPROC) (GLuint array);
-typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VPROC) (GLenum target, GLuint index, GLint *data);
-typedef void (GL_APIENTRYP PFNGLBEGINTRANSFORMFEEDBACKPROC) (GLenum primitiveMode);
-typedef void (GL_APIENTRYP PFNGLENDTRANSFORMFEEDBACKPROC) (void);
-typedef void (GL_APIENTRYP PFNGLBINDBUFFERRANGEPROC) (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-typedef void (GL_APIENTRYP PFNGLBINDBUFFERBASEPROC) (GLenum target, GLuint index, GLuint buffer);
-typedef void (GL_APIENTRYP PFNGLTRANSFORMFEEDBACKVARYINGSPROC) (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-typedef void (GL_APIENTRYP PFNGLGETTRANSFORMFEEDBACKVARYINGPROC) (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIIVPROC) (GLuint index, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETVERTEXATTRIBIUIVPROC) (GLuint index, GLenum pname, GLuint *params);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IPROC) (GLuint index, GLint x, GLint y, GLint z, GLint w);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIPROC) (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4IVPROC) (GLuint index, const GLint *v);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBI4UIVPROC) (GLuint index, const GLuint *v);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMUIVPROC) (GLuint program, GLint location, GLuint *params);
-typedef GLint (GL_APIENTRYP PFNGLGETFRAGDATALOCATIONPROC) (GLuint program, const GLchar *name);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1UIPROC) (GLint location, GLuint v0);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2UIPROC) (GLint location, GLuint v0, GLuint v1);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4UIPROC) (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-typedef void (GL_APIENTRYP PFNGLUNIFORM1UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM2UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM3UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLUNIFORM4UIVPROC) (GLint location, GLsizei count, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLCLEARBUFFERIVPROC) (GLenum buffer, GLint drawbuffer, const GLint *value);
-typedef void (GL_APIENTRYP PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint *value);
-typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFVPROC) (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-typedef void (GL_APIENTRYP PFNGLCLEARBUFFERFIPROC) (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-typedef const GLubyte *(GL_APIENTRYP PFNGLGETSTRINGIPROC) (GLenum name, GLuint index);
-typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATAPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-typedef void (GL_APIENTRYP PFNGLGETUNIFORMINDICESPROC) (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMSIVPROC) (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-typedef GLuint (GL_APIENTRYP PFNGLGETUNIFORMBLOCKINDEXPROC) (GLuint program, const GLchar *uniformBlockName);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKIVPROC) (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC) (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-typedef void (GL_APIENTRYP PFNGLUNIFORMBLOCKBINDINGPROC) (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCPROC) (GLenum condition, GLbitfield flags);
-typedef GLboolean (GL_APIENTRYP PFNGLISSYNCPROC) (GLsync sync);
-typedef void (GL_APIENTRYP PFNGLDELETESYNCPROC) (GLsync sync);
-typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLWAITSYNCPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64VPROC) (GLenum pname, GLint64 *data);
-typedef void (GL_APIENTRYP PFNGLGETSYNCIVPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-typedef void (GL_APIENTRYP PFNGLGETINTEGER64I_VPROC) (GLenum target, GLuint index, GLint64 *data);
-typedef void (GL_APIENTRYP PFNGLGETBUFFERPARAMETERI64VPROC) (GLenum target, GLenum pname, GLint64 *params);
-typedef void (GL_APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers);
-typedef void (GL_APIENTRYP PFNGLDELETESAMPLERSPROC) (GLsizei count, const GLuint *samplers);
-typedef GLboolean (GL_APIENTRYP PFNGLISSAMPLERPROC) (GLuint sampler);
-typedef void (GL_APIENTRYP PFNGLBINDSAMPLERPROC) (GLuint unit, GLuint sampler);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIPROC) (GLuint sampler, GLenum pname, GLint param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, const GLint *param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param);
-typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pname, GLint *params);
-typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, GLfloat *params);
-typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor);
-typedef void (GL_APIENTRYP PFNGLBINDTRANSFORMFEEDBACKPROC) (GLenum target, GLuint id);
-typedef void (GL_APIENTRYP PFNGLDELETETRANSFORMFEEDBACKSPROC) (GLsizei n, const GLuint *ids);
-typedef void (GL_APIENTRYP PFNGLGENTRANSFORMFEEDBACKSPROC) (GLsizei n, GLuint *ids);
-typedef GLboolean (GL_APIENTRYP PFNGLISTRANSFORMFEEDBACKPROC) (GLuint id);
-typedef void (GL_APIENTRYP PFNGLPAUSETRANSFORMFEEDBACKPROC) (void);
-typedef void (GL_APIENTRYP PFNGLRESUMETRANSFORMFEEDBACKPROC) (void);
-typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIPROC) (GLuint program, GLenum pname, GLint value);
-typedef void (GL_APIENTRYP PFNGLINVALIDATEFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-typedef void (GL_APIENTRYP PFNGLINVALIDATESUBFRAMEBUFFERPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-typedef void (GL_APIENTRYP PFNGLGETINTERNALFORMATIVPROC) (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-#if GL_GLES_PROTOTYPES
-GL_APICALL void GL_APIENTRY glReadBuffer (GLenum src);
-GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
-GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
-GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids);
-GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id);
-GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glEndQuery (GLenum target);
-GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params);
-GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target);
-GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params);
-GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
-GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length);
-GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays);
-GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays);
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array);
-GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data);
-GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode);
-GL_APICALL void GL_APIENTRY glEndTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer);
-GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
-GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
-GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params);
-GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
-GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v);
-GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v);
-GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params);
-GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name);
-GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0);
-GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1);
-GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2);
-GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
-GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value);
-GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value);
-GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value);
-GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
-GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index);
-GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
-GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
-GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
-GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
-GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
-GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
-GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount);
-GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags);
-GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync);
-GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync);
-GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout);
-GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
-GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data);
-GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params);
-GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers);
-GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers);
-GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler);
-GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler);
-GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param);
-GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param);
-GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param);
-GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param);
-GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params);
-GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params);
-GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor);
-GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id);
-GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids);
-GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids);
-GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id);
-GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void);
-GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
-GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
-GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value);
-GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments);
-GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
-GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
-GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-#endif
-#endif /* GL_ES_VERSION_3_0 */
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/include/GLES3/gl3platform.h b/include/GLES3/gl3platform.h
deleted file mode 100644
index ca9d7a6de..000000000
--- a/include/GLES3/gl3platform.h
+++ /dev/null
@@ -1,38 +0,0 @@
-#ifndef __gl3platform_h_
-#define __gl3platform_h_
-
-/*
-** Copyright (c) 2017 The Khronos Group Inc.
-**
-** Licensed under the Apache License, Version 2.0 (the "License");
-** you may not use this file except in compliance with the License.
-** You may obtain a copy of the License at
-**
-** http://www.apache.org/licenses/LICENSE-2.0
-**
-** Unless required by applicable law or agreed to in writing, software
-** distributed under the License is distributed on an "AS IS" BASIS,
-** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-** See the License for the specific language governing permissions and
-** limitations under the License.
-*/
-
-/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h
- *
- * Adopters may modify khrplatform.h and this file to suit their platform.
- * Please contribute modifications back to Khronos as pull requests on the
- * public github repository:
- * https://github.com/KhronosGroup/OpenGL-Registry
- */
-
-#include <KHR/khrplatform.h>
-
-#ifndef GL_APICALL
-#define GL_APICALL KHRONOS_APICALL
-#endif
-
-#ifndef GL_APIENTRY
-#define GL_APIENTRY KHRONOS_APIENTRY
-#endif
-
-#endif /* __gl3platform_h_ */
diff --git a/include/KHR/khrplatform.h b/include/KHR/khrplatform.h
deleted file mode 100644
index 975bbffed..000000000
--- a/include/KHR/khrplatform.h
+++ /dev/null
@@ -1,282 +0,0 @@
-#ifndef __khrplatform_h_
-#define __khrplatform_h_
-
-/*
-** Copyright (c) 2008-2018 The Khronos Group Inc.
-**
-** Permission is hereby granted, free of charge, to any person obtaining a
-** copy of this software and/or associated documentation files (the
-** "Materials"), to deal in the Materials without restriction, including
-** without limitation the rights to use, copy, modify, merge, publish,
-** distribute, sublicense, and/or sell copies of the Materials, and to
-** permit persons to whom the Materials are furnished to do so, subject to
-** the following conditions:
-**
-** The above copyright notice and this permission notice shall be included
-** in all copies or substantial portions of the Materials.
-**
-** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
-*/
-
-/* Khronos platform-specific types and definitions.
- *
- * The master copy of khrplatform.h is maintained in the Khronos EGL
- * Registry repository at https://github.com/KhronosGroup/EGL-Registry
- * The last semantic modification to khrplatform.h was at commit ID:
- * 67a3e0864c2d75ea5287b9f3d2eb74a745936692
- *
- * Adopters may modify this file to suit their platform. Adopters are
- * encouraged to submit platform specific modifications to the Khronos
- * group so that they can be included in future versions of this file.
- * Please submit changes by filing pull requests or issues on
- * the EGL Registry repository linked above.
- *
- *
- * See the Implementer's Guidelines for information about where this file
- * should be located on your system and for more details of its use:
- * http://www.khronos.org/registry/implementers_guide.pdf
- *
- * This file should be included as
- * #include <KHR/khrplatform.h>
- * by Khronos client API header files that use its types and defines.
- *
- * The types in khrplatform.h should only be used to define API-specific types.
- *
- * Types defined in khrplatform.h:
- * khronos_int8_t signed 8 bit
- * khronos_uint8_t unsigned 8 bit
- * khronos_int16_t signed 16 bit
- * khronos_uint16_t unsigned 16 bit
- * khronos_int32_t signed 32 bit
- * khronos_uint32_t unsigned 32 bit
- * khronos_int64_t signed 64 bit
- * khronos_uint64_t unsigned 64 bit
- * khronos_intptr_t signed same number of bits as a pointer
- * khronos_uintptr_t unsigned same number of bits as a pointer
- * khronos_ssize_t signed size
- * khronos_usize_t unsigned size
- * khronos_float_t signed 32 bit floating point
- * khronos_time_ns_t unsigned 64 bit time in nanoseconds
- * khronos_utime_nanoseconds_t unsigned time interval or absolute time in
- * nanoseconds
- * khronos_stime_nanoseconds_t signed time interval in nanoseconds
- * khronos_boolean_enum_t enumerated boolean type. This should
- * only be used as a base type when a client API's boolean type is
- * an enum. Client APIs which use an integer or other type for
- * booleans cannot use this as the base type for their boolean.
- *
- * Tokens defined in khrplatform.h:
- *
- * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values.
- *
- * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0.
- * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0.
- *
- * Calling convention macros defined in this file:
- * KHRONOS_APICALL
- * KHRONOS_APIENTRY
- * KHRONOS_APIATTRIBUTES
- *
- * These may be used in function prototypes as:
- *
- * KHRONOS_APICALL void KHRONOS_APIENTRY funcname(
- * int arg1,
- * int arg2) KHRONOS_APIATTRIBUTES;
- */
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APICALL
- *-------------------------------------------------------------------------
- * This precedes the return type of the function in the function prototype.
- */
-#if defined(_WIN32) && !defined(__SCITECH_SNAP__)
-# define KHRONOS_APICALL __declspec(dllimport)
-#elif defined (__SYMBIAN32__)
-# define KHRONOS_APICALL IMPORT_C
-#elif defined(__ANDROID__)
-# define KHRONOS_APICALL __attribute__((visibility("default")))
-#else
-# define KHRONOS_APICALL
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIENTRY
- *-------------------------------------------------------------------------
- * This follows the return type of the function and precedes the function
- * name in the function prototype.
- */
-#if defined(_WIN32) && !defined(_WIN32_WCE) && !defined(__SCITECH_SNAP__)
- /* Win32 but not WinCE */
-# define KHRONOS_APIENTRY __stdcall
-#else
-# define KHRONOS_APIENTRY
-#endif
-
-/*-------------------------------------------------------------------------
- * Definition of KHRONOS_APIATTRIBUTES
- *-------------------------------------------------------------------------
- * This follows the closing parenthesis of the function prototype arguments.
- */
-#if defined (__ARMCC_2__)
-#define KHRONOS_APIATTRIBUTES __softfp
-#else
-#define KHRONOS_APIATTRIBUTES
-#endif
-
-/*-------------------------------------------------------------------------
- * basic type definitions
- *-----------------------------------------------------------------------*/
-#if (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || defined(__GNUC__) || defined(__SCO__) || defined(__USLC__)
-
-
-/*
- * Using <stdint.h>
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__VMS ) || defined(__sgi)
-
-/*
- * Using <inttypes.h>
- */
-#include <inttypes.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(_WIN32) && !defined(__SCITECH_SNAP__)
-
-/*
- * Win32
- */
-typedef __int32 khronos_int32_t;
-typedef unsigned __int32 khronos_uint32_t;
-typedef __int64 khronos_int64_t;
-typedef unsigned __int64 khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif defined(__sun__) || defined(__digital__)
-
-/*
- * Sun or Digital
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#if defined(__arch64__) || defined(_LP64)
-typedef long int khronos_int64_t;
-typedef unsigned long int khronos_uint64_t;
-#else
-typedef long long int khronos_int64_t;
-typedef unsigned long long int khronos_uint64_t;
-#endif /* __arch64__ */
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#elif 0
-
-/*
- * Hypothetical platform with no float or int64 support
- */
-typedef int khronos_int32_t;
-typedef unsigned int khronos_uint32_t;
-#define KHRONOS_SUPPORT_INT64 0
-#define KHRONOS_SUPPORT_FLOAT 0
-
-#else
-
-/*
- * Generic fallback
- */
-#include <stdint.h>
-typedef int32_t khronos_int32_t;
-typedef uint32_t khronos_uint32_t;
-typedef int64_t khronos_int64_t;
-typedef uint64_t khronos_uint64_t;
-#define KHRONOS_SUPPORT_INT64 1
-#define KHRONOS_SUPPORT_FLOAT 1
-
-#endif
-
-
-/*
- * Types that are (so far) the same on all platforms
- */
-typedef signed char khronos_int8_t;
-typedef unsigned char khronos_uint8_t;
-typedef signed short int khronos_int16_t;
-typedef unsigned short int khronos_uint16_t;
-
-/*
- * Types that differ between LLP64 and LP64 architectures - in LLP64,
- * pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
- * to be the only LLP64 architecture in current use.
- */
-#ifdef _WIN64
-typedef signed long long int khronos_intptr_t;
-typedef unsigned long long int khronos_uintptr_t;
-typedef signed long long int khronos_ssize_t;
-typedef unsigned long long int khronos_usize_t;
-#else
-typedef signed long int khronos_intptr_t;
-typedef unsigned long int khronos_uintptr_t;
-typedef signed long int khronos_ssize_t;
-typedef unsigned long int khronos_usize_t;
-#endif
-
-#if KHRONOS_SUPPORT_FLOAT
-/*
- * Float type
- */
-typedef float khronos_float_t;
-#endif
-
-#if KHRONOS_SUPPORT_INT64
-/* Time types
- *
- * These types can be used to represent a time interval in nanoseconds or
- * an absolute Unadjusted System Time. Unadjusted System Time is the number
- * of nanoseconds since some arbitrary system event (e.g. since the last
- * time the system booted). The Unadjusted System Time is an unsigned
- * 64 bit value that wraps back to 0 every 584 years. Time intervals
- * may be either signed or unsigned.
- */
-typedef khronos_uint64_t khronos_utime_nanoseconds_t;
-typedef khronos_int64_t khronos_stime_nanoseconds_t;
-#endif
-
-/*
- * Dummy value used to pad enum types to 32 bits.
- */
-#ifndef KHRONOS_MAX_ENUM
-#define KHRONOS_MAX_ENUM 0x7FFFFFFF
-#endif
-
-/*
- * Enumerated boolean type
- *
- * Values other than zero should be considered to be true. Therefore
- * comparisons should not be made against KHRONOS_TRUE.
- */
-typedef enum {
- KHRONOS_FALSE = 0,
- KHRONOS_TRUE = 1,
- KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
-} khronos_boolean_enum_t;
-
-#endif /* __khrplatform_h_ */
diff --git a/src/Common/BUILD.gn b/src/Common/BUILD.gn
deleted file mode 100644
index 6b3305e96..000000000
--- a/src/Common/BUILD.gn
+++ /dev/null
@@ -1,42 +0,0 @@
-# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("../swiftshader.gni")
-
-# Need a separate config to ensure the warnings are added to the end.
-config("swiftshader_common_private_config") {
- if (is_win) {
- cflags = [
- "/wd4201", # nameless struct/union
- "/wd5030", # attribute is not recognized
- ]
- }
-}
-
-swiftshader_source_set("swiftshader_common") {
- sources = [
- "CPUID.cpp",
- "Configurator.cpp",
- "Debug.cpp",
- "Half.cpp",
- "Math.cpp",
- "Memory.cpp",
- "Resource.cpp",
- "Socket.cpp",
- "Thread.cpp",
- "Timer.cpp",
- ]
-
- configs = [ ":swiftshader_common_private_config" ]
-}
diff --git a/src/Common/CPUID.cpp b/src/Common/CPUID.cpp
deleted file mode 100644
index c0800342f..000000000
--- a/src/Common/CPUID.cpp
+++ /dev/null
@@ -1,301 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "CPUID.hpp"
-
-#if defined(_WIN32)
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #include <intrin.h>
- #include <float.h>
-#else
- #include <unistd.h>
- #include <sched.h>
- #include <sys/types.h>
-#endif
-
-namespace sw
-{
- bool CPUID::MMX = detectMMX();
- bool CPUID::CMOV = detectCMOV();
- bool CPUID::SSE = detectSSE();
- bool CPUID::SSE2 = detectSSE2();
- bool CPUID::SSE3 = detectSSE3();
- bool CPUID::SSSE3 = detectSSSE3();
- bool CPUID::SSE4_1 = detectSSE4_1();
- int CPUID::cores = detectCoreCount();
- int CPUID::affinity = detectAffinity();
-
- bool CPUID::enableMMX = true;
- bool CPUID::enableCMOV = true;
- bool CPUID::enableSSE = true;
- bool CPUID::enableSSE2 = true;
- bool CPUID::enableSSE3 = true;
- bool CPUID::enableSSSE3 = true;
- bool CPUID::enableSSE4_1 = true;
-
- void CPUID::setEnableMMX(bool enable)
- {
- enableMMX = enable;
-
- if(!enableMMX)
- {
- enableSSE = false;
- enableSSE2 = false;
- enableSSE3 = false;
- enableSSSE3 = false;
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableCMOV(bool enable)
- {
- enableCMOV = enable;
-
- if(!CMOV)
- {
- enableSSE = false;
- enableSSE2 = false;
- enableSSE3 = false;
- enableSSSE3 = false;
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableSSE(bool enable)
- {
- enableSSE = enable;
-
- if(enableSSE)
- {
- enableMMX = true;
- enableCMOV = true;
- }
- else
- {
- enableSSE2 = false;
- enableSSE3 = false;
- enableSSSE3 = false;
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableSSE2(bool enable)
- {
- enableSSE2 = enable;
-
- if(enableSSE2)
- {
- enableMMX = true;
- enableCMOV = true;
- enableSSE = true;
- }
- else
- {
- enableSSE3 = false;
- enableSSSE3 = false;
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableSSE3(bool enable)
- {
- enableSSE3 = enable;
-
- if(enableSSE3)
- {
- enableMMX = true;
- enableCMOV = true;
- enableSSE = true;
- enableSSE2 = true;
- }
- else
- {
- enableSSSE3 = false;
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableSSSE3(bool enable)
- {
- enableSSSE3 = enable;
-
- if(enableSSSE3)
- {
- enableMMX = true;
- enableCMOV = true;
- enableSSE = true;
- enableSSE2 = true;
- enableSSE3 = true;
- }
- else
- {
- enableSSE4_1 = false;
- }
- }
-
- void CPUID::setEnableSSE4_1(bool enable)
- {
- enableSSE4_1 = enable;
-
- if(enableSSE4_1)
- {
- enableMMX = true;
- enableCMOV = true;
- enableSSE = true;
- enableSSE2 = true;
- enableSSE3 = true;
- enableSSSE3 = true;
- }
- }
-
- static void cpuid(int registers[4], int info)
- {
- #if defined(__i386__) || defined(__x86_64__)
- #if defined(_WIN32)
- __cpuid(registers, info);
- #else
- __asm volatile("cpuid": "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3]): "a" (info));
- #endif
- #else
- registers[0] = 0;
- registers[1] = 0;
- registers[2] = 0;
- registers[3] = 0;
- #endif
- }
-
- bool CPUID::detectMMX()
- {
- int registers[4];
- cpuid(registers, 1);
- return MMX = (registers[3] & 0x00800000) != 0;
- }
-
- bool CPUID::detectCMOV()
- {
- int registers[4];
- cpuid(registers, 1);
- return CMOV = (registers[3] & 0x00008000) != 0;
- }
-
- bool CPUID::detectSSE()
- {
- int registers[4];
- cpuid(registers, 1);
- return SSE = (registers[3] & 0x02000000) != 0;
- }
-
- bool CPUID::detectSSE2()
- {
- int registers[4];
- cpuid(registers, 1);
- return SSE2 = (registers[3] & 0x04000000) != 0;
- }
-
- bool CPUID::detectSSE3()
- {
- int registers[4];
- cpuid(registers, 1);
- return SSE3 = (registers[2] & 0x00000001) != 0;
- }
-
- bool CPUID::detectSSSE3()
- {
- int registers[4];
- cpuid(registers, 1);
- return SSSE3 = (registers[2] & 0x00000200) != 0;
- }
-
- bool CPUID::detectSSE4_1()
- {
- int registers[4];
- cpuid(registers, 1);
- return SSE4_1 = (registers[2] & 0x00080000) != 0;
- }
-
- int CPUID::detectCoreCount()
- {
- int cores = 0;
-
- #if defined(_WIN32)
- DWORD_PTR processAffinityMask = 1;
- DWORD_PTR systemAffinityMask = 1;
-
- GetProcessAffinityMask(GetCurrentProcess(), &processAffinityMask, &systemAffinityMask);
-
- while(systemAffinityMask)
- {
- if(systemAffinityMask & 1)
- {
- cores++;
- }
-
- systemAffinityMask >>= 1;
- }
- #else
- cores = sysconf(_SC_NPROCESSORS_ONLN);
- #endif
-
- if(cores < 1) cores = 1;
- if(cores > 16) cores = 16;
-
- return cores; // FIXME: Number of physical cores
- }
-
- int CPUID::detectAffinity()
- {
- int cores = 0;
-
- #if defined(_WIN32)
- DWORD_PTR processAffinityMask = 1;
- DWORD_PTR systemAffinityMask = 1;
-
- GetProcessAffinityMask(GetCurrentProcess(), &processAffinityMask, &systemAffinityMask);
-
- while(processAffinityMask)
- {
- if(processAffinityMask & 1)
- {
- cores++;
- }
-
- processAffinityMask >>= 1;
- }
- #else
- return detectCoreCount(); // FIXME: Assumes no affinity limitation
- #endif
-
- if(cores < 1) cores = 1;
- if(cores > 16) cores = 16;
-
- return cores;
- }
-
- void CPUID::setFlushToZero(bool enable)
- {
- #if defined(_MSC_VER)
- _controlfp(enable ? _DN_FLUSH : _DN_SAVE, _MCW_DN);
- #else
- // Unimplemented
- #endif
- }
-
- void CPUID::setDenormalsAreZero(bool enable)
- {
- // Unimplemented
- }
-}
diff --git a/src/Common/CPUID.hpp b/src/Common/CPUID.hpp
deleted file mode 100644
index 3c21cd743..000000000
--- a/src/Common/CPUID.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_CPUID_hpp
-#define sw_CPUID_hpp
-
-namespace sw
-{
- #if !defined(__i386__) && defined(_M_IX86)
- #define __i386__ 1
- #endif
-
- #if !defined(__x86_64__) && (defined(_M_AMD64) || defined (_M_X64))
- #define __x86_64__ 1
- #endif
-
- class CPUID
- {
- public:
- static bool supportsMMX();
- static bool supportsCMOV();
- static bool supportsMMX2(); // MMX instructions added by SSE: pshufw, pmulhuw, pmovmskb, pavgw/b, pextrw, pinsrw, pmaxsw/ub, etc.
- static bool supportsSSE();
- static bool supportsSSE2();
- static bool supportsSSE3();
- static bool supportsSSSE3();
- static bool supportsSSE4_1();
- static int coreCount();
- static int processAffinity();
-
- static void setEnableMMX(bool enable);
- static void setEnableCMOV(bool enable);
- static void setEnableSSE(bool enable);
- static void setEnableSSE2(bool enable);
- static void setEnableSSE3(bool enable);
- static void setEnableSSSE3(bool enable);
- static void setEnableSSE4_1(bool enable);
-
- static void setFlushToZero(bool enable); // Denormal results are written as zero
- static void setDenormalsAreZero(bool enable); // Denormal inputs are read as zero
-
- private:
- static bool MMX;
- static bool CMOV;
- static bool SSE;
- static bool SSE2;
- static bool SSE3;
- static bool SSSE3;
- static bool SSE4_1;
- static int cores;
- static int affinity;
-
- static bool enableMMX;
- static bool enableCMOV;
- static bool enableSSE;
- static bool enableSSE2;
- static bool enableSSE3;
- static bool enableSSSE3;
- static bool enableSSE4_1;
-
- static bool detectMMX();
- static bool detectCMOV();
- static bool detectSSE();
- static bool detectSSE2();
- static bool detectSSE3();
- static bool detectSSSE3();
- static bool detectSSE4_1();
- static int detectCoreCount();
- static int detectAffinity();
- };
-}
-
-namespace sw
-{
- inline bool CPUID::supportsMMX()
- {
- return MMX && enableMMX;
- }
-
- inline bool CPUID::supportsCMOV()
- {
- return CMOV && enableCMOV;
- }
-
- inline bool CPUID::supportsMMX2()
- {
- return supportsSSE(); // Coincides with 64-bit integer vector instructions supported by SSE
- }
-
- inline bool CPUID::supportsSSE()
- {
- return SSE && enableSSE;
- }
-
- inline bool CPUID::supportsSSE2()
- {
- return SSE2 && enableSSE2;
- }
-
- inline bool CPUID::supportsSSE3()
- {
- return SSE3 && enableSSE3;
- }
-
- inline bool CPUID::supportsSSSE3()
- {
- return SSSE3 && enableSSSE3;
- }
-
- inline bool CPUID::supportsSSE4_1()
- {
- return SSE4_1 && enableSSE4_1;
- }
-
- inline int CPUID::coreCount()
- {
- return cores;
- }
-
- inline int CPUID::processAffinity()
- {
- return affinity;
- }
-}
-
-#endif // sw_CPUID_hpp
diff --git a/src/Common/Configurator.cpp b/src/Common/Configurator.cpp
deleted file mode 100644
index ead1d282c..000000000
--- a/src/Common/Configurator.cpp
+++ /dev/null
@@ -1,255 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Configurator.hpp"
-
-#include <iostream>
-#include <fstream>
-
-using namespace std;
-
-#include <stdio.h>
-#include <stdarg.h>
-#include <ctype.h>
-
-#if defined(__unix__)
-#include <unistd.h>
-#endif
-
-namespace sw
-{
- Configurator::Configurator(string iniPath)
- {
- path = iniPath;
-
- readFile();
- }
-
- Configurator::~Configurator()
- {
- }
-
- bool Configurator::readFile()
- {
- #if defined(__unix__)
- if(access(path.c_str(), R_OK) != 0)
- {
- return false;
- }
- #endif
-
- fstream file(path.c_str(), ios::in);
- if(file.fail()) return false;
-
- string line;
- string keyName;
-
- while(getline(file, line))
- {
- if(line.length())
- {
- if(line[line.length() - 1] == '\r')
- {
- line = line.substr(0, line.length() - 1);
- }
-
- if(!isprint(line[0]))
- {
- // printf("Failing on char %d\n", line[0]);
- file.close();
- return false;
- }
-
- string::size_type pLeft = line.find_first_of(";#[=");
-
- if(pLeft != string::npos)
- {
- switch(line[pLeft])
- {
- case '[':
- {
- string::size_type pRight = line.find_last_of("]");
-
- if(pRight != string::npos && pRight > pLeft)
- {
- keyName = line.substr(pLeft + 1, pRight - pLeft - 1);
- addKeyName(keyName);
- }
- }
- break;
- case '=':
- {
- string valueName = line.substr(0, pLeft);
- string value = line.substr(pLeft + 1);
- addValue(keyName, valueName, value);
- }
- break;
- case ';':
- case '#':
- // Ignore comments
- break;
- }
- }
- }
- }
-
- file.close();
-
- if(names.size())
- {
- return true;
- }
-
- return false;
- }
-
- void Configurator::writeFile(std::string title)
- {
- #if defined(__unix__)
- if(access(path.c_str(), W_OK) != 0)
- {
- return;
- }
- #endif
-
- fstream file(path.c_str(), ios::out);
- if(file.fail()) return;
-
- file << "; " << title << endl << endl;
-
- for(unsigned int keyID = 0; keyID < sections.size(); keyID++)
- {
- file << "[" << names[keyID] << "]" << endl;
-
- for(unsigned int valueID = 0; valueID < sections[keyID].names.size(); valueID++)
- {
- file << sections[keyID].names[valueID] << "=" << sections[keyID].values[valueID] << endl;
- }
-
- file << endl;
- }
-
- file.close();
- }
-
- int Configurator::findKey(string keyName) const
- {
- for(unsigned int keyID = 0; keyID < names.size(); keyID++)
- {
- if(names[keyID] == keyName)
- {
- return keyID;
- }
- }
-
- return -1;
- }
-
- int Configurator::findValue(unsigned int keyID, string valueName) const
- {
- if(!sections.size() || keyID >= sections.size())
- {
- return -1;
- }
-
- for(unsigned int valueID = 0; valueID < sections[keyID].names.size(); ++valueID)
- {
- if(sections[keyID].names[valueID] == valueName)
- {
- return valueID;
- }
- }
-
- return -1;
- }
-
- unsigned int Configurator::addKeyName(string keyName)
- {
- names.resize(names.size() + 1, keyName);
- sections.resize(sections.size() + 1);
- return (unsigned int)names.size() - 1;
- }
-
- void Configurator::addValue(string const keyName, string const valueName, string const value)
- {
- int keyID = findKey(keyName);
-
- if(keyID == -1)
- {
- keyID = addKeyName(keyName);
- }
-
- int valueID = findValue(keyID, valueName);
-
- if(valueID == -1)
- {
- sections[keyID].names.resize(sections[keyID].names.size() + 1, valueName);
- sections[keyID].values.resize(sections[keyID].values.size() + 1, value);
- }
- else
- {
- sections[keyID].values[valueID] = value;
- }
- }
-
- string Configurator::getValue(string keyName, string valueName, string defaultValue) const
- {
- int keyID = findKey(keyName);
- if(keyID == -1) return defaultValue;
- int valueID = findValue((unsigned int)keyID, valueName);
- if(valueID == -1) return defaultValue;
-
- return sections[keyID].values[valueID];
- }
-
- int Configurator::getInteger(string keyName, string valueName, int defaultValue) const
- {
- char svalue[256];
-
- sprintf(svalue, "%d", defaultValue);
-
- return atoi(getValue(keyName, valueName, svalue).c_str());
- }
-
- bool Configurator::getBoolean(string keyName, string valueName, bool defaultValue) const
- {
- return getInteger(keyName, valueName, (int)defaultValue) != 0;
- }
-
- double Configurator::getFloat(string keyName, string valueName, double defaultValue) const
- {
- char svalue[256];
-
- sprintf(svalue, "%f", defaultValue);
-
- return atof(getValue(keyName, valueName, svalue).c_str());
- }
-
- unsigned int Configurator::getFormatted(string keyName, string valueName, char *format,
- void *v1, void *v2, void *v3, void *v4,
- void *v5, void *v6, void *v7, void *v8,
- void *v9, void *v10, void *v11, void *v12,
- void *v13, void *v14, void *v15, void *v16)
- {
- string value = getValue(keyName, valueName);
-
- if(!value.length()) return false;
-
- unsigned int nVals = sscanf(value.c_str(), format,
- v1, v2, v3, v4, v5, v6, v7, v8,
- v9, v10, v11, v12, v13, v14, v15, v16);
-
- return nVals;
- }
-}
diff --git a/src/Common/Configurator.hpp b/src/Common/Configurator.hpp
deleted file mode 100644
index 6fd930cf9..000000000
--- a/src/Common/Configurator.hpp
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Configurator_hpp
-#define sw_Configurator_hpp
-
-#include <string>
-#include <vector>
-
-#include <stdlib.h>
-
-namespace sw
-{
- class Configurator
- {
- public:
- Configurator(std::string iniPath = "");
-
- ~Configurator();
-
- std::string getValue(std::string sectionName, std::string valueName, std::string defaultValue = "") const;
- int getInteger(std::string sectionName, std::string valueName, int defaultValue = 0) const;
- bool getBoolean(std::string sectionName, std::string valueName, bool defaultValue = false) const;
- double getFloat(std::string sectionName, std::string valueName, double defaultValue = 0.0) const;
- unsigned int getFormatted(std::string sectionName, std::string valueName, char *format,
- void *v1 = 0, void *v2 = 0, void *v3 = 0, void *v4 = 0,
- void *v5 = 0, void *v6 = 0, void *v7 = 0, void *v8 = 0,
- void *v9 = 0, void *v10 = 0, void *v11 = 0, void *v12 = 0,
- void *v13 = 0, void *v14 = 0, void *v15 = 0, void *v16 = 0);
-
- void addValue(std::string sectionName, std::string valueName, std::string value);
-
- void writeFile(std::string title = "Configuration File");
-
- private:
- bool readFile();
-
- unsigned int addKeyName(std::string sectionName);
- int findKey(std::string sectionName) const;
- int findValue(unsigned int sectionID, std::string valueName) const;
-
- std::string path;
-
- struct Section
- {
- std::vector<std::string> names;
- std::vector<std::string> values;
- };
-
- std::vector<Section> sections;
- std::vector<std::string> names;
- };
-}
-
-#endif // sw_Configurator_hpp
diff --git a/src/Common/Debug.cpp b/src/Common/Debug.cpp
deleted file mode 100644
index acf469e5a..000000000
--- a/src/Common/Debug.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Debug.hpp"
-
-#include <stdio.h>
-#include <stdarg.h>
-
-namespace sw
-{
-void trace(const char *format, ...)
-{
- if(false)
- {
- FILE *file = fopen("debug.txt", "a");
-
- if(file)
- {
- va_list vararg;
- va_start(vararg, format);
- vfprintf(file, format, vararg);
- va_end(vararg);
-
- fclose(file);
- }
- }
-}
-}
diff --git a/src/Common/Debug.hpp b/src/Common/Debug.hpp
deleted file mode 100644
index 0c862d4dc..000000000
--- a/src/Common/Debug.hpp
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Debug_hpp
-#define Debug_hpp
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "DebugAndroid.hpp"
-#else
-
-#include <assert.h>
-#include <stdio.h>
-
-#undef min
-#undef max
-
-namespace sw
-{
-void trace(const char *format, ...);
-inline void trace() {}
-}
-
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- #define TRACE(format, ...) sw::trace("[0x%0.8X]%s(" format ")\n", this, __FUNCTION__, ##__VA_ARGS__)
-#else
- #define TRACE(...) ((void)0)
-#endif
-
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- #define UNIMPLEMENTED(...) do { \
- sw::trace("\t! Unimplemented: %s(%d): ", __FUNCTION__, __LINE__); \
- sw::trace(__VA_ARGS__); \
- sw::trace("\n"); \
- ASSERT(false); \
- } while(0)
-#else
- #define UNIMPLEMENTED(...) ((void)0)
-#endif
-
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- #define ASSERT(expression) {if(!(expression)) sw::trace("\t! Assert failed in %s(%d): " #expression "\n", __FUNCTION__, __LINE__); assert(expression);}
-#else
- #define ASSERT assert
-#endif
-
-#endif // !__ANDROID__
-#endif // Debug_hpp
diff --git a/src/Common/DebugAndroid.cpp b/src/Common/DebugAndroid.cpp
deleted file mode 100644
index c511fc379..000000000
--- a/src/Common/DebugAndroid.cpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "DebugAndroid.hpp"
-
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <cutils/properties.h>
-
-void AndroidEnterDebugger()
-{
- ALOGE(__FUNCTION__);
-#ifndef NDEBUG
- static volatile int * const makefault = nullptr;
- char value[PROPERTY_VALUE_MAX];
- property_get("debug.db.uid", value, "-1");
- int debug_uid = atoi(value);
- if((debug_uid >= 0) && (geteuid() < static_cast<uid_t>(debug_uid)))
- {
- ALOGE("Waiting for debugger: gdbserver :${PORT} --attach %u. Look for thread %u", getpid(), gettid());
- volatile int waiting = 1;
- while (waiting) {
- sleep(1);
- }
- }
- else
- {
- ALOGE("No debugger");
- }
-#endif
-}
-
-void trace(const char *format, ...)
-{
-#ifndef NDEBUG
- va_list vararg;
- va_start(vararg, format);
- android_vprintLog(ANDROID_LOG_VERBOSE, NULL, LOG_TAG, format, vararg);
- va_end(vararg);
-#endif
-}
diff --git a/src/Common/DebugAndroid.hpp b/src/Common/DebugAndroid.hpp
deleted file mode 100644
index eced19453..000000000
--- a/src/Common/DebugAndroid.hpp
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef DebugAndroid_hpp
-#define DebugAndroid_hpp
-
-#if ANDROID_PLATFORM_SDK_VERSION < 27
-#include <cutils/log.h>
-#elif ANDROID_PLATFORM_SDK_VERSION >= 27
-#include <log/log.h>
-#else
-#error "ANDROID_PLATFORM_SDK_VERSION is not defined"
-#endif
-
-#include <cassert>
-
-// On Android Virtual Devices we heavily depend on logging, even in
-// production builds. We do this because AVDs are components of larger
-// systems, and may be configured in ways that are difficult to
-// reproduce locally. For example some system run tests against
-// third-party code that we cannot access. Aborting (cf. assert) on
-// unimplemented functionality creates two problems. First, it produces
-// a service failure where none is needed. Second, it puts the
-// customer on the critical path for notifying us of a problem.
-// The alternative, skipping unimplemented functionality silently, is
-// arguably worse: neither the service provider nor the customer will
-// learn that unimplemented functionality may have compromised the test
-// results.
-// Logging invocations of unimplemented functionality is useful to both
-// service provider and the customer. The service provider can learn
-// that the functionality is needed. The customer learns that the test
-// results may be compromised.
-
-/**
- * Enter the debugger with a memory fault iff debuggerd is set to capture this
- * process. Otherwise return.
- */
-void AndroidEnterDebugger();
-
-#define ASSERT(E) do { \
- if (!(E)) { \
- ALOGE("badness: assertion_failed %s in %s at %s:%d", #E, \
- __FUNCTION__, __FILE__, __LINE__); \
- AndroidEnterDebugger(); \
- } \
- } while(0)
-
-#undef assert
-#define assert(E) ASSERT(E)
-
-#define ERR(format, ...) \
- do { \
- ALOGE("badness: err %s %s:%d (" format ")", __FUNCTION__, __FILE__, \
- __LINE__, ##__VA_ARGS__); \
- AndroidEnterDebugger(); \
- } while(0)
-
-#define FIXME(format, ...) \
- do { \
- ALOGE("badness: fixme %s %s:%d (" format ")", __FUNCTION__, __FILE__, \
- __LINE__, ##__VA_ARGS__); \
- AndroidEnterDebugger(); \
- } while(0)
-
-// TODO: Handle __VA_ARGS__ (can be empty)
-#define UNIMPLEMENTED(...) do { \
- ALOGE("badness: unimplemented: %s %s:%d", \
- __FUNCTION__, __FILE__, __LINE__); \
- AndroidEnterDebugger(); \
- } while(0)
-
-#define UNREACHABLE(value) do { \
- ALOGE("badness: unreachable case reached: %s %s:%d. %s: %d", \
- __FUNCTION__, __FILE__, __LINE__, #value, value); \
- AndroidEnterDebugger(); \
- } while(0)
-
-#ifndef NDEBUG
- #define TRACE(format, ...) \
- ALOGV("%s %s:%d (" format ")", __FUNCTION__, __FILE__, \
- __LINE__, ##__VA_ARGS__)
-#else
- #define TRACE(...) ((void)0)
-#endif
-
-void trace(const char *format, ...);
-
-#endif // DebugAndroid_hpp
diff --git a/src/Common/GrallocAndroid.cpp b/src/Common/GrallocAndroid.cpp
deleted file mode 100644
index ffdf52ec1..000000000
--- a/src/Common/GrallocAndroid.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "GrallocAndroid.hpp"
-#include "Debug.hpp"
-
-#ifdef HAVE_GRALLOC1
-# include <sync/sync.h>
-#endif
-#ifdef HAVE_GRALLOC3
-using V3Error = android::hardware::graphics::mapper::V3_0::Error;
-using V3Mapper = android::hardware::graphics::mapper::V3_0::IMapper;
-using android::hardware::hidl_handle;
-#endif
-#ifdef HAVE_GRALLOC4
-using V4Error = android::hardware::graphics::mapper::V4_0::Error;
-using V4Mapper = android::hardware::graphics::mapper::V4_0::IMapper;
-using android::hardware::hidl_handle;
-#endif
-
-GrallocModule *GrallocModule::getInstance()
-{
- static GrallocModule instance;
- return &instance;
-}
-
-GrallocModule::GrallocModule()
-{
-#ifdef HAVE_GRALLOC4
- m_gralloc4_mapper = V4Mapper::getService();
- if(m_gralloc4_mapper != nullptr)
- {
- return;
- }
-#endif
-
-#ifdef HAVE_GRALLOC3
- m_gralloc3_mapper = V3Mapper::getService();
- if(m_gralloc3_mapper != nullptr)
- {
- return;
- }
-#endif
-
- const hw_module_t *module = nullptr;
- hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module);
-
- m_major_version = (module->module_api_version >> 8) & 0xff;
- switch(m_major_version)
- {
- case 0:
- m_module = reinterpret_cast<const gralloc_module_t *>(module);
- break;
- case 1:
-#ifdef HAVE_GRALLOC1
- gralloc1_open(module, &m_gralloc1_device);
- m_gralloc1_lock = (GRALLOC1_PFN_LOCK)m_gralloc1_device->getFunction(m_gralloc1_device, GRALLOC1_FUNCTION_LOCK);
- m_gralloc1_unlock = (GRALLOC1_PFN_UNLOCK)m_gralloc1_device->getFunction(m_gralloc1_device, GRALLOC1_FUNCTION_UNLOCK);
- break;
-#endif
- default:
- TRACE("unknown gralloc major version (%d)", m_major_version);
- break;
- }
-}
-
-int GrallocModule::import(buffer_handle_t handle, buffer_handle_t *imported_handle)
-{
-#ifdef HAVE_GRALLOC4
- if(m_gralloc4_mapper != nullptr)
- {
- V4Error error;
- auto ret = m_gralloc4_mapper->importBuffer(handle,
- [&](const auto &tmp_err, const auto &tmp_buf) {
- error = tmp_err;
- if(error == V4Error::NONE)
- {
- *imported_handle = static_cast<buffer_handle_t>(tmp_buf);
- }
- });
- return ret.isOk() && error == V4Error::NONE ? 0 : -1;
- }
-#endif
-
-#ifdef HAVE_GRALLOC3
- if(m_gralloc3_mapper != nullptr)
- {
- V3Error error;
- auto ret = m_gralloc3_mapper->importBuffer(handle,
- [&](const auto &tmp_err, const auto &tmp_buf) {
- error = tmp_err;
- if(error == V3Error::NONE)
- {
- *imported_handle = static_cast<buffer_handle_t>(tmp_buf);
- }
- });
- return ret.isOk() && error == V3Error::NONE ? 0 : -1;
- }
-#endif
-
- *imported_handle = handle;
- return 0;
-}
-
-int GrallocModule::release(buffer_handle_t handle)
-{
-#ifdef HAVE_GRALLOC4
- if(m_gralloc4_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
- return m_gralloc4_mapper->freeBuffer(native_handle).isOk() ? 0 : 1;
- }
-#endif
-
-#ifdef HAVE_GRALLOC3
- if(m_gralloc3_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
- return m_gralloc3_mapper->freeBuffer(native_handle).isOk() ? 0 : 1;
- }
-#endif
-
- return 0;
-}
-
-int GrallocModule::lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr)
-{
-#ifdef HAVE_GRALLOC4
- if(m_gralloc4_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
-
- V4Mapper::Rect rect;
- rect.left = left;
- rect.top = top;
- rect.width = width;
- rect.height = height;
-
- hidl_handle empty_fence_handle;
-
- V4Error error;
- auto ret = m_gralloc4_mapper->lock(native_handle, usage, rect, empty_fence_handle,
- [&](const auto &tmp_err, const auto &tmp_vaddr) {
- error = tmp_err;
- if(tmp_err == V4Error::NONE)
- {
- *vaddr = tmp_vaddr;
- }
- });
- return ret.isOk() && error == V4Error::NONE ? 0 : -1;
- }
-#endif
-
-#ifdef HAVE_GRALLOC3
- if(m_gralloc3_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
-
- V3Mapper::Rect rect;
- rect.left = left;
- rect.top = top;
- rect.width = width;
- rect.height = height;
-
- hidl_handle empty_fence_handle;
-
- V3Error error;
- auto ret = m_gralloc3_mapper->lock(native_handle, usage, rect, empty_fence_handle,
- [&](const auto &tmp_err,
- const auto &tmp_vaddr,
- const auto & /*bytes_per_pixel*/,
- const auto & /*bytes_per_stride*/) {
- error = tmp_err;
- if(tmp_err == V3Error::NONE)
- {
- *vaddr = tmp_vaddr;
- }
- });
- return ret.isOk() && error == V3Error::NONE ? 0 : -1;
- }
-#endif
-
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->lock(m_module, handle, usage, left, top, width, height, vaddr);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- gralloc1_rect_t outRect{};
- outRect.left = left;
- outRect.top = top;
- outRect.width = width;
- outRect.height = height;
- return m_gralloc1_lock(m_gralloc1_device, handle, usage, usage, &outRect, vaddr, -1);
- }
-#endif
- default:
- {
- TRACE("no gralloc module to lock");
- return -1;
- }
- }
-}
-
-int GrallocModule::unlock(buffer_handle_t handle)
-{
-#ifdef HAVE_GRALLOC4
- if(m_gralloc4_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
-
- V4Error error;
- auto ret = m_gralloc4_mapper->unlock(native_handle,
- [&](const auto &tmp_err, const auto &) {
- error = tmp_err;
- });
- return ret.isOk() && error == V4Error::NONE ? 0 : -1;
- }
-#endif
-
-#ifdef HAVE_GRALLOC3
- if(m_gralloc3_mapper != nullptr)
- {
- native_handle_t *native_handle = const_cast<native_handle_t *>(handle);
-
- V3Error error;
- auto ret = m_gralloc3_mapper->unlock(native_handle,
- [&](const auto &tmp_err, const auto &) {
- error = tmp_err;
- });
- return ret.isOk() && error == V3Error::NONE ? 0 : -1;
- }
-#endif
-
- switch(m_major_version)
- {
- case 0:
- {
- return m_module->unlock(m_module, handle);
- }
- case 1:
-#ifdef HAVE_GRALLOC1
- {
- int32_t fenceFd = -1;
- int error = m_gralloc1_unlock(m_gralloc1_device, handle, &fenceFd);
- if(!error)
- {
- sync_wait(fenceFd, -1);
- close(fenceFd);
- }
- return error;
- }
-#endif
- default:
- {
- TRACE("no gralloc module to unlock");
- return -1;
- }
- }
-}
diff --git a/src/Common/GrallocAndroid.hpp b/src/Common/GrallocAndroid.hpp
deleted file mode 100644
index 058eaf140..000000000
--- a/src/Common/GrallocAndroid.hpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef GRALLOC_ANDROID
-#define GRALLOC_ANDROID
-
-#include <hardware/gralloc.h>
-#include <hardware/gralloc1.h>
-
-#ifdef HAVE_GRALLOC3
-# include <android/hardware/graphics/mapper/3.0/IMapper.h>
-# include <utils/StrongPointer.h>
-#endif
-#ifdef HAVE_GRALLOC4
-# include <android/hardware/graphics/mapper/4.0/IMapper.h>
-# include <utils/StrongPointer.h>
-#endif
-
-#include <unistd.h> // for close()
-
-class GrallocModule
-{
-public:
- static GrallocModule *getInstance();
-
- int import(buffer_handle_t handle, buffer_handle_t *imported_handle);
- int release(buffer_handle_t handle);
-
- int lock(buffer_handle_t handle, int usage, int left, int top, int width, int height, void **vaddr);
- int unlock(buffer_handle_t handle);
-
-private:
- GrallocModule();
- uint8_t m_major_version;
- const gralloc_module_t *m_module;
-#ifdef HAVE_GRALLOC1
- gralloc1_device_t *m_gralloc1_device = nullptr;
- GRALLOC1_PFN_LOCK m_gralloc1_lock = nullptr;
- GRALLOC1_PFN_UNLOCK m_gralloc1_unlock = nullptr;
-#endif
-#ifdef HAVE_GRALLOC3
- android::sp<android::hardware::graphics::mapper::V3_0::IMapper> m_gralloc3_mapper;
-#endif
-#ifdef HAVE_GRALLOC4
- android::sp<android::hardware::graphics::mapper::V4_0::IMapper> m_gralloc4_mapper;
-#endif
-};
-
-#endif // GRALLOC_ANDROID
diff --git a/src/Common/Half.cpp b/src/Common/Half.cpp
deleted file mode 100644
index d6d809a00..000000000
--- a/src/Common/Half.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Half.hpp"
-
-namespace sw
-{
- half::half(float fp32)
- {
- unsigned int fp32i = *(unsigned int*)&fp32;
- unsigned int sign = (fp32i & 0x80000000) >> 16;
- unsigned int abs = fp32i & 0x7FFFFFFF;
-
- if(abs > 0x47FFEFFF) // Infinity
- {
- fp16i = sign | 0x7FFF;
- }
- else if(abs < 0x38800000) // Denormal
- {
- unsigned int mantissa = (abs & 0x007FFFFF) | 0x00800000;
- int e = 113 - (abs >> 23);
-
- if(e < 24)
- {
- abs = mantissa >> e;
- }
- else
- {
- abs = 0;
- }
-
- fp16i = sign | (abs + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
- }
- else
- {
- fp16i = sign | (abs + 0xC8000000 + 0x00000FFF + ((abs >> 13) & 1)) >> 13;
- }
- }
-
- half::operator float() const
- {
- unsigned int fp32i;
-
- int s = (fp16i >> 15) & 0x00000001;
- int e = (fp16i >> 10) & 0x0000001F;
- int m = fp16i & 0x000003FF;
-
- if(e == 0)
- {
- if(m == 0)
- {
- fp32i = s << 31;
-
- return (float&)fp32i;
- }
- else
- {
- while(!(m & 0x00000400))
- {
- m <<= 1;
- e -= 1;
- }
-
- e += 1;
- m &= ~0x00000400;
- }
- }
-
- e = e + (127 - 15);
- m = m << 13;
-
- fp32i = (s << 31) | (e << 23) | m;
-
- return (float&)fp32i;
- }
-
- half &half::operator=(float f)
- {
- *this = half(f);
-
- return *this;
- }
-}
diff --git a/src/Common/Half.hpp b/src/Common/Half.hpp
deleted file mode 100644
index 2f72fd4f4..000000000
--- a/src/Common/Half.hpp
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Half_hpp
-#define sw_Half_hpp
-
-namespace sw
-{
- class half
- {
- public:
- half() = default;
- half(const half& h) = default;
- explicit half(float f);
-
- operator float() const;
-
- half &operator=(const half& h) = default;
- half &operator=(float f);
-
- private:
- unsigned short fp16i;
- };
-
- inline half shortAsHalf(short s)
- {
- union
- {
- half h;
- short s;
- } hs;
-
- hs.s = s;
-
- return hs.h;
- }
-
- class RGB9E5
- {
- unsigned int R : 9;
- unsigned int G : 9;
- unsigned int B : 9;
- unsigned int E : 5;
-
- public:
- void toRGB16F(half rgb[3]) const
- {
- constexpr int offset = 24; // Exponent bias (15) + number of mantissa bits per component (9) = 24
-
- const float factor = (1u << E) * (1.0f / (1 << offset));
- rgb[0] = half(R * factor);
- rgb[1] = half(G * factor);
- rgb[2] = half(B * factor);
- }
- };
-
- class R11G11B10F
- {
- unsigned int R : 11;
- unsigned int G : 11;
- unsigned int B : 10;
-
- static inline half float11ToFloat16(unsigned short fp11)
- {
- return shortAsHalf(fp11 << 4); // Sign bit 0
- }
-
- static inline half float10ToFloat16(unsigned short fp10)
- {
- return shortAsHalf(fp10 << 5); // Sign bit 0
- }
-
- public:
- void toRGB16F(half rgb[3]) const
- {
- rgb[0] = float11ToFloat16(R);
- rgb[1] = float11ToFloat16(G);
- rgb[2] = float10ToFloat16(B);
- }
- };
-}
-
-#endif // sw_Half_hpp
diff --git a/src/Common/Math.cpp b/src/Common/Math.cpp
deleted file mode 100644
index 290d4ab83..000000000
--- a/src/Common/Math.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Math.hpp"
-
-namespace sw
-{
- inline uint64_t FNV_1a(uint64_t hash, unsigned char data)
- {
- return (hash ^ data) * 1099511628211;
- }
-
- uint64_t FNV_1a(const unsigned char *data, int size)
- {
- int64_t hash = 0xCBF29CE484222325;
-
- for(int i = 0; i < size; i++)
- {
- hash = FNV_1a(hash, data[i]);
- }
-
- return hash;
- }
-
- unsigned char sRGB8toLinear8(unsigned char value)
- {
- static unsigned char sRGBtoLinearTable[256] = { 255 };
- if(sRGBtoLinearTable[0] == 255)
- {
- for(int i = 0; i < 256; i++)
- {
- sRGBtoLinearTable[i] = static_cast<unsigned char>(sw::sRGBtoLinear(static_cast<float>(i) / 255.0f) * 255.0f + 0.5f);
- }
- }
-
- return sRGBtoLinearTable[value];
- }
-}
diff --git a/src/Common/Math.hpp b/src/Common/Math.hpp
deleted file mode 100644
index 79c8e74a3..000000000
--- a/src/Common/Math.hpp
+++ /dev/null
@@ -1,405 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Math_hpp
-#define sw_Math_hpp
-
-#include "Types.hpp"
-#include "Half.hpp"
-
-#include <cmath>
-#if defined(_MSC_VER)
- #include <intrin.h>
-#endif
-
-namespace sw
-{
- using std::abs;
-
- #undef min
- #undef max
-
- template<class T>
- inline T max(T a, T b)
- {
- return a > b ? a : b;
- }
-
- template<class T>
- inline T min(T a, T b)
- {
- return a < b ? a : b;
- }
-
- template<class T>
- inline T max(T a, T b, T c)
- {
- return max(max(a, b), c);
- }
-
- template<class T>
- inline T min(T a, T b, T c)
- {
- return min(min(a, b), c);
- }
-
- template<class T>
- inline T max(T a, T b, T c, T d)
- {
- return max(max(a, b), max(c, d));
- }
-
- template<class T>
- inline T min(T a, T b, T c, T d)
- {
- return min(min(a, b), min(c, d));
- }
-
- template<class T>
- inline void swap(T &a, T &b)
- {
- T t = a;
- a = b;
- b = t;
- }
-
- template <typename destType, typename sourceType>
- destType bit_cast(const sourceType &source)
- {
- union
- {
- sourceType s;
- destType d;
- } sd;
- sd.s = source;
- return sd.d;
- }
-
- inline int iround(float x)
- {
- return (int)floor(x + 0.5f);
- // return _mm_cvtss_si32(_mm_load_ss(&x)); // FIXME: Demands SSE support
- }
-
- inline int ifloor(float x)
- {
- return (int)floor(x);
- }
-
- inline int ceilFix4(int x)
- {
- return (x + 0xF) & 0xFFFFFFF0;
- }
-
- inline int ceilInt4(int x)
- {
- return (x + 0xF) >> 4;
- }
-
- #define BITS(x) ( \
- !!((x) & 0x80000000) + \
- !!((x) & 0xC0000000) + \
- !!((x) & 0xE0000000) + \
- !!((x) & 0xF0000000) + \
- !!((x) & 0xF8000000) + \
- !!((x) & 0xFC000000) + \
- !!((x) & 0xFE000000) + \
- !!((x) & 0xFF000000) + \
- !!((x) & 0xFF800000) + \
- !!((x) & 0xFFC00000) + \
- !!((x) & 0xFFE00000) + \
- !!((x) & 0xFFF00000) + \
- !!((x) & 0xFFF80000) + \
- !!((x) & 0xFFFC0000) + \
- !!((x) & 0xFFFE0000) + \
- !!((x) & 0xFFFF0000) + \
- !!((x) & 0xFFFF8000) + \
- !!((x) & 0xFFFFC000) + \
- !!((x) & 0xFFFFE000) + \
- !!((x) & 0xFFFFF000) + \
- !!((x) & 0xFFFFF800) + \
- !!((x) & 0xFFFFFC00) + \
- !!((x) & 0xFFFFFE00) + \
- !!((x) & 0xFFFFFF00) + \
- !!((x) & 0xFFFFFF80) + \
- !!((x) & 0xFFFFFFC0) + \
- !!((x) & 0xFFFFFFE0) + \
- !!((x) & 0xFFFFFFF0) + \
- !!((x) & 0xFFFFFFF8) + \
- !!((x) & 0xFFFFFFFC) + \
- !!((x) & 0xFFFFFFFE) + \
- !!((x) & 0xFFFFFFFF))
-
- #define MAX(x, y) ((x) > (y) ? (x) : (y))
- #define MIN(x, y) ((x) < (y) ? (x) : (y))
-
- inline float exp2(float x)
- {
- return exp2f(x);
- }
-
- inline int exp2(int x)
- {
- return 1 << x;
- }
-
- inline unsigned long log2(int x)
- {
- #if defined(_MSC_VER)
- unsigned long y;
- _BitScanReverse(&y, x);
- return y;
- #else
- return 31 - __builtin_clz(x);
- #endif
- }
-
- inline int ilog2(float x)
- {
- unsigned int y = *(unsigned int*)&x;
-
- return ((y & 0x7F800000) >> 23) - 127;
- }
-
- inline float log2(float x)
- {
- return logf(x) * 1.44269504f; // 1.0 / log[e](2)
- }
-
- inline bool isPow2(int x)
- {
- return (x & -x) == x;
- }
-
- template<class T>
- inline T clamp(T x, T a, T b)
- {
- if(x < a) x = a;
- if(x > b) x = b;
-
- return x;
- }
-
- inline float clamp01(float x)
- {
- return clamp(x, 0.0f, 1.0f);
- }
-
- // Bit-cast of a floating-point value into a two's complement integer representation.
- // This makes floating-point values comparable as integers.
- inline int32_t float_as_twos_complement(float f)
- {
- // IEEE-754 floating-point numbers are sorted by magnitude in the same way as integers,
- // except negative values are like one's complement integers. Convert them to two's complement.
- int32_t i = bit_cast<int32_t>(f);
- return (i < 0) ? (0x7FFFFFFFu - i) : i;
- }
-
- // 'Safe' clamping operation which always returns a value between min and max (inclusive).
- inline float clamp_s(float x, float min, float max)
- {
- // NaN values can't be compared directly
- if(float_as_twos_complement(x) < float_as_twos_complement(min)) x = min;
- if(float_as_twos_complement(x) > float_as_twos_complement(max)) x = max;
-
- return x;
- }
-
- inline int ceilPow2(int x)
- {
- int i = 1;
-
- while(i < x)
- {
- i <<= 1;
- }
-
- return i;
- }
-
- inline int floorDiv(int a, int b)
- {
- return a / b + ((a % b) >> 31);
- }
-
- inline int floorMod(int a, int b)
- {
- int r = a % b;
- return r + ((r >> 31) & b);
- }
-
- inline int ceilDiv(int a, int b)
- {
- return a / b - (-(a % b) >> 31);
- }
-
- inline int ceilMod(int a, int b)
- {
- int r = a % b;
- return r - ((-r >> 31) & b);
- }
-
- template<const int n>
- inline unsigned int unorm(float x)
- {
- static const unsigned int max = 0xFFFFFFFF >> (32 - n);
- static const float maxf = static_cast<float>(max);
-
- if(x >= 1.0f)
- {
- return max;
- }
- else if(x <= 0.0f)
- {
- return 0;
- }
- else
- {
- return static_cast<unsigned int>(maxf * x + 0.5f);
- }
- }
-
- template<const int n>
- inline int snorm(float x)
- {
- static const unsigned int min = 0x80000000 >> (32 - n);
- static const unsigned int max = 0xFFFFFFFF >> (32 - n + 1);
- static const float maxf = static_cast<float>(max);
- static const unsigned int range = 0xFFFFFFFF >> (32 - n);
-
- if(x >= 0.0f)
- {
- if(x >= 1.0f)
- {
- return max;
- }
- else
- {
- return static_cast<int>(maxf * x + 0.5f);
- }
- }
- else
- {
- if(x <= -1.0f)
- {
- return min;
- }
- else
- {
- return static_cast<int>(maxf * x - 0.5f) & range;
- }
- }
- }
-
- template<const int n>
- inline unsigned int ucast(float x)
- {
- static const unsigned int max = 0xFFFFFFFF >> (32 - n);
- static const float maxf = static_cast<float>(max);
-
- if(x >= maxf)
- {
- return max;
- }
- else if(x <= 0.0f)
- {
- return 0;
- }
- else
- {
- return static_cast<unsigned int>(x + 0.5f);
- }
- }
-
- template<const int n>
- inline int scast(float x)
- {
- static const unsigned int min = 0x80000000 >> (32 - n);
- static const unsigned int max = 0xFFFFFFFF >> (32 - n + 1);
- static const float maxf = static_cast<float>(max);
- static const float minf = static_cast<float>(min);
- static const unsigned int range = 0xFFFFFFFF >> (32 - n);
-
- if(x > 0.0f)
- {
- if(x >= maxf)
- {
- return max;
- }
- else
- {
- return static_cast<int>(x + 0.5f);
- }
- }
- else
- {
- if(x <= -minf)
- {
- return min;
- }
- else
- {
- return static_cast<int>(x - 0.5f) & range;
- }
- }
- }
-
- inline float sRGBtoLinear(float c)
- {
- if(c <= 0.04045f)
- {
- return c * 0.07739938f; // 1.0f / 12.92f;
- }
- else
- {
- return powf((c + 0.055f) * 0.9478673f, 2.4f); // 1.0f / 1.055f
- }
- }
-
- inline float linearToSRGB(float c)
- {
- if(c <= 0.0031308f)
- {
- return c * 12.92f;
- }
- else
- {
- return 1.055f * powf(c, 0.4166667f) - 0.055f; // 1.0f / 2.4f
- }
- }
-
- unsigned char sRGB8toLinear8(unsigned char value);
-
- uint64_t FNV_1a(const unsigned char *data, int size); // Fowler-Noll-Vo hash function
-
- // Round up to the next multiple of alignment
- template<typename T>
- inline T align(T value, unsigned int alignment)
- {
- return ((value + alignment - 1) / alignment) * alignment;
- }
-
- template<unsigned int alignment, typename T>
- inline T align(T value)
- {
- return ((value + alignment - 1) / alignment) * alignment;
- }
-
- inline int clampToSignedInt(unsigned int x)
- {
- return static_cast<int>(min(x, 0x7FFFFFFFu));
- }
-}
-
-#endif // sw_Math_hpp
diff --git a/src/Common/Memory.cpp b/src/Common/Memory.cpp
deleted file mode 100644
index e5b878797..000000000
--- a/src/Common/Memory.cpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Memory.hpp"
-
-#include "Types.hpp"
-#include "Debug.hpp"
-
-#if defined(_WIN32)
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #include <intrin.h>
-#else
- #include <errno.h>
- #include <sys/mman.h>
- #include <stdlib.h>
- #include <unistd.h>
-#endif
-
-#include <memory.h>
-
-#undef allocate
-#undef deallocate
-
-#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__) || defined (_M_X64)) && !defined(__x86__)
-#define __x86__
-#endif
-
-namespace sw
-{
-namespace
-{
-struct Allocation
-{
-// size_t bytes;
- unsigned char *block;
-};
-
-void *allocateRaw(size_t bytes, size_t alignment)
-{
- ASSERT((alignment & (alignment - 1)) == 0); // Power of 2 alignment.
-
- unsigned char *block = new unsigned char[bytes + sizeof(Allocation) + alignment];
- unsigned char *aligned = nullptr;
-
- if(block)
- {
- aligned = (unsigned char*)((uintptr_t)(block + sizeof(Allocation) + alignment - 1) & -(intptr_t)alignment);
- Allocation *allocation = (Allocation*)(aligned - sizeof(Allocation));
-
- // allocation->bytes = bytes;
- allocation->block = block;
- }
-
- return aligned;
-}
-} // anonymous namespace
-
-size_t memoryPageSize()
-{
- static int pageSize = 0;
-
- if(pageSize == 0)
- {
- #if defined(_WIN32)
- SYSTEM_INFO systemInfo;
- GetSystemInfo(&systemInfo);
- pageSize = systemInfo.dwPageSize;
- #else
- pageSize = sysconf(_SC_PAGESIZE);
- #endif
- }
-
- return pageSize;
-}
-
-void *allocate(size_t bytes, size_t alignment)
-{
- void *memory = allocateRaw(bytes, alignment);
-
- if(memory)
- {
- memset(memory, 0, bytes);
- }
-
- return memory;
-}
-
-void deallocate(void *memory)
-{
- if(memory)
- {
- unsigned char *aligned = (unsigned char*)memory;
- Allocation *allocation = (Allocation*)(aligned - sizeof(Allocation));
-
- delete[] allocation->block;
- }
-}
-
-void clear(uint16_t *memory, uint16_t element, size_t count)
-{
- #if defined(_MSC_VER) && defined(__x86__) && !defined(MEMORY_SANITIZER)
- __stosw(memory, element, count);
- #elif defined(__GNUC__) && defined(__x86__) && !defined(MEMORY_SANITIZER)
- __asm__ __volatile__("rep stosw" : "+D"(memory), "+c"(count) : "a"(element) : "memory");
- #else
- for(size_t i = 0; i < count; i++)
- {
- memory[i] = element;
- }
- #endif
-}
-
-void clear(uint32_t *memory, uint32_t element, size_t count)
-{
- #if defined(_MSC_VER) && defined(__x86__) && !defined(MEMORY_SANITIZER)
- __stosd((unsigned long*)memory, element, count);
- #elif defined(__GNUC__) && defined(__x86__) && !defined(MEMORY_SANITIZER)
- __asm__ __volatile__("rep stosl" : "+D"(memory), "+c"(count) : "a"(element) : "memory");
- #else
- for(size_t i = 0; i < count; i++)
- {
- memory[i] = element;
- }
- #endif
-}
-
-}
diff --git a/src/Common/Memory.hpp b/src/Common/Memory.hpp
deleted file mode 100644
index 0e8d188e1..000000000
--- a/src/Common/Memory.hpp
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Memory_hpp
-#define Memory_hpp
-
-#include <stddef.h>
-#include <stdint.h>
-
-namespace sw
-{
-size_t memoryPageSize();
-
-void *allocate(size_t bytes, size_t alignment = 16);
-void deallocate(void *memory);
-
-void clear(uint16_t *memory, uint16_t element, size_t count);
-void clear(uint32_t *memory, uint32_t element, size_t count);
-}
-
-#endif // Memory_hpp
diff --git a/src/Common/MutexLock.hpp b/src/Common/MutexLock.hpp
deleted file mode 100644
index 1328e35f8..000000000
--- a/src/Common/MutexLock.hpp
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_MutexLock_hpp
-#define sw_MutexLock_hpp
-
-#include "Thread.hpp"
-
-#if defined(__linux__)
-// Use a pthread mutex on Linux. Since many processes may use SwiftShader
-// at the same time it's best to just have the scheduler overhead.
-#include <pthread.h>
-
-namespace sw
-{
- class MutexLock
- {
- public:
- MutexLock()
- {
- pthread_mutex_init(&mutex, NULL);
- }
-
- ~MutexLock()
- {
- pthread_mutex_destroy(&mutex);
- }
-
- bool attemptLock()
- {
- return pthread_mutex_trylock(&mutex) == 0;
- }
-
- void lock()
- {
- pthread_mutex_lock(&mutex);
- }
-
- void unlock()
- {
- pthread_mutex_unlock(&mutex);
- }
-
- private:
- pthread_mutex_t mutex;
- };
-}
-
-#else // !__linux__
-
-#include <atomic>
-
-namespace sw
-{
- class BackoffLock
- {
- public:
- BackoffLock()
- {
- mutex = 0;
- }
-
- bool attemptLock()
- {
- if(!isLocked())
- {
- if(mutex.exchange(true) == false)
- {
- return true;
- }
- }
-
- return false;
- }
-
- void lock()
- {
- int backoff = 1;
-
- while(!attemptLock())
- {
- if(backoff <= 64)
- {
- for(int i = 0; i < backoff; i++)
- {
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
-
- nop();
- nop();
- nop();
- nop();
- nop();
- }
-
- backoff *= 2;
- }
- else
- {
- Thread::yield();
-
- backoff = 1;
- }
- };
- }
-
- void unlock()
- {
- mutex.store(false, std::memory_order_release);
- }
-
- bool isLocked()
- {
- return mutex.load(std::memory_order_acquire);
- }
-
- private:
- struct
- {
- // Ensure that the mutex variable is on its own 64-byte cache line to avoid false sharing
- // Padding must be public to avoid compiler warnings
- volatile int padding1[16];
- std::atomic<bool> mutex;
- volatile int padding2[15];
- };
- };
-
- using MutexLock = BackoffLock;
-}
-
-#endif // !__linux__
-
-class LockGuard
-{
-public:
- explicit LockGuard(sw::MutexLock &mutex) : mutex(&mutex)
- {
- mutex.lock();
- }
-
- explicit LockGuard(sw::MutexLock *mutex) : mutex(mutex)
- {
- if (mutex) mutex->lock();
- }
-
- ~LockGuard()
- {
- if (mutex) mutex->unlock();
- }
-
-protected:
- sw::MutexLock *mutex;
-};
-
-#endif // sw_MutexLock_hpp
diff --git a/src/Common/RecursiveLock.hpp b/src/Common/RecursiveLock.hpp
deleted file mode 100644
index 9db9295e6..000000000
--- a/src/Common/RecursiveLock.hpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2019 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_RecursiveLock_hpp
-#define sw_RecursiveLock_hpp
-
-#include "Thread.hpp"
-
-#include <mutex>
-
-namespace sw
-{
- class RecursiveLock
- {
- public:
- RecursiveLock()
- {
- }
-
- bool attemptLock()
- {
- return mutex.try_lock();
- }
-
- void lock()
- {
- mutex.lock();
- }
-
- void unlock()
- {
- mutex.unlock();
- }
- private:
- std::recursive_mutex mutex;
- };
-}
-
-class RecursiveLockGuard
-{
-public:
- explicit RecursiveLockGuard(sw::RecursiveLock &mutex) : mutex(&mutex)
- {
- mutex.lock();
- }
-
- explicit RecursiveLockGuard(sw::RecursiveLock *mutex) : mutex(mutex)
- {
- if (mutex) mutex->lock();
- }
-
- ~RecursiveLockGuard()
- {
- if (mutex) mutex->unlock();
- }
-
-protected:
- sw::RecursiveLock *mutex;
-};
-
-#endif // sw_RecursiveLock_hpp
diff --git a/src/Common/Resource.cpp b/src/Common/Resource.cpp
deleted file mode 100644
index 3a63810ad..000000000
--- a/src/Common/Resource.cpp
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Resource.hpp"
-
-#include "Memory.hpp"
-#include "Debug.hpp"
-
-namespace sw
-{
- Resource::Resource(size_t bytes) : size(bytes)
- {
- blocked = 0;
-
- accessor = PUBLIC;
- count = 0;
- orphaned = false;
-
- buffer = allocate(bytes);
- }
-
- Resource::~Resource()
- {
- deallocate(buffer);
- }
-
- void *Resource::lock(Accessor claimer)
- {
- criticalSection.lock();
-
- while(count > 0 && accessor != claimer)
- {
- blocked++;
- criticalSection.unlock();
-
- unblock.wait();
-
- criticalSection.lock();
- blocked--;
- }
-
- accessor = claimer;
- count++;
-
- criticalSection.unlock();
-
- return buffer;
- }
-
- void *Resource::lock(Accessor relinquisher, Accessor claimer)
- {
- criticalSection.lock();
-
- // Release
- while(count > 0 && accessor == relinquisher)
- {
- count--;
-
- if(count == 0)
- {
- if(blocked)
- {
- unblock.signal();
- }
- else if(orphaned)
- {
- criticalSection.unlock();
-
- delete this;
-
- return 0;
- }
- }
- }
-
- // Acquire
- while(count > 0 && accessor != claimer)
- {
- blocked++;
- criticalSection.unlock();
-
- unblock.wait();
-
- criticalSection.lock();
- blocked--;
- }
-
- accessor = claimer;
- count++;
-
- criticalSection.unlock();
-
- return buffer;
- }
-
- void Resource::unlock()
- {
- criticalSection.lock();
- ASSERT(count > 0);
-
- count--;
-
- if(count == 0)
- {
- if(blocked)
- {
- unblock.signal();
- }
- else if(orphaned)
- {
- criticalSection.unlock();
-
- delete this;
-
- return;
- }
- }
-
- criticalSection.unlock();
- }
-
- void Resource::unlock(Accessor relinquisher)
- {
- criticalSection.lock();
- ASSERT(count > 0);
-
- while(count > 0 && accessor == relinquisher)
- {
- count--;
-
- if(count == 0)
- {
- if(blocked)
- {
- unblock.signal();
- }
- else if(orphaned)
- {
- criticalSection.unlock();
-
- delete this;
-
- return;
- }
- }
- }
-
- criticalSection.unlock();
- }
-
- void Resource::destruct()
- {
- criticalSection.lock();
-
- if(count == 0 && !blocked)
- {
- criticalSection.unlock();
-
- delete this;
-
- return;
- }
-
- orphaned = true;
-
- criticalSection.unlock();
- }
-
- const void *Resource::data() const
- {
- return buffer;
- }
-}
diff --git a/src/Common/Resource.hpp b/src/Common/Resource.hpp
deleted file mode 100644
index 2e8c34932..000000000
--- a/src/Common/Resource.hpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Resource_hpp
-#define sw_Resource_hpp
-
-#include "MutexLock.hpp"
-
-namespace sw
-{
- enum Accessor
- {
- PUBLIC, // Application/API access
- PRIVATE, // Renderer access, shared by multiple threads if read-only
- MANAGED, // Renderer access, shared read/write access if partitioned
- EXCLUSIVE
- };
-
- // Resource is a form of shared mutex that guards an internally allocated
- // buffer. Resource has an exclusive lock mode (sw::Accessor) and lock
- // count, defaulting to sw::Accessor::PUBLIC and 0, respectively.
- // Resource doesn't treat any of the sw::Accessor enumerator lock modes
- // differently, all semantic meaning comes from the usage of Resource.
- // You can have multiple locks in mode sw::Accessor::EXCLUSIVE.
- class Resource
- {
- public:
- Resource(size_t bytes);
-
- // destruct() is an asynchronous destructor, that will atomically:
- // When the resource is unlocked:
- // * Delete itself.
- // When the resource is locked:
- // * Flag itself for deletion when next fully unlocked.
- void destruct();
-
- // lock() will atomically:
- // When the resource is unlocked OR the lock mode equals claimer:
- // * Increment the lock count.
- // * Return a pointer to the buffer.
- // When the resource is locked AND the lock mode does not equal claimer:
- // * Block until all existing locks are released (lock count equals 0).
- // * Switch lock mode to claimer.
- // * Increment the lock count.
- // * Return a pointer to the buffer.
- void *lock(Accessor claimer);
-
- // lock() will atomically:
- // When the resource is unlocked OR the lock mode equals claimer:
- // * Increment the lock count.
- // * Return a pointer to the buffer.
- // When the resource is locked AND the lock mode equals relinquisher:
- // * Release *all* existing locks (regardless of prior count).
- // * Delete itself and return nullptr if Resource::destruct() had been called while locked.
- // * Switch lock mode to claimer.
- // * Increment the lock count to 1.
- // * Return a pointer to the buffer.
- // When the resource is locked AND the lock mode does not equal relinquisher:
- // * Block until all existing locks are released (lock count equals 0)
- // * Switch lock mode to claimer
- // * Increment the lock count to 1.
- // * Return a pointer to the buffer.
- void *lock(Accessor relinquisher, Accessor claimer);
-
- // unlock() will atomically:
- // * Assert if there are no locks.
- // * Release a single lock.
- // * Delete itself if Resource::destruct() had been called while locked.
- void unlock();
-
- // unlock() will atomically:
- // When the resource is locked AND the lock mode equals relinquisher:
- // * Release *all* existing locks (regardless of prior count).
- // * Delete itself if Resource::destruct() had been called while locked.
- // When the resource is not locked OR the lock mode does not equal relinquisher:
- // * Do nothing.
- void unlock(Accessor relinquisher);
-
- // data() will return the Resource's buffer pointer regardless of lock
- // state.
- const void *data() const;
-
- // size is the size in bytes of the Resource's buffer.
- const size_t size;
-
- private:
- ~Resource(); // Always call destruct() instead
-
- MutexLock criticalSection;
- Event unblock;
- volatile int blocked;
-
- volatile Accessor accessor;
- volatile int count;
- bool orphaned;
-
- void *buffer;
- };
-}
-
-#endif // sw_Resource_hpp
diff --git a/src/Common/SharedLibrary.cpp b/src/Common/SharedLibrary.cpp
deleted file mode 100644
index 982292d7c..000000000
--- a/src/Common/SharedLibrary.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "SharedLibrary.hpp"
-
-#if defined(_WIN32)
-std::string getModuleDirectory()
-{
- static int dummy_symbol = 0;
-
- HMODULE module = NULL;
- GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, (LPCTSTR)&dummy_symbol, &module);
-
- char filename[1024];
- if(module && (GetModuleFileName(module, filename, sizeof(filename)) != 0))
- {
- std::string directory(filename);
- return directory.substr(0, directory.find_last_of("\\/") + 1).c_str();
- }
- else
- {
- return "";
- }
-}
-#else
-std::string getModuleDirectory()
-{
- static int dummy_symbol = 0;
-
- Dl_info dl_info;
- if(dladdr(&dummy_symbol, &dl_info) != 0)
- {
- std::string directory(dl_info.dli_fname);
- return directory.substr(0, directory.find_last_of("\\/") + 1).c_str();
- }
- else
- {
- return "";
- }
-}
-#endif
diff --git a/src/Common/SharedLibrary.hpp b/src/Common/SharedLibrary.hpp
deleted file mode 100644
index 2af79986d..000000000
--- a/src/Common/SharedLibrary.hpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef SharedLibrary_hpp
-#define SharedLibrary_hpp
-
-#if defined(_WIN32)
- #include <Windows.h>
-#else
- #include <dlfcn.h>
-#endif
-
-#include <string>
-
-void *getLibraryHandle(const char *path);
-void *loadLibrary(const char *path);
-void freeLibrary(void *library);
-void *getProcAddress(void *library, const char *name);
-std::string getModuleDirectory();
-
-template<int n>
-void *loadLibrary(const std::string &libraryDirectory, const char *(&names)[n], const char *mustContainSymbol = nullptr)
-{
- for(const char *libraryName : names)
- {
- std::string libraryPath = libraryDirectory + libraryName;
- void *library = getLibraryHandle(libraryPath.c_str());
-
- if(library)
- {
- if(!mustContainSymbol || getProcAddress(library, mustContainSymbol))
- {
- return library;
- }
-
- freeLibrary(library);
- }
- }
-
- for(const char *libraryName : names)
- {
- std::string libraryPath = libraryDirectory + libraryName;
- void *library = loadLibrary(libraryPath.c_str());
-
- if(library)
- {
- if(!mustContainSymbol || getProcAddress(library, mustContainSymbol))
- {
- return library;
- }
-
- freeLibrary(library);
- }
- }
-
- return nullptr;
-}
-
-#if defined(_WIN32)
- inline void *loadLibrary(const char *path)
- {
- return (void*)LoadLibrary(path);
- }
-
- inline void *getLibraryHandle(const char *path)
- {
- HMODULE module = NULL;
- GetModuleHandleEx(0, path, &module);
- return (void*)module;
- }
-
- inline void freeLibrary(void *library)
- {
- FreeLibrary((HMODULE)library);
- }
-
- inline void *getProcAddress(void *library, const char *name)
- {
- return (void*)GetProcAddress((HMODULE)library, name);
- }
-#else
- inline void *loadLibrary(const char *path)
- {
- return dlopen(path, RTLD_LAZY | RTLD_LOCAL);
- }
-
- inline void *getLibraryHandle(const char *path)
- {
- #ifdef __ANDROID__
- // bionic doesn't support RTLD_NOLOAD before L
- return dlopen(path, RTLD_NOW | RTLD_LOCAL);
- #else
- void *resident = dlopen(path, RTLD_LAZY | RTLD_NOLOAD | RTLD_LOCAL);
-
- if(resident)
- {
- return dlopen(path, RTLD_LAZY | RTLD_LOCAL); // Increment reference count
- }
-
- return nullptr;
- #endif
- }
-
- inline void freeLibrary(void *library)
- {
- if(library)
- {
- dlclose(library);
- }
- }
-
- inline void *getProcAddress(void *library, const char *name)
- {
- void *symbol = dlsym(library, name);
-
- if(!symbol)
- {
- const char *reason = dlerror(); // Silence the error
- (void)reason;
- }
-
- return symbol;
- }
-#endif
-
-#endif // SharedLibrary_hpp
diff --git a/src/Common/Socket.cpp b/src/Common/Socket.cpp
deleted file mode 100644
index b09803198..000000000
--- a/src/Common/Socket.cpp
+++ /dev/null
@@ -1,110 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Socket.hpp"
-
-#if defined(_WIN32)
- #include <ws2tcpip.h>
-#else
- #include <unistd.h>
- #include <netdb.h>
- #include <netinet/in.h>
- #include <sys/select.h>
-#endif
-
-namespace sw
-{
- Socket::Socket(SOCKET socket) : socket(socket)
- {
- }
-
- Socket::Socket(const char *address, const char *port)
- {
- #if defined(_WIN32)
- socket = INVALID_SOCKET;
- #else
- socket = -1;
- #endif
-
- addrinfo hints = {};
- hints.ai_family = AF_INET;
- hints.ai_socktype = SOCK_STREAM;
- hints.ai_protocol = IPPROTO_TCP;
- hints.ai_flags = AI_PASSIVE;
-
- addrinfo *info = 0;
- getaddrinfo(address, port, &hints, &info);
-
- if(info)
- {
- socket = ::socket(info->ai_family, info->ai_socktype, info->ai_protocol);
- bind(socket, info->ai_addr, (int)info->ai_addrlen);
- }
- }
-
- Socket::~Socket()
- {
- #if defined(_WIN32)
- closesocket(socket);
- #else
- close(socket);
- #endif
- }
-
- void Socket::listen(int backlog)
- {
- ::listen(socket, backlog);
- }
-
- bool Socket::select(int us)
- {
- fd_set sockets;
- FD_ZERO(&sockets);
- FD_SET(socket, &sockets);
-
- timeval timeout = {us / 1000000, us % 1000000};
-
- return ::select(FD_SETSIZE, &sockets, 0, 0, &timeout) >= 1;
- }
-
- Socket *Socket::accept()
- {
- return new Socket(::accept(socket, 0, 0));
- }
-
- int Socket::receive(char *buffer, int length)
- {
- return recv(socket, buffer, length, 0);
- }
-
- void Socket::send(const char *buffer, int length)
- {
- ::send(socket, buffer, length, 0);
- }
-
- void Socket::startup()
- {
- #if defined(_WIN32)
- WSADATA winsockData;
- WSAStartup(MAKEWORD(2, 2), &winsockData);
- #endif
- }
-
- void Socket::cleanup()
- {
- #if defined(_WIN32)
- WSACleanup();
- #endif
- }
-}
diff --git a/src/Common/Socket.hpp b/src/Common/Socket.hpp
deleted file mode 100644
index b6b9abde1..000000000
--- a/src/Common/Socket.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Socket_hpp
-#define sw_Socket_hpp
-
-#if defined(_WIN32)
- #include <winsock2.h>
-#else
- #include <sys/socket.h>
- typedef int SOCKET;
-#endif
-
-namespace sw
-{
- class Socket
- {
- public:
- Socket(SOCKET socket);
- Socket(const char *address, const char *port);
- ~Socket();
-
- void listen(int backlog = 1);
- bool select(int us);
- Socket *accept();
-
- int receive(char *buffer, int length);
- void send(const char *buffer, int length);
-
- static void startup();
- static void cleanup();
-
- private:
- SOCKET socket;
- };
-}
-
-#endif // sw_Socket_hpp
diff --git a/src/Common/Thread.cpp b/src/Common/Thread.cpp
deleted file mode 100644
index df9a0b794..000000000
--- a/src/Common/Thread.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Thread.hpp"
-
-namespace sw
-{
- Thread::Thread(void (*threadFunction)(void *parameters), void *parameters)
- {
- Event init;
- Entry entry = {threadFunction, parameters, &init};
-
- #if defined(_WIN32)
- handle = CreateThread(NULL, 1024 * 1024, startFunction, &entry, 0, NULL);
- #else
- pthread_create(&handle, NULL, startFunction, &entry);
- #endif
-
- init.wait();
- }
-
- Thread::~Thread()
- {
- join(); // Make threads exit before deleting them to not block here
- }
-
- void Thread::join()
- {
- if(!hasJoined)
- {
- #if defined(_WIN32)
- WaitForSingleObject(handle, INFINITE);
- CloseHandle(handle);
- #else
- pthread_join(handle, NULL);
- #endif
-
- hasJoined = true;
- }
- }
-
- #if defined(_WIN32)
- unsigned long __stdcall Thread::startFunction(void *parameters)
- {
- Entry entry = *(Entry*)parameters;
- entry.init->signal();
- entry.threadFunction(entry.threadParameters);
- return 0;
- }
- #else
- void *Thread::startFunction(void *parameters)
- {
- Entry entry = *(Entry*)parameters;
- entry.init->signal();
- entry.threadFunction(entry.threadParameters);
- return nullptr;
- }
- #endif
-
- Event::Event()
- {
- #if defined(_WIN32)
- handle = CreateEvent(NULL, FALSE, FALSE, NULL);
- #else
- pthread_cond_init(&handle, NULL);
- pthread_mutex_init(&mutex, NULL);
- signaled = false;
- #endif
- }
-
- Event::~Event()
- {
- #if defined(_WIN32)
- CloseHandle(handle);
- #else
- pthread_cond_destroy(&handle);
- pthread_mutex_destroy(&mutex);
- #endif
- }
-}
diff --git a/src/Common/Thread.hpp b/src/Common/Thread.hpp
deleted file mode 100644
index b8280f1d7..000000000
--- a/src/Common/Thread.hpp
+++ /dev/null
@@ -1,338 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Thread_hpp
-#define sw_Thread_hpp
-
-#if defined(_WIN32)
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #include <intrin.h>
-#else
- #include <pthread.h>
- #include <sched.h>
- #include <unistd.h>
- #define TLS_OUT_OF_INDEXES (pthread_key_t)(~0)
-#endif
-
-#include <stdlib.h>
-
-#if defined(__clang__)
-#if __has_include(<atomic>) // clang has an explicit check for the availability of atomic
-#define USE_STD_ATOMIC 1
-#endif
-// atomic is available in C++11 or newer, and in Visual Studio 2012 or newer
-#elif (defined(_MSC_VER) && (_MSC_VER >= 1700)) || (__cplusplus >= 201103L)
-#define USE_STD_ATOMIC 1
-#endif
-
-#if USE_STD_ATOMIC
-#include <atomic>
-#endif
-
-namespace sw
-{
- class Event;
-
- class Thread
- {
- public:
- Thread(void (*threadFunction)(void *parameters), void *parameters);
-
- ~Thread();
-
- void join();
-
- static void yield();
- static void sleep(int milliseconds);
-
- #if defined(_WIN32)
- typedef DWORD LocalStorageKey;
- #else
- typedef pthread_key_t LocalStorageKey;
- #endif
-
- static LocalStorageKey allocateLocalStorageKey(void (*destructor)(void *storage) = free);
- static void freeLocalStorageKey(LocalStorageKey key);
- static void *allocateLocalStorage(LocalStorageKey key, size_t size);
- static void *getLocalStorage(LocalStorageKey key);
- static void freeLocalStorage(LocalStorageKey key);
-
- private:
- struct Entry
- {
- void (*const threadFunction)(void *parameters);
- void *threadParameters;
- Event *init;
- };
-
- #if defined(_WIN32)
- static unsigned long __stdcall startFunction(void *parameters);
- HANDLE handle;
- #else
- static void *startFunction(void *parameters);
- pthread_t handle;
- #endif
-
- bool hasJoined = false;
- };
-
- class Event
- {
- friend class Thread;
-
- public:
- Event();
-
- ~Event();
-
- void signal();
- void wait();
-
- private:
- #if defined(_WIN32)
- HANDLE handle;
- #else
- pthread_cond_t handle;
- pthread_mutex_t mutex;
- volatile bool signaled;
- #endif
- };
-
- #if PERF_PROFILE
- int64_t atomicExchange(int64_t volatile *target, int64_t value);
- int atomicExchange(int volatile *target, int value);
- #endif
-
- int atomicIncrement(int volatile *value);
- int atomicDecrement(int volatile *value);
- int atomicAdd(int volatile *target, int value);
- void nop();
-}
-
-namespace sw
-{
- inline void Thread::yield()
- {
- #if defined(_WIN32)
- Sleep(0);
- #elif defined(__APPLE__)
- pthread_yield_np();
- #else
- sched_yield();
- #endif
- }
-
- inline void Thread::sleep(int milliseconds)
- {
- #if defined(_WIN32)
- Sleep(milliseconds);
- #else
- usleep(1000 * milliseconds);
- #endif
- }
-
- inline Thread::LocalStorageKey Thread::allocateLocalStorageKey(void (*destructor)(void *storage))
- {
- #if defined(_WIN32)
- return TlsAlloc();
- #else
- LocalStorageKey key;
- pthread_key_create(&key, destructor);
- return key;
- #endif
- }
-
- inline void Thread::freeLocalStorageKey(LocalStorageKey key)
- {
- #if defined(_WIN32)
- TlsFree(key);
- #else
- pthread_key_delete(key); // Using an invalid key is an error but not undefined behavior.
- #endif
- }
-
- inline void *Thread::allocateLocalStorage(LocalStorageKey key, size_t size)
- {
- if(key == TLS_OUT_OF_INDEXES)
- {
- return nullptr;
- }
-
- freeLocalStorage(key);
-
- void *storage = malloc(size);
-
- #if defined(_WIN32)
- TlsSetValue(key, storage);
- #else
- pthread_setspecific(key, storage);
- #endif
-
- return storage;
- }
-
- inline void *Thread::getLocalStorage(LocalStorageKey key)
- {
- #if defined(_WIN32)
- return TlsGetValue(key);
- #else
- if(key == TLS_OUT_OF_INDEXES) // Avoid undefined behavior.
- {
- return nullptr;
- }
-
- return pthread_getspecific(key);
- #endif
- }
-
- inline void Thread::freeLocalStorage(LocalStorageKey key)
- {
- free(getLocalStorage(key));
-
- #if defined(_WIN32)
- TlsSetValue(key, nullptr);
- #else
- pthread_setspecific(key, nullptr);
- #endif
- }
-
- inline void Event::signal()
- {
- #if defined(_WIN32)
- SetEvent(handle);
- #else
- pthread_mutex_lock(&mutex);
- signaled = true;
- pthread_cond_signal(&handle);
- pthread_mutex_unlock(&mutex);
- #endif
- }
-
- inline void Event::wait()
- {
- #if defined(_WIN32)
- WaitForSingleObject(handle, INFINITE);
- #else
- pthread_mutex_lock(&mutex);
- while(!signaled) pthread_cond_wait(&handle, &mutex);
- signaled = false;
- pthread_mutex_unlock(&mutex);
- #endif
- }
-
- #if PERF_PROFILE
- inline int64_t atomicExchange(volatile int64_t *target, int64_t value)
- {
- #if defined(_WIN32)
- return InterlockedExchange64(target, value);
- #else
- int ret;
- __asm__ __volatile__("lock; xchg8 %x0,(%x1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" );
- return ret;
- #endif
- }
-
- inline int atomicExchange(volatile int *target, int value)
- {
- #if defined(_WIN32)
- return InterlockedExchange((volatile long*)target, (long)value);
- #else
- int ret;
- __asm__ __volatile__("lock; xchgl %x0,(%x1)" : "=r" (ret) :"r" (target), "0" (value) : "memory" );
- return ret;
- #endif
- }
- #endif
-
- inline int atomicIncrement(volatile int *value)
- {
- #if defined(_WIN32)
- return InterlockedIncrement((volatile long*)value);
- #else
- return __sync_add_and_fetch(value, 1);
- #endif
- }
-
- inline int atomicDecrement(volatile int *value)
- {
- #if defined(_WIN32)
- return InterlockedDecrement((volatile long*)value);
- #else
- return __sync_sub_and_fetch(value, 1);
- #endif
- }
-
- inline int atomicAdd(volatile int* target, int value)
- {
- #if defined(_WIN32)
- return InterlockedExchangeAdd((volatile long*)target, value) + value;
- #else
- return __sync_add_and_fetch(target, value);
- #endif
- }
-
- inline void nop()
- {
- #if defined(_WIN32)
- __nop();
- #else
- __asm__ __volatile__ ("nop");
- #endif
- }
-
- #if USE_STD_ATOMIC
- class AtomicInt
- {
- public:
- AtomicInt() : ai() {}
- AtomicInt(int i) : ai(i) {}
-
- inline operator int() const { return ai.load(std::memory_order_acquire); }
- inline void operator=(const AtomicInt& i) { ai.store(i.ai.load(std::memory_order_acquire), std::memory_order_release); }
- inline void operator=(int i) { ai.store(i, std::memory_order_release); }
- inline void operator--() { ai.fetch_sub(1, std::memory_order_acq_rel); }
- inline void operator++() { ai.fetch_add(1, std::memory_order_acq_rel); }
- inline int operator--(int) { return ai.fetch_sub(1, std::memory_order_acq_rel) - 1; }
- inline int operator++(int) { return ai.fetch_add(1, std::memory_order_acq_rel) + 1; }
- inline void operator-=(int i) { ai.fetch_sub(i, std::memory_order_acq_rel); }
- inline void operator+=(int i) { ai.fetch_add(i, std::memory_order_acq_rel); }
- private:
- std::atomic<int> ai;
- };
- #else
- class AtomicInt
- {
- public:
- AtomicInt() {}
- AtomicInt(int i) : vi(i) {}
-
- inline operator int() const { return vi; } // Note: this isn't a guaranteed atomic operation
- inline void operator=(const AtomicInt& i) { sw::atomicExchange(&vi, i.vi); }
- inline void operator=(int i) { sw::atomicExchange(&vi, i); }
- inline void operator--() { sw::atomicDecrement(&vi); }
- inline void operator++() { sw::atomicIncrement(&vi); }
- inline int operator--(int) { return sw::atomicDecrement(&vi); }
- inline int operator++(int) { return sw::atomicIncrement(&vi); }
- inline void operator-=(int i) { sw::atomicAdd(&vi, -i); }
- inline void operator+=(int i) { sw::atomicAdd(&vi, i); }
- private:
- volatile int vi;
- };
- #endif
-}
-
-#endif // sw_Thread_hpp
diff --git a/src/Common/Timer.cpp b/src/Common/Timer.cpp
deleted file mode 100644
index 0fa339f08..000000000
--- a/src/Common/Timer.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Timer.hpp"
-
-#if !defined(__i386__) && defined(_M_IX86)
- #define __i386__ 1
-#endif
-
-#if !defined(__x86_64__) && (defined(_M_AMD64) || defined (_M_X64))
- #define __x86_64__ 1
-#endif
-
-#if defined(_WIN32)
- #ifndef WIN32_LEAN_AND_MEAN
- #define WIN32_LEAN_AND_MEAN
- #endif
- #include <windows.h>
- #include <intrin.h>
-#else
- #include <sys/time.h>
- #if defined(__i386__) || defined(__x86_64__)
- #include <x86intrin.h>
- #endif
-#endif
-
-namespace sw
-{
- Timer::Timer()
- {
- }
-
- Timer::~Timer()
- {
- }
-
- double Timer::seconds()
- {
- #if defined(_WIN32)
- return (double)counter() / (double)frequency();
- #else
- timeval t;
- gettimeofday(&t, 0);
- return (double)t.tv_sec + (double)t.tv_usec * 1.0e-6;
- #endif
- }
-
- int64_t Timer::ticks()
- {
- #if defined(_WIN32)
- #if defined(_M_ARM64)
- return _ReadStatusReg(ARM64_PMCCNTR_EL0);
- #else
- return __rdtsc();
- #endif
- #elif defined(__i386__) || defined(__x86_64__)
- return __builtin_ia32_rdtsc();
- #else
- return 0;
- #endif
- }
-
- int64_t Timer::counter()
- {
- #if defined(_WIN32)
- int64_t counter;
- QueryPerformanceCounter((LARGE_INTEGER*)&counter);
- return counter;
- #else
- timeval t;
- gettimeofday(&t, 0);
- return t.tv_sec * 1000000 + t.tv_usec;
- #endif
- }
-
- int64_t Timer::frequency()
- {
- #if defined(_WIN32)
- int64_t frequency;
- QueryPerformanceFrequency((LARGE_INTEGER*)&frequency);
- return frequency;
- #else
- return 1000000; // gettimeofday uses microsecond resolution
- #endif
- }
-}
diff --git a/src/Common/Timer.hpp b/src/Common/Timer.hpp
deleted file mode 100644
index 977c87719..000000000
--- a/src/Common/Timer.hpp
+++ /dev/null
@@ -1,37 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Timer_hpp
-#define sw_Timer_hpp
-
-#include "Types.hpp"
-
-namespace sw
-{
- class Timer
- {
- public:
- Timer();
-
- ~Timer();
-
- static double seconds();
- static int64_t ticks();
-
- static int64_t counter();
- static int64_t frequency();
- };
-}
-
-#endif // sw_Timer_hpp
diff --git a/src/Common/Types.hpp b/src/Common/Types.hpp
deleted file mode 100644
index 00da6c86f..000000000
--- a/src/Common/Types.hpp
+++ /dev/null
@@ -1,156 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Types_hpp
-#define sw_Types_hpp
-
-#include <assert.h>
-#include <limits>
-#include <type_traits>
-
-// GCC warns against bitfields not fitting the entire range of an enum with a fixed underlying type of unsigned int, which gets promoted to an error with -Werror and cannot be suppressed.
-// However, GCC already defaults to using unsigned int as the underlying type of an unscoped enum without a fixed underlying type. So we can just omit it.
-#if defined(__GNUC__) && !defined(__clang__)
-namespace {enum E {}; static_assert(!std::numeric_limits<std::underlying_type<E>::type>::is_signed, "expected unscoped enum whose underlying type is not fixed to be unsigned");}
-#define ENUM_UNDERLYING_TYPE_UNSIGNED_INT
-#else
-#define ENUM_UNDERLYING_TYPE_UNSIGNED_INT : unsigned int
-#endif
-
-#if defined(_MSC_VER)
- typedef signed __int8 int8_t;
- typedef signed __int16 int16_t;
- typedef signed __int32 int32_t;
- typedef signed __int64 int64_t;
- typedef unsigned __int8 uint8_t;
- typedef unsigned __int16 uint16_t;
- typedef unsigned __int32 uint32_t;
- typedef unsigned __int64 uint64_t;
- #define ALIGN(bytes, type) __declspec(align(bytes)) type
-#else
- #include <stdint.h>
- #define ALIGN(bytes, type) type __attribute__((aligned(bytes)))
-#endif
-
-namespace sw
-{
- typedef ALIGN(1, uint8_t) byte;
- typedef ALIGN(2, uint16_t) word;
- typedef ALIGN(4, uint32_t) dword;
- typedef ALIGN(8, uint64_t) qword;
- typedef ALIGN(16, uint64_t) qword2[2];
- typedef ALIGN(4, uint8_t) byte4[4];
- typedef ALIGN(8, uint8_t) byte8[8];
- typedef ALIGN(16, uint8_t) byte16[16];
- typedef ALIGN(8, uint16_t) word4[4];
- typedef ALIGN(8, uint32_t) dword2[2];
- typedef ALIGN(16, uint32_t) dword4[4];
- typedef ALIGN(16, uint64_t) xword[2];
-
- typedef ALIGN(1, int8_t) sbyte;
- typedef ALIGN(4, int8_t) sbyte4[4];
- typedef ALIGN(8, int8_t) sbyte8[8];
- typedef ALIGN(16, int8_t) sbyte16[16];
- typedef ALIGN(8, short) short4[4];
- typedef ALIGN(8, unsigned short) ushort4[4];
- typedef ALIGN(16, short) short8[8];
- typedef ALIGN(16, unsigned short) ushort8[8];
- typedef ALIGN(8, int) int2[2];
- typedef ALIGN(8, unsigned int) uint2[2];
- typedef ALIGN(16, unsigned int) uint4[4];
-
- typedef ALIGN(8, float) float2[2];
-
- ALIGN(16, struct int4
- {
- int x;
- int y;
- int z;
- int w;
-
- int &operator[](int i)
- {
- return (&x)[i];
- }
-
- const int &operator[](int i) const
- {
- return (&x)[i];
- }
-
- bool operator!=(const int4 &rhs)
- {
- return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w;
- }
-
- bool operator==(const int4 &rhs)
- {
- return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
- }
- });
-
- ALIGN(16, struct float4
- {
- float x;
- float y;
- float z;
- float w;
-
- float &operator[](int i)
- {
- return (&x)[i];
- }
-
- const float &operator[](int i) const
- {
- return (&x)[i];
- }
-
- bool operator!=(const float4 &rhs)
- {
- return x != rhs.x || y != rhs.y || z != rhs.z || w != rhs.w;
- }
-
- bool operator==(const float4 &rhs)
- {
- return x == rhs.x && y == rhs.y && z == rhs.z && w == rhs.w;
- }
- });
-
- inline float4 vector(float x, float y, float z, float w)
- {
- float4 v;
-
- v.x = x;
- v.y = y;
- v.z = z;
- v.w = w;
-
- return v;
- }
-
- inline float4 replicate(float f)
- {
- float4 v;
-
- v.x = f;
- v.y = f;
- v.z = f;
- v.w = f;
-
- return v;
- }
-}
-
-#endif // sw_Types_hpp
diff --git a/src/Common/Version.h b/src/Common/Version.h
deleted file mode 100644
index dbb59e138..000000000
--- a/src/Common/Version.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#define MAJOR_VERSION 4
-#define MINOR_VERSION 6
-#define BUILD_VERSION 6
-#define BUILD_REVISION 6
-
-#define STRINGIFY(x) #x
-#define MACRO_STRINGIFY(x) STRINGIFY(x)
-
-#define REVISION_STRING MACRO_STRINGIFY(BUILD_REVISION)
-#define VERSION_STRING MACRO_STRINGIFY(MAJOR_VERSION) "." MACRO_STRINGIFY(MINOR_VERSION) "." MACRO_STRINGIFY(BUILD_VERSION) "." MACRO_STRINGIFY(BUILD_REVISION)
diff --git a/src/Main/Config.cpp b/src/Main/Config.cpp
deleted file mode 100644
index 3e499207b..000000000
--- a/src/Main/Config.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Config.hpp"
-
-#include "Common/Thread.hpp"
-#include "Common/Timer.hpp"
-
-namespace sw
-{
- Profiler profiler;
-
- Profiler::Profiler()
- {
- reset();
- }
-
- void Profiler::reset()
- {
- framesSec = 0;
- framesTotal = 0;
- FPS = 0;
-
- #if PERF_PROFILE
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- cycles[i] = 0;
- }
-
- ropOperations = 0;
- ropOperationsTotal = 0;
- ropOperationsFrame = 0;
-
- texOperations = 0;
- texOperationsTotal = 0;
- texOperationsFrame = 0;
-
- compressedTex = 0;
- compressedTexTotal = 0;
- compressedTexFrame = 0;
- #endif
- }
-
- void Profiler::nextFrame()
- {
- #if PERF_PROFILE
- ropOperationsFrame = sw::atomicExchange(&ropOperations, 0);
- texOperationsFrame = sw::atomicExchange(&texOperations, 0);
- compressedTexFrame = sw::atomicExchange(&compressedTex, 0);
-
- ropOperationsTotal += ropOperationsFrame;
- texOperationsTotal += texOperationsFrame;
- compressedTexTotal += compressedTexFrame;
- #endif
-
- static double fpsTime = sw::Timer::seconds();
-
- double time = sw::Timer::seconds();
- double delta = time - fpsTime;
- framesSec++;
-
- if(delta > 1.0)
- {
- FPS = framesSec / delta;
-
- fpsTime = time;
- framesTotal += framesSec;
- framesSec = 0;
- }
- }
-} \ No newline at end of file
diff --git a/src/Main/Config.hpp b/src/Main/Config.hpp
deleted file mode 100644
index 9eb7e1128..000000000
--- a/src/Main/Config.hpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Config_hpp
-#define sw_Config_hpp
-
-#include "Common/Types.hpp"
-
-#define PERF_HUD 0 // Display time spent on vertex, setup and pixel processing for each thread
-#define PERF_PROFILE 0 // Profile various pipeline stages and display the timing in SwiftConfig
-
-// Worker thread count when not set by SwiftConfig
-// 0 = process affinity count (recommended)
-// 1 = rendering on main thread (no worker threads), useful for debugging
-#ifndef DEFAULT_THREAD_COUNT
-#define DEFAULT_THREAD_COUNT 0
-#endif
-
-namespace sw
-{
- enum
- {
- PERF_PIXEL,
- PERF_PIPE,
- PERF_INTERP,
- PERF_SHADER,
- PERF_TEX,
- PERF_ROP,
-
- PERF_TIMERS
- };
-
- struct Profiler
- {
- Profiler();
-
- void reset();
- void nextFrame();
-
- int framesSec;
- int framesTotal;
- double FPS;
-
- #if PERF_PROFILE
- double cycles[PERF_TIMERS];
-
- int64_t ropOperations;
- int64_t ropOperationsTotal;
- int64_t ropOperationsFrame;
-
- int64_t texOperations;
- int64_t texOperationsTotal;
- int64_t texOperationsFrame;
-
- int64_t compressedTex;
- int64_t compressedTexTotal;
- int64_t compressedTexFrame;
- #endif
- };
-
- extern Profiler profiler;
-
- enum
- {
- OUTLINE_RESOLUTION = 8192, // Maximum vertical resolution of the render target
- MIPMAP_LEVELS = 14,
- TEXTURE_IMAGE_UNITS = 16,
- VERTEX_TEXTURE_IMAGE_UNITS = 16,
- TOTAL_IMAGE_UNITS = TEXTURE_IMAGE_UNITS + VERTEX_TEXTURE_IMAGE_UNITS,
- FRAGMENT_UNIFORM_VECTORS = 264,
- VERTEX_UNIFORM_VECTORS = 259,
- MAX_VERTEX_INPUTS = 32,
- MAX_VERTEX_OUTPUTS = 34,
- MAX_FRAGMENT_INPUTS = 32,
- MAX_FRAGMENT_UNIFORM_BLOCKS = 12,
- MAX_VERTEX_UNIFORM_BLOCKS = 12,
- MAX_UNIFORM_BUFFER_BINDINGS = MAX_FRAGMENT_UNIFORM_BLOCKS + MAX_VERTEX_UNIFORM_BLOCKS, // Limited to 127 by SourceParameter.bufferIndex in Shader.hpp
- MAX_UNIFORM_BLOCK_SIZE = 16384,
- MAX_CLIP_PLANES = 6,
- MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 64,
- MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 64,
- MIN_PROGRAM_TEXEL_OFFSET = -8,
- MAX_PROGRAM_TEXEL_OFFSET = 7,
- MAX_TEXTURE_LOD = MIPMAP_LEVELS - 2, // Trilinear accesses lod+1
- RENDERTARGETS = 8,
- NUM_TEMPORARY_REGISTERS = 4096,
- MAX_SHADER_CALL_STACK_SIZE = 64,
- MAX_SHADER_ENABLE_STACK_SIZE = 1 + 24,
- };
-}
-
-#endif // sw_Config_hpp
diff --git a/src/Main/FrameBuffer.cpp b/src/Main/FrameBuffer.cpp
deleted file mode 100644
index 2dc5cd660..000000000
--- a/src/Main/FrameBuffer.cpp
+++ /dev/null
@@ -1,634 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBuffer.hpp"
-
-#include "Renderer/Surface.hpp"
-#include "Reactor/Reactor.hpp"
-#include "Common/Timer.hpp"
-#include "Common/Debug.hpp"
-
-#include <stdio.h>
-#include <string.h>
-#include <time.h>
-
-#define ASYNCHRONOUS_BLIT false // FIXME: Currently leads to rare race conditions
-
-namespace sw
-{
- extern bool forceWindowed;
-
- FrameBuffer::Cursor FrameBuffer::cursor = {};
- bool FrameBuffer::topLeftOrigin = false;
-
- FrameBuffer::FrameBuffer(int width, int height, bool fullscreen, bool topLeftOrigin)
- {
- this->topLeftOrigin = topLeftOrigin;
-
- framebuffer = nullptr;
-
- this->width = width;
- this->height = height;
- format = FORMAT_X8R8G8B8;
- stride = 0;
-
- windowed = !fullscreen || forceWindowed;
-
- blitFunction = nullptr;
- blitRoutine = nullptr;
- blitState = {};
-
- if(ASYNCHRONOUS_BLIT)
- {
- terminate = false;
- FrameBuffer *parameters = this;
- blitThread = new Thread(threadFunction, &parameters);
- }
- }
-
- FrameBuffer::~FrameBuffer()
- {
- if(ASYNCHRONOUS_BLIT)
- {
- terminate = true;
- blitEvent.signal();
- blitThread->join();
- delete blitThread;
- }
- }
-
- void FrameBuffer::setCursorImage(sw::Surface *cursorImage)
- {
- if(cursorImage)
- {
- cursor.image = cursorImage->lockExternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
- cursorImage->unlockExternal();
-
- cursor.width = cursorImage->getWidth();
- cursor.height = cursorImage->getHeight();
- }
- else
- {
- cursor.width = 0;
- cursor.height = 0;
- }
- }
-
- void FrameBuffer::setCursorOrigin(int x0, int y0)
- {
- cursor.hotspotX = x0;
- cursor.hotspotY = y0;
- }
-
- void FrameBuffer::setCursorPosition(int x, int y)
- {
- cursor.positionX = x;
- cursor.positionY = y;
- }
-
- void FrameBuffer::copy(sw::Surface *source)
- {
- if(!source)
- {
- return;
- }
-
- if(!lock())
- {
- return;
- }
-
- int sourceStride = source->getInternalPitchB();
-
- updateState = {};
- updateState.width = width;
- updateState.height = height;
- updateState.destFormat = format;
- updateState.destStride = stride;
- updateState.sourceFormat = source->getInternalFormat();
- updateState.sourceStride = topLeftOrigin ? sourceStride : -sourceStride;
- updateState.cursorWidth = cursor.width;
- updateState.cursorHeight = cursor.height;
-
- renderbuffer = source->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
-
- if(!topLeftOrigin)
- {
- renderbuffer = (byte*)renderbuffer + (height - 1) * sourceStride;
- }
-
- cursor.x = cursor.positionX - cursor.hotspotX;
- cursor.y = cursor.positionY - cursor.hotspotY;
-
- if(ASYNCHRONOUS_BLIT)
- {
- blitEvent.signal();
- syncEvent.wait();
- }
- else
- {
- copyLocked();
- }
-
- source->unlockInternal();
- unlock();
-
- profiler.nextFrame(); // Assumes every copy() is a full frame
- }
-
- void FrameBuffer::copyLocked()
- {
- if(memcmp(&blitState, &updateState, sizeof(BlitState)) != 0)
- {
- blitState = updateState;
- blitRoutine = copyRoutine(blitState);
- blitFunction = (void(*)(void*, void*, Cursor*))blitRoutine->getEntry();
- }
-
- blitFunction(framebuffer, renderbuffer, &cursor);
- }
-
- std::shared_ptr<Routine> FrameBuffer::copyRoutine(const BlitState &state)
- {
- const int width = state.width;
- const int height = state.height;
- const int dBytes = Surface::bytes(state.destFormat);
- const int dStride = state.destStride;
- const int sBytes = Surface::bytes(state.sourceFormat);
- const int sStride = state.sourceStride;
-
- Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
- {
- Pointer<Byte> dst(function.Arg<0>());
- Pointer<Byte> src(function.Arg<1>());
- Pointer<Byte> cursor(function.Arg<2>());
-
- For(Int y = 0, y < height, y++)
- {
- Pointer<Byte> d = dst + y * dStride;
- Pointer<Byte> s = src + y * sStride;
-
- Int x0 = 0;
-
- switch(state.destFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- {
- Int x = x0;
-
- switch(state.sourceFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- For(, x < width - 3, x += 4)
- {
- *Pointer<Int4>(d, 1) = *Pointer<Int4>(s, sStride % 16 ? 1 : 16);
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- For(, x < width - 3, x += 4)
- {
- Int4 bgra = *Pointer<Int4>(s, sStride % 16 ? 1 : 16);
-
- *Pointer<Int4>(d, 1) = ((bgra & Int4(0x00FF0000)) >> 16) |
- ((bgra & Int4(0x000000FF)) << 16) |
- (bgra & Int4(0xFF00FF00));
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- case FORMAT_A16B16G16R16:
- For(, x < width - 1, x += 2)
- {
- Short4 c0 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 0), 0x2103)) >> 8;
- Short4 c1 = As<UShort4>(Swizzle(*Pointer<Short4>(s + 8), 0x2103)) >> 8;
-
- *Pointer<Int2>(d) = As<Int2>(PackUnsigned(c0, c1));
-
- s += 2 * sBytes;
- d += 2 * dBytes;
- }
- break;
- case FORMAT_R5G6B5:
- For(, x < width - 3, x += 4)
- {
- Int4 rgb = Int4(*Pointer<Short4>(s));
-
- *Pointer<Int4>(d) = (((rgb & Int4(0xF800)) << 8) | ((rgb & Int4(0xE01F)) << 3)) |
- (((rgb & Int4(0x07E0)) << 5) | ((rgb & Int4(0x0600)) >> 1)) |
- (((rgb & Int4(0x001C)) >> 2) | Int4(0xFF000000));
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- For(, x < width, x++)
- {
- switch(state.sourceFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- *Pointer<Int>(d) = *Pointer<Int>(s);
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- {
- Int rgba = *Pointer<Int>(s);
-
- *Pointer<Int>(d) = ((rgba & Int(0x00FF0000)) >> 16) |
- ((rgba & Int(0x000000FF)) << 16) |
- (rgba & Int(0xFF00FF00));
- }
- break;
- case FORMAT_A16B16G16R16:
- {
- Short4 c = As<UShort4>(Swizzle(*Pointer<Short4>(s), 0x2103)) >> 8;
-
- *Pointer<Int>(d) = Int(As<Int2>(PackUnsigned(c, c)));
- }
- break;
- case FORMAT_R5G6B5:
- {
- Int rgb = Int(*Pointer<Short>(s));
-
- *Pointer<Int>(d) = 0xFF000000 |
- ((rgb & 0xF800) << 8) | ((rgb & 0xE01F) << 3) |
- ((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1) |
- ((rgb & 0x001C) >> 2);
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- s += sBytes;
- d += dBytes;
- }
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- {
- Int x = x0;
-
- switch(state.sourceFormat)
- {
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- For(, x < width - 3, x += 4)
- {
- *Pointer<Int4>(d, 1) = *Pointer<Int4>(s, sStride % 16 ? 1 : 16);
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- For(, x < width - 3, x += 4)
- {
- Int4 bgra = *Pointer<Int4>(s, sStride % 16 ? 1 : 16);
-
- *Pointer<Int4>(d, 1) = ((bgra & Int4(0x00FF0000)) >> 16) |
- ((bgra & Int4(0x000000FF)) << 16) |
- (bgra & Int4(0xFF00FF00));
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- case FORMAT_A16B16G16R16:
- For(, x < width - 1, x += 2)
- {
- Short4 c0 = *Pointer<UShort4>(s + 0) >> 8;
- Short4 c1 = *Pointer<UShort4>(s + 8) >> 8;
-
- *Pointer<Int2>(d) = As<Int2>(PackUnsigned(c0, c1));
-
- s += 2 * sBytes;
- d += 2 * dBytes;
- }
- break;
- case FORMAT_R5G6B5:
- For(, x < width - 3, x += 4)
- {
- Int4 rgb = Int4(*Pointer<Short4>(s));
-
- *Pointer<Int4>(d) = Int4(0xFF000000) |
- (((rgb & Int4(0x001F)) << 19) | ((rgb & Int4(0x001C)) << 14)) |
- (((rgb & Int4(0x07E0)) << 5) | ((rgb & Int4(0x0600)) >> 1)) |
- (((rgb & Int4(0xF800)) >> 8) | ((rgb & Int4(0xE000)) >> 13));
-
- s += 4 * sBytes;
- d += 4 * dBytes;
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- For(, x < width, x++)
- {
- switch(state.sourceFormat)
- {
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- *Pointer<Int>(d) = *Pointer<Int>(s);
- break;
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- {
- Int bgra = *Pointer<Int>(s);
- *Pointer<Int>(d) = ((bgra & Int(0x00FF0000)) >> 16) |
- ((bgra & Int(0x000000FF)) << 16) |
- (bgra & Int(0xFF00FF00));
- }
- break;
- case FORMAT_A16B16G16R16:
- {
- Short4 c = *Pointer<UShort4>(s) >> 8;
-
- *Pointer<Int>(d) = Int(As<Int2>(PackUnsigned(c, c)));
- }
- break;
- case FORMAT_R5G6B5:
- {
- Int rgb = Int(*Pointer<Short>(s));
-
- *Pointer<Int>(d) = 0xFF000000 |
- ((rgb & 0x001F) << 19) | ((rgb & 0x001C) << 14) |
- ((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1) |
- ((rgb & 0xF800) >> 8) | ((rgb & 0xE000) >> 13);
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- s += sBytes;
- d += dBytes;
- }
- }
- break;
- case FORMAT_R8G8B8:
- {
- For(Int x = x0, x < width, x++)
- {
- switch(state.sourceFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- *Pointer<Byte>(d + 0) = *Pointer<Byte>(s + 0);
- *Pointer<Byte>(d + 1) = *Pointer<Byte>(s + 1);
- *Pointer<Byte>(d + 2) = *Pointer<Byte>(s + 2);
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- *Pointer<Byte>(d + 0) = *Pointer<Byte>(s + 2);
- *Pointer<Byte>(d + 1) = *Pointer<Byte>(s + 1);
- *Pointer<Byte>(d + 2) = *Pointer<Byte>(s + 0);
- break;
- case FORMAT_A16B16G16R16:
- *Pointer<Byte>(d + 0) = *Pointer<Byte>(s + 5);
- *Pointer<Byte>(d + 1) = *Pointer<Byte>(s + 3);
- *Pointer<Byte>(d + 2) = *Pointer<Byte>(s + 1);
- break;
- case FORMAT_R5G6B5:
- {
- Int rgb = Int(*Pointer<Short>(s));
-
- *Pointer<Byte>(d + 0) = Byte(((rgb & 0x001F) << 3) | ((rgb & 0x001C) >> 2));
- *Pointer<Byte>(d + 1) = Byte(((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1));
- *Pointer<Byte>(d + 2) = Byte(((rgb & 0xF800) << 8) | ((rgb & 0xE000) << 3));
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- s += sBytes;
- d += dBytes;
- }
- }
- break;
- case FORMAT_R5G6B5:
- {
- For(Int x = x0, x < width, x++)
- {
- switch(state.sourceFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- {
- Int c = *Pointer<Int>(s);
-
- *Pointer<Short>(d) = Short((c & 0x00F80000) >> 8 |
- (c & 0x0000FC00) >> 5 |
- (c & 0x000000F8) >> 3);
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- {
- Int c = *Pointer<Int>(s);
-
- *Pointer<Short>(d) = Short((c & 0x00F80000) >> 19 |
- (c & 0x0000FC00) >> 5 |
- (c & 0x000000F8) << 8);
- }
- break;
- case FORMAT_A16B16G16R16:
- {
- Short4 cc = *Pointer<UShort4>(s) >> 8;
- Int c = Int(As<Int2>(PackUnsigned(cc, cc)));
-
- *Pointer<Short>(d) = Short((c & 0x00F80000) >> 19 |
- (c & 0x0000FC00) >> 5 |
- (c & 0x000000F8) << 8);
- }
- break;
- case FORMAT_R5G6B5:
- *Pointer<Short>(d) = *Pointer<Short>(s);
- break;
- default:
- ASSERT(false);
- break;
- }
-
- s += sBytes;
- d += dBytes;
- }
- }
- break;
- default:
- ASSERT(false);
- break;
- }
- }
-
- if(state.cursorWidth > 0 && state.cursorHeight > 0)
- {
- Int x0 = *Pointer<Int>(cursor + OFFSET(Cursor,x));
- Int y0 = *Pointer<Int>(cursor + OFFSET(Cursor,y));
-
- For(Int y1 = 0, y1 < state.cursorHeight, y1++)
- {
- Int y = y0 + y1;
-
- If(y >= 0 && y < height)
- {
- Pointer<Byte> d = dst + y * dStride + x0 * dBytes;
- Pointer<Byte> s = src + y * sStride + x0 * sBytes;
- Pointer<Byte> c = *Pointer<Pointer<Byte>>(cursor + OFFSET(Cursor,image)) + y1 * state.cursorWidth * 4;
-
- For(Int x1 = 0, x1 < state.cursorWidth, x1++)
- {
- Int x = x0 + x1;
-
- If(x >= 0 && x < width)
- {
- blend(state, d, s, c);
- }
-
- c += 4;
- s += sBytes;
- d += dBytes;
- }
- }
- }
- }
- }
-
- return function("FrameBuffer");
- }
-
- void FrameBuffer::blend(const BlitState &state, const Pointer<Byte> &d, const Pointer<Byte> &s, const Pointer<Byte> &c)
- {
- Short4 c1;
- Short4 c2;
-
- c1 = Unpack(*Pointer<Byte4>(c));
-
- switch(state.sourceFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- c2 = Unpack(*Pointer<Byte4>(s));
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- c2 = Swizzle(Unpack(*Pointer<Byte4>(s)), 0x2103);
- break;
- case FORMAT_A16B16G16R16:
- c2 = Swizzle(*Pointer<Short4>(s), 0x2103);
- break;
- case FORMAT_R5G6B5:
- {
- Int rgb(*Pointer<Short>(s));
- rgb = 0xFF000000 |
- ((rgb & 0xF800) << 8) | ((rgb & 0xE01F) << 3) |
- ((rgb & 0x07E0) << 5) | ((rgb & 0x0600) >> 1) |
- ((rgb & 0x001C) >> 2);
- c2 = Unpack(As<Byte4>(rgb));
- }
- break;
- default:
- ASSERT(false);
- break;
- }
-
- c1 = As<Short4>(As<UShort4>(c1) >> 9);
- c2 = As<Short4>(As<UShort4>(c2) >> 9);
-
- Short4 alpha = Swizzle(c1, 0x3333) & Short4(0xFFFFu, 0xFFFFu, 0xFFFFu, 0x0000);
-
- c1 = (c1 - c2) * alpha;
- c1 = c1 >> 7;
- c1 = c1 + c2;
- c1 = c1 + c1;
-
- switch(state.destFormat)
- {
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- *Pointer<Byte4>(d) = Byte4(PackUnsigned(c1, c1));
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- {
- c1 = Swizzle(c1, 0x2103);
-
- *Pointer<Byte4>(d) = Byte4(PackUnsigned(c1, c1));
- }
- break;
- case FORMAT_R8G8B8:
- {
- Int c = Int(As<Int2>(PackUnsigned(c1, c1)));
-
- *Pointer<Byte>(d + 0) = Byte(c >> 0);
- *Pointer<Byte>(d + 1) = Byte(c >> 8);
- *Pointer<Byte>(d + 2) = Byte(c >> 16);
- }
- break;
- case FORMAT_R5G6B5:
- {
- Int c = Int(As<Int2>(PackUnsigned(c1, c1)));
-
- *Pointer<Short>(d) = Short((c & 0x00F80000) >> 8 |
- (c & 0x0000FC00) >> 5 |
- (c & 0x000000F8) >> 3);
- }
- break;
- default:
- ASSERT(false);
- break;
- }
- }
-
- void FrameBuffer::threadFunction(void *parameters)
- {
- FrameBuffer *frameBuffer = *static_cast<FrameBuffer**>(parameters);
-
- while(!frameBuffer->terminate)
- {
- frameBuffer->blitEvent.wait();
-
- if(!frameBuffer->terminate)
- {
- frameBuffer->copyLocked();
-
- frameBuffer->syncEvent.signal();
- }
- }
- }
-}
diff --git a/src/Main/FrameBuffer.hpp b/src/Main/FrameBuffer.hpp
deleted file mode 100644
index 94a189079..000000000
--- a/src/Main/FrameBuffer.hpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBuffer_hpp
-#define sw_FrameBuffer_hpp
-
-#include "Reactor/Reactor.hpp"
-#include "Renderer/Surface.hpp"
-#include "Common/Thread.hpp"
-
-namespace sw
-{
- using namespace rr;
-
- class Surface;
-
- struct BlitState
- {
- int width;
- int height;
- Format destFormat;
- Format sourceFormat;
- int destStride;
- int sourceStride;
- int cursorWidth;
- int cursorHeight;
- };
-
- class [[clang::lto_visibility_public]] FrameBuffer
- {
- public:
- FrameBuffer(int width, int height, bool fullscreen, bool topLeftOrigin);
-
- virtual ~FrameBuffer() = 0;
-
- virtual void flip(sw::Surface *source) = 0;
- virtual void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) = 0;
-
- virtual void *lock() = 0;
- virtual void unlock() = 0;
-
- static void setCursorImage(sw::Surface *cursor);
- static void setCursorOrigin(int x0, int y0);
- static void setCursorPosition(int x, int y);
-
- static std::shared_ptr<Routine> copyRoutine(const BlitState &state);
-
- protected:
- void copy(sw::Surface *source);
-
- bool windowed;
-
- void *framebuffer; // Native window buffer.
- int width;
- int height;
- int stride;
- Format format;
-
- private:
- void copyLocked();
-
- static void threadFunction(void *parameters);
-
- void *renderbuffer; // Render target buffer.
-
- struct Cursor
- {
- void *image;
- int x;
- int y;
- int width;
- int height;
- int hotspotX;
- int hotspotY;
- int positionX;
- int positionY;
- };
-
- static Cursor cursor;
-
- void (*blitFunction)(void *dst, void *src, Cursor *cursor);
- std::shared_ptr<Routine> blitRoutine;
- BlitState blitState; // State of the current blitRoutine.
- BlitState updateState; // State of the routine to be generated.
-
- static void blend(const BlitState &state, const Pointer<Byte> &d, const Pointer<Byte> &s, const Pointer<Byte> &c);
-
- Thread *blitThread;
- Event syncEvent;
- Event blitEvent;
- volatile bool terminate;
-
- static bool topLeftOrigin;
- };
-}
-
-#endif // sw_FrameBuffer_hpp
diff --git a/src/Main/FrameBufferAndroid.cpp b/src/Main/FrameBufferAndroid.cpp
deleted file mode 100644
index 5ff1b4144..000000000
--- a/src/Main/FrameBufferAndroid.cpp
+++ /dev/null
@@ -1,196 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferAndroid.hpp"
-
-#ifndef ANDROID_NDK_BUILD
-#include "Common/GrallocAndroid.hpp"
-#include <sync/sync.h>
-#include <system/graphics.h>
-#include <vndk/window.h>
-#else
-#include <android/native_window.h>
-#endif
-
-namespace sw
-{
-#if !defined(ANDROID_NDK_BUILD)
- inline int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer)
- {
- int fenceFd = -1;
- int ret = ANativeWindow_dequeueBuffer(window, buffer, &fenceFd);
- if (ret || fenceFd < 0) return ret;
- sync_wait(fenceFd, -1 /* forever */);
- close(fenceFd);
- return ret;
- }
-
- inline int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd)
- {
- return ANativeWindow_queueBuffer(window, buffer, fenceFd);
- }
-
- inline int cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd)
- {
- return ANativeWindow_cancelBuffer(window, buffer, fenceFd);
- }
-#endif // !defined(ANDROID_NDK_BUILD)
-
- FrameBufferAndroid::FrameBufferAndroid(ANativeWindow* window, int width, int height)
- : FrameBuffer(width, height, false, false),
- nativeWindow(window), buffer(nullptr)
- {
-#ifndef ANDROID_NDK_BUILD
- ANativeWindow_acquire(nativeWindow);
- ANativeWindow_setUsage(nativeWindow, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
-#endif
- }
-
- FrameBufferAndroid::~FrameBufferAndroid()
- {
-#ifndef ANDROID_NDK_BUILD
- ANativeWindow_release(nativeWindow);
-#endif
- }
-
- void FrameBufferAndroid::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
-
- if(buffer)
- {
- if(framebuffer)
- {
- framebuffer = nullptr;
- unlock();
- }
-
-#ifndef ANDROID_NDK_BUILD
- queueBuffer(nativeWindow, buffer, -1);
-#endif
- }
- }
-
- void *FrameBufferAndroid::lock()
- {
-
-#if defined(ANDROID_NDK_BUILD)
- ANativeWindow_Buffer surfaceBuffer;
- if (ANativeWindow_lock(nativeWindow, &surfaceBuffer, nullptr) != 0) {
- TRACE("%s failed to lock buffer %p", __FUNCTION__, buffer);
- return nullptr;
- }
- framebuffer = surfaceBuffer.bits;
-
- if((surfaceBuffer.width < width) || (surfaceBuffer.height < height))
- {
- TRACE("lock failed: buffer of %dx%d too small for window of %dx%d",
- surfaceBuffer.width, surfaceBuffer.height, width, height);
- return nullptr;
- }
-
- switch(surfaceBuffer.format)
- {
- case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: format = FORMAT_A8B8G8R8; break;
- case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: format = FORMAT_X8B8G8R8; break;
- case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM:
- // Frame buffers are expected to have 16-bit or 32-bit colors, not 24-bit.
- TRACE("Unsupported frame buffer format R8G8B8"); ASSERT(false);
- format = FORMAT_R8G8B8; // Wrong component order.
- break;
- case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: format = FORMAT_R5G6B5; break;
- default:
- TRACE("Unsupported frame buffer format %d", surfaceBuffer.format); ASSERT(false);
- format = FORMAT_NULL;
- break;
- }
- stride = surfaceBuffer.stride * Surface::bytes(format);
-#else // !defined(ANDROID_NDK_BUILD)
- if(dequeueBuffer(nativeWindow, &buffer) != 0)
- {
- return nullptr;
- }
- if(GrallocModule::getInstance()->import(buffer->handle, &bufferImportedHandle) != 0) {
- TRACE("%s failed to import buffer %p", __FUNCTION__, buffer);
- return nullptr;
- }
-
- if(GrallocModule::getInstance()->lock(bufferImportedHandle,
- GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN,
- 0, 0, buffer->width, buffer->height, &framebuffer) != 0)
- {
- TRACE("%s failed to lock buffer %p", __FUNCTION__, buffer);
- return nullptr;
- }
-
- if((buffer->width < width) || (buffer->height < height))
- {
- TRACE("lock failed: buffer of %dx%d too small for window of %dx%d",
- buffer->width, buffer->height, width, height);
- return nullptr;
- }
-
- switch(buffer->format)
- {
- case HAL_PIXEL_FORMAT_RGB_565: format = FORMAT_R5G6B5; break;
- case HAL_PIXEL_FORMAT_RGBA_8888: format = FORMAT_A8B8G8R8; break;
-#if ANDROID_PLATFORM_SDK_VERSION > 16
- case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: format = FORMAT_X8B8G8R8; break;
-#endif
- case HAL_PIXEL_FORMAT_RGBX_8888: format = FORMAT_X8B8G8R8; break;
- case HAL_PIXEL_FORMAT_BGRA_8888: format = FORMAT_A8R8G8B8; break;
- case HAL_PIXEL_FORMAT_RGB_888:
- // Frame buffers are expected to have 16-bit or 32-bit colors, not 24-bit.
- TRACE("Unsupported frame buffer format RGB_888"); ASSERT(false);
- format = FORMAT_R8G8B8; // Wrong component order.
- break;
- default:
- TRACE("Unsupported frame buffer format %d", buffer->format); ASSERT(false);
- format = FORMAT_NULL;
- break;
- }
- stride = buffer->stride * Surface::bytes(format);
-#endif // !defined(ANDROID_NDK_BUILD)
-
- return framebuffer;
- }
-
- void FrameBufferAndroid::unlock()
- {
- if(!buffer)
- {
- TRACE("%s: badness unlock with no active buffer", __FUNCTION__);
- return;
- }
-
- framebuffer = nullptr;
-
-#ifdef ANDROID_NDK_BUILD
- ANativeWindow_unlockAndPost(nativeWindow);
-#else
- if(GrallocModule::getInstance()->unlock(bufferImportedHandle) != 0)
- {
- TRACE("%s: badness unlock failed", __FUNCTION__);
- }
- if(GrallocModule::getInstance()->release(bufferImportedHandle) != 0) {
- TRACE("%s: badness release failed", __FUNCTION__);
- }
-#endif
- }
-}
-
-sw::FrameBuffer *createFrameBuffer(void *display, ANativeWindow* window, int width, int height)
-{
- return new sw::FrameBufferAndroid(window, width, height);
-}
diff --git a/src/Main/FrameBufferAndroid.hpp b/src/Main/FrameBufferAndroid.hpp
deleted file mode 100644
index 1b76d2d0e..000000000
--- a/src/Main/FrameBufferAndroid.hpp
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferAndroid_hpp
-#define sw_FrameBufferAndroid_hpp
-
-#include <cutils/native_handle.h>
-
-#include "Main/FrameBuffer.hpp"
-#include "Common/Debug.hpp"
-
-struct ANativeWindow;
-struct ANativeWindowBuffer;
-
-namespace sw
-{
- class FrameBufferAndroid : public FrameBuffer
- {
- public:
- FrameBufferAndroid(ANativeWindow *window, int width, int height);
-
- ~FrameBufferAndroid() override;
-
- void flip(sw::Surface *source) override {blit(source, nullptr, nullptr);}
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- bool setSwapRectangle(int l, int t, int w, int h);
-
- private:
- ANativeWindow *nativeWindow;
- ANativeWindowBuffer *buffer;
- buffer_handle_t bufferImportedHandle;
- };
-}
-
-#endif // sw_FrameBufferAndroid
diff --git a/src/Main/FrameBufferDD.cpp b/src/Main/FrameBufferDD.cpp
deleted file mode 100644
index 46ed89f47..000000000
--- a/src/Main/FrameBufferDD.cpp
+++ /dev/null
@@ -1,510 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferDD.hpp"
-
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- extern bool forceWindowed;
-
- GUID secondaryDisplay = {0};
-
- int __stdcall enumDisplayCallback(GUID* guid, char *driverDescription, char *driverName, void *context, HMONITOR monitor)
- {
- if(strcmp(driverName, "\\\\.\\DISPLAY2") == 0)
- {
- secondaryDisplay = *guid;
- }
-
- return 1;
- }
-
- FrameBufferDD::FrameBufferDD(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin) : FrameBufferWin(windowHandle, width, height, fullscreen, topLeftOrigin)
- {
- directDraw = 0;
- frontBuffer = 0;
- backBuffer = 0;
-
- framebuffer = nullptr;
-
- ddraw = LoadLibrary("ddraw.dll");
- DirectDrawCreate = (DIRECTDRAWCREATE)GetProcAddress(ddraw, "DirectDrawCreate");
- DirectDrawEnumerateExA = (DIRECTDRAWENUMERATEEXA)GetProcAddress(ddraw, "DirectDrawEnumerateExA");
-
- if(!windowed)
- {
- initFullscreen();
- }
- else
- {
- initWindowed();
- }
- }
-
- FrameBufferDD::~FrameBufferDD()
- {
- releaseAll();
-
- FreeLibrary(ddraw);
- }
-
- void FrameBufferDD::createSurfaces()
- {
- if(backBuffer)
- {
- backBuffer->Release();
- backBuffer = 0;
- }
-
- if(frontBuffer)
- {
- frontBuffer->Release();
- frontBuffer = 0;
- }
-
- if(!windowed)
- {
- DDSURFACEDESC surfaceDescription = {0};
- surfaceDescription.dwSize = sizeof(surfaceDescription);
- surfaceDescription.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT;
- surfaceDescription.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP | DDSCAPS_COMPLEX;
- surfaceDescription.dwBackBufferCount = 1;
- directDraw->CreateSurface(&surfaceDescription, &frontBuffer, 0);
-
- if(frontBuffer)
- {
- DDSCAPS surfaceCapabilties = {0};
- surfaceCapabilties.dwCaps = DDSCAPS_BACKBUFFER;
- frontBuffer->GetAttachedSurface(&surfaceCapabilties, &backBuffer);
- backBuffer->AddRef();
- }
- }
- else
- {
- IDirectDrawClipper *clipper;
-
- DDSURFACEDESC ddsd = {0};
- ddsd.dwSize = sizeof(ddsd);
- ddsd.dwFlags = DDSD_CAPS;
- ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE;
-
- long result = directDraw->CreateSurface(&ddsd, &frontBuffer, 0);
- directDraw->GetDisplayMode(&ddsd);
-
- switch(ddsd.ddpfPixelFormat.dwRGBBitCount)
- {
- case 32: format = FORMAT_X8R8G8B8; break;
- case 24: format = FORMAT_R8G8B8; break;
- case 16: format = FORMAT_R5G6B5; break;
- default: format = FORMAT_NULL; break;
- }
-
- if((result != DD_OK && result != DDERR_PRIMARYSURFACEALREADYEXISTS) || (format == FORMAT_NULL))
- {
- assert(!"Failed to initialize graphics: Incompatible display mode.");
- }
- else
- {
- ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT;
- ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN;
- ddsd.dwWidth = width;
- ddsd.dwHeight = height;
-
- directDraw->CreateSurface(&ddsd, &backBuffer, 0);
-
- directDraw->CreateClipper(0, &clipper, 0);
- clipper->SetHWnd(0, windowHandle);
- frontBuffer->SetClipper(clipper);
- clipper->Release();
- }
- }
- }
-
- bool FrameBufferDD::readySurfaces()
- {
- if(!frontBuffer || !backBuffer)
- {
- createSurfaces();
- }
-
- if(frontBuffer && backBuffer)
- {
- if(frontBuffer->IsLost() || backBuffer->IsLost())
- {
- restoreSurfaces();
- }
-
- if(frontBuffer && backBuffer)
- {
- if(!frontBuffer->IsLost() && !backBuffer->IsLost())
- {
- return true;
- }
- }
- }
-
- return false;
- }
-
- void FrameBufferDD::updateClipper(HWND windowOverride)
- {
- if(windowed)
- {
- if(frontBuffer)
- {
- HWND window = windowOverride ? windowOverride : windowHandle;
-
- IDirectDrawClipper *clipper;
- frontBuffer->GetClipper(&clipper);
- clipper->SetHWnd(0, window);
- clipper->Release();
- }
- }
- }
-
- void FrameBufferDD::restoreSurfaces()
- {
- long result1 = frontBuffer->Restore();
- long result2 = backBuffer->Restore();
-
- if(result1 != DD_OK || result2 != DD_OK) // Surfaces could not be restored; recreate them
- {
- createSurfaces();
- }
- }
-
- void FrameBufferDD::initFullscreen()
- {
- releaseAll();
-
- if(true) // Render to primary display
- {
- DirectDrawCreate(0, &directDraw, 0);
- }
- else // Render to secondary display
- {
- DirectDrawEnumerateEx(&enumDisplayCallback, 0, DDENUM_ATTACHEDSECONDARYDEVICES);
- DirectDrawCreate(&secondaryDisplay, &directDraw, 0);
- }
-
- directDraw->SetCooperativeLevel(windowHandle, DDSCL_EXCLUSIVE | DDSCL_FULLSCREEN);
-
- long result;
-
- do
- {
- format = FORMAT_X8R8G8B8;
- result = directDraw->SetDisplayMode(width, height, 32);
-
- if(result == DDERR_INVALIDMODE)
- {
- format = FORMAT_R8G8B8;
- result = directDraw->SetDisplayMode(width, height, 24);
-
- if(result == DDERR_INVALIDMODE)
- {
- format = FORMAT_R5G6B5;
- result = directDraw->SetDisplayMode(width, height, 16);
-
- if(result == DDERR_INVALIDMODE)
- {
- assert(!"Failed to initialize graphics: Display mode not supported.");
- }
- }
- }
-
- if(result != DD_OK)
- {
- Sleep(1);
- }
- }
- while(result != DD_OK);
-
- createSurfaces();
-
- updateBounds(windowHandle);
- }
-
- void FrameBufferDD::initWindowed()
- {
- releaseAll();
-
- DirectDrawCreate(0, &directDraw, 0);
- directDraw->SetCooperativeLevel(windowHandle, DDSCL_NORMAL);
-
- createSurfaces();
-
- updateBounds(windowHandle);
- }
-
- void FrameBufferDD::flip(sw::Surface *source)
- {
- copy(source);
-
- if(!readySurfaces())
- {
- return;
- }
-
- while(true)
- {
- long result;
-
- if(windowed)
- {
- result = frontBuffer->Blt(&bounds, backBuffer, 0, DDBLT_WAIT, 0);
- }
- else
- {
- result = frontBuffer->Flip(0, DDFLIP_NOVSYNC);
- }
-
- if(result != DDERR_WASSTILLDRAWING)
- {
- break;
- }
-
- Sleep(0);
- }
- }
-
- void FrameBufferDD::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
-
- if(!readySurfaces())
- {
- return;
- }
-
- RECT dRect;
-
- if(destRect)
- {
- dRect.bottom = bounds.top + destRect->y1;
- dRect.left = bounds.left + destRect->x0;
- dRect.right = bounds.left + destRect->x1;
- dRect.top = bounds.top + destRect->y0;
- }
- else
- {
- dRect.bottom = bounds.top + height;
- dRect.left = bounds.left + 0;
- dRect.right = bounds.left + width;
- dRect.top = bounds.top + 0;
- }
-
- while(true)
- {
- long result = frontBuffer->Blt(&dRect, backBuffer, (LPRECT)sourceRect, DDBLT_WAIT, 0);
-
- if(result != DDERR_WASSTILLDRAWING)
- {
- break;
- }
-
- Sleep(0);
- }
- }
-
- void FrameBufferDD::flip(HWND windowOverride, sw::Surface *source)
- {
- updateClipper(windowOverride);
- updateBounds(windowOverride);
-
- flip(source);
- }
-
- void FrameBufferDD::blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- updateClipper(windowOverride);
- updateBounds(windowOverride);
-
- blit(source, sourceRect, destRect);
- }
-
- void FrameBufferDD::screenshot(void *destBuffer)
- {
- if(!readySurfaces())
- {
- return;
- }
-
- DDSURFACEDESC DDSD;
- DDSD.dwSize = sizeof(DDSD);
-
- long result = frontBuffer->Lock(0, &DDSD, DDLOCK_WAIT, 0);
-
- if(result == DD_OK)
- {
- int width = DDSD.dwWidth;
- int height = DDSD.dwHeight;
- int stride = DDSD.lPitch;
-
- void *sourceBuffer = DDSD.lpSurface;
-
- for(int y = 0; y < height; y++)
- {
- memcpy(destBuffer, sourceBuffer, width * 4); // FIXME: Assumes 32-bit buffer
-
- (char*&)sourceBuffer += stride;
- (char*&)destBuffer += 4 * width;
- }
-
- frontBuffer->Unlock(0);
- }
- }
-
- void FrameBufferDD::setGammaRamp(GammaRamp *gammaRamp, bool calibrate)
- {
- IDirectDrawGammaControl *gammaControl = 0;
-
- if(frontBuffer)
- {
- frontBuffer->QueryInterface(IID_IDirectDrawGammaControl, (void**)&gammaControl);
-
- if(gammaControl)
- {
- gammaControl->SetGammaRamp(calibrate ? DDSGR_CALIBRATE : 0, (DDGAMMARAMP*)gammaRamp);
-
- gammaControl->Release();
- }
- }
- }
-
- void FrameBufferDD::getGammaRamp(GammaRamp *gammaRamp)
- {
- IDirectDrawGammaControl *gammaControl = 0;
-
- if(frontBuffer)
- {
- frontBuffer->QueryInterface(IID_IDirectDrawGammaControl, (void**)&gammaControl);
-
- if(gammaControl)
- {
- gammaControl->GetGammaRamp(0, (DDGAMMARAMP*)gammaRamp);
-
- gammaControl->Release();
- }
- }
- }
-
- void *FrameBufferDD::lock()
- {
- if(framebuffer)
- {
- return framebuffer;
- }
-
- if(!readySurfaces())
- {
- return nullptr;
- }
-
- DDSURFACEDESC DDSD;
- DDSD.dwSize = sizeof(DDSD);
-
- long result = backBuffer->Lock(0, &DDSD, DDLOCK_WAIT, 0);
-
- if(result == DD_OK)
- {
- width = DDSD.dwWidth;
- height = DDSD.dwHeight;
- stride = DDSD.lPitch;
-
- framebuffer = DDSD.lpSurface;
-
- return framebuffer;
- }
-
- return nullptr;
- }
-
- void FrameBufferDD::unlock()
- {
- if(!framebuffer || !backBuffer) return;
-
- backBuffer->Unlock(0);
-
- framebuffer = nullptr;
- }
-
- void FrameBufferDD::drawText(int x, int y, const char *string, ...)
- {
- char buffer[256];
- va_list arglist;
-
- va_start(arglist, string);
- vsprintf(buffer, string, arglist);
- va_end(arglist);
-
- HDC hdc;
-
- backBuffer->GetDC(&hdc);
-
- SetBkColor(hdc, RGB(0, 0, 255));
- SetTextColor(hdc, RGB(255, 255, 255));
-
- TextOut(hdc, x, y, buffer, lstrlen(buffer));
-
- backBuffer->ReleaseDC(hdc);
- }
-
- bool FrameBufferDD::getScanline(bool &inVerticalBlank, unsigned int &scanline)
- {
- HRESULT result = directDraw->GetScanLine((unsigned long*)&scanline);
-
- if(result == DD_OK)
- {
- inVerticalBlank = false;
- }
- else if(result == DDERR_VERTICALBLANKINPROGRESS)
- {
- inVerticalBlank = true;
- }
- else if(result == DDERR_UNSUPPORTED)
- {
- return false;
- }
- else ASSERT(false);
-
- return true;
- }
-
- void FrameBufferDD::releaseAll()
- {
- unlock();
-
- if(backBuffer)
- {
- backBuffer->Release();
- backBuffer = 0;
- }
-
- if(frontBuffer)
- {
- frontBuffer->Release();
- frontBuffer = 0;
- }
-
- if(directDraw)
- {
- directDraw->SetCooperativeLevel(0, DDSCL_NORMAL);
- directDraw->Release();
- directDraw = 0;
- }
- }
-}
diff --git a/src/Main/FrameBufferDD.hpp b/src/Main/FrameBufferDD.hpp
deleted file mode 100644
index 22d76c950..000000000
--- a/src/Main/FrameBufferDD.hpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferDD_hpp
-#define sw_FrameBufferDD_hpp
-
-#include "FrameBufferWin.hpp"
-
-#include <ddraw.h>
-
-namespace sw
-{
- class FrameBufferDD : public FrameBufferWin
- {
- public:
- FrameBufferDD(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
-
- ~FrameBufferDD() override;
-
- void flip(sw::Surface *source) override;
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void flip(HWND windowOverride, sw::Surface *source) override;
- void blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- void setGammaRamp(GammaRamp *gammaRamp, bool calibrate) override;
- void getGammaRamp(GammaRamp *gammaRamp) override;
-
- void screenshot(void *destBuffer) override;
- bool getScanline(bool &inVerticalBlank, unsigned int &scanline) override;
-
- void drawText(int x, int y, const char *string, ...);
-
- private:
- void initFullscreen();
- void initWindowed();
- void createSurfaces();
- bool readySurfaces();
- void updateClipper(HWND windowOverride);
- void restoreSurfaces();
- void releaseAll();
-
- HMODULE ddraw;
- typedef HRESULT (WINAPI *DIRECTDRAWCREATE)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
- HRESULT (WINAPI *DirectDrawCreate)( GUID FAR *lpGUID, LPDIRECTDRAW FAR *lplpDD, IUnknown FAR *pUnkOuter );
- typedef HRESULT (WINAPI *DIRECTDRAWENUMERATEEXA)( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags);
- HRESULT (WINAPI *DirectDrawEnumerateExA)( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags);
-
- IDirectDraw *directDraw;
- IDirectDrawSurface *frontBuffer;
- IDirectDrawSurface *backBuffer;
- };
-}
-
-#endif // sw_FrameBufferDD_hpp
diff --git a/src/Main/FrameBufferFactoryOzone.cpp b/src/Main/FrameBufferFactoryOzone.cpp
deleted file mode 100644
index 30b193667..000000000
--- a/src/Main/FrameBufferFactoryOzone.cpp
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2020 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Main/FrameBuffer.hpp"
-
-#include "Main/FrameBufferOzone.hpp"
-
-#if defined(SWIFTSHADER_USE_X11)
-#include "libX11.hpp"
-#include "Main/FrameBufferX11.hpp"
-#endif
-
-NO_SANITIZE_FUNCTION sw::FrameBuffer *createFrameBuffer(void *display, intptr_t window, int width, int height)
-{
-#if defined(SWIFTSHADER_USE_X11)
- if(reinterpret_cast<::Display *>(display))
- {
- return new sw::FrameBufferX11((::Display *)display, window, width, height);
- }
-#endif
- return new sw::FrameBufferOzone((intptr_t)display, window, width, height);
-}
diff --git a/src/Main/FrameBufferGDI.cpp b/src/Main/FrameBufferGDI.cpp
deleted file mode 100644
index 90a469e66..000000000
--- a/src/Main/FrameBufferGDI.cpp
+++ /dev/null
@@ -1,162 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferGDI.hpp"
-
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- extern bool forceWindowed;
-
- FrameBufferGDI::FrameBufferGDI(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin) : FrameBufferWin(windowHandle, width, height, fullscreen, topLeftOrigin)
- {
- if(!windowed)
- {
- SetWindowPos(windowHandle, HWND_TOPMOST, 0, 0, width, height, SWP_SHOWWINDOW);
-
- DEVMODE deviceMode;
- deviceMode.dmSize = sizeof(DEVMODE);
- deviceMode.dmPelsWidth= width;
- deviceMode.dmPelsHeight = height;
- deviceMode.dmFields = DM_PELSWIDTH | DM_PELSHEIGHT;
-
- ChangeDisplaySettings(&deviceMode, CDS_FULLSCREEN);
- }
-
- init(this->windowHandle);
-
- format = FORMAT_X8R8G8B8;
- }
-
- FrameBufferGDI::~FrameBufferGDI()
- {
- release();
-
- if(!windowed)
- {
- ChangeDisplaySettings(0, 0);
-
- RECT clientRect;
- RECT windowRect;
- GetClientRect(windowHandle, &clientRect);
- GetWindowRect(windowHandle, &windowRect);
- int windowWidth = width + (windowRect.right - windowRect.left) - (clientRect.right - clientRect.left);
- int windowHeight = height + (windowRect.bottom - windowRect.top) - (clientRect.bottom - clientRect.top);
- int desktopWidth = GetSystemMetrics(SM_CXSCREEN);
- int desktopHeight = GetSystemMetrics(SM_CYSCREEN);
- SetWindowPos(windowHandle, HWND_TOP, desktopWidth / 2 - windowWidth / 2, desktopHeight / 2 - windowHeight / 2, windowWidth, windowHeight, SWP_SHOWWINDOW);
- }
- }
-
- void *FrameBufferGDI::lock()
- {
- stride = width * 4;
-
- return framebuffer;
- }
-
- void FrameBufferGDI::unlock()
- {
- }
-
- void FrameBufferGDI::flip(sw::Surface *source)
- {
- blit(source, nullptr, nullptr);
- }
-
- void FrameBufferGDI::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
-
- int sourceLeft = sourceRect ? sourceRect->x0 : 0;
- int sourceTop = sourceRect ? sourceRect->y0 : 0;
- int sourceWidth = sourceRect ? sourceRect->x1 - sourceRect->x0 : width;
- int sourceHeight = sourceRect ? sourceRect->y1 - sourceRect->y0 : height;
- int destLeft = destRect ? destRect->x0 : 0;
- int destTop = destRect ? destRect->y0 : 0;
- int destWidth = destRect ? destRect->x1 - destRect->x0 : bounds.right - bounds.left;
- int destHeight = destRect ? destRect->y1 - destRect->y0 : bounds.bottom - bounds.top;
-
- StretchBlt(windowContext, destLeft, destTop, destWidth, destHeight, bitmapContext, sourceLeft, sourceTop, sourceWidth, sourceHeight, SRCCOPY);
- }
-
- void FrameBufferGDI::flip(HWND windowOverride, sw::Surface *source)
- {
- blit(windowOverride, source, nullptr, nullptr);
- }
-
- void FrameBufferGDI::blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- if(windowed && windowOverride != 0 && windowOverride != bitmapWindow)
- {
- release();
- init(windowOverride);
- }
-
- blit(source, sourceRect, destRect);
- }
-
- void FrameBufferGDI::setGammaRamp(GammaRamp *gammaRamp, bool calibrate)
- {
- SetDeviceGammaRamp(windowContext, gammaRamp);
- }
-
- void FrameBufferGDI::getGammaRamp(GammaRamp *gammaRamp)
- {
- GetDeviceGammaRamp(windowContext, gammaRamp);
- }
-
- void FrameBufferGDI::screenshot(void *destBuffer)
- {
- UNIMPLEMENTED();
- }
-
- bool FrameBufferGDI::getScanline(bool &inVerticalBlank, unsigned int &scanline)
- {
- UNIMPLEMENTED();
-
- return false;
- }
-
- void FrameBufferGDI::init(HWND window)
- {
- bitmapWindow = window;
-
- windowContext = GetDC(window);
- bitmapContext = CreateCompatibleDC(windowContext);
-
- BITMAPINFO bitmapInfo;
- memset(&bitmapInfo, 0, sizeof(BITMAPINFO));
- bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFO);
- bitmapInfo.bmiHeader.biBitCount = 32;
- bitmapInfo.bmiHeader.biPlanes = 1;
- bitmapInfo.bmiHeader.biHeight = -height;
- bitmapInfo.bmiHeader.biWidth = width;
- bitmapInfo.bmiHeader.biCompression = BI_RGB;
-
- bitmap = CreateDIBSection(bitmapContext, &bitmapInfo, DIB_RGB_COLORS, &framebuffer, 0, 0);
- SelectObject(bitmapContext, bitmap);
-
- updateBounds(window);
- }
-
- void FrameBufferGDI::release()
- {
- SelectObject(bitmapContext, 0);
- DeleteObject(bitmap);
- ReleaseDC(bitmapWindow, windowContext);
- DeleteDC(bitmapContext);
- }
-}
diff --git a/src/Main/FrameBufferGDI.hpp b/src/Main/FrameBufferGDI.hpp
deleted file mode 100644
index add25045a..000000000
--- a/src/Main/FrameBufferGDI.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferGDI_hpp
-#define sw_FrameBufferGDI_hpp
-
-#include "FrameBufferWin.hpp"
-
-namespace sw
-{
- class FrameBufferGDI : public FrameBufferWin
- {
- public:
- FrameBufferGDI(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
-
- ~FrameBufferGDI() override;
-
- void flip(sw::Surface *source) override;
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void flip(HWND windowOverride, sw::Surface *source) override;
- void blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- void setGammaRamp(GammaRamp *gammaRamp, bool calibrate) override;
- void getGammaRamp(GammaRamp *gammaRamp) override;
-
- void screenshot(void *destBuffer) override;
- bool getScanline(bool &inVerticalBlank, unsigned int &scanline) override;
-
- private:
- void init(HWND bitmapWindow);
- void release();
-
- HDC windowContext;
- HDC bitmapContext;
- HWND bitmapWindow;
-
- HBITMAP bitmap;
- };
-}
-
-#endif // sw_FrameBufferGDI_hpp
diff --git a/src/Main/FrameBufferOSX.hpp b/src/Main/FrameBufferOSX.hpp
deleted file mode 100644
index 07f8d6330..000000000
--- a/src/Main/FrameBufferOSX.hpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferOSX_hpp
-#define sw_FrameBufferOSX_hpp
-
-#include "Main/FrameBuffer.hpp"
-
-#import <Cocoa/Cocoa.h>
-
-@class CALayer;
-
-namespace sw
-{
- class FrameBufferOSX : public FrameBuffer
- {
- public:
- FrameBufferOSX(CALayer *layer, int width, int height);
- ~FrameBufferOSX() override;
-
- void flip(sw::Surface *source) override;
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- private:
- int width;
- int height;
- CALayer *layer;
- uint8_t *buffer;
- CGDataProviderRef provider;
- CGColorSpaceRef colorspace;
- CGImageRef currentImage;
- };
-}
-
-#endif // sw_FrameBufferOSX
diff --git a/src/Main/FrameBufferOSX.mm b/src/Main/FrameBufferOSX.mm
deleted file mode 100644
index 9c2c9666c..000000000
--- a/src/Main/FrameBufferOSX.mm
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferOSX.hpp"
-
-#include "Common/Debug.hpp"
-
-#include <EGL/egl.h>
-#import <QuartzCore/QuartzCore.h>
-
-namespace sw {
-
- FrameBufferOSX::FrameBufferOSX(CALayer* layer, int width, int height)
- : FrameBuffer(width, height, false, false), width(width), height(height),
- layer(layer), buffer(nullptr), provider(nullptr), currentImage(nullptr)
- {
- format = sw::FORMAT_X8B8G8R8;
- int bufferSize = width * height * 4 * sizeof(uint8_t);
- buffer = new uint8_t[bufferSize];
- provider = CGDataProviderCreateWithData(nullptr, buffer, bufferSize, nullptr);
- colorspace = CGColorSpaceCreateDeviceRGB();
- }
-
- FrameBufferOSX::~FrameBufferOSX()
- {
- //[CATransaction begin];
- //[layer setContents:nullptr];
- //[CATransaction commit];
-
- CGImageRelease(currentImage);
- CGColorSpaceRelease(colorspace);
- CGDataProviderRelease(provider);
-
- delete[] buffer;
- }
-
- void FrameBufferOSX::flip(sw::Surface *source)
- {
- blit(source, nullptr, nullptr);
- }
-
- void FrameBufferOSX::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
-
- int bytesPerRow = width * 4 * sizeof(uint8_t);
- CGImageRef image = CGImageCreate(width, height, 8, 32, bytesPerRow, colorspace, kCGBitmapByteOrder32Big, provider, nullptr, false, kCGRenderingIntentDefault);
-
- [CATransaction begin];
- [layer setContents:(id)image];
- [CATransaction commit];
- [CATransaction flush];
-
- if(currentImage)
- {
- CGImageRelease(currentImage);
- }
- currentImage = image;
- }
-
- void *FrameBufferOSX::lock()
- {
- stride = width * 4 * sizeof(uint8_t);
- framebuffer = buffer;
- return framebuffer;
- }
-
- void FrameBufferOSX::unlock()
- {
- framebuffer = nullptr;
- }
-}
-
-sw::FrameBuffer *createFrameBuffer(void *display, EGLNativeWindowType nativeWindow, int width, int height)
-{
- NSObject *window = reinterpret_cast<NSObject*>(nativeWindow);
- CALayer *layer = nullptr;
-
- if([window isKindOfClass:[NSView class]])
- {
- NSView *view = reinterpret_cast<NSView*>(window);
- [view setWantsLayer:YES];
- layer = [view layer];
- }
- else if([window isKindOfClass:[CALayer class]])
- {
- layer = reinterpret_cast<CALayer*>(window);
- }
- else ASSERT(0);
-
- return new sw::FrameBufferOSX(layer, width, height);
-}
diff --git a/src/Main/FrameBufferOzone.cpp b/src/Main/FrameBufferOzone.cpp
deleted file mode 100644
index db00adf50..000000000
--- a/src/Main/FrameBufferOzone.cpp
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferOzone.hpp"
-
-namespace sw
-{
- FrameBufferOzone::FrameBufferOzone(intptr_t display, intptr_t window, int width, int height) : FrameBuffer(width, height, false, false)
- {
- buffer = sw::Surface::create(width, height, 1, format, nullptr,
- sw::Surface::pitchB(width, 0, format, true),
- sw::Surface::sliceB(width, height, 0, format, true));
- }
-
- FrameBufferOzone::~FrameBufferOzone()
- {
- delete buffer;
- }
-
- void *FrameBufferOzone::lock()
- {
- framebuffer = buffer->lockInternal(0, 0, 0, sw::LOCK_READWRITE, sw::PUBLIC);
-
- return framebuffer;
- }
-
- void FrameBufferOzone::unlock()
- {
- buffer->unlockInternal();
-
- framebuffer = nullptr;
- }
-
- void FrameBufferOzone::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
- }
-}
diff --git a/src/Main/FrameBufferOzone.hpp b/src/Main/FrameBufferOzone.hpp
deleted file mode 100644
index 0dc9f6048..000000000
--- a/src/Main/FrameBufferOzone.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferOzone_hpp
-#define sw_FrameBufferOzone_hpp
-
-#include "Main/FrameBuffer.hpp"
-
-namespace sw
-{
- class FrameBufferOzone : public FrameBuffer
- {
- public:
- FrameBufferOzone(intptr_t display, intptr_t window, int width, int height);
-
- ~FrameBufferOzone() override;
-
- void flip(sw::Surface *source) override {blit(source, nullptr, nullptr);};
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- private:
- sw::Surface* buffer;
- };
-}
-
-#endif // sw_FrameBufferOzone_hpp
diff --git a/src/Main/FrameBufferWin.cpp b/src/Main/FrameBufferWin.cpp
deleted file mode 100644
index cad8954cb..000000000
--- a/src/Main/FrameBufferWin.cpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferWin.hpp"
-
-namespace sw
-{
- FrameBufferWin::FrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin) : FrameBuffer(width, height, fullscreen, topLeftOrigin), windowHandle(windowHandle)
- {
- if(!windowed)
- {
- // Force fullscreen window style (no borders)
- originalWindowStyle = GetWindowLong(windowHandle, GWL_STYLE);
- SetWindowLong(windowHandle, GWL_STYLE, WS_POPUP);
- }
- }
-
- FrameBufferWin::~FrameBufferWin()
- {
- if(!windowed && GetWindowLong(windowHandle, GWL_STYLE) == WS_POPUP)
- {
- SetWindowLong(windowHandle, GWL_STYLE, originalWindowStyle);
- }
- }
-
- void FrameBufferWin::updateBounds(HWND windowOverride)
- {
- HWND window = windowOverride ? windowOverride : windowHandle;
-
- if(windowed)
- {
- GetClientRect(window, &bounds);
- ClientToScreen(window, (POINT*)&bounds);
- ClientToScreen(window, (POINT*)&bounds + 1);
- }
- else
- {
- SetRect(&bounds, 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN));
- }
- }
-}
-
-#include "FrameBufferDD.hpp"
-#include "FrameBufferGDI.hpp"
-#include "Common/Configurator.hpp"
-
-sw::FrameBufferWin *createFrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin)
-{
- sw::Configurator ini("SwiftShader.ini");
- int api = ini.getInteger("Testing", "FrameBufferAPI", 0);
-
- if(api == 0 && topLeftOrigin)
- {
- return new sw::FrameBufferDD(windowHandle, width, height, fullscreen, topLeftOrigin);
- }
- else
- {
- return new sw::FrameBufferGDI(windowHandle, width, height, fullscreen, topLeftOrigin);
- }
-
- return 0;
-}
-
-sw::FrameBuffer *createFrameBuffer(void *display, HWND window, int width, int height)
-{
- return createFrameBufferWin(window, width, height, false, false);
-}
diff --git a/src/Main/FrameBufferWin.hpp b/src/Main/FrameBufferWin.hpp
deleted file mode 100644
index 15c1e0e54..000000000
--- a/src/Main/FrameBufferWin.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferWin_hpp
-#define sw_FrameBufferWin_hpp
-
-#include "FrameBuffer.hpp"
-
-namespace sw
-{
- struct GammaRamp
- {
- short red[256];
- short green[256];
- short blue[256];
- };
-
- class FrameBufferWin : public FrameBuffer
- {
- public:
- FrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
-
- ~FrameBufferWin() override;
-
- void flip(sw::Surface *source) override = 0;
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override = 0;
-
- virtual void flip(HWND windowOverride, sw::Surface *source) = 0;
- virtual void blit(HWND windowOverride, sw::Surface *source, const Rect *sourceRect, const Rect *destRect) = 0;
-
- virtual void setGammaRamp(GammaRamp *gammaRamp, bool calibrate) = 0;
- virtual void getGammaRamp(GammaRamp *gammaRamp) = 0;
-
- virtual void screenshot(void *destBuffer) = 0;
- virtual bool getScanline(bool &inVerticalBlank, unsigned int &scanline) = 0;
-
- protected:
- void updateBounds(HWND windowOverride);
-
- HWND windowHandle;
- DWORD originalWindowStyle;
- RECT bounds;
- };
-}
-
-sw::FrameBufferWin *createFrameBufferWin(HWND windowHandle, int width, int height, bool fullscreen, bool topLeftOrigin);
-
-#endif // sw_FrameBufferWin_hpp
diff --git a/src/Main/FrameBufferX11.cpp b/src/Main/FrameBufferX11.cpp
deleted file mode 100644
index fbcd11f38..000000000
--- a/src/Main/FrameBufferX11.cpp
+++ /dev/null
@@ -1,199 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "FrameBufferX11.hpp"
-
-#include "libX11.hpp"
-#include "Common/Timer.hpp"
-
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <string.h>
-#include <assert.h>
-#include <stdlib.h>
-
-namespace sw
-{
- static int (*PreviousXErrorHandler)(Display *display, XErrorEvent *event) = 0;
- static bool shmBadAccess = false;
-
- // Catches BadAcces errors so we can fall back to not using MIT-SHM
- static int XShmErrorHandler(Display *display, XErrorEvent *event)
- {
- if(event->error_code == BadAccess)
- {
- shmBadAccess = true;
- return 0;
- }
- else
- {
- return PreviousXErrorHandler(display, event);
- }
- }
-
- FrameBufferX11::FrameBufferX11(Display *display, Window window, int width, int height) : FrameBuffer(width, height, false, false), ownX11(!display), x_display(display), x_window(window)
- {
- if(!x_display)
- {
- x_display = libX11->XOpenDisplay(0);
- assert(x_display);
- }
-
- XWindowAttributes attribs;
- Status status = libX11->XGetWindowAttributes(display, window, &attribs);
- assert(status != 0);
- int depth = attribs.depth;
- Visual *visual = attribs.visual;
-
- x_gc = libX11->XCreateGC(x_display, window, 0, nullptr);
-
- mit_shm = (libX11->XShmQueryExtension && libX11->XShmQueryExtension(x_display) == True);
- if(mit_shm)
- {
- x_image = libX11->XShmCreateImage(x_display, visual, depth, ZPixmap, 0, &shminfo, width, height);
-
- shminfo.shmid = shmget(IPC_PRIVATE, x_image->bytes_per_line * x_image->height, IPC_CREAT | SHM_R | SHM_W);
- shminfo.shmaddr = x_image->data = (char*)shmat(shminfo.shmid, 0, 0);
- shminfo.readOnly = False;
-
- PreviousXErrorHandler = libX11->XSetErrorHandler(XShmErrorHandler);
- libX11->XShmAttach(x_display, &shminfo); // May produce a BadAccess error
- libX11->XSync(x_display, False);
- libX11->XSetErrorHandler(PreviousXErrorHandler);
-
- if(shmBadAccess)
- {
- mit_shm = false;
-
- XDestroyImage(x_image);
- shmdt(shminfo.shmaddr);
- shmctl(shminfo.shmid, IPC_RMID, 0);
-
- shmBadAccess = false;
- }
- }
-
- if(!mit_shm)
- {
- int bytes_per_line = width * 4;
- int bytes_per_image = height * bytes_per_line;
- char *buffer = (char*)malloc(bytes_per_image);
- memset(buffer, 0, bytes_per_image);
-
- x_image = libX11->XCreateImage(x_display, visual, depth, ZPixmap, 0, buffer, width, height, 32, bytes_per_line);
- assert(x_image);
-
- if(!x_image)
- {
- free(buffer);
- }
- }
- }
-
- FrameBufferX11::~FrameBufferX11()
- {
- if(x_gc)
- {
- libX11->XFreeGC(x_display, x_gc);
- }
-
- if(!mit_shm)
- {
- XDestroyImage(x_image);
- }
- else
- {
- libX11->XShmDetach(x_display, &shminfo);
- XDestroyImage(x_image);
- shmdt(shminfo.shmaddr);
- shmctl(shminfo.shmid, IPC_RMID, 0);
- }
-
- if(ownX11)
- {
- libX11->XCloseDisplay(x_display);
- }
- }
-
- void *FrameBufferX11::lock()
- {
- if(x_image)
- {
- stride = x_image->bytes_per_line;
- framebuffer = x_image->data;
- }
-
- return framebuffer;
- }
-
- void FrameBufferX11::unlock()
- {
- framebuffer = nullptr;
- }
-
- void FrameBufferX11::blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect)
- {
- copy(source);
-
- if(!mit_shm)
- {
- libX11->XPutImage(x_display, x_window, x_gc, x_image, 0, 0, 0, 0, width, height);
- }
- else
- {
- libX11->XShmPutImage(x_display, x_window, x_gc, x_image, 0, 0, 0, 0, width, height, False);
- }
-
- libX11->XSync(x_display, False);
-
- if(false) // Draw the framerate on screen
- {
- static double fpsTime = sw::Timer::seconds();
- static int frames = -1;
-
- double time = sw::Timer::seconds();
- double delta = time - fpsTime;
- frames++;
-
- static double FPS = 0.0;
- static double maxFPS = 0.0;
-
- if(delta > 1.0)
- {
- FPS = frames / delta;
-
- fpsTime = time;
- frames = 0;
-
- if(FPS > maxFPS)
- {
- maxFPS = FPS;
- }
- }
-
- char string[256];
- sprintf(string, "FPS: %.2f (max: %.2f)", FPS, maxFPS);
- libX11->XDrawString(x_display, x_window, x_gc, 50, 50, string, strlen(string));
- }
- }
-}
-
-// Chromium can be built with USE_X11 && USE_OZONE. In case of pure USE_X11 builds, we can use this path.
-// In another case, the decision what framebuffer to create will be done by the FrameBufferFactoryOzone.
-#if !defined(USE_OZONE)
-NO_SANITIZE_FUNCTION sw::FrameBuffer *createFrameBuffer(void *display, Window window, int width, int height)
-{
- return new sw::FrameBufferX11((::Display*)display, window, width, height);
-}
-#endif
diff --git a/src/Main/FrameBufferX11.hpp b/src/Main/FrameBufferX11.hpp
deleted file mode 100644
index dc9633130..000000000
--- a/src/Main/FrameBufferX11.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_FrameBufferX11_hpp
-#define sw_FrameBufferX11_hpp
-
-#include "Main/FrameBuffer.hpp"
-#include "Common/Debug.hpp"
-
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XShm.h>
-
-namespace sw
-{
- class FrameBufferX11 : public FrameBuffer
- {
- public:
- FrameBufferX11(Display *display, Window window, int width, int height);
-
- ~FrameBufferX11() override;
-
- void flip(sw::Surface *source) override { blit(source, nullptr, nullptr); }
- void blit(sw::Surface *source, const Rect *sourceRect, const Rect *destRect) override;
-
- void *lock() override;
- void unlock() override;
-
- private:
- const bool ownX11;
- Display *x_display;
- const Window x_window;
- XImage *x_image = nullptr;
- GC x_gc;
-
- bool mit_shm;
- XShmSegmentInfo shminfo;
- };
-}
-
-#endif // sw_FrameBufferX11_hpp
diff --git a/src/Main/SwiftConfig.cpp b/src/Main/SwiftConfig.cpp
deleted file mode 100644
index 5876054ff..000000000
--- a/src/Main/SwiftConfig.cpp
+++ /dev/null
@@ -1,824 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "SwiftConfig.hpp"
-
-#include "Config.hpp"
-#include "Common/Configurator.hpp"
-#include "Common/Debug.hpp"
-#include "Common/Version.h"
-
-#include <sstream>
-#include <stdio.h>
-#include <time.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <algorithm>
-
-namespace sw
-{
- extern Profiler profiler;
-
- std::string itoa(int number)
- {
- std::stringstream ss;
- ss << number;
- return ss.str();
- }
-
- std::string ftoa(double number)
- {
- std::stringstream ss;
- ss << number;
- return ss.str();
- }
-
- SwiftConfig::SwiftConfig(bool disableServerOverride) : listenSocket(0)
- {
- readConfiguration(disableServerOverride);
-
- if(!disableServerOverride)
- {
- writeConfiguration();
- }
-
- receiveBuffer = 0;
-
- if(!config.disableServer)
- {
- createServer();
- }
- }
-
- SwiftConfig::~SwiftConfig()
- {
- destroyServer();
- }
-
- void SwiftConfig::createServer()
- {
- bufferLength = 16 * 1024;
- receiveBuffer = new char[bufferLength];
-
- Socket::startup();
- listenSocket = new Socket("localhost", "8080");
- listenSocket->listen();
-
- terminate = false;
- serverThread = new Thread(serverRoutine, this);
- }
-
- void SwiftConfig::destroyServer()
- {
- if(receiveBuffer)
- {
- terminate = true;
- serverThread->join();
- delete serverThread;
-
- delete listenSocket;
- listenSocket = 0;
-
- Socket::cleanup();
-
- delete[] receiveBuffer;
- receiveBuffer = 0;
- }
- }
-
- bool SwiftConfig::hasNewConfiguration(bool reset)
- {
- bool value = newConfig;
-
- if(reset)
- {
- newConfig = false;
- }
-
- return value;
- }
-
- void SwiftConfig::getConfiguration(Configuration &configuration)
- {
- criticalSection.lock();
- configuration = config;
- criticalSection.unlock();
- }
-
- void SwiftConfig::serverRoutine(void *parameters)
- {
- SwiftConfig *swiftConfig = (SwiftConfig*)parameters;
-
- swiftConfig->serverLoop();
- }
-
- void SwiftConfig::serverLoop()
- {
- readConfiguration();
-
- while(!terminate)
- {
- if(listenSocket->select(100000))
- {
- Socket *clientSocket = listenSocket->accept();
- int bytesReceived = 1;
-
- while(bytesReceived > 0 && !terminate)
- {
- if(clientSocket->select(10))
- {
- bytesReceived = clientSocket->receive(receiveBuffer, bufferLength);
-
- if(bytesReceived > 0)
- {
- receiveBuffer[bytesReceived] = 0;
-
- respond(clientSocket, receiveBuffer);
- }
- }
- }
-
- delete clientSocket;
- }
- }
- }
-
- bool match(const char **url, const char *string)
- {
- size_t length = strlen(string);
-
- if(strncmp(*url, string, length) == 0)
- {
- *url += length;
-
- return true;
- }
-
- return false;
- }
-
- void SwiftConfig::respond(Socket *clientSocket, const char *request)
- {
- if(match(&request, "GET /"))
- {
- if(match(&request, "swiftshader") || match(&request, "swiftconfig"))
- {
- if(match(&request, " ") || match(&request, "/ "))
- {
- return send(clientSocket, OK, page());
- }
- }
- }
- else if(match(&request, "POST /"))
- {
- if(match(&request, "swiftshader") || match(&request, "swiftconfig"))
- {
- if(match(&request, " ") || match(&request, "/ "))
- {
- criticalSection.lock();
-
- const char *postData = strstr(request, "\r\n\r\n");
- postData = postData ? postData + 4 : 0;
-
- if(postData && strlen(postData) > 0)
- {
- parsePost(postData);
- }
- else // POST data in next packet
- {
- int bytesReceived = clientSocket->receive(receiveBuffer, bufferLength);
-
- if(bytesReceived > 0)
- {
- receiveBuffer[bytesReceived] = 0;
- parsePost(receiveBuffer);
- }
- }
-
- writeConfiguration();
- newConfig = true;
-
- if(config.disableServer)
- {
- destroyServer();
- }
-
- criticalSection.unlock();
-
- return send(clientSocket, OK, page());
- }
- else if(match(&request, "/profile "))
- {
- return send(clientSocket, OK, profile());
- }
- }
- }
-
- return send(clientSocket, NotFound);
- }
-
- std::string SwiftConfig::page()
- {
- std::string html;
-
- const std::string selected = "selected='selected'";
- const std::string checked = "checked='checked'";
- const std::string empty = "";
-
- html += "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01//EN' 'http://www.w3.org/TR/html4/strict.dtd'>\n";
- html += "<html>\n";
- html += "<head>\n";
- html += "<meta http-equiv='content-type' content='text/html; charset=UTF-8'>\n";
- html += "<title>SwiftShader Configuration Panel</title>\n";
- html += "</head>\n";
- html += "<body>\n";
- html += "<script type='text/javascript'>\n";
- html += "request();\n";
- html += "function request()\n";
- html += "{\n";
- html += "var xhr = new XMLHttpRequest();\n";
- html += "xhr.open('POST', '/swiftshader/profile', true);\n";
- html += "xhr.onreadystatechange = function()\n";
- html += "{\n";
- html += "if(xhr.readyState == 4 && xhr.status == 200)\n";
- html += "{\n";
- html += "document.getElementById('profile').innerHTML = xhr.responseText;\n";
- html += "setTimeout('request()', 1000);\n";
- html += "}\n";
- html += "}\n";
- html += "xhr.send();\n";
- html += "}\n";
- html += "</script>\n";
- html += "<form method='POST' action=''>\n";
- html += "<h1>SwiftShader Configuration Panel</h1>\n";
- html += "<div id='profile'>" + profile() + "</div>\n";
- html += "<hr><p>\n";
- html += "<input type='submit' value='Apply changes' title='Click to apply all settings.'>\n";
- // html += "<input type='reset' value='Reset changes' title='Click to reset your changes to the previous value.'>\n";
- html += "</p><hr>\n";
- html += "<h2><em>Device capabilities</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Build revision:</td><td>" REVISION_STRING "</td></tr>\n";
- html += "<tr><td>Pixel shader model:</td><td><select name='pixelShaderVersion' title='The highest version of pixel shader supported by SwiftShader. Lower versions might be faster if supported by the application. Only effective after restarting the application.'>\n";
- html += "<option value='0'" + (config.pixelShaderVersion == 0 ? selected : empty) + ">0.0</option>\n";
- html += "<option value='11'" + (config.pixelShaderVersion == 11 ? selected : empty) + ">1.1</option>\n";
- html += "<option value='12'" + (config.pixelShaderVersion == 12 ? selected : empty) + ">1.2</option>\n";
- html += "<option value='13'" + (config.pixelShaderVersion == 13 ? selected : empty) + ">1.3</option>\n";
- html += "<option value='14'" + (config.pixelShaderVersion == 14 ? selected : empty) + ">1.4</option>\n";
- html += "<option value='20'" + (config.pixelShaderVersion == 20 ? selected : empty) + ">2.0</option>\n";
- html += "<option value='21'" + (config.pixelShaderVersion == 21 ? selected : empty) + ">2.x</option>\n";
- html += "<option value='30'" + (config.pixelShaderVersion == 30 ? selected : empty) + ">3.0 (default)</option>\n";
- html += "</select></td></tr>\n";
- html += "<tr><td>Vertex shader model:</td><td><select name='vertexShaderVersion' title='The highest version of vertex shader supported by SwiftShader. Lower versions might be faster if supported by the application. Only effective after restarting the application.'>\n";
- html += "<option value='0'" + (config.vertexShaderVersion == 0 ? selected : empty) + ">0.0</option>\n";
- html += "<option value='11'" + (config.vertexShaderVersion == 11 ? selected : empty) + ">1.1</option>\n";
- html += "<option value='20'" + (config.vertexShaderVersion == 20 ? selected : empty) + ">2.0</option>\n";
- html += "<option value='21'" + (config.vertexShaderVersion == 21 ? selected : empty) + ">2.x</option>\n";
- html += "<option value='30'" + (config.vertexShaderVersion == 30 ? selected : empty) + ">3.0 (default)</option>\n";
- html += "</select></td></tr>\n";
- html += "<tr><td>Texture memory:</td><td><select name='textureMemory' title='The maximum amount of memory used for textures and other resources.'>\n";
- html += "<option value='128'" + (config.textureMemory == 128 ? selected : empty) + ">128 MB</option>\n";
- html += "<option value='256'" + (config.textureMemory == 256 ? selected : empty) + ">256 MB (default)</option>\n";
- html += "<option value='512'" + (config.textureMemory == 512 ? selected : empty) + ">512 MB</option>\n";
- html += "<option value='1024'" + (config.textureMemory == 1024 ? selected : empty) + ">1024 MB</option>\n";
- html += "<option value='2048'" + (config.textureMemory == 2048 ? selected : empty) + ">2048 MB</option>\n";
- html += "</select></td></tr>\n";
- html += "<tr><td>Device identifier:</td><td><select name='identifier' title='The information used by some applications to determine device capabilities.'>\n";
- html += "<option value='0'" + (config.identifier == 0 ? selected : empty) + ">Google SwiftShader (default)</option>\n";
- html += "<option value='1'" + (config.identifier == 1 ? selected : empty) + ">NVIDIA GeForce 7900 GS</option>\n";
- html += "<option value='2'" + (config.identifier == 2 ? selected : empty) + ">ATI Mobility Radeon X1600</option>\n";
- html += "<option value='3'" + (config.identifier == 3 ? selected : empty) + ">Intel GMA X3100</option>\n";
- html += "<option value='4'" + (config.identifier == 4 ? selected : empty) + ">System device</option>\n";
- html += "</select></td></tr>\n";
- html += "</table>\n";
- html += "<h2><em>Cache sizes</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Vertex routine cache size:</td><td><select name='vertexRoutineCacheSize' title='The number of dynamically generated vertex processing routines being cached for reuse. Lower numbers save memory but require more routines to be regenerated.'>\n";
- html += "<option value='64'" + (config.vertexRoutineCacheSize == 64 ? selected : empty) + ">64</option>\n";
- html += "<option value='128'" + (config.vertexRoutineCacheSize == 128 ? selected : empty) + ">128</option>\n";
- html += "<option value='256'" + (config.vertexRoutineCacheSize == 256 ? selected : empty) + ">256</option>\n";
- html += "<option value='512'" + (config.vertexRoutineCacheSize == 512 ? selected : empty) + ">512</option>\n";
- html += "<option value='1024'" + (config.vertexRoutineCacheSize == 1024 ? selected : empty) + ">1024 (default)</option>\n";
- html += "<option value='2048'" + (config.vertexRoutineCacheSize == 2048 ? selected : empty) + ">2048</option>\n";
- html += "<option value='4096'" + (config.vertexRoutineCacheSize == 4096 ? selected : empty) + ">4096</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Pixel routine cache size:</td><td><select name='pixelRoutineCacheSize' title='The number of dynamically generated pixel processing routines being cached for reuse. Lower numbers save memory but require more routines to be regenerated.'>\n";
- html += "<option value='64'" + (config.pixelRoutineCacheSize == 64 ? selected : empty) + ">64</option>\n";
- html += "<option value='128'" + (config.pixelRoutineCacheSize == 128 ? selected : empty) + ">128</option>\n";
- html += "<option value='256'" + (config.pixelRoutineCacheSize == 256 ? selected : empty) + ">256</option>\n";
- html += "<option value='512'" + (config.pixelRoutineCacheSize == 512 ? selected : empty) + ">512</option>\n";
- html += "<option value='1024'" + (config.pixelRoutineCacheSize == 1024 ? selected : empty) + ">1024 (default)</option>\n";
- html += "<option value='2048'" + (config.pixelRoutineCacheSize == 2048 ? selected : empty) + ">2048</option>\n";
- html += "<option value='4096'" + (config.pixelRoutineCacheSize == 4096 ? selected : empty) + ">4096</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Setup routine cache size:</td><td><select name='setupRoutineCacheSize' title='The number of dynamically generated primitive setup routines being cached for reuse. Lower numbers save memory but require more routines to be regenerated.'>\n";
- html += "<option value='64'" + (config.setupRoutineCacheSize == 64 ? selected : empty) + ">64</option>\n";
- html += "<option value='128'" + (config.setupRoutineCacheSize == 128 ? selected : empty) + ">128</option>\n";
- html += "<option value='256'" + (config.setupRoutineCacheSize == 256 ? selected : empty) + ">256</option>\n";
- html += "<option value='512'" + (config.setupRoutineCacheSize == 512 ? selected : empty) + ">512</option>\n";
- html += "<option value='1024'" + (config.setupRoutineCacheSize == 1024 ? selected : empty) + ">1024 (default)</option>\n";
- html += "<option value='2048'" + (config.setupRoutineCacheSize == 2048 ? selected : empty) + ">2048</option>\n";
- html += "<option value='4096'" + (config.setupRoutineCacheSize == 4096 ? selected : empty) + ">4096</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Vertex cache size:</td><td><select name='vertexCacheSize' title='The number of processed vertices being cached for reuse. Lower numbers save memory but require more vertices to be reprocessed.'>\n";
- html += "<option value='64'" + (config.vertexCacheSize == 64 ? selected : empty) + ">64 (default)</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "</table>\n";
- html += "<h2><em>Quality</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Maximum texture sampling quality:</td><td><select name='textureSampleQuality' title='The maximum texture filtering quality. Lower settings can be faster but cause visual artifacts.'>\n";
- html += "<option value='0'" + (config.textureSampleQuality == 0 ? selected : empty) + ">Point</option>\n";
- html += "<option value='1'" + (config.textureSampleQuality == 1 ? selected : empty) + ">Linear</option>\n";
- html += "<option value='2'" + (config.textureSampleQuality == 2 ? selected : empty) + ">Anisotropic (default)</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Maximum mipmapping quality:</td><td><select name='mipmapQuality' title='The maximum mipmap filtering quality. Higher settings can be more visually appealing but are slower.'>\n";
- html += "<option value='0'" + (config.mipmapQuality == 0 ? selected : empty) + ">Point</option>\n";
- html += "<option value='1'" + (config.mipmapQuality == 1 ? selected : empty) + ">Linear (default)</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Perspective correction:</td><td><select name='perspectiveCorrection' title='Enables or disables perspective correction. Disabling it is faster but can causes distortion. Recommended for 2D applications only.'>\n";
- html += "<option value='0'" + (config.perspectiveCorrection == 0 ? selected : empty) + ">Off</option>\n";
- html += "<option value='1'" + (config.perspectiveCorrection == 1 ? selected : empty) + ">On (default)</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Transcendental function precision:</td><td><select name='transcendentalPrecision' title='The precision at which log/exp/pow/rcp/rsq/nrm shader instructions are computed. Lower settings can be faster but cause visual artifacts.'>\n";
- html += "<option value='0'" + (config.transcendentalPrecision == 0 ? selected : empty) + ">Approximate</option>\n";
- html += "<option value='1'" + (config.transcendentalPrecision == 1 ? selected : empty) + ">Partial</option>\n";
- html += "<option value='2'" + (config.transcendentalPrecision == 2 ? selected : empty) + ">Accurate (default)</option>\n";
- html += "<option value='3'" + (config.transcendentalPrecision == 3 ? selected : empty) + ">WHQL</option>\n";
- html += "<option value='4'" + (config.transcendentalPrecision == 4 ? selected : empty) + ">IEEE</option>\n";
- html += "</select></td>\n";
- html += "</tr>\n";
- html += "<tr><td>Transparency anti-aliasing:</td><td><select name='transparencyAntialiasing' title='The technique used to anti-alias alpha-tested transparent textures.'>\n";
- html += "<option value='0'" + (config.transparencyAntialiasing == 0 ? selected : empty) + ">None (default)</option>\n";
- html += "<option value='1'" + (config.transparencyAntialiasing == 1 ? selected : empty) + ">Alpha-to-Coverage</option>\n";
- html += "</select></td>\n";
- html += "</table>\n";
- html += "<h2><em>Processor settings</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Number of threads:</td><td><select name='threadCount' title='The number of rendering threads to be used.'>\n";
- html += "<option value='-1'" + (config.threadCount == -1 ? selected : empty) + ">Core count</option>\n";
- html += "<option value='0'" + (config.threadCount == 0 ? selected : empty) + ">Process affinity (default)</option>\n";
- html += "<option value='1'" + (config.threadCount == 1 ? selected : empty) + ">1</option>\n";
- html += "<option value='2'" + (config.threadCount == 2 ? selected : empty) + ">2</option>\n";
- html += "<option value='3'" + (config.threadCount == 3 ? selected : empty) + ">3</option>\n";
- html += "<option value='4'" + (config.threadCount == 4 ? selected : empty) + ">4</option>\n";
- html += "<option value='5'" + (config.threadCount == 5 ? selected : empty) + ">5</option>\n";
- html += "<option value='6'" + (config.threadCount == 6 ? selected : empty) + ">6</option>\n";
- html += "<option value='7'" + (config.threadCount == 7 ? selected : empty) + ">7</option>\n";
- html += "<option value='8'" + (config.threadCount == 8 ? selected : empty) + ">8</option>\n";
- html += "<option value='9'" + (config.threadCount == 9 ? selected : empty) + ">9</option>\n";
- html += "<option value='10'" + (config.threadCount == 10 ? selected : empty) + ">10</option>\n";
- html += "<option value='11'" + (config.threadCount == 11 ? selected : empty) + ">11</option>\n";
- html += "<option value='12'" + (config.threadCount == 12 ? selected : empty) + ">12</option>\n";
- html += "<option value='13'" + (config.threadCount == 13 ? selected : empty) + ">13</option>\n";
- html += "<option value='14'" + (config.threadCount == 14 ? selected : empty) + ">14</option>\n";
- html += "<option value='15'" + (config.threadCount == 15 ? selected : empty) + ">15</option>\n";
- html += "<option value='16'" + (config.threadCount == 16 ? selected : empty) + ">16</option>\n";
- html += "</select></td></tr>\n";
- html += "<tr><td>Enable SSE:</td><td><input name = 'enableSSE' type='checkbox'" + (config.enableSSE ? checked : empty) + " disabled='disabled' title='If checked enables the use of SSE instruction set extentions if supported by the CPU.'></td></tr>";
- html += "<tr><td>Enable SSE2:</td><td><input name = 'enableSSE2' type='checkbox'" + (config.enableSSE2 ? checked : empty) + " title='If checked enables the use of SSE2 instruction set extentions if supported by the CPU.'></td></tr>";
- html += "<tr><td>Enable SSE3:</td><td><input name = 'enableSSE3' type='checkbox'" + (config.enableSSE3 ? checked : empty) + " title='If checked enables the use of SSE3 instruction set extentions if supported by the CPU.'></td></tr>";
- html += "<tr><td>Enable SSSE3:</td><td><input name = 'enableSSSE3' type='checkbox'" + (config.enableSSSE3 ? checked : empty) + " title='If checked enables the use of SSSE3 instruction set extentions if supported by the CPU.'></td></tr>";
- html += "<tr><td>Enable SSE4.1:</td><td><input name = 'enableSSE4_1' type='checkbox'" + (config.enableSSE4_1 ? checked : empty) + " title='If checked enables the use of SSE4.1 instruction set extentions if supported by the CPU.'></td></tr>";
- html += "</table>\n";
- html += "<h2><em>Compiler optimizations</em></h2>\n";
- html += "<table>\n";
-
- for(size_t pass = 0; pass < config.optimization.size(); pass++)
- {
- html += "<tr><td>Optimization pass " + itoa(pass + 1) + ":</td><td><select name='optimization" + itoa(pass + 1) + "' title='An optimization pass for the shader compiler.'>\n";
- html += "<option value='0'" + (config.optimization[pass] == rr::Optimization::Pass::Disabled ? selected : empty) + ">Disabled" + (pass > 0 ? " (default)" : "") + "</option>\n";
- html += "<option value='1'" + (config.optimization[pass] == rr::Optimization::Pass::InstructionCombining ? selected : empty) + ">Instruction Combining" + (pass == 0 ? " (default)" : "") + "</option>\n";
- html += "<option value='2'" + (config.optimization[pass] == rr::Optimization::Pass::CFGSimplification ? selected : empty) + ">Control Flow Simplification</option>\n";
- html += "<option value='3'" + (config.optimization[pass] == rr::Optimization::Pass::LICM ? selected : empty) + ">Loop Invariant Code Motion</option>\n";
- html += "<option value='4'" + (config.optimization[pass] == rr::Optimization::Pass::AggressiveDCE ? selected : empty) + ">Aggressive Dead Code Elimination</option>\n";
- html += "<option value='5'" + (config.optimization[pass] == rr::Optimization::Pass::GVN ? selected : empty) + ">Global Value Numbering</option>\n";
- html += "<option value='6'" + (config.optimization[pass] == rr::Optimization::Pass::Reassociate ? selected : empty) + ">Commutative Expressions Reassociation</option>\n";
- html += "<option value='7'" + (config.optimization[pass] == rr::Optimization::Pass::DeadStoreElimination ? selected : empty) + ">Dead Store Elimination</option>\n";
- html += "<option value='8'" + (config.optimization[pass] == rr::Optimization::Pass::SCCP ? selected : empty) + ">Sparse Conditional Copy Propagation</option>\n";
- html += "<option value='9'" + (config.optimization[pass] == rr::Optimization::Pass::ScalarReplAggregates ? selected : empty) + ">Scalar Replacement of Aggregates</option>\n";
- html += "<option value='10'" + (config.optimization[pass] == rr::Optimization::Pass::EarlyCSEPass ? selected : empty) + ">Eliminate trivially redundant instructions</option>\n";
- html += "</select></td></tr>\n";
- }
-
- html += "</table>\n";
- html += "<h2><em>Testing & Experimental</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Disable SwiftConfig server:</td><td><input name = 'disableServer' type='checkbox'" + (config.disableServer == true ? checked : empty) + " title='If checked disables the web browser based control panel.'></td></tr>";
- html += "<tr><td>Force windowed mode:</td><td><input name = 'forceWindowed' type='checkbox'" + (config.forceWindowed == true ? checked : empty) + " title='If checked prevents the application from switching to full-screen mode.'></td></tr>";
- html += "<tr><td>Complementary depth buffer:</td><td><input name = 'complementaryDepthBuffer' type='checkbox'" + (config.complementaryDepthBuffer == true ? checked : empty) + " title='If checked causes 1 - z to be stored in the depth buffer.'></td></tr>";
- html += "<tr><td>Post alpha blend sRGB conversion:</td><td><input name = 'postBlendSRGB' type='checkbox'" + (config.postBlendSRGB == true ? checked : empty) + " title='If checked alpha blending is performed in linear color space.'></td></tr>";
- html += "<tr><td>Exact color rounding:</td><td><input name = 'exactColorRounding' type='checkbox'" + (config.exactColorRounding == true ? checked : empty) + " title='If checked color rounding is done at high accuracy.'></td></tr>";
- html += "<tr><td>Disable alpha display formats:</td><td><input name = 'disableAlphaMode' type='checkbox'" + (config.disableAlphaMode == true ? checked : empty) + " title='If checked the device does not advertise the A8R8G8B8 display mode.'></td></tr>";
- html += "<tr><td>Disable 10-bit display formats:</td><td><input name = 'disable10BitMode' type='checkbox'" + (config.disable10BitMode == true ? checked : empty) + " title='If checked the device does not advertise the A2R10G10B10 display mode.'></td></tr>";
- html += "<tr><td>Frame-buffer API:</td><td><select name='frameBufferAPI' title='The API used for displaying the rendered result on screen (requires restart).'>\n";
- html += "<option value='0'" + (config.frameBufferAPI == 0 ? selected : empty) + ">DirectDraw (default)</option>\n";
- html += "<option value='1'" + (config.frameBufferAPI == 1 ? selected : empty) + ">GDI</option>\n";
- html += "</select></td>\n";
- html += "<tr><td>DLL precaching:</td><td><input name = 'precache' type='checkbox'" + (config.precache == true ? checked : empty) + " title='If checked dynamically generated routines will be stored in a DLL for faster loading on application restart.'></td></tr>";
- html += "<tr><td>Shadow mapping extensions:</td><td><select name='shadowMapping' title='Features that may accelerate or improve the quality of shadow mapping.'>\n";
- html += "<option value='0'" + (config.shadowMapping == 0 ? selected : empty) + ">None</option>\n";
- html += "<option value='1'" + (config.shadowMapping == 1 ? selected : empty) + ">Fetch4</option>\n";
- html += "<option value='2'" + (config.shadowMapping == 2 ? selected : empty) + ">DST</option>\n";
- html += "<option value='3'" + (config.shadowMapping == 3 ? selected : empty) + ">Fetch4 & DST (default)</option>\n";
- html += "</select></td>\n";
- html += "<tr><td>Force clearing registers that have no default value:</td><td><input name = 'forceClearRegisters' type='checkbox'" + (config.forceClearRegisters == true ? checked : empty) + " title='Initializes shader register values to 0 even if they have no default.'></td></tr>";
- html += "</table>\n";
- #ifndef NDEBUG
- html += "<h2><em>Debugging</em></h2>\n";
- html += "<table>\n";
- html += "<tr><td>Minimum primitives:</td><td><input type='text' size='10' maxlength='10' name='minPrimitives' value='" + itoa(config.minPrimitives) + "'></td></tr>\n";
- html += "<tr><td>Maximum primitives:</td><td><input type='text' size='10' maxlength='10' name='maxPrimitives' value='" + itoa(config.maxPrimitives) + "'></td></tr>\n";
- html += "</table>\n";
- #endif
- html += "<hr><p>\n";
- html += "<span style='font-size:10pt'>Hover the mouse pointer over a control to get additional information.</span><br>\n";
- html += "<span style='font-size:10pt'>Some settings can be applied interactively, some need a restart of the application.</span><br>\n";
- html += "<span style='font-size:10pt'>Removing the SwiftShader.ini file results in resetting the options to their default.</span></p>\n";
- html += "</form>\n";
- html += "</body>\n";
- html += "</html>\n";
-
- profiler.reset();
-
- return html;
- }
-
- std::string SwiftConfig::profile()
- {
- std::string html;
-
- html += "<p>FPS: " + ftoa(profiler.FPS) + "</p>\n";
- html += "<p>Frame: " + itoa(profiler.framesTotal) + "</p>\n";
-
- #if PERF_PROFILE
- int texTime = (int)(1000 * profiler.cycles[PERF_TEX] / profiler.cycles[PERF_PIXEL] + 0.5);
- int shaderTime = (int)(1000 * profiler.cycles[PERF_SHADER] / profiler.cycles[PERF_PIXEL] + 0.5);
- int pipeTime = (int)(1000 * profiler.cycles[PERF_PIPE] / profiler.cycles[PERF_PIXEL] + 0.5);
- int ropTime = (int)(1000 * profiler.cycles[PERF_ROP] / profiler.cycles[PERF_PIXEL] + 0.5);
- int interpTime = (int)(1000 * profiler.cycles[PERF_INTERP] / profiler.cycles[PERF_PIXEL] + 0.5);
- int rastTime = 1000 - pipeTime;
-
- pipeTime -= shaderTime + ropTime + interpTime;
- shaderTime -= texTime;
-
- double texTimeF = (double)texTime / 10;
- double shaderTimeF = (double)shaderTime / 10;
- double pipeTimeF = (double)pipeTime / 10;
- double ropTimeF = (double)ropTime / 10;
- double interpTimeF = (double)interpTime / 10;
- double rastTimeF = (double)rastTime / 10;
-
- double averageRopOperations = profiler.ropOperationsTotal / std::max(profiler.framesTotal, 1) / 1.0e6f;
- double averageCompressedTex = profiler.compressedTexTotal / std::max(profiler.framesTotal, 1) / 1.0e6f;
- double averageTexOperations = profiler.texOperationsTotal / std::max(profiler.framesTotal, 1) / 1.0e6f;
-
- html += "<p>Raster operations (million): " + ftoa(profiler.ropOperationsFrame / 1.0e6f) + " (current), " + ftoa(averageRopOperations) + " (average)</p>\n";
- html += "<p>Texture operations (million): " + ftoa(profiler.texOperationsFrame / 1.0e6f) + " (current), " + ftoa(averageTexOperations) + " (average)</p>\n";
- html += "<p>Compressed texture operations (million): " + ftoa(profiler.compressedTexFrame / 1.0e6f) + " (current), " + ftoa(averageCompressedTex) + " (average)</p>\n";
- html += "<div id='profile' style='position:relative; width:1010px; height:50px; background-color:silver;'>";
- html += "<div style='position:relative; width:1000px; height:40px; background-color:white; left:5px; top:5px;'>";
- html += "<div style='position:relative; float:left; width:" + itoa(rastTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#FFFF7F; overflow:hidden;'>" + ftoa(rastTimeF) + "% rast</div>\n";
- html += "<div style='position:relative; float:left; width:" + itoa(pipeTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#FF7F7F; overflow:hidden;'>" + ftoa(pipeTimeF) + "% pipe</div>\n";
- html += "<div style='position:relative; float:left; width:" + itoa(interpTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#7FFFFF; overflow:hidden;'>" + ftoa(interpTimeF) + "% interp</div>\n";
- html += "<div style='position:relative; float:left; width:" + itoa(shaderTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#7FFF7F; overflow:hidden;'>" + ftoa(shaderTimeF) + "% shader</div>\n";
- html += "<div style='position:relative; float:left; width:" + itoa(texTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#FF7FFF; overflow:hidden;'>" + ftoa(texTimeF) + "% tex</div>\n";
- html += "<div style='position:relative; float:left; width:" + itoa(ropTime) + "px; height:40px; border-style:none; text-align:center; line-height:40px; background-color:#7F7FFF; overflow:hidden;'>" + ftoa(ropTimeF) + "% rop</div>\n";
- html += "</div></div>\n";
-
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- profiler.cycles[i] = 0;
- }
- #endif
-
- return html;
- }
-
- void SwiftConfig::send(Socket *clientSocket, Status code, std::string body)
- {
- std::string status;
- char header[1024];
-
- switch(code)
- {
- case OK: status += "HTTP/1.1 200 OK\r\n"; break;
- case NotFound: status += "HTTP/1.1 404 Not Found\r\n"; break;
- }
-
- sprintf(header, "Content-Type: text/html; charset=UTF-8\r\n"
- "Content-Length: %zd\r\n"
- "Host: localhost\r\n"
- "\r\n", body.size());
-
- std::string message = status + header + body;
- clientSocket->send(message.c_str(), (int)message.length());
- }
-
- void SwiftConfig::parsePost(const char *post)
- {
- // Only enabled checkboxes appear in the POST
- config.enableSSE = true;
- config.enableSSE2 = false;
- config.enableSSE3 = false;
- config.enableSSSE3 = false;
- config.enableSSE4_1 = false;
- config.disableServer = false;
- config.forceWindowed = false;
- config.complementaryDepthBuffer = false;
- config.postBlendSRGB = false;
- config.exactColorRounding = false;
- config.disableAlphaMode = false;
- config.disable10BitMode = false;
- config.precache = false;
- config.forceClearRegisters = false;
-
- while(*post != 0)
- {
- int integer;
- int index;
-
- if(sscanf(post, "pixelShaderVersion=%d", &integer))
- {
- config.pixelShaderVersion = integer;
- }
- else if(sscanf(post, "vertexShaderVersion=%d", &integer))
- {
- config.vertexShaderVersion = integer;
- }
- else if(sscanf(post, "textureMemory=%d", &integer))
- {
- config.textureMemory = integer;
- }
- else if(sscanf(post, "identifier=%d", &integer))
- {
- config.identifier = integer;
- }
- else if(sscanf(post, "vertexRoutineCacheSize=%d", &integer))
- {
- config.vertexRoutineCacheSize = integer;
- }
- else if(sscanf(post, "pixelRoutineCacheSize=%d", &integer))
- {
- config.pixelRoutineCacheSize = integer;
- }
- else if(sscanf(post, "setupRoutineCacheSize=%d", &integer))
- {
- config.setupRoutineCacheSize = integer;
- }
- else if(sscanf(post, "vertexCacheSize=%d", &integer))
- {
- config.vertexCacheSize = integer;
- }
- else if(sscanf(post, "textureSampleQuality=%d", &integer))
- {
- config.textureSampleQuality = integer;
- }
- else if(sscanf(post, "mipmapQuality=%d", &integer))
- {
- config.mipmapQuality = integer;
- }
- else if(sscanf(post, "perspectiveCorrection=%d", &integer))
- {
- config.perspectiveCorrection = integer != 0;
- }
- else if(sscanf(post, "transcendentalPrecision=%d", &integer))
- {
- config.transcendentalPrecision = integer;
- }
- else if(sscanf(post, "transparencyAntialiasing=%d", &integer))
- {
- config.transparencyAntialiasing = integer;
- }
- else if(sscanf(post, "threadCount=%d", &integer))
- {
- config.threadCount = integer;
- }
- else if(sscanf(post, "frameBufferAPI=%d", &integer))
- {
- config.frameBufferAPI = integer;
- }
- else if(sscanf(post, "shadowMapping=%d", &integer))
- {
- config.shadowMapping = integer;
- }
- else if(strstr(post, "enableSSE=on"))
- {
- config.enableSSE = true;
- }
- else if(strstr(post, "enableSSE2=on"))
- {
- if(config.enableSSE)
- {
- config.enableSSE2 = true;
- }
- }
- else if(strstr(post, "enableSSE3=on"))
- {
- if(config.enableSSE2)
- {
- config.enableSSE3 = true;
- }
- }
- else if(strstr(post, "enableSSSE3=on"))
- {
- if(config.enableSSE3)
- {
- config.enableSSSE3 = true;
- }
- }
- else if(strstr(post, "enableSSE4_1=on"))
- {
- if(config.enableSSSE3)
- {
- config.enableSSE4_1 = true;
- }
- }
- else if(sscanf(post, "optimization%d=%d", &index, &integer))
- {
- config.optimization[index - 1] = (rr::Optimization::Pass)integer;
- }
- else if(strstr(post, "disableServer=on"))
- {
- config.disableServer = true;
- }
- else if(strstr(post, "forceWindowed=on"))
- {
- config.forceWindowed = true;
- }
- else if(strstr(post, "complementaryDepthBuffer=on"))
- {
- config.complementaryDepthBuffer = true;
- }
- else if(strstr(post, "postBlendSRGB=on"))
- {
- config.postBlendSRGB = true;
- }
- else if(strstr(post, "exactColorRounding=on"))
- {
- config.exactColorRounding = true;
- }
- else if(strstr(post, "disableAlphaMode=on"))
- {
- config.disableAlphaMode = true;
- }
- else if(strstr(post, "disable10BitMode=on"))
- {
- config.disable10BitMode = true;
- }
- else if(strstr(post, "precache=on"))
- {
- config.precache = true;
- }
- else if(strstr(post, "forceClearRegisters=on"))
- {
- config.forceClearRegisters = true;
- }
- #ifndef NDEBUG
- else if(sscanf(post, "minPrimitives=%d", &integer))
- {
- config.minPrimitives = integer;
- }
- else if(sscanf(post, "maxPrimitives=%d", &integer))
- {
- config.maxPrimitives = integer;
- }
- #endif
- else
- {
- ASSERT(false);
- }
-
- do
- {
- post++;
- }
- while(post[-1] != '&' && *post != 0);
- }
- }
-
- void SwiftConfig::readConfiguration(bool disableServerOverride)
- {
- Configurator ini("SwiftShader.ini");
-
- config.pixelShaderVersion = ini.getInteger("Capabilities", "PixelShaderVersion", 30);
- config.vertexShaderVersion = ini.getInteger("Capabilities", "VertexShaderVersion", 30);
- config.textureMemory = ini.getInteger("Capabilities", "TextureMemory", 256);
- config.identifier = ini.getInteger("Capabilities", "Identifier", 0);
- config.vertexRoutineCacheSize = ini.getInteger("Caches", "VertexRoutineCacheSize", 1024);
- config.pixelRoutineCacheSize = ini.getInteger("Caches", "PixelRoutineCacheSize", 1024);
- config.setupRoutineCacheSize = ini.getInteger("Caches", "SetupRoutineCacheSize", 1024);
- config.vertexCacheSize = ini.getInteger("Caches", "VertexCacheSize", 64);
- config.textureSampleQuality = ini.getInteger("Quality", "TextureSampleQuality", 2);
- config.mipmapQuality = ini.getInteger("Quality", "MipmapQuality", 1);
- config.perspectiveCorrection = ini.getBoolean("Quality", "PerspectiveCorrection", true);
- config.transcendentalPrecision = ini.getInteger("Quality", "TranscendentalPrecision", 2);
- config.transparencyAntialiasing = ini.getInteger("Quality", "TransparencyAntialiasing", 0);
- config.threadCount = ini.getInteger("Processor", "ThreadCount", DEFAULT_THREAD_COUNT);
- config.enableSSE = ini.getBoolean("Processor", "EnableSSE", true);
- config.enableSSE2 = ini.getBoolean("Processor", "EnableSSE2", true);
- config.enableSSE3 = ini.getBoolean("Processor", "EnableSSE3", true);
- config.enableSSSE3 = ini.getBoolean("Processor", "EnableSSSE3", true);
- config.enableSSE4_1 = ini.getBoolean("Processor", "EnableSSE4_1", true);
-
- for(size_t pass = 0; pass < config.optimization.size(); pass++)
- {
- auto def = pass == 0 ? rr::Optimization::Pass::InstructionCombining : rr::Optimization::Pass::Disabled;
- config.optimization[pass] = (rr::Optimization::Pass)ini.getInteger("Optimization", "OptimizationPass" + itoa(pass + 1), (int)def);
- }
-
- config.disableServer = ini.getBoolean("Testing", "DisableServer", false);
- config.forceWindowed = ini.getBoolean("Testing", "ForceWindowed", false);
- config.complementaryDepthBuffer = ini.getBoolean("Testing", "ComplementaryDepthBuffer", false);
- config.postBlendSRGB = ini.getBoolean("Testing", "PostBlendSRGB", false);
- config.exactColorRounding = ini.getBoolean("Testing", "ExactColorRounding", true);
- config.disableAlphaMode = ini.getBoolean("Testing", "DisableAlphaMode", false);
- config.disable10BitMode = ini.getBoolean("Testing", "Disable10BitMode", false);
- config.frameBufferAPI = ini.getInteger("Testing", "FrameBufferAPI", 0);
- config.precache = ini.getBoolean("Testing", "Precache", false);
- config.shadowMapping = ini.getInteger("Testing", "ShadowMapping", 3);
- config.forceClearRegisters = ini.getBoolean("Testing", "ForceClearRegisters", false);
-
- #ifndef NDEBUG
- config.minPrimitives = 1;
- config.maxPrimitives = 1 << 21;
- #endif
-
- struct stat status;
- int lastModified = ini.getInteger("LastModified", "Time", 0);
-
- bool noConfig = stat("SwiftShader.ini", &status) != 0;
- newConfig = !noConfig && abs((int)status.st_mtime - lastModified) > 1;
-
- if(disableServerOverride)
- {
- config.disableServer = true;
- }
- }
-
- void SwiftConfig::writeConfiguration()
- {
- Configurator ini("SwiftShader.ini");
-
- ini.addValue("Capabilities", "PixelShaderVersion", itoa(config.pixelShaderVersion));
- ini.addValue("Capabilities", "VertexShaderVersion", itoa(config.vertexShaderVersion));
- ini.addValue("Capabilities", "TextureMemory", itoa(config.textureMemory));
- ini.addValue("Capabilities", "Identifier", itoa(config.identifier));
- ini.addValue("Caches", "VertexRoutineCacheSize", itoa(config.vertexRoutineCacheSize));
- ini.addValue("Caches", "PixelRoutineCacheSize", itoa(config.pixelRoutineCacheSize));
- ini.addValue("Caches", "SetupRoutineCacheSize", itoa(config.setupRoutineCacheSize));
- ini.addValue("Caches", "VertexCacheSize", itoa(config.vertexCacheSize));
- ini.addValue("Quality", "TextureSampleQuality", itoa(config.textureSampleQuality));
- ini.addValue("Quality", "MipmapQuality", itoa(config.mipmapQuality));
- ini.addValue("Quality", "PerspectiveCorrection", itoa(config.perspectiveCorrection));
- ini.addValue("Quality", "TranscendentalPrecision", itoa(config.transcendentalPrecision));
- ini.addValue("Quality", "TransparencyAntialiasing", itoa(config.transparencyAntialiasing));
- ini.addValue("Processor", "ThreadCount", itoa(config.threadCount));
- // ini.addValue("Processor", "EnableSSE", itoa(config.enableSSE));
- ini.addValue("Processor", "EnableSSE2", itoa(config.enableSSE2));
- ini.addValue("Processor", "EnableSSE3", itoa(config.enableSSE3));
- ini.addValue("Processor", "EnableSSSE3", itoa(config.enableSSSE3));
- ini.addValue("Processor", "EnableSSE4_1", itoa(config.enableSSE4_1));
-
- for(size_t pass = 0; pass < config.optimization.size(); pass++)
- {
- ini.addValue("Optimization", "OptimizationPass" + itoa(pass + 1), itoa((int)config.optimization[pass]));
- }
-
- ini.addValue("Testing", "DisableServer", itoa(config.disableServer));
- ini.addValue("Testing", "ForceWindowed", itoa(config.forceWindowed));
- ini.addValue("Testing", "ComplementaryDepthBuffer", itoa(config.complementaryDepthBuffer));
- ini.addValue("Testing", "PostBlendSRGB", itoa(config.postBlendSRGB));
- ini.addValue("Testing", "ExactColorRounding", itoa(config.exactColorRounding));
- ini.addValue("Testing", "DisableAlphaMode", itoa(config.disableAlphaMode));
- ini.addValue("Testing", "Disable10BitMode", itoa(config.disable10BitMode));
- ini.addValue("Testing", "FrameBufferAPI", itoa(config.frameBufferAPI));
- ini.addValue("Testing", "Precache", itoa(config.precache));
- ini.addValue("Testing", "ShadowMapping", itoa(config.shadowMapping));
- ini.addValue("Testing", "ForceClearRegisters", itoa(config.forceClearRegisters));
- ini.addValue("LastModified", "Time", itoa((int)time(0)));
-
- ini.writeFile("SwiftShader Configuration File\n"
- ";\n"
- "; To get an overview of the valid settings and their meaning,\n"
- "; run the application in windowed mode and open the\n"
- "; SwiftConfig application or go to http://localhost:8080/swiftconfig.");
- }
-}
diff --git a/src/Main/SwiftConfig.hpp b/src/Main/SwiftConfig.hpp
deleted file mode 100644
index a40648c64..000000000
--- a/src/Main/SwiftConfig.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_SwiftConfig_hpp
-#define sw_SwiftConfig_hpp
-
-#include "Reactor/Nucleus.hpp"
-
-#include "Common/Thread.hpp"
-#include "Common/MutexLock.hpp"
-#include "Common/Socket.hpp"
-
-#include <array>
-#include <string>
-
-namespace sw
-{
- class SwiftConfig
- {
- public:
- struct Configuration
- {
- int pixelShaderVersion;
- int vertexShaderVersion;
- int textureMemory;
- int identifier;
- int vertexRoutineCacheSize;
- int pixelRoutineCacheSize;
- int setupRoutineCacheSize;
- int vertexCacheSize;
- int textureSampleQuality;
- int mipmapQuality;
- bool perspectiveCorrection;
- int transcendentalPrecision;
- int threadCount;
- bool enableSSE;
- bool enableSSE2;
- bool enableSSE3;
- bool enableSSSE3;
- bool enableSSE4_1;
- std::array<rr::Optimization::Pass, 10> optimization;
- bool disableServer;
- bool keepSystemCursor;
- bool forceWindowed;
- bool complementaryDepthBuffer;
- bool postBlendSRGB;
- bool exactColorRounding;
- bool disableAlphaMode;
- bool disable10BitMode;
- int transparencyAntialiasing;
- int frameBufferAPI;
- bool precache;
- int shadowMapping;
- bool forceClearRegisters;
- #ifndef NDEBUG
- unsigned int minPrimitives;
- unsigned int maxPrimitives;
- #endif
- };
-
- SwiftConfig(bool disableServerOverride);
-
- ~SwiftConfig();
-
- bool hasNewConfiguration(bool reset = true);
- void getConfiguration(Configuration &configuration);
-
- private:
- enum Status
- {
- OK = 200,
- NotFound = 404
- };
-
- void createServer();
- void destroyServer();
-
- static void serverRoutine(void *parameters);
-
- void serverLoop();
- void respond(Socket *clientSocket, const char *request);
- std::string page();
- std::string profile();
- void send(Socket *clientSocket, Status code, std::string body = "");
- void parsePost(const char *post);
-
- void readConfiguration(bool disableServerOverride = false);
- void writeConfiguration();
-
- Configuration config;
-
- Thread *serverThread;
- volatile bool terminate;
- MutexLock criticalSection; // Protects reading and writing the configuration settings
-
- bool newConfig;
-
- Socket *listenSocket;
-
- int bufferLength;
- char *receiveBuffer;
- };
-}
-
-#endif // sw_SwiftConfig_hpp
diff --git a/src/Main/libX11.cpp b/src/Main/libX11.cpp
deleted file mode 100644
index 6911d0e01..000000000
--- a/src/Main/libX11.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "libX11.hpp"
-
-#include "Common/SharedLibrary.hpp"
-
-LibX11exports::LibX11exports(void *libX11, void *libXext)
-{
- XOpenDisplay = (Display *(*)(char*))getProcAddress(libX11, "XOpenDisplay");
- XGetWindowAttributes = (Status (*)(Display*, Window, XWindowAttributes*))getProcAddress(libX11, "XGetWindowAttributes");
- XDefaultScreenOfDisplay = (Screen *(*)(Display*))getProcAddress(libX11, "XDefaultScreenOfDisplay");
- XWidthOfScreen = (int (*)(Screen*))getProcAddress(libX11, "XWidthOfScreen");
- XHeightOfScreen = (int (*)(Screen*))getProcAddress(libX11, "XHeightOfScreen");
- XPlanesOfScreen = (int (*)(Screen*))getProcAddress(libX11, "XPlanesOfScreen");
- XCreateGC = (GC (*)(Display *, Drawable, unsigned long, XGCValues *))getProcAddress(libX11, "XCreateGC");
- XFreeGC = (int (*)(Display *, GC))getProcAddress(libX11, "XFreeGC");
- XSetErrorHandler = (int (*(*)(int (*)(Display*, XErrorEvent*)))(Display*, XErrorEvent*))getProcAddress(libX11, "XSetErrorHandler");
- XSync = (int (*)(Display*, Bool))getProcAddress(libX11, "XSync");
- XCreateImage = (XImage *(*)(Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int))getProcAddress(libX11, "XCreateImage");
- XCloseDisplay = (int (*)(Display*))getProcAddress(libX11, "XCloseDisplay");
- XPutImage = (int (*)(Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int))getProcAddress(libX11, "XPutImage");
- XDrawString = (int (*)(Display*, Drawable, GC, int, int, char*, int))getProcAddress(libX11, "XDrawString");
-
- XShmQueryExtension = (Bool (*)(Display*))getProcAddress(libXext, "XShmQueryExtension");
- XShmCreateImage = (XImage *(*)(Display*, Visual*, unsigned int, int, char*, XShmSegmentInfo*, unsigned int, unsigned int))getProcAddress(libXext, "XShmCreateImage");
- XShmAttach = (Bool (*)(Display*, XShmSegmentInfo*))getProcAddress(libXext, "XShmAttach");
- XShmDetach = (Bool (*)(Display*, XShmSegmentInfo*))getProcAddress(libXext, "XShmDetach");
- XShmPutImage = (int (*)(Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int, bool))getProcAddress(libXext, "XShmPutImage");
-}
-
-LibX11exports *LibX11::operator->()
-{
- return loadExports();
-}
-
-LibX11exports *LibX11::loadExports()
-{
- static void *libX11 = nullptr;
- static void *libXext = nullptr;
- static LibX11exports *libX11exports = nullptr;
-
- if(!libX11)
- {
- if(getProcAddress(RTLD_DEFAULT, "XOpenDisplay")) // Search the global scope for pre-loaded X11 library.
- {
- libX11exports = new LibX11exports(RTLD_DEFAULT, RTLD_DEFAULT);
- libX11 = (void*)-1; // No need to load it.
- }
- else
- {
- libX11 = loadLibrary("libX11.so");
-
- if(libX11)
- {
- libXext = loadLibrary("libXext.so");
- libX11exports = new LibX11exports(libX11, libXext);
- }
- else
- {
- libX11 = (void*)-1; // Don't attempt loading more than once.
- }
- }
- }
-
- return libX11exports;
-}
-
-LibX11 libX11;
diff --git a/src/Main/libX11.hpp b/src/Main/libX11.hpp
deleted file mode 100644
index 16e22a5e0..000000000
--- a/src/Main/libX11.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef libX11_hpp
-#define libX11_hpp
-
-#define Bool int
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-#include <X11/extensions/XShm.h>
-
-struct LibX11exports
-{
- LibX11exports(void *libX11, void *libXext);
-
- Display *(*XOpenDisplay)(char *display_name);
- Status (*XGetWindowAttributes)(Display *display, Window w, XWindowAttributes *window_attributes_return);
- Screen *(*XDefaultScreenOfDisplay)(Display *display);
- int (*XWidthOfScreen)(Screen *screen);
- int (*XHeightOfScreen)(Screen *screen);
- int (*XPlanesOfScreen)(Screen *screen);
- GC (*XCreateGC)(Display *display, Drawable d, unsigned long valuemask, XGCValues *values);
- int (*XFreeGC)(Display *display, GC gc);
- int (*(*XSetErrorHandler)(int (*handler)(Display*, XErrorEvent*)))(Display*, XErrorEvent*);
- int (*XSync)(Display *display, Bool discard);
- XImage *(*XCreateImage)(Display *display, Visual *visual, unsigned int depth, int format, int offset, char *data, unsigned int width, unsigned int height, int bitmap_pad, int bytes_per_line);
- int (*XCloseDisplay)(Display *display);
- int (*XPutImage)(Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height);
- int (*XDrawString)(Display *display, Drawable d, GC gc, int x, int y, char *string, int length);
-
- Bool (*XShmQueryExtension)(Display *display);
- XImage *(*XShmCreateImage)(Display *display, Visual *visual, unsigned int depth, int format, char *data, XShmSegmentInfo *shminfo, unsigned int width, unsigned int height);
- Bool (*XShmAttach)(Display *display, XShmSegmentInfo *shminfo);
- Bool (*XShmDetach)(Display *display, XShmSegmentInfo *shminfo);
- int (*XShmPutImage)(Display *display, Drawable d, GC gc, XImage *image, int src_x, int src_y, int dest_x, int dest_y, unsigned int width, unsigned int height, bool send_event);
-};
-
-class LibX11
-{
-public:
- operator bool()
- {
- return loadExports();
- }
-
- LibX11exports *operator->();
-
-private:
- LibX11exports *loadExports();
-};
-
-extern LibX11 libX11;
-
-#endif // libX11_hpp
diff --git a/src/OpenGL/common/Image.cpp b/src/OpenGL/common/Image.cpp
deleted file mode 100644
index 039245081..000000000
--- a/src/OpenGL/common/Image.cpp
+++ /dev/null
@@ -1,1709 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Image.hpp"
-
-#include "../libEGL/Texture.hpp"
-#include "../common/debug.h"
-#include "Common/Math.hpp"
-#include "Common/Thread.hpp"
-
-#include <GLES3/gl3.h>
-
-#include <string.h>
-#include <algorithm>
-
-#if defined(__APPLE__)
-#include <CoreFoundation/CoreFoundation.h>
-#include <IOSurface/IOSurface.h>
-#endif
-
-namespace gl
-{
- bool IsUnsizedInternalFormat(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_ALPHA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_RGBA:
- case GL_RED_INTEGER:
- case GL_RG_INTEGER:
- case GL_RGB_INTEGER:
- case GL_RGBA_INTEGER:
- case GL_BGRA_EXT:
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL:
- // GL_EXT_sRGB
- // case GL_SRGB_EXT:
- // case GL_SRGB_ALPHA_EXT:
- return true;
- default:
- return false;
- }
- }
-
- GLenum GetBaseInternalFormat(GLint internalformat)
- {
- switch(internalformat)
- {
- // [OpenGL ES 3.0 Table 3.13]
- case GL_R8: return GL_RED;
- case GL_R8_SNORM: return GL_RED;
- case GL_RG8: return GL_RG;
- case GL_RG8_SNORM: return GL_RG;
- case GL_RGB8: return GL_RGB;
- case GL_RGB8_SNORM: return GL_RGB;
- case GL_RGB565: return GL_RGB;
- case GL_RGBA4: return GL_RGBA;
- case GL_RGB5_A1: return GL_RGBA;
- case GL_RGBA8: return GL_RGBA;
- case GL_RGBA8_SNORM: return GL_RGBA;
- case GL_RGB10_A2: return GL_RGBA;
- case GL_RGB10_A2UI: return GL_RGBA;
- case GL_SRGB8: return GL_RGB;
- case GL_SRGB8_ALPHA8: return GL_RGBA;
- case GL_R16F: return GL_RED;
- case GL_RG16F: return GL_RG;
- case GL_RGB16F: return GL_RGB;
- case GL_RGBA16F: return GL_RGBA;
- case GL_R32F: return GL_RED;
- case GL_RG32F: return GL_RG;
- case GL_RGB32F: return GL_RGB;
- case GL_RGBA32F: return GL_RGBA;
- case GL_R11F_G11F_B10F: return GL_RGB;
- case GL_RGB9_E5: return GL_RGB;
- case GL_R8I: return GL_RED;
- case GL_R8UI: return GL_RED;
- case GL_R16I: return GL_RED;
- case GL_R16UI: return GL_RED;
- case GL_R32I: return GL_RED;
- case GL_R32UI: return GL_RED;
- case GL_RG8I: return GL_RG;
- case GL_RG8UI: return GL_RG;
- case GL_RG16I: return GL_RG;
- case GL_RG16UI: return GL_RG;
- case GL_RG32I: return GL_RG;
- case GL_RG32UI: return GL_RG;
- case GL_RGB8I: return GL_RGB;
- case GL_RGB8UI: return GL_RGB;
- case GL_RGB16I: return GL_RGB;
- case GL_RGB16UI: return GL_RGB;
- case GL_RGB32I: return GL_RGB;
- case GL_RGB32UI: return GL_RGB;
- case GL_RGBA8I: return GL_RGBA;
- case GL_RGBA8UI: return GL_RGBA;
- case GL_RGBA16I: return GL_RGBA;
- case GL_RGBA16UI: return GL_RGBA;
- case GL_RGBA32I: return GL_RGBA;
- case GL_RGBA32UI: return GL_RGBA;
-
- // GL_EXT_texture_storage
- case GL_ALPHA8_EXT: return GL_ALPHA;
- case GL_LUMINANCE8_EXT: return GL_LUMINANCE;
- case GL_LUMINANCE8_ALPHA8_EXT: return GL_LUMINANCE_ALPHA;
- case GL_ALPHA32F_EXT: return GL_ALPHA;
- case GL_LUMINANCE32F_EXT: return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA32F_EXT: return GL_LUMINANCE_ALPHA;
- case GL_ALPHA16F_EXT: return GL_ALPHA;
- case GL_LUMINANCE16F_EXT: return GL_LUMINANCE;
- case GL_LUMINANCE_ALPHA16F_EXT: return GL_LUMINANCE_ALPHA;
-
- case GL_BGRA8_EXT: return GL_BGRA_EXT; // GL_APPLE_texture_format_BGRA8888
-
- case GL_DEPTH_COMPONENT24: return GL_DEPTH_COMPONENT;
- case GL_DEPTH_COMPONENT32_OES: return GL_DEPTH_COMPONENT;
- case GL_DEPTH_COMPONENT32F: return GL_DEPTH_COMPONENT;
- case GL_DEPTH_COMPONENT16: return GL_DEPTH_COMPONENT;
- case GL_DEPTH32F_STENCIL8: return GL_DEPTH_STENCIL;
- case GL_DEPTH24_STENCIL8: return GL_DEPTH_STENCIL;
- case GL_STENCIL_INDEX8: return GL_STENCIL_INDEX_OES;
- default:
- UNREACHABLE(internalformat);
- break;
- }
-
- return GL_NONE;
- }
-
- GLint GetSizedInternalFormat(GLint internalformat, GLenum type)
- {
- if(!IsUnsizedInternalFormat(internalformat))
- {
- return internalformat;
- }
-
- switch(internalformat)
- {
- case GL_RGBA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGBA8;
- case GL_BYTE: return GL_RGBA8_SNORM;
- case GL_UNSIGNED_SHORT_4_4_4_4: return GL_RGBA4;
- case GL_UNSIGNED_SHORT_5_5_5_1: return GL_RGB5_A1;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return GL_RGB10_A2;
- case GL_FLOAT: return GL_RGBA32F;
- case GL_HALF_FLOAT: return GL_RGBA16F;
- case GL_HALF_FLOAT_OES: return GL_RGBA16F;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RGBA_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGBA8UI;
- case GL_BYTE: return GL_RGBA8I;
- case GL_UNSIGNED_SHORT: return GL_RGBA16UI;
- case GL_SHORT: return GL_RGBA16I;
- case GL_UNSIGNED_INT: return GL_RGBA32UI;
- case GL_INT: return GL_RGBA32I;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return GL_RGB10_A2UI;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RGB:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGB8;
- case GL_BYTE: return GL_RGB8_SNORM;
- case GL_UNSIGNED_SHORT_5_6_5: return GL_RGB565;
- case GL_UNSIGNED_INT_10F_11F_11F_REV: return GL_R11F_G11F_B10F;
- case GL_UNSIGNED_INT_5_9_9_9_REV: return GL_RGB9_E5;
- case GL_FLOAT: return GL_RGB32F;
- case GL_HALF_FLOAT: return GL_RGB16F;
- case GL_HALF_FLOAT_OES: return GL_RGB16F;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RGB_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RGB8UI;
- case GL_BYTE: return GL_RGB8I;
- case GL_UNSIGNED_SHORT: return GL_RGB16UI;
- case GL_SHORT: return GL_RGB16I;
- case GL_UNSIGNED_INT: return GL_RGB32UI;
- case GL_INT: return GL_RGB32I;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RG:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RG8;
- case GL_BYTE: return GL_RG8_SNORM;
- case GL_FLOAT: return GL_RG32F;
- case GL_HALF_FLOAT: return GL_RG16F;
- case GL_HALF_FLOAT_OES: return GL_RG16F;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RG_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_RG8UI;
- case GL_BYTE: return GL_RG8I;
- case GL_UNSIGNED_SHORT: return GL_RG16UI;
- case GL_SHORT: return GL_RG16I;
- case GL_UNSIGNED_INT: return GL_RG32UI;
- case GL_INT: return GL_RG32I;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RED:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_R8;
- case GL_BYTE: return GL_R8_SNORM;
- case GL_FLOAT: return GL_R32F;
- case GL_HALF_FLOAT: return GL_R16F;
- case GL_HALF_FLOAT_OES: return GL_R16F;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_RED_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_R8UI;
- case GL_BYTE: return GL_R8I;
- case GL_UNSIGNED_SHORT: return GL_R16UI;
- case GL_SHORT: return GL_R16I;
- case GL_UNSIGNED_INT: return GL_R32UI;
- case GL_INT: return GL_R32I;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_LUMINANCE_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_LUMINANCE8_ALPHA8_EXT;
- case GL_FLOAT: return GL_LUMINANCE_ALPHA32F_EXT;
- case GL_HALF_FLOAT: return GL_LUMINANCE_ALPHA16F_EXT;
- case GL_HALF_FLOAT_OES: return GL_LUMINANCE_ALPHA16F_EXT;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_LUMINANCE:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_LUMINANCE8_EXT;
- case GL_FLOAT: return GL_LUMINANCE32F_EXT;
- case GL_HALF_FLOAT: return GL_LUMINANCE16F_EXT;
- case GL_HALF_FLOAT_OES: return GL_LUMINANCE16F_EXT;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_ALPHA8_EXT;
- case GL_FLOAT: return GL_ALPHA32F_EXT;
- case GL_HALF_FLOAT: return GL_ALPHA16F_EXT;
- case GL_HALF_FLOAT_OES: return GL_ALPHA16F_EXT;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_BGRA_EXT:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return GL_BGRA8_EXT;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: // Only valid for glReadPixels calls.
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: // Only valid for glReadPixels calls.
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_UNSIGNED_SHORT: return GL_DEPTH_COMPONENT16;
- case GL_UNSIGNED_INT: return GL_DEPTH_COMPONENT32_OES;
- case GL_FLOAT: return GL_DEPTH_COMPONENT32F;
- default: UNREACHABLE(type); return GL_NONE;
- }
- case GL_DEPTH_STENCIL:
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8: return GL_DEPTH24_STENCIL8;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return GL_DEPTH32F_STENCIL8;
- default: UNREACHABLE(type); return GL_NONE;
- }
-
- // GL_OES_texture_stencil8
- // case GL_STENCIL_INDEX_OES / GL_UNSIGNED_BYTE: return GL_STENCIL_INDEX8;
-
- // GL_EXT_sRGB
- // case GL_SRGB_EXT / GL_UNSIGNED_BYTE: return GL_SRGB8;
- // case GL_SRGB_ALPHA_EXT / GL_UNSIGNED_BYTE: return GL_SRGB8_ALPHA8;
-
- default:
- UNREACHABLE(internalformat);
- }
-
- return GL_NONE;
- }
-
- sw::Format SelectInternalFormat(GLint format)
- {
- switch(format)
- {
- case GL_RGBA4: return sw::FORMAT_A8B8G8R8;
- case GL_RGB5_A1: return sw::FORMAT_A8B8G8R8;
- case GL_RGBA8: return sw::FORMAT_A8B8G8R8;
- case GL_RGB565: return sw::FORMAT_R5G6B5;
- case GL_RGB8: return sw::FORMAT_X8B8G8R8;
-
- case GL_DEPTH_COMPONENT32F: return sw::FORMAT_D32F_LOCKABLE;
- case GL_DEPTH_COMPONENT16: return sw::FORMAT_D32F_LOCKABLE;
- case GL_DEPTH_COMPONENT24: return sw::FORMAT_D32F_LOCKABLE;
- case GL_DEPTH_COMPONENT32_OES: return sw::FORMAT_D32F_LOCKABLE;
- case GL_DEPTH24_STENCIL8: return sw::FORMAT_D32FS8_TEXTURE;
- case GL_DEPTH32F_STENCIL8: return sw::FORMAT_D32FS8_TEXTURE;
- case GL_STENCIL_INDEX8: return sw::FORMAT_S8;
-
- case GL_R8: return sw::FORMAT_R8;
- case GL_RG8: return sw::FORMAT_G8R8;
- case GL_R8I: return sw::FORMAT_R8I;
- case GL_RG8I: return sw::FORMAT_G8R8I;
- case GL_RGB8I: return sw::FORMAT_X8B8G8R8I;
- case GL_RGBA8I: return sw::FORMAT_A8B8G8R8I;
- case GL_R8UI: return sw::FORMAT_R8UI;
- case GL_RG8UI: return sw::FORMAT_G8R8UI;
- case GL_RGB8UI: return sw::FORMAT_X8B8G8R8UI;
- case GL_RGBA8UI: return sw::FORMAT_A8B8G8R8UI;
- case GL_R16I: return sw::FORMAT_R16I;
- case GL_RG16I: return sw::FORMAT_G16R16I;
- case GL_RGB16I: return sw::FORMAT_X16B16G16R16I;
- case GL_RGBA16I: return sw::FORMAT_A16B16G16R16I;
- case GL_R16UI: return sw::FORMAT_R16UI;
- case GL_RG16UI: return sw::FORMAT_G16R16UI;
- case GL_RGB16UI: return sw::FORMAT_X16B16G16R16UI;
- case GL_RGBA16UI: return sw::FORMAT_A16B16G16R16UI;
- case GL_R32I: return sw::FORMAT_R32I;
- case GL_RG32I: return sw::FORMAT_G32R32I;
- case GL_RGB32I: return sw::FORMAT_X32B32G32R32I;
- case GL_RGBA32I: return sw::FORMAT_A32B32G32R32I;
- case GL_R32UI: return sw::FORMAT_R32UI;
- case GL_RG32UI: return sw::FORMAT_G32R32UI;
- case GL_RGB32UI: return sw::FORMAT_X32B32G32R32UI;
- case GL_RGBA32UI: return sw::FORMAT_A32B32G32R32UI;
- case GL_R16F: return sw::FORMAT_R16F;
- case GL_RG16F: return sw::FORMAT_G16R16F;
- case GL_R11F_G11F_B10F: return sw::FORMAT_X16B16G16R16F_UNSIGNED;
- case GL_RGB16F: return sw::FORMAT_X16B16G16R16F;
- case GL_RGBA16F: return sw::FORMAT_A16B16G16R16F;
- case GL_R32F: return sw::FORMAT_R32F;
- case GL_RG32F: return sw::FORMAT_G32R32F;
- case GL_RGB32F: return sw::FORMAT_X32B32G32R32F;
- case GL_RGBA32F: return sw::FORMAT_A32B32G32R32F;
- case GL_RGB10_A2: return sw::FORMAT_A2B10G10R10;
- case GL_RGB10_A2UI: return sw::FORMAT_A2B10G10R10UI;
- case GL_SRGB8: return sw::FORMAT_SRGB8_X8;
- case GL_SRGB8_ALPHA8: return sw::FORMAT_SRGB8_A8;
-
- case GL_ETC1_RGB8_OES: return sw::FORMAT_ETC1;
- case GL_COMPRESSED_R11_EAC: return sw::FORMAT_R11_EAC;
- case GL_COMPRESSED_SIGNED_R11_EAC: return sw::FORMAT_SIGNED_R11_EAC;
- case GL_COMPRESSED_RG11_EAC: return sw::FORMAT_RG11_EAC;
- case GL_COMPRESSED_SIGNED_RG11_EAC: return sw::FORMAT_SIGNED_RG11_EAC;
- case GL_COMPRESSED_RGB8_ETC2: return sw::FORMAT_RGB8_ETC2;
- case GL_COMPRESSED_SRGB8_ETC2: return sw::FORMAT_SRGB8_ETC2;
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return sw::FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return sw::FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
- case GL_COMPRESSED_RGBA8_ETC2_EAC: return sw::FORMAT_RGBA8_ETC2_EAC;
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: return sw::FORMAT_SRGB8_ALPHA8_ETC2_EAC;
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT: return sw::FORMAT_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: return sw::FORMAT_DXT1;
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE: return sw::FORMAT_DXT3;
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE: return sw::FORMAT_DXT5;
-
- case GL_ALPHA32F_EXT: return sw::FORMAT_A32F;
- case GL_LUMINANCE32F_EXT: return sw::FORMAT_L32F;
- case GL_LUMINANCE_ALPHA32F_EXT: return sw::FORMAT_A32L32F;
- case GL_RGB9_E5: return sw::FORMAT_X16B16G16R16F_UNSIGNED;
- case GL_ALPHA16F_EXT: return sw::FORMAT_A16F;
- case GL_LUMINANCE16F_EXT: return sw::FORMAT_L16F;
- case GL_LUMINANCE_ALPHA16F_EXT: return sw::FORMAT_A16L16F;
- case GL_R8_SNORM: return sw::FORMAT_R8_SNORM;
- case GL_RG8_SNORM: return sw::FORMAT_G8R8_SNORM;
- case GL_RGB8_SNORM: return sw::FORMAT_X8B8G8R8_SNORM;
- case GL_RGBA8_SNORM: return sw::FORMAT_A8B8G8R8_SNORM;
- case GL_LUMINANCE8_EXT: return sw::FORMAT_L8;
- case GL_LUMINANCE8_ALPHA8_EXT: return sw::FORMAT_A8L8;
- case GL_BGRA8_EXT: return sw::FORMAT_A8R8G8B8;
- case GL_ALPHA8_EXT: return sw::FORMAT_A8;
-
- case SW_YV12_BT601: return sw::FORMAT_YV12_BT601;
- case SW_YV12_BT709: return sw::FORMAT_YV12_BT709;
- case SW_YV12_JFIF: return sw::FORMAT_YV12_JFIF;
-
- default:
- UNREACHABLE(format); // Not a sized internal format.
- return sw::FORMAT_NULL;
- }
- }
-
- // Returns the size, in bytes, of a single client-side pixel.
- // OpenGL ES 3.0.5 table 3.2.
- GLsizei ComputePixelSize(GLenum format, GLenum type)
- {
- switch(format)
- {
- case GL_RED:
- case GL_RED_INTEGER:
- case GL_ALPHA:
- case GL_LUMINANCE:
- switch(type)
- {
- case GL_BYTE: return 1;
- case GL_UNSIGNED_BYTE: return 1;
- case GL_FLOAT: return 4;
- case GL_HALF_FLOAT: return 2;
- case GL_HALF_FLOAT_OES: return 2;
- case GL_SHORT: return 2;
- case GL_UNSIGNED_SHORT: return 2;
- case GL_INT: return 4;
- case GL_UNSIGNED_INT: return 4;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RG:
- case GL_RG_INTEGER:
- case GL_LUMINANCE_ALPHA:
- switch(type)
- {
- case GL_BYTE: return 2;
- case GL_UNSIGNED_BYTE: return 2;
- case GL_FLOAT: return 8;
- case GL_HALF_FLOAT: return 4;
- case GL_HALF_FLOAT_OES: return 4;
- case GL_SHORT: return 4;
- case GL_UNSIGNED_SHORT: return 4;
- case GL_INT: return 8;
- case GL_UNSIGNED_INT: return 8;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGB:
- case GL_RGB_INTEGER:
- switch(type)
- {
- case GL_BYTE: return 3;
- case GL_UNSIGNED_BYTE: return 3;
- case GL_UNSIGNED_SHORT_5_6_5: return 2;
- case GL_UNSIGNED_INT_10F_11F_11F_REV: return 4;
- case GL_UNSIGNED_INT_5_9_9_9_REV: return 4;
- case GL_FLOAT: return 12;
- case GL_HALF_FLOAT: return 6;
- case GL_HALF_FLOAT_OES: return 6;
- case GL_SHORT: return 6;
- case GL_UNSIGNED_SHORT: return 6;
- case GL_INT: return 12;
- case GL_UNSIGNED_INT: return 12;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGBA:
- case GL_RGBA_INTEGER:
- case GL_BGRA_EXT:
- switch(type)
- {
- case GL_BYTE: return 4;
- case GL_UNSIGNED_BYTE: return 4;
- case GL_UNSIGNED_SHORT_4_4_4_4: return 2;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: return 2;
- case GL_UNSIGNED_SHORT_5_5_5_1: return 2;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: return 2;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return 4;
- case GL_FLOAT: return 16;
- case GL_HALF_FLOAT: return 8;
- case GL_HALF_FLOAT_OES: return 8;
- case GL_SHORT: return 8;
- case GL_UNSIGNED_SHORT: return 8;
- case GL_INT: return 16;
- case GL_UNSIGNED_INT: return 16;
- default: UNREACHABLE(type);
- }
- break;
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_FLOAT: return 4;
- case GL_UNSIGNED_SHORT: return 2;
- case GL_UNSIGNED_INT: return 4;
- default: UNREACHABLE(type);
- }
- break;
- case GL_DEPTH_STENCIL:
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8: return 4;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return 8;
- default: UNREACHABLE(type);
- }
- break;
- default:
- UNREACHABLE(format);
- }
-
- return 0;
- }
-
- GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment)
- {
- ASSERT(alignment > 0 && sw::isPow2(alignment));
-
- GLsizei rawPitch = ComputePixelSize(format, type) * width;
- return (rawPitch + alignment - 1) & ~(alignment - 1);
- }
-
- size_t ComputePackingOffset(GLenum format, GLenum type, GLsizei width, GLsizei height, const gl::PixelStorageModes &storageModes)
- {
- GLsizei pitchB = ComputePitch(width, format, type, storageModes.alignment);
- return (storageModes.skipImages * height + storageModes.skipRows) * pitchB + storageModes.skipPixels * ComputePixelSize(format, type);
- }
-
- inline GLsizei ComputeCompressedPitch(GLsizei width, GLenum format)
- {
- return ComputeCompressedSize(width, 1, format);
- }
-
- inline int GetNumCompressedBlocks(int w, int h, int blockSizeX, int blockSizeY)
- {
- return ((w + blockSizeX - 1) / blockSizeX) * ((h + blockSizeY - 1) / blockSizeY);
- }
-
- GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format)
- {
- switch(format)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_ETC1_RGB8_OES:
- case GL_COMPRESSED_R11_EAC:
- case GL_COMPRESSED_SIGNED_R11_EAC:
- case GL_COMPRESSED_RGB8_ETC2:
- case GL_COMPRESSED_SRGB8_ETC2:
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- return 8 * GetNumCompressedBlocks(width, height, 4, 4);
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- case GL_COMPRESSED_RG11_EAC:
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- return 16 * GetNumCompressedBlocks(width, height, 4, 4);
- default:
- UNREACHABLE(format);
- return 0;
- }
- }
-}
-
-namespace egl
-{
- // We assume the image data can be indexed with a signed 32-bit offset,
- // so we must keep the size reasonable. 1 GiB ought to be enough for anybody.
- // 4 extra bytes account for the padding added in Surface::size().
- // They are not addressed separately, so can't cause overflow.
- // TODO(b/145229887): Eliminate or don't hard-code the padding bytes.
- enum : uint64_t { IMPLEMENTATION_MAX_IMAGE_SIZE_BYTES = 0x40000000u + 4 };
-
- enum TransferType
- {
- Bytes,
- RGB8toRGBX8,
- RGB16toRGBX16,
- RGB32toRGBX32,
- RGB32FtoRGBX32F,
- RGB16FtoRGBX16F,
- RGBA4toRGBA8,
- RGBA5_A1toRGBA8,
- R11G11B10FtoRGBX16F,
- RGB9_E5FtoRGBX16F,
- D16toD32F,
- D24X8toD32F,
- D32toD32F,
- D32FtoD32F_CLAMPED,
- D32FX32toD32F,
- X24S8toS8,
- X56S8toS8,
- RGBA1010102toRGBA8,
- RGB8toRGB565,
- R32FtoR16F,
- RG32FtoRG16F,
- RGB32FtoRGB16F,
- RGB32FtoRGB16F_UNSIGNED,
- RGBA32FtoRGBA16F
- };
-
- template<TransferType transferType>
- void TransferRow(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes);
-
- template<>
- void TransferRow<Bytes>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- memcpy(dest, source, width * bytes);
- }
-
- template<>
- void TransferRow<RGB8toRGBX8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- unsigned char *destB = dest;
-
- for(int x = 0; x < width; x++)
- {
- destB[4 * x + 0] = source[x * 3 + 0];
- destB[4 * x + 1] = source[x * 3 + 1];
- destB[4 * x + 2] = source[x * 3 + 2];
- destB[4 * x + 3] = 0xFF;
- }
- }
-
- template<>
- void TransferRow<RGB16toRGBX16>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned short *sourceS = reinterpret_cast<const unsigned short*>(source);
- unsigned short *destS = reinterpret_cast<unsigned short*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destS[4 * x + 0] = sourceS[x * 3 + 0];
- destS[4 * x + 1] = sourceS[x * 3 + 1];
- destS[4 * x + 2] = sourceS[x * 3 + 2];
- destS[4 * x + 3] = 0xFFFF;
- }
- }
-
- template<>
- void TransferRow<RGB32toRGBX32>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned int *sourceI = reinterpret_cast<const unsigned int*>(source);
- unsigned int *destI = reinterpret_cast<unsigned int*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destI[4 * x + 0] = sourceI[x * 3 + 0];
- destI[4 * x + 1] = sourceI[x * 3 + 1];
- destI[4 * x + 2] = sourceI[x * 3 + 2];
- destI[4 * x + 3] = 0xFFFFFFFF;
- }
- }
-
- template<>
- void TransferRow<RGB32FtoRGBX32F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *sourceF = reinterpret_cast<const float*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destF[4 * x + 0] = sourceF[x * 3 + 0];
- destF[4 * x + 1] = sourceF[x * 3 + 1];
- destF[4 * x + 2] = sourceF[x * 3 + 2];
- destF[4 * x + 3] = 1.0f;
- }
- }
-
- template<>
- void TransferRow<RGB16FtoRGBX16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned short *sourceH = reinterpret_cast<const unsigned short*>(source);
- unsigned short *destH = reinterpret_cast<unsigned short*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destH[4 * x + 0] = sourceH[x * 3 + 0];
- destH[4 * x + 1] = sourceH[x * 3 + 1];
- destH[4 * x + 2] = sourceH[x * 3 + 2];
- destH[4 * x + 3] = 0x3C00; // SEEEEEMMMMMMMMMM, S = 0, E = 15, M = 0: 16-bit floating-point representation of 1.0
- }
- }
-
- template<>
- void TransferRow<RGBA4toRGBA8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned short *source4444 = reinterpret_cast<const unsigned short*>(source);
- unsigned char *dest4444 = dest;
-
- for(int x = 0; x < width; x++)
- {
- unsigned short rgba = source4444[x];
- dest4444[4 * x + 0] = ((rgba & 0xF000) >> 8) | ((rgba & 0xF000) >> 12);
- dest4444[4 * x + 1] = ((rgba & 0x0F00) >> 4) | ((rgba & 0x0F00) >> 8);
- dest4444[4 * x + 2] = ((rgba & 0x00F0) << 0) | ((rgba & 0x00F0) >> 4);
- dest4444[4 * x + 3] = ((rgba & 0x000F) << 4) | ((rgba & 0x000F) >> 0);
- }
- }
-
- template<>
- void TransferRow<RGBA5_A1toRGBA8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned short *source5551 = reinterpret_cast<const unsigned short*>(source);
- unsigned char *dest8888 = dest;
-
- for(int x = 0; x < width; x++)
- {
- unsigned short rgba = source5551[x];
- dest8888[4 * x + 0] = ((rgba & 0xF800) >> 8) | ((rgba & 0xF800) >> 13);
- dest8888[4 * x + 1] = ((rgba & 0x07C0) >> 3) | ((rgba & 0x07C0) >> 8);
- dest8888[4 * x + 2] = ((rgba & 0x003E) << 2) | ((rgba & 0x003E) >> 3);
- dest8888[4 * x + 3] = (rgba & 0x0001) ? 0xFF : 0;
- }
- }
-
- template<>
- void TransferRow<RGBA1010102toRGBA8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned int *source1010102 = reinterpret_cast<const unsigned int*>(source);
- unsigned char *dest8888 = dest;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int rgba = source1010102[x];
- dest8888[4 * x + 0] = sw::unorm<8>((rgba & 0x000003FF) * (1.0f / 0x000003FF));
- dest8888[4 * x + 1] = sw::unorm<8>((rgba & 0x000FFC00) * (1.0f / 0x000FFC00));
- dest8888[4 * x + 2] = sw::unorm<8>((rgba & 0x3FF00000) * (1.0f / 0x3FF00000));
- dest8888[4 * x + 3] = sw::unorm<8>((rgba & 0xC0000000) * (1.0f / 0xC0000000));
- }
- }
-
- template<>
- void TransferRow<RGB8toRGB565>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- unsigned short *dest565 = reinterpret_cast<unsigned short*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- float r = source[3 * x + 0] * (1.0f / 0xFF);
- float g = source[3 * x + 1] * (1.0f / 0xFF);
- float b = source[3 * x + 2] * (1.0f / 0xFF);
- dest565[x] = (sw::unorm<5>(r) << 11) | (sw::unorm<6>(g) << 5) | (sw::unorm<5>(b) << 0);
- }
- }
-
- template<>
- void TransferRow<R11G11B10FtoRGBX16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const sw::R11G11B10F *sourceRGB = reinterpret_cast<const sw::R11G11B10F*>(source);
- sw::half *destF = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++, sourceRGB++, destF += 4)
- {
- sourceRGB->toRGB16F(destF);
- destF[3] = 1.0f;
- }
- }
-
- template<>
- void TransferRow<RGB9_E5FtoRGBX16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const sw::RGB9E5 *sourceRGB = reinterpret_cast<const sw::RGB9E5*>(source);
- sw::half *destF = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++, sourceRGB++, destF += 4)
- {
- sourceRGB->toRGB16F(destF);
- destF[3] = 1.0f;
- }
- }
-
- template<>
- void TransferRow<R32FtoR16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *source32F = reinterpret_cast<const float*>(source);
- sw::half *dest16F = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- dest16F[x] = source32F[x];
- }
- }
-
- template<>
- void TransferRow<RG32FtoRG16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *source32F = reinterpret_cast<const float*>(source);
- sw::half *dest16F = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- dest16F[2 * x + 0] = source32F[2 * x + 0];
- dest16F[2 * x + 1] = source32F[2 * x + 1];
- }
- }
-
- template<>
- void TransferRow<RGB32FtoRGB16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *source32F = reinterpret_cast<const float*>(source);
- sw::half *dest16F = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- dest16F[4 * x + 0] = source32F[3 * x + 0];
- dest16F[4 * x + 1] = source32F[3 * x + 1];
- dest16F[4 * x + 2] = source32F[3 * x + 2];
- dest16F[4 * x + 3] = 1.0f;
- }
- }
-
- template<>
- void TransferRow<RGB32FtoRGB16F_UNSIGNED>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *source32F = reinterpret_cast<const float*>(source);
- sw::half *dest16F = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- dest16F[4 * x + 0] = std::max(source32F[3 * x + 0], 0.0f);
- dest16F[4 * x + 1] = std::max(source32F[3 * x + 1], 0.0f);
- dest16F[4 * x + 2] = std::max(source32F[3 * x + 2], 0.0f);
- dest16F[4 * x + 3] = 1.0f;
- }
- }
-
- template<>
- void TransferRow<RGBA32FtoRGBA16F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *source32F = reinterpret_cast<const float*>(source);
- sw::half *dest16F = reinterpret_cast<sw::half*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- dest16F[4 * x + 0] = source32F[4 * x + 0];
- dest16F[4 * x + 1] = source32F[4 * x + 1];
- dest16F[4 * x + 2] = source32F[4 * x + 2];
- dest16F[4 * x + 3] = source32F[4 * x + 3];
- }
- }
-
- template<>
- void TransferRow<D16toD32F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned short *sourceD16 = reinterpret_cast<const unsigned short*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destF[x] = (float)sourceD16[x] / 0xFFFF;
- }
- }
-
- template<>
- void TransferRow<D24X8toD32F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned int *sourceD24 = reinterpret_cast<const unsigned int*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destF[x] = (float)(sourceD24[x] & 0xFFFFFF00) / 0xFFFFFF00;
- }
- }
-
- template<>
- void TransferRow<D32toD32F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned int *sourceD32 = reinterpret_cast<const unsigned int*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- // NOTE: Second (float) cast is required to avoid compiler warning:
- // error: implicit conversion from 'unsigned int' to 'float' changes value from
- // 4294967295 to 4294967296 [-Werror,-Wimplicit-int-float-conversion]
- destF[x] = (float)sourceD32[x] / (float)0xFFFFFFFF;
- }
- }
-
- template<>
- void TransferRow<D32FtoD32F_CLAMPED>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const float *sourceF = reinterpret_cast<const float*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destF[x] = sw::clamp(sourceF[x], 0.0f, 1.0f);
- }
- }
-
- template<>
- void TransferRow<D32FX32toD32F>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- struct D32FS8 { float depth32f; unsigned int stencil24_8; };
- const D32FS8 *sourceD32FS8 = reinterpret_cast<const D32FS8*>(source);
- float *destF = reinterpret_cast<float*>(dest);
-
- for(int x = 0; x < width; x++)
- {
- destF[x] = sw::clamp(sourceD32FS8[x].depth32f, 0.0f, 1.0f);
- }
- }
-
- template<>
- void TransferRow<X24S8toS8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- const unsigned int *sourceI = reinterpret_cast<const unsigned int*>(source);
- unsigned char *destI = dest;
-
- for(int x = 0; x < width; x++)
- {
- destI[x] = static_cast<unsigned char>(sourceI[x] & 0x000000FF); // FIXME: Quad layout
- }
- }
-
- template<>
- void TransferRow<X56S8toS8>(unsigned char *dest, const unsigned char *source, GLsizei width, GLsizei bytes)
- {
- struct D32FS8 { float depth32f; unsigned int stencil24_8; };
- const D32FS8 *sourceD32FS8 = reinterpret_cast<const D32FS8*>(source);
- unsigned char *destI = dest;
-
- for(int x = 0; x < width; x++)
- {
- destI[x] = static_cast<unsigned char>(sourceD32FS8[x].stencil24_8 & 0x000000FF); // FIXME: Quad layout
- }
- }
-
- struct Rectangle
- {
- GLsizei bytes;
- GLsizei width;
- GLsizei height;
- GLsizei depth;
- int inputPitch;
- int inputHeight;
- int destPitch;
- GLsizei destSlice;
- };
-
- template<TransferType transferType>
- void Transfer(void *buffer, const void *input, const Rectangle &rect)
- {
- for(int z = 0; z < rect.depth; z++)
- {
- const unsigned char *inputStart = static_cast<const unsigned char*>(input) + (z * rect.inputPitch * rect.inputHeight);
- unsigned char *destStart = static_cast<unsigned char*>(buffer) + (z * rect.destSlice);
- for(int y = 0; y < rect.height; y++)
- {
- const unsigned char *source = inputStart + y * rect.inputPitch;
- unsigned char *dest = destStart + y * rect.destPitch;
-
- TransferRow<transferType>(dest, source, rect.width, rect.bytes);
- }
- }
- }
-
- class ImageImplementation : public Image
- {
- public:
- ImageImplementation(Texture *parentTexture, GLsizei width, GLsizei height, GLint internalformat)
- : Image(parentTexture, width, height, internalformat) {}
- ImageImplementation(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, int border, GLint internalformat)
- : Image(parentTexture, width, height, depth, border, internalformat) {}
- ImageImplementation(GLsizei width, GLsizei height, GLint internalformat, int pitchP)
- : Image(width, height, internalformat, pitchP) {}
- ImageImplementation(GLsizei width, GLsizei height, GLint internalformat, int multiSampleDepth, bool lockable)
- : Image(width, height, internalformat, multiSampleDepth, lockable) {}
-
- ~ImageImplementation() override
- {
- sync(); // Wait for any threads that use this image to finish.
- }
-
- void *lockInternal(int x, int y, int z, sw::Lock lock, sw::Accessor client) override
- {
- return Image::lockInternal(x, y, z, lock, client);
- }
-
- void unlockInternal() override
- {
- return Image::unlockInternal();
- }
-
- void release() override
- {
- return Image::release();
- }
- };
-
- Image *Image::create(Texture *parentTexture, GLsizei width, GLsizei height, GLint internalformat)
- {
- if(size(width, height, 1, 0, 1, internalformat) > IMPLEMENTATION_MAX_IMAGE_SIZE_BYTES)
- {
- return nullptr;
- }
-
- return new ImageImplementation(parentTexture, width, height, internalformat);
- }
-
- Image *Image::create(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, int border, GLint internalformat)
- {
- if(size(width, height, depth, border, 1, internalformat) > IMPLEMENTATION_MAX_IMAGE_SIZE_BYTES)
- {
- return nullptr;
- }
-
- return new ImageImplementation(parentTexture, width, height, depth, border, internalformat);
- }
-
- Image *Image::create(GLsizei width, GLsizei height, GLint internalformat, int pitchP)
- {
- if(size(pitchP, height, 1, 0, 1, internalformat) > IMPLEMENTATION_MAX_IMAGE_SIZE_BYTES)
- {
- return nullptr;
- }
-
- return new ImageImplementation(width, height, internalformat, pitchP);
- }
-
- Image *Image::create(GLsizei width, GLsizei height, GLint internalformat, int multiSampleDepth, bool lockable)
- {
- if(size(width, height, 1, 0, multiSampleDepth, internalformat) > IMPLEMENTATION_MAX_IMAGE_SIZE_BYTES)
- {
- return nullptr;
- }
-
- return new ImageImplementation(width, height, internalformat, multiSampleDepth, lockable);
- }
-
- size_t Image::size(int width, int height, int depth, int border, int samples, GLint internalformat)
- {
- return sw::Surface::size(width, height, depth, border, samples, gl::SelectInternalFormat(internalformat));
- }
-
- int ClientBuffer::getWidth() const
- {
- return width;
- }
-
- int ClientBuffer::getHeight() const
- {
- return height;
- }
-
- sw::Format ClientBuffer::getFormat() const
- {
- return format;
- }
-
- size_t ClientBuffer::getPlane() const
- {
- return plane;
- }
-
- int ClientBuffer::pitchP() const
- {
-#if defined(__APPLE__)
- if(buffer)
- {
- IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(buffer);
- int pitchB = static_cast<int>(IOSurfaceGetBytesPerRowOfPlane(ioSurface, plane));
- int bytesPerPixel = sw::Surface::bytes(format);
- ASSERT((pitchB % bytesPerPixel) == 0);
- return pitchB / bytesPerPixel;
- }
-
- return 0;
-#else
- return sw::Surface::pitchP(width, 0, format, false);
-#endif
- }
-
- void ClientBuffer::retain()
- {
-#if defined(__APPLE__)
- if(buffer)
- {
- CFRetain(reinterpret_cast<IOSurfaceRef>(buffer));
- }
-#endif
- }
-
- void ClientBuffer::release()
- {
-#if defined(__APPLE__)
- if(buffer)
- {
- CFRelease(reinterpret_cast<IOSurfaceRef>(buffer));
- buffer = nullptr;
- }
-#endif
- }
-
- void* ClientBuffer::lock(int x, int y, int z)
- {
-#if defined(__APPLE__)
- if(buffer)
- {
- IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(buffer);
- IOSurfaceLock(ioSurface, 0, nullptr);
- void* pixels = IOSurfaceGetBaseAddressOfPlane(ioSurface, plane);
- int bytes = sw::Surface::bytes(format);
- int pitchB = static_cast<int>(IOSurfaceGetBytesPerRowOfPlane(ioSurface, plane));
- int sliceB = static_cast<int>(IOSurfaceGetHeightOfPlane(ioSurface, plane)) * pitchB;
- return (unsigned char*)pixels + x * bytes + y * pitchB + z * sliceB;
- }
-
- return nullptr;
-#else
- int bytes = sw::Surface::bytes(format);
- int pitchB = sw::Surface::pitchB(width, 0, format, false);
- int sliceB = height * pitchB;
- return (unsigned char*)buffer + x * bytes + y * pitchB + z * sliceB;
-#endif
- }
-
- void ClientBuffer::unlock()
- {
-#if defined(__APPLE__)
- if(buffer)
- {
- IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(buffer);
- IOSurfaceUnlock(ioSurface, 0, nullptr);
- }
-#endif
- }
-
- bool ClientBuffer::requiresSync() const
- {
-#if defined(__APPLE__)
- return true;
-#else
- return false;
-#endif
- }
-
- class ClientBufferImage : public egl::Image
- {
- public:
- explicit ClientBufferImage(const ClientBuffer& clientBuffer) :
- egl::Image(clientBuffer.getWidth(),
- clientBuffer.getHeight(),
- getClientBufferInternalFormat(clientBuffer.getFormat()),
- clientBuffer.pitchP()),
- clientBuffer(clientBuffer)
- {
- shared = false;
- this->clientBuffer.retain();
- }
-
- private:
- ClientBuffer clientBuffer;
-
- ~ClientBufferImage() override
- {
- sync(); // Wait for any threads that use this image to finish.
-
- clientBuffer.release();
- }
-
- static GLint getClientBufferInternalFormat(sw::Format format)
- {
- switch(format)
- {
- case sw::FORMAT_R8: return GL_R8;
- case sw::FORMAT_G8R8: return GL_RG8;
- case sw::FORMAT_X8R8G8B8: return GL_RGB8;
- case sw::FORMAT_A8R8G8B8: return GL_BGRA8_EXT;
- case sw::FORMAT_R16UI: return GL_R16UI;
- case sw::FORMAT_A16B16G16R16F: return GL_RGBA16F;
- default: return GL_NONE;
- }
- }
-
- void *lockInternal(int x, int y, int z, sw::Lock lock, sw::Accessor client) override
- {
- LOGLOCK("image=%p op=%s.swsurface lock=%d", this, __FUNCTION__, lock);
-
- // Always do this for reference counting.
- void *data = sw::Surface::lockInternal(x, y, z, lock, client);
-
- if(x != 0 || y != 0 || z != 0)
- {
- LOGLOCK("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
- }
-
- LOGLOCK("image=%p op=%s.ani lock=%d", this, __FUNCTION__, lock);
-
- // Lock the ClientBuffer and use its address.
- data = clientBuffer.lock(x, y, z);
-
- if(lock == sw::LOCK_UNLOCKED)
- {
- // We're never going to get a corresponding unlock, so unlock
- // immediately. This keeps the reference counts sane.
- clientBuffer.unlock();
- }
-
- return data;
- }
-
- void unlockInternal() override
- {
- LOGLOCK("image=%p op=%s.ani", this, __FUNCTION__);
- clientBuffer.unlock();
-
- LOGLOCK("image=%p op=%s.swsurface", this, __FUNCTION__);
- sw::Surface::unlockInternal();
- }
-
- void *lock(int x, int y, int z, sw::Lock lock) override
- {
- LOGLOCK("image=%p op=%s lock=%d", this, __FUNCTION__, lock);
- (void)sw::Surface::lockExternal(x, y, z, lock, sw::PUBLIC);
-
- return clientBuffer.lock(x, y, z);
- }
-
- void unlock() override
- {
- LOGLOCK("image=%p op=%s.ani", this, __FUNCTION__);
- clientBuffer.unlock();
-
- LOGLOCK("image=%p op=%s.swsurface", this, __FUNCTION__);
- sw::Surface::unlockExternal();
- }
-
- bool requiresSync() const override
- {
- return clientBuffer.requiresSync();
- }
-
- void release() override
- {
- Image::release();
- }
- };
-
- Image *Image::create(const egl::ClientBuffer& clientBuffer)
- {
- return new ClientBufferImage(clientBuffer);
- }
-
- Image::~Image()
- {
- // sync() must be called in the destructor of the most derived class to ensure their vtable isn't destroyed
- // before all threads are done using this image. Image itself is abstract so it can't be the most derived.
- ASSERT(isUnlocked());
-
- if(parentTexture)
- {
- parentTexture->release();
- }
-
- ASSERT(!shared);
- }
-
- void *Image::lockInternal(int x, int y, int z, sw::Lock lock, sw::Accessor client)
- {
- return Surface::lockInternal(x, y, z, lock, client);
- }
-
- void Image::unlockInternal()
- {
- Surface::unlockInternal();
- }
-
- void Image::release()
- {
- int refs = dereference();
-
- if(refs > 0)
- {
- if(parentTexture)
- {
- parentTexture->sweep();
- }
- }
- else
- {
- delete this;
- }
- }
-
- void Image::unbind(const egl::Texture *parent)
- {
- if(parentTexture == parent)
- {
- parentTexture = nullptr;
- }
-
- release();
- }
-
- bool Image::isChildOf(const egl::Texture *parent) const
- {
- return parentTexture == parent;
- }
-
- void Image::loadImageData(GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, GLenum format, GLenum type, const void *input, void *buffer)
- {
- Rectangle rect;
- rect.bytes = gl::ComputePixelSize(format, type);
- rect.width = width;
- rect.height = height;
- rect.depth = depth;
- rect.inputPitch = inputPitch;
- rect.inputHeight = inputHeight;
- rect.destPitch = getPitch();
- rect.destSlice = getSlice();
-
- // [OpenGL ES 3.0.5] table 3.2 and 3.3.
- switch(format)
- {
- case GL_RGBA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- switch(internalformat)
- {
- case GL_RGBA8:
- case GL_SRGB8_ALPHA8:
- return Transfer<Bytes>(buffer, input, rect);
- case GL_RGB5_A1:
- case GL_RGBA4:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_A8B8G8R8);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(internalformat);
- }
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGBA8_SNORM && getExternalFormat() == sw::FORMAT_A8B8G8R8_SNORM);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_SHORT_4_4_4_4:
- ASSERT_OR_RETURN(internalformat == GL_RGBA4 && getExternalFormat() == sw::FORMAT_A8B8G8R8);
- return Transfer<RGBA4toRGBA8>(buffer, input, rect);
- case GL_UNSIGNED_SHORT_5_5_5_1:
- ASSERT_OR_RETURN(internalformat == GL_RGB5_A1 && getExternalFormat() == sw::FORMAT_A8B8G8R8);
- return Transfer<RGBA5_A1toRGBA8>(buffer, input, rect);
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- switch(internalformat)
- {
- case GL_RGB10_A2:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_A2B10G10R10);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_RGB5_A1:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_A8B8G8R8);
- return Transfer<RGBA1010102toRGBA8>(buffer, input, rect);
- default:
- UNREACHABLE(internalformat);
- }
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- ASSERT_OR_RETURN(internalformat == GL_RGBA16F && getExternalFormat() == sw::FORMAT_A16B16G16R16F);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_RGBA32F: return Transfer<Bytes>(buffer, input, rect);
- case GL_RGBA16F: return Transfer<RGBA32FtoRGBA16F>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- default:
- UNREACHABLE(type);
- }
- case GL_RGBA_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGBA8UI && getExternalFormat() == sw::FORMAT_A8B8G8R8UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGBA8I && getExternalFormat() == sw::FORMAT_A8B8G8R8I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RGBA16UI && getExternalFormat() == sw::FORMAT_A16B16G16R16UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RGBA16I && getExternalFormat() == sw::FORMAT_A16B16G16R16I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_INT:
- ASSERT_OR_RETURN(internalformat == GL_RGBA32UI && getExternalFormat() == sw::FORMAT_A32B32G32R32UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_INT:
- ASSERT_OR_RETURN(internalformat == GL_RGBA32I && getExternalFormat() == sw::FORMAT_A32B32G32R32I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- ASSERT_OR_RETURN(internalformat == GL_RGB10_A2UI && getExternalFormat() == sw::FORMAT_A2B10G10R10UI);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- case GL_BGRA_EXT:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_BGRA8_EXT && getExternalFormat() == sw::FORMAT_A8R8G8B8);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: // Only valid for glReadPixels calls.
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: // Only valid for glReadPixels calls.
- default:
- UNREACHABLE(type);
- }
- case GL_RGB:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- switch(internalformat)
- {
- case GL_RGB8: return Transfer<RGB8toRGBX8>(buffer, input, rect);
- case GL_SRGB8: return Transfer<RGB8toRGBX8>(buffer, input, rect);
- case GL_RGB565: return Transfer<RGB8toRGB565>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGB8_SNORM && getExternalFormat() == sw::FORMAT_X8B8G8R8_SNORM);
- return Transfer<RGB8toRGBX8>(buffer, input, rect);
- case GL_UNSIGNED_SHORT_5_6_5:
- ASSERT_OR_RETURN(internalformat == GL_RGB565 && getExternalFormat() == sw::FORMAT_R5G6B5);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_INT_10F_11F_11F_REV:
- ASSERT_OR_RETURN(internalformat == GL_R11F_G11F_B10F && getExternalFormat() == sw::FORMAT_X16B16G16R16F_UNSIGNED);
- return Transfer<R11G11B10FtoRGBX16F>(buffer, input, rect);
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- ASSERT_OR_RETURN(internalformat == GL_RGB9_E5 && getExternalFormat() == sw::FORMAT_X16B16G16R16F_UNSIGNED);
- return Transfer<RGB9_E5FtoRGBX16F>(buffer, input, rect);
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- switch(internalformat)
- {
- case GL_RGB16F:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_X16B16G16R16F);
- return Transfer<RGB16FtoRGBX16F>(buffer, input, rect);
- case GL_R11F_G11F_B10F:
- case GL_RGB9_E5:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_X16B16G16R16F_UNSIGNED);
- return Transfer<RGB16FtoRGBX16F>(buffer, input, rect);
- default:
- UNREACHABLE(internalformat);
- }
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_RGB32F:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_X32B32G32R32F);
- return Transfer<RGB32FtoRGBX32F>(buffer, input, rect);
- case GL_RGB16F:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_X16B16G16R16F);
- return Transfer<RGB32FtoRGB16F>(buffer, input, rect);
- case GL_R11F_G11F_B10F:
- case GL_RGB9_E5:
- ASSERT_OR_RETURN(getExternalFormat() == sw::FORMAT_X16B16G16R16F_UNSIGNED);
- return Transfer<RGB32FtoRGB16F_UNSIGNED>(buffer, input, rect);
- default:
- UNREACHABLE(internalformat);
- }
- default:
- UNREACHABLE(type);
- }
- case GL_RGB_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGB8UI && getExternalFormat() == sw::FORMAT_X8B8G8R8UI);
- return Transfer<RGB8toRGBX8>(buffer, input, rect);
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RGB8I && getExternalFormat() == sw::FORMAT_X8B8G8R8I);
- return Transfer<RGB8toRGBX8>(buffer, input, rect);
- case GL_UNSIGNED_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RGB16UI && getExternalFormat() == sw::FORMAT_X16B16G16R16UI);
- return Transfer<RGB16toRGBX16>(buffer, input, rect);
- case GL_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RGB16I && getExternalFormat() == sw::FORMAT_X16B16G16R16I);
- return Transfer<RGB16toRGBX16>(buffer, input, rect);
- case GL_UNSIGNED_INT:
- ASSERT_OR_RETURN(internalformat == GL_RGB32UI && getExternalFormat() == sw::FORMAT_X32B32G32R32UI);
- return Transfer<RGB32toRGBX32>(buffer, input, rect);
- case GL_INT:
- ASSERT_OR_RETURN(internalformat == GL_RGB32I && getExternalFormat() == sw::FORMAT_X32B32G32R32I);
- return Transfer<RGB32toRGBX32>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- case GL_RG:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- return Transfer<Bytes>(buffer, input, rect);
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_RG32F: return Transfer<Bytes>(buffer, input, rect);
- case GL_RG16F: return Transfer<RG32FtoRG16F>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- default:
- UNREACHABLE(type);
- }
- case GL_RG_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RG8UI && getExternalFormat() == sw::FORMAT_G8R8UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_RG8I && getExternalFormat() == sw::FORMAT_G8R8I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RG16UI && getExternalFormat() == sw::FORMAT_G16R16UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_RG16I && getExternalFormat() == sw::FORMAT_G16R16I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_INT:
- ASSERT_OR_RETURN(internalformat == GL_RG32UI && getExternalFormat() == sw::FORMAT_G32R32UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_INT:
- ASSERT_OR_RETURN(internalformat == GL_RG32I && getExternalFormat() == sw::FORMAT_G32R32I);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- case GL_RED:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_BYTE:
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- return Transfer<Bytes>(buffer, input, rect);
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_R32F: return Transfer<Bytes>(buffer, input, rect);
- case GL_R16F: return Transfer<R32FtoR16F>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- default:
- UNREACHABLE(type);
- }
- case GL_RED_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_R8UI && getExternalFormat() == sw::FORMAT_R8UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_BYTE:
- ASSERT_OR_RETURN(internalformat == GL_R8I && getExternalFormat() == sw::FORMAT_R8I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_R16UI && getExternalFormat() == sw::FORMAT_R16UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_SHORT:
- ASSERT_OR_RETURN(internalformat == GL_R16I && getExternalFormat() == sw::FORMAT_R16I);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_UNSIGNED_INT:
- ASSERT_OR_RETURN(internalformat == GL_R32UI && getExternalFormat() == sw::FORMAT_R32UI);
- return Transfer<Bytes>(buffer, input, rect);
- case GL_INT:
- ASSERT_OR_RETURN(internalformat == GL_R32I && getExternalFormat() == sw::FORMAT_R32I);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_UNSIGNED_SHORT: return Transfer<D16toD32F>(buffer, input, rect);
- case GL_UNSIGNED_INT: return Transfer<D32toD32F>(buffer, input, rect);
- case GL_FLOAT: return Transfer<D32FtoD32F_CLAMPED>(buffer, input, rect);
- case GL_DEPTH_COMPONENT24: // Only valid for glRenderbufferStorage calls.
- case GL_DEPTH_COMPONENT32_OES: // Only valid for glRenderbufferStorage calls.
- default: UNREACHABLE(type);
- }
- case GL_DEPTH_STENCIL:
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8: return Transfer<D24X8toD32F>(buffer, input, rect);
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return Transfer<D32FX32toD32F>(buffer, input, rect);
- default: UNREACHABLE(type);
- }
- case GL_LUMINANCE_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- return Transfer<Bytes>(buffer, input, rect);
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_LUMINANCE_ALPHA32F_EXT: return Transfer<Bytes>(buffer, input, rect);
- case GL_LUMINANCE_ALPHA16F_EXT: return Transfer<RG32FtoRG16F>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- ASSERT_OR_RETURN(internalformat == GL_LUMINANCE_ALPHA16F_EXT);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- case GL_LUMINANCE:
- case GL_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- return Transfer<Bytes>(buffer, input, rect);
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_LUMINANCE32F_EXT: return Transfer<Bytes>(buffer, input, rect);
- case GL_LUMINANCE16F_EXT: return Transfer<R32FtoR16F>(buffer, input, rect);
- case GL_ALPHA32F_EXT: return Transfer<Bytes>(buffer, input, rect);
- case GL_ALPHA16F_EXT: return Transfer<R32FtoR16F>(buffer, input, rect);
- default: UNREACHABLE(internalformat);
- }
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- ASSERT_OR_RETURN(internalformat == GL_LUMINANCE16F_EXT || internalformat == GL_ALPHA16F_EXT);
- return Transfer<Bytes>(buffer, input, rect);
- default:
- UNREACHABLE(type);
- }
- default:
- UNREACHABLE(format);
- }
- }
-
- void Image::loadStencilData(GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, GLenum format, GLenum type, const void *input, void *buffer)
- {
- Rectangle rect;
- rect.bytes = gl::ComputePixelSize(format, type);
- rect.width = width;
- rect.height = height;
- rect.depth = depth;
- rect.inputPitch = inputPitch;
- rect.inputHeight = inputHeight;
- rect.destPitch = getStencilPitchB();
- rect.destSlice = getStencilSliceB();
-
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8: return Transfer<X24S8toS8>(buffer, input, rect);
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: return Transfer<X56S8toS8>(buffer, input, rect);
- default: UNREACHABLE(format);
- }
- }
-
- void Image::loadImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
- {
- GLsizei inputWidth = (unpackParameters.rowLength == 0) ? width : unpackParameters.rowLength;
- GLsizei inputPitch = gl::ComputePitch(inputWidth, format, type, unpackParameters.alignment);
- GLsizei inputHeight = (unpackParameters.imageHeight == 0) ? height : unpackParameters.imageHeight;
- char *input = ((char*)pixels) + gl::ComputePackingOffset(format, type, inputWidth, inputHeight, unpackParameters);
-
- void *buffer = lock(xoffset, yoffset, zoffset, sw::LOCK_WRITEONLY);
-
- if(buffer)
- {
- loadImageData(width, height, depth, inputPitch, inputHeight, format, type, input, buffer);
- }
-
- unlock();
-
- if(hasStencil())
- {
- unsigned char *stencil = reinterpret_cast<unsigned char*>(lockStencil(xoffset, yoffset, zoffset, sw::PUBLIC));
-
- if(stencil)
- {
- loadStencilData(width, height, depth, inputPitch, inputHeight, format, type, input, stencil);
- }
-
- unlockStencil();
- }
- }
-
- void Image::loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
- {
- int inputPitch = gl::ComputeCompressedPitch(width, internalformat);
- int inputSlice = imageSize / depth;
- int rows = inputSlice / inputPitch;
-
- void *buffer = lock(xoffset, yoffset, zoffset, sw::LOCK_WRITEONLY);
-
- if(buffer)
- {
- for(int z = 0; z < depth; z++)
- {
- for(int y = 0; y < rows; y++)
- {
- GLbyte *dest = (GLbyte*)buffer + y * getPitch() + z * getSlice();
- GLbyte *source = (GLbyte*)pixels + y * inputPitch + z * inputSlice;
- memcpy(dest, source, inputPitch);
- }
- }
- }
-
- unlock();
- }
-}
diff --git a/src/OpenGL/common/Image.hpp b/src/OpenGL/common/Image.hpp
deleted file mode 100644
index d0cec5884..000000000
--- a/src/OpenGL/common/Image.hpp
+++ /dev/null
@@ -1,369 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef egl_Image_hpp
-#define egl_Image_hpp
-
-#include "libEGL/Texture.hpp"
-#include "Renderer/Surface.hpp"
-
-#include <GLES3/gl3.h>
-#include <GLES2/gl2ext.h>
-
-#if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
-#include <system/graphics.h>
-#include <vndk/window.h>
-#include "../../Common/GrallocAndroid.hpp"
-#endif
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "../../Common/DebugAndroid.hpp"
-#define LOGLOCK(fmt, ...) // TRACE(fmt " tid=%d", ##__VA_ARGS__, gettid())
-#else
-#include <assert.h>
-#define LOGLOCK(...)
-#endif
-
-// Implementation-defined formats
-#define SW_YV12_BT601 0x32315659 // YCrCb 4:2:0 Planar, 16-byte aligned, BT.601 color space, studio swing
-#define SW_YV12_BT709 0x48315659 // YCrCb 4:2:0 Planar, 16-byte aligned, BT.709 color space, studio swing
-#define SW_YV12_JFIF 0x4A315659 // YCrCb 4:2:0 Planar, 16-byte aligned, BT.601 color space, full swing
-
-namespace gl
-{
-
-struct PixelStorageModes
-{
- GLint rowLength = 0;
- GLint skipRows = 0;
- GLint skipPixels = 0;
- GLint alignment = 4;
- GLint imageHeight = 0;
- GLint skipImages = 0;
-};
-
-GLint GetSizedInternalFormat(GLint internalFormat, GLenum type);
-sw::Format SelectInternalFormat(GLint format);
-bool IsUnsizedInternalFormat(GLint internalformat);
-GLenum GetBaseInternalFormat(GLint internalformat);
-GLsizei ComputePitch(GLsizei width, GLenum format, GLenum type, GLint alignment);
-GLsizei ComputeCompressedSize(GLsizei width, GLsizei height, GLenum format);
-GLsizei ComputePixelSize(GLenum format, GLenum type);
-size_t ComputePackingOffset(GLenum format, GLenum type, GLsizei width, GLsizei height, const PixelStorageModes &storageModes);
-
-}
-
-namespace egl
-{
-
-class ClientBuffer
-{
-public:
- ClientBuffer(int width, int height, sw::Format format, void* buffer, size_t plane)
- : width(width), height(height), format(format), buffer(buffer), plane(plane)
- {}
-
- int getWidth() const;
- int getHeight() const;
- sw::Format getFormat() const;
- size_t getPlane() const;
- int pitchP() const;
- void retain();
- void release();
- void* lock(int x, int y, int z);
- void unlock();
- bool requiresSync() const;
-
-private:
- int width;
- int height;
- sw::Format format;
- void* buffer;
- size_t plane;
-};
-
-class [[clang::lto_visibility_public]] Image : public sw::Surface, public gl::Object
-{
-protected:
- // 2D texture image
- Image(Texture *parentTexture, GLsizei width, GLsizei height, GLint internalformat)
- : sw::Surface(parentTexture->getResource(), width, height, 1, 0, 1, gl::SelectInternalFormat(internalformat), true, true),
- width(width), height(height), depth(1), internalformat(internalformat), parentTexture(parentTexture)
- {
- shared = false;
- Object::addRef();
- parentTexture->addRef();
- }
-
- // 3D/Cube texture image
- Image(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, int border, GLint internalformat)
- : sw::Surface(parentTexture->getResource(), width, height, depth, border, 1, gl::SelectInternalFormat(internalformat), true, true),
- width(width), height(height), depth(depth), internalformat(internalformat), parentTexture(parentTexture)
- {
- shared = false;
- Object::addRef();
- parentTexture->addRef();
- }
-
- // Native EGL image
- Image(GLsizei width, GLsizei height, GLint internalformat, int pitchP)
- : sw::Surface(nullptr, width, height, 1, 0, 1, gl::SelectInternalFormat(internalformat), true, true, pitchP),
- width(width), height(height), depth(1), internalformat(internalformat), parentTexture(nullptr)
- {
- shared = true;
- Object::addRef();
- }
-
- // Render target
- Image(GLsizei width, GLsizei height, GLint internalformat, int multiSampleDepth, bool lockable)
- : sw::Surface(nullptr, width, height, 1, 0, multiSampleDepth, gl::SelectInternalFormat(internalformat), lockable, true),
- width(width), height(height), depth(1), internalformat(internalformat), parentTexture(nullptr)
- {
- shared = false;
- Object::addRef();
- }
-
-public:
- // 2D texture image
- static Image *create(Texture *parentTexture, GLsizei width, GLsizei height, GLint internalformat);
-
- // 3D/Cube texture image
- static Image *create(Texture *parentTexture, GLsizei width, GLsizei height, GLsizei depth, int border, GLint internalformat);
-
- // Native EGL image
- static Image *create(GLsizei width, GLsizei height, GLint internalformat, int pitchP);
-
- // Render target
- static Image *create(GLsizei width, GLsizei height, GLint internalformat, int multiSampleDepth, bool lockable);
-
- // Back buffer from client buffer
- static Image *create(const egl::ClientBuffer& clientBuffer);
-
- static size_t size(int width, int height, int depth, int border, int samples, GLint internalformat);
-
- GLsizei getWidth() const
- {
- return width;
- }
-
- GLsizei getHeight() const
- {
- return height;
- }
-
- int getDepth() const
- {
- // FIXME: add member if the depth dimension (for 3D textures or 2D testure arrays)
- // and multi sample depth are ever simultaneously required.
- return depth;
- }
-
- GLint getFormat() const
- {
- return internalformat;
- }
-
- bool isShared() const
- {
- return shared;
- }
-
- void markShared()
- {
- shared = true;
- }
-
- virtual void *lock(int x, int y, int z, sw::Lock lock)
- {
- return lockExternal(x, y, z, lock, sw::PUBLIC);
- }
-
- unsigned int getPitch() const
- {
- return getExternalPitchB();
- }
-
- unsigned int getSlice() const
- {
- return getExternalSliceB();
- }
-
- virtual void unlock()
- {
- unlockExternal();
- }
-
- void *lockInternal(int x, int y, int z, sw::Lock lock, sw::Accessor client) override = 0;
- void unlockInternal() override = 0;
-
- void loadImageData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void loadCompressedData(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
-
- void release() override = 0;
- void unbind(const Texture *parent); // Break parent ownership and release
- bool isChildOf(const Texture *parent) const;
-
- virtual void destroyShared() // Release a shared image
- {
- assert(shared);
- shared = false;
- release();
- }
-
-protected:
- const GLsizei width;
- const GLsizei height;
- const int depth;
- const GLint internalformat;
-
- bool shared; // Used as an EGLImage
-
- egl::Texture *parentTexture;
-
- ~Image() override = 0;
-
- void loadImageData(GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, GLenum format, GLenum type, const void *input, void *buffer);
- void loadStencilData(GLsizei width, GLsizei height, GLsizei depth, int inputPitch, int inputHeight, GLenum format, GLenum type, const void *input, void *buffer);
-};
-
-#if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
-
-inline GLenum GLPixelFormatFromAndroid(int halFormat)
-{
- switch(halFormat)
- {
- case HAL_PIXEL_FORMAT_RGBA_8888: return GL_RGBA8;
-#if ANDROID_PLATFORM_SDK_VERSION > 16
- case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: return GL_RGB8;
-#endif
- case HAL_PIXEL_FORMAT_RGBX_8888: return GL_RGB8;
- case HAL_PIXEL_FORMAT_BGRA_8888: return GL_BGRA8_EXT;
- case HAL_PIXEL_FORMAT_RGB_565: return GL_RGB565;
- case HAL_PIXEL_FORMAT_YV12: return SW_YV12_BT601;
-#ifdef GRALLOC_MODULE_API_VERSION_0_2
- case HAL_PIXEL_FORMAT_YCbCr_420_888: return SW_YV12_BT601;
-#endif
-#if ANDROID_PLATFORM_SDK_VERSION >= 26
- case HAL_PIXEL_FORMAT_RGBA_FP16: return GL_RGBA16F;
-#endif
- case HAL_PIXEL_FORMAT_RGB_888: // Unsupported.
- default:
- ERR("Unsupported EGL image format %d", halFormat); ASSERT(false);
- return GL_NONE;
- }
-}
-
-class AndroidNativeImage : public egl::Image
-{
-public:
- explicit AndroidNativeImage(ANativeWindowBuffer *nativeBuffer)
- : egl::Image(nativeBuffer->width, nativeBuffer->height,
- GLPixelFormatFromAndroid(nativeBuffer->format),
- nativeBuffer->stride),
- nativeBuffer(nativeBuffer)
- {
- nativeBuffer->common.incRef(&nativeBuffer->common);
-
- GrallocModule::getInstance()->import(nativeBuffer->handle, &nativeBufferImportedHandle);
- }
-
-private:
- ANativeWindowBuffer *nativeBuffer;
- buffer_handle_t nativeBufferImportedHandle;
-
- ~AndroidNativeImage() override
- {
- sync(); // Wait for any threads that use this image to finish.
-
- GrallocModule::getInstance()->release(nativeBufferImportedHandle);
-
- nativeBuffer->common.decRef(&nativeBuffer->common);
- }
-
- void *lockInternal(int x, int y, int z, sw::Lock lock, sw::Accessor client) override
- {
- LOGLOCK("image=%p op=%s.swsurface lock=%d", this, __FUNCTION__, lock);
-
- // Always do this for reference counting.
- void *data = sw::Surface::lockInternal(x, y, z, lock, client);
-
- if(nativeBuffer)
- {
- if(x != 0 || y != 0 || z != 0)
- {
- TRACE("badness: %s called with unsupported parms: image=%p x=%d y=%d z=%d", __FUNCTION__, this, x, y, z);
- }
-
- LOGLOCK("image=%p op=%s.ani lock=%d", this, __FUNCTION__, lock);
-
- // Lock the ANativeWindowBuffer and use its address.
- data = lockNativeBuffer(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
- }
-
- return data;
- }
-
- void unlockInternal() override
- {
- if(nativeBuffer) // Unlock the buffer from ANativeWindowBuffer
- {
- LOGLOCK("image=%p op=%s.ani", this, __FUNCTION__);
- unlockNativeBuffer();
- }
-
- LOGLOCK("image=%p op=%s.swsurface", this, __FUNCTION__);
- sw::Surface::unlockInternal();
- }
-
- void *lock(int x, int y, int z, sw::Lock lock) override
- {
- LOGLOCK("image=%p op=%s lock=%d", this, __FUNCTION__, lock);
- (void)sw::Surface::lockExternal(x, y, z, lock, sw::PUBLIC);
-
- return lockNativeBuffer(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN);
- }
-
- void unlock() override
- {
- LOGLOCK("image=%p op=%s.ani", this, __FUNCTION__);
- unlockNativeBuffer();
-
- LOGLOCK("image=%p op=%s.swsurface", this, __FUNCTION__);
- sw::Surface::unlockExternal();
- }
-
- void *lockNativeBuffer(int usage)
- {
- void *buffer = nullptr;
- GrallocModule::getInstance()->lock(nativeBufferImportedHandle, usage, 0, 0, nativeBuffer->width, nativeBuffer->height, &buffer);
-
- return buffer;
- }
-
- void unlockNativeBuffer()
- {
- GrallocModule::getInstance()->unlock(nativeBufferImportedHandle);
- }
-
- void release() override
- {
- Image::release();
- }
-};
-
-#endif // __ANDROID__ && !defined(ANDROID_NDK_BUILD)
-
-}
-
-#endif // egl_Image_hpp
diff --git a/src/OpenGL/common/MatrixStack.cpp b/src/OpenGL/common/MatrixStack.cpp
deleted file mode 100644
index 4550285eb..000000000
--- a/src/OpenGL/common/MatrixStack.cpp
+++ /dev/null
@@ -1,217 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "MatrixStack.hpp"
-
-#include "Common/Math.hpp"
-
-namespace sw
-{
- MatrixStack::MatrixStack(int size)
- {
- stack = new Matrix[size];
- stack[0] = 1;
-
- top = 0;
- this->size = size;
- }
-
- MatrixStack::~MatrixStack()
- {
- delete[] stack;
- stack = 0;
- }
-
- void MatrixStack::identity()
- {
- stack[top] = 1;
- }
-
- void MatrixStack::load(const Matrix &M)
- {
- stack[top] = M;
- }
-
- void MatrixStack::load(const float *M)
- {
- stack[top] = Matrix(M[0], M[4], M[8], M[12],
- M[1], M[5], M[9], M[13],
- M[2], M[6], M[10], M[14],
- M[3], M[7], M[11], M[15]);
- }
-
- void MatrixStack::load(const double *M)
- {
- stack[top] = Matrix((float)M[0], (float)M[4], (float)M[8], (float)M[12],
- (float)M[1], (float)M[5], (float)M[9], (float)M[13],
- (float)M[2], (float)M[6], (float)M[10], (float)M[14],
- (float)M[3], (float)M[7], (float)M[11], (float)M[15]);
- }
-
- void MatrixStack::translate(float x, float y, float z)
- {
- stack[top] *= Matrix::translate(x, y, z);
- }
-
- void MatrixStack::translate(double x, double y, double z)
- {
- translate((float)x, (float)y, (float)z);
- }
-
- void MatrixStack::rotate(float angle, float x, float y, float z)
- {
- float n = 1.0f / sqrt(x*x + y*y + z*z);
-
- x *= n;
- y *= n;
- z *= n;
-
- float theta = angle * 0.0174532925f; // In radians
- float c = cos(theta);
- float _c = 1 - c;
- float s = sin(theta);
-
- // Rodrigues' rotation formula
- sw::Matrix rotate(c+x*x*_c, x*y*_c-z*s, x*z*_c+y*s,
- x*y*_c+z*s, c+y*y*_c, y*z*_c-x*s,
- x*z*_c-y*s, y*z*_c+x*s, c+z*z*_c);
-
- stack[top] *= rotate;
- }
-
- void MatrixStack::rotate(double angle, double x, double y, double z)
- {
- rotate((float)angle, (float)x, (float)y, (float)z);
- }
-
- void MatrixStack::scale(float x, float y, float z)
- {
- stack[top] *= Matrix::scale(x, y, z);
- }
-
- void MatrixStack::scale(double x, double y, double z)
- {
- scale((float)x, (float)y, (float)z);
- }
-
- void MatrixStack::multiply(const float *M)
- {
- stack[top] *= Matrix(M[0], M[4], M[8], M[12],
- M[1], M[5], M[9], M[13],
- M[2], M[6], M[10], M[14],
- M[3], M[7], M[11], M[15]);
- }
-
- void MatrixStack::multiply(const double *M)
- {
- stack[top] *= Matrix((float)M[0], (float)M[4], (float)M[8], (float)M[12],
- (float)M[1], (float)M[5], (float)M[9], (float)M[13],
- (float)M[2], (float)M[6], (float)M[10], (float)M[14],
- (float)M[3], (float)M[7], (float)M[11], (float)M[15]);
- }
-
- void MatrixStack::frustum(float left, float right, float bottom, float top, float zNear, float zFar)
- {
- float l = (float)left;
- float r = (float)right;
- float b = (float)bottom;
- float t = (float)top;
- float n = (float)zNear;
- float f = (float)zFar;
-
- float A = (r + l) / (r - l);
- float B = (t + b) / (t - b);
- float C = -(f + n) / (f - n);
- float D = -2 * f * n / (f - n);
-
- Matrix frustum(2 * n / (r - l), 0, A, 0,
- 0, 2 * n / (t - b), B, 0,
- 0, 0, C, D,
- 0, 0, -1, 0);
-
- stack[this->top] *= frustum;
- }
-
- void MatrixStack::ortho(double left, double right, double bottom, double top, double zNear, double zFar)
- {
- float l = (float)left;
- float r = (float)right;
- float b = (float)bottom;
- float t = (float)top;
- float n = (float)zNear;
- float f = (float)zFar;
-
- float tx = -(r + l) / (r - l);
- float ty = -(t + b) / (t - b);
- float tz = -(f + n) / (f - n);
-
- Matrix ortho(2 / (r - l), 0, 0, tx,
- 0, 2 / (t - b), 0, ty,
- 0, 0, -2 / (f - n), tz,
- 0, 0, 0, 1);
-
- stack[this->top] *= ortho;
- }
-
- bool MatrixStack::push()
- {
- if(top >= size - 1) return false;
-
- stack[top + 1] = stack[top];
- top++;
-
- return true;
- }
-
- bool MatrixStack::pop()
- {
- if(top <= 0) return false;
-
- top--;
-
- return true;
- }
-
- const Matrix &MatrixStack::current()
- {
- return stack[top];
- }
-
- bool MatrixStack::isIdentity() const
- {
- const Matrix &m = stack[top];
-
- if(m.m[0][0] != 1.0f) return false;
- if(m.m[0][1] != 0.0f) return false;
- if(m.m[0][2] != 0.0f) return false;
- if(m.m[0][3] != 0.0f) return false;
-
- if(m.m[1][0] != 0.0f) return false;
- if(m.m[1][1] != 1.0f) return false;
- if(m.m[1][2] != 0.0f) return false;
- if(m.m[1][3] != 0.0f) return false;
-
- if(m.m[2][0] != 0.0f) return false;
- if(m.m[2][1] != 0.0f) return false;
- if(m.m[2][2] != 1.0f) return false;
- if(m.m[2][3] != 0.0f) return false;
-
- if(m.m[3][0] != 0.0f) return false;
- if(m.m[3][1] != 0.0f) return false;
- if(m.m[3][2] != 0.0f) return false;
- if(m.m[3][3] != 1.0f) return false;
-
- return true;
- }
-}
diff --git a/src/OpenGL/common/MatrixStack.hpp b/src/OpenGL/common/MatrixStack.hpp
deleted file mode 100644
index cba59bf2c..000000000
--- a/src/OpenGL/common/MatrixStack.hpp
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_MatrixStack_hpp
-#define sw_MatrixStack_hpp
-
-#include "Renderer/Matrix.hpp"
-
-namespace sw
-{
- class MatrixStack
- {
- public:
- MatrixStack(int size = 2);
-
- ~MatrixStack();
-
- void identity();
- void load(const Matrix &M);
- void load(const float *M);
- void load(const double *M);
-
- void translate(float x, float y, float z);
- void translate(double x, double y, double z);
- void rotate(float angle, float x, float y, float z);
- void rotate(double angle, double x, double y, double z);
- void scale(float x, float y, float z);
- void scale(double x, double y, double z);
- void multiply(const float *M);
- void multiply(const double *M);
-
- void frustum(float left, float right, float bottom, float top, float zNear, float zFar);
- void ortho(double left, double right, double bottom, double top, double zNear, double zFar);
-
- bool push(); // False on overflow
- bool pop(); // False on underflow
-
- const Matrix &current();
- bool isIdentity() const;
-
- private:
- int top;
- int size;
- Matrix *stack;
- };
-}
-
-#endif // sw_MatrixStack_hpp
diff --git a/src/OpenGL/common/NameSpace.hpp b/src/OpenGL/common/NameSpace.hpp
deleted file mode 100644
index ce55b5bcb..000000000
--- a/src/OpenGL/common/NameSpace.hpp
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// NameSpace.h: Defines the NameSpace class, which is used to
-// allocate GL object names.
-
-#ifndef gl_NameSpace_hpp
-#define gl_NameSpace_hpp
-
-#include "Object.hpp"
-#include "debug.h"
-
-#include <map>
-
-namespace gl
-{
-
-template<class ObjectType, GLuint baseName = 1>
-class NameSpace
-{
-public:
- NameSpace() : freeName(baseName)
- {
- }
-
- ~NameSpace()
- {
- ASSERT(empty());
- }
-
- bool empty()
- {
- return map.empty();
- }
-
- GLuint firstName()
- {
- return map.begin()->first;
- }
-
- GLuint lastName()
- {
- return map.rbegin()->first;
- }
-
- GLuint allocate(ObjectType *object = nullptr)
- {
- GLuint name = freeName;
-
- while(isReserved(name))
- {
- name++;
- }
-
- map.insert({name, object});
- freeName = name + 1;
-
- return name;
- }
-
- bool isReserved(GLuint name) const
- {
- return map.find(name) != map.end();
- }
-
- void insert(GLuint name, ObjectType *object)
- {
- map[name] = object;
-
- if(name == freeName)
- {
- freeName++;
- }
- }
-
- ObjectType *remove(GLuint name)
- {
- auto element = map.find(name);
-
- if(element != map.end())
- {
- ObjectType *object = element->second;
- map.erase(element);
-
- if(name < freeName)
- {
- freeName = name;
- }
-
- return object;
- }
-
- return nullptr;
- }
-
- ObjectType *find(GLuint name) const
- {
- auto element = map.find(name);
-
- if(element == map.end())
- {
- return nullptr;
- }
-
- return element->second;
- }
-
-private:
- typedef std::map<GLuint, ObjectType*> Map;
- Map map;
-
- GLuint freeName; // Lowest known potentially free name
-};
-
-}
-
-#endif // gl_NameSpace_hpp
diff --git a/src/OpenGL/common/Object.cpp b/src/OpenGL/common/Object.cpp
deleted file mode 100644
index b4d84c023..000000000
--- a/src/OpenGL/common/Object.cpp
+++ /dev/null
@@ -1,103 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Object.cpp: Defines the Object base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-
-#include "Object.hpp"
-
-#include "Common/Thread.hpp"
-
-namespace gl
-{
-#ifndef NDEBUG
-sw::MutexLock Object::instances_mutex;
-std::set<Object*> Object::instances;
-#endif
-
-Object::Object()
-{
- referenceCount = 0;
-
- #ifndef NDEBUG
- LockGuard instances_lock(instances_mutex);
- instances.insert(this);
- #endif
-}
-
-Object::~Object()
-{
- ASSERT(referenceCount == 0);
-
- #ifndef NDEBUG
- LockGuard instances_lock(instances_mutex);
- ASSERT(instances.find(this) != instances.end()); // Check for double deletion
- instances.erase(this);
- #endif
-}
-
-void Object::addRef()
-{
- sw::atomicIncrement(&referenceCount);
-}
-
-void Object::release()
-{
- if(dereference() == 0)
- {
- delete this;
- }
-}
-
-int Object::dereference()
-{
- ASSERT(referenceCount > 0);
-
- if(referenceCount > 0)
- {
- return sw::atomicDecrement(&referenceCount);
- }
-
- return 0;
-}
-
-void Object::destroy()
-{
- referenceCount = 0;
- delete this;
-}
-
-NamedObject::NamedObject(GLuint name) : name(name)
-{
-}
-
-NamedObject::~NamedObject()
-{
-}
-
-#ifndef NDEBUG
-struct ObjectLeakCheck
-{
- ~ObjectLeakCheck()
- {
- LockGuard instances_lock(Object::instances_mutex);
- ASSERT(Object::instances.empty()); // Check for GL object leak at termination
- }
-};
-
-static ObjectLeakCheck objectLeakCheck;
-#endif
-
-}
diff --git a/src/OpenGL/common/Object.hpp b/src/OpenGL/common/Object.hpp
deleted file mode 100644
index 7d9a8fef4..000000000
--- a/src/OpenGL/common/Object.hpp
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Object.hpp: Defines the Object base class that provides
-// lifecycle support for GL objects using the traditional BindObject scheme, but
-// that need to be reference counted for correct cross-context deletion.
-
-#ifndef gl_Object_hpp
-#define gl_Object_hpp
-
-#include "common/debug.h"
-#include "Common/MutexLock.hpp"
-
-#include <set>
-
-typedef unsigned int GLuint;
-
-namespace gl
-{
-
-class [[clang::lto_visibility_public]] Object
-{
-public:
- Object();
-
- virtual void addRef();
- virtual void release();
-
- inline bool hasSingleReference() const
- {
- return referenceCount == 1;
- }
-
-protected:
- virtual ~Object();
-
- int dereference();
- void destroy();
-
- volatile int referenceCount;
-
-#ifndef NDEBUG
-public:
- static sw::MutexLock instances_mutex;
- static std::set<Object*> instances; // For leak checking
-#endif
-};
-
-class NamedObject : public Object
-{
-public:
- explicit NamedObject(GLuint name);
- virtual ~NamedObject();
-
- const GLuint name;
-};
-
-template<class ObjectType>
-class BindingPointer
-{
-public:
- BindingPointer() : object(nullptr) { }
-
- BindingPointer(const BindingPointer<ObjectType> &other) : object(nullptr)
- {
- operator=(other.object);
- }
-
- ~BindingPointer()
- {
- ASSERT(!object); // Objects have to be released before the resource manager is destroyed, so they must be explicitly cleaned up. Assign null to all binding pointers to make the reference count go to zero.
- }
-
- ObjectType *operator=(ObjectType *newObject)
- {
- if(newObject) newObject->addRef();
- if(object) object->release();
-
- object = newObject;
-
- return object;
- }
-
- ObjectType *operator=(const BindingPointer<ObjectType> &other)
- {
- return operator=(other.object);
- }
-
- operator ObjectType*() const { return object; }
- ObjectType *operator->() const { return object; }
- GLuint name() const { return object ? object->name : 0; }
- bool operator!() const { return !object; }
-
-private:
- ObjectType *object;
-};
-
-}
-
-#endif // gl_Object_hpp
diff --git a/src/OpenGL/common/Surface.hpp b/src/OpenGL/common/Surface.hpp
deleted file mode 100644
index a65305c70..000000000
--- a/src/OpenGL/common/Surface.hpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Surface.hpp: Defines the gl::Surface class, which is the abstract interface
-// for an EGL surface as viewed by the GL implementation.
-
-#ifndef INCLUDE_SURFACE_H_
-#define INCLUDE_SURFACE_H_
-
-#include "Renderer/Surface.hpp"
-
-#include <EGL/egl.h>
-#undef Bool
-
-namespace egl
-{
-class Texture;
-class Image;
-}
-
-namespace gl
-{
-class [[clang::lto_visibility_public]] Surface
-{
-protected:
- Surface();
- virtual ~Surface() = 0;
-
-public:
- virtual egl::Image *getRenderTarget() = 0;
- virtual egl::Image *getDepthStencil() = 0;
-
- virtual EGLint getWidth() const = 0;
- virtual EGLint getHeight() const = 0;
- virtual EGLenum getTextureTarget() const = 0;
-
- virtual void setBoundTexture(egl::Texture *texture) = 0;
-};
-}
-
-#endif // INCLUDE_SURFACE_H_
diff --git a/src/OpenGL/common/debug.cpp b/src/OpenGL/common/debug.cpp
deleted file mode 100644
index b14555552..000000000
--- a/src/OpenGL/common/debug.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// debug.cpp: Debugging utilities.
-
-#include "common/debug.h"
-
-#ifdef __ANDROID__
-#if !defined(ANDROID_NDK_BUILD)
-#include <utils/String8.h>
-#if ANDROID_PLATFORM_SDK_VERSION < 27
-#include <cutils/log.h>
-#elif ANDROID_PLATFORM_SDK_VERSION >= 27
-#include <log/log.h>
-#else
-#error "ANDROID_PLATFORM_SDK_VERSION is not defined"
-#endif
-#endif
-#endif
-
-#include <stdio.h>
-#include <stdarg.h>
-
-namespace es
-{
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
- static void output(const char *format, va_list vararg)
- {
- ALOGI("%s", android::String8::formatV(format, vararg).string());
- }
-#else
- static void output(const char *format, va_list vararg)
- {
- if(false)
- {
- static FILE* file = nullptr;
- if(!file)
- {
- file = fopen(TRACE_OUTPUT_FILE, "w");
- }
-
- if(file)
- {
- vfprintf(file, format, vararg);
- // fflush(file);
- }
- }
- }
-#endif
-
- void trace(const char *format, ...)
- {
- va_list vararg;
- va_start(vararg, format);
- output(format, vararg);
- va_end(vararg);
- }
-}
diff --git a/src/OpenGL/common/debug.h b/src/OpenGL/common/debug.h
deleted file mode 100644
index ce488a21a..000000000
--- a/src/OpenGL/common/debug.h
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// debug.h: Debugging utilities.
-
-#ifndef COMMON_DEBUG_H_
-#define COMMON_DEBUG_H_
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "../../Common/DebugAndroid.hpp"
-#else
-#include <stdio.h>
-#include <assert.h>
-
-#if !defined(TRACE_OUTPUT_FILE)
-#define TRACE_OUTPUT_FILE "debug.txt"
-#endif
-
-namespace es
-{
-// Outputs text to the debugging log
-void trace(const char *format, ...);
-inline void trace() {}
-}
-
-// A macro to output a trace of a function call and its arguments to the debugging log
-#if defined(ANGLE_DISABLE_TRACE)
-#define TRACE(message, ...) (void(0))
-#else
-#define TRACE(message, ...) es::trace("trace: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__)
-#endif
-
-// A macro to output a function call and its arguments to the debugging log, to denote an item in need of fixing.
-#if defined(ANGLE_DISABLE_TRACE)
-#define FIXME(message, ...) (void(0))
-#else
-#define FIXME(message, ...) do {es::trace("fixme: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
-#endif
-
-// A macro to output a function call and its arguments to the debugging log, in case of error.
-#if defined(ANGLE_DISABLE_TRACE)
-#define ERR(message, ...) (void(0))
-#else
-#define ERR(message, ...) do {es::trace("err: %s(%d): " message "\n", __FUNCTION__, __LINE__, ##__VA_ARGS__); assert(false);} while(false)
-#endif
-
-// A macro asserting a condition and outputting failures to the debug log
-#undef ASSERT
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-#define ASSERT(expression) do { \
- if(!(expression)) { \
- ERR("\t! Assert failed in %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
- assert(expression); \
- } } while(0)
-#else
-#define ASSERT(expression) (void(0))
-#endif
-
-// A macro to indicate unimplemented functionality
-#undef UNIMPLEMENTED
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-#define UNIMPLEMENTED(...) do { \
- es::trace("\t! Unimplemented: %s(%d): ", __FUNCTION__, __LINE__); \
- es::trace(__VA_ARGS__); \
- es::trace("\n"); \
- assert(false); \
- } while(0)
-#else
- #define UNIMPLEMENTED(...) FIXME("\t! Unimplemented: %s(%d)\n", __FUNCTION__, __LINE__)
-#endif
-
-// A macro for code which is not expected to be reached under valid assumptions
-#undef UNREACHABLE
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
-#define UNREACHABLE(value) do { \
- ERR("\t! Unreachable case reached: %s(%d). %s: %d\n", __FUNCTION__, __LINE__, #value, value); \
- assert(false); \
- } while(0)
-#else
- #define UNREACHABLE(value) ERR("\t! Unreachable reached: %s(%d). %s: %d\n", __FUNCTION__, __LINE__, #value, value)
-#endif
-
-#endif // !__ANDROID__
-
-// A macro asserting a condition and outputting failures to the debug log, or return when in release mode.
-#undef ASSERT_OR_RETURN
-#define ASSERT_OR_RETURN(expression) do { \
- if(!(expression)) { \
- ASSERT(expression); \
- return; \
- } } while(0)
-
-#endif // COMMON_DEBUG_H_
diff --git a/src/OpenGL/compiler/AnalyzeCallDepth.cpp b/src/OpenGL/compiler/AnalyzeCallDepth.cpp
deleted file mode 100644
index 48f00179c..000000000
--- a/src/OpenGL/compiler/AnalyzeCallDepth.cpp
+++ /dev/null
@@ -1,265 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "AnalyzeCallDepth.h"
-
-static TIntermSequence::iterator
-traverseCaseBody(AnalyzeCallDepth* analysis,
- TIntermSequence::iterator& start,
- const TIntermSequence::iterator& end) {
- TIntermSequence::iterator current = start;
- for (++current; current != end; ++current)
- {
- (*current)->traverse(analysis);
- if((*current)->getAsBranchNode()) // Kill, Break, Continue or Return
- {
- break;
- }
- }
- return current;
-}
-
-
-AnalyzeCallDepth::FunctionNode::FunctionNode(TIntermAggregate *node) : node(node)
-{
- visit = PreVisit;
- callDepth = 0;
-}
-
-const TString &AnalyzeCallDepth::FunctionNode::getName() const
-{
- return node->getName();
-}
-
-void AnalyzeCallDepth::FunctionNode::addCallee(AnalyzeCallDepth::FunctionNode *callee)
-{
- for(size_t i = 0; i < callees.size(); i++)
- {
- if(callees[i] == callee)
- {
- return;
- }
- }
-
- callees.push_back(callee);
-}
-
-unsigned int AnalyzeCallDepth::FunctionNode::analyzeCallDepth(AnalyzeCallDepth *analyzeCallDepth)
-{
- ASSERT(visit == PreVisit);
- ASSERT(analyzeCallDepth);
-
- callDepth = 0;
- visit = InVisit;
-
- for(size_t i = 0; i < callees.size(); i++)
- {
- unsigned int calleeDepth = 0;
- switch(callees[i]->visit)
- {
- case InVisit:
- // Cycle detected (recursion)
- return UINT_MAX;
- case PostVisit:
- calleeDepth = callees[i]->getLastDepth();
- break;
- case PreVisit:
- calleeDepth = callees[i]->analyzeCallDepth(analyzeCallDepth);
- break;
- default:
- UNREACHABLE(callees[i]->visit);
- break;
- }
- if(calleeDepth != UINT_MAX) ++calleeDepth;
- callDepth = std::max(callDepth, calleeDepth);
- }
-
- visit = PostVisit;
- return callDepth;
-}
-
-unsigned int AnalyzeCallDepth::FunctionNode::getLastDepth() const
-{
- return callDepth;
-}
-
-void AnalyzeCallDepth::FunctionNode::removeIfUnreachable()
-{
- if(visit == PreVisit)
- {
- node->setOp(EOpPrototype);
- node->getSequence().resize(1); // Remove function body
- }
-}
-
-AnalyzeCallDepth::AnalyzeCallDepth(TIntermNode *root)
- : TIntermTraverser(true, false, true, false),
- currentFunction(0)
-{
- root->traverse(this);
-}
-
-AnalyzeCallDepth::~AnalyzeCallDepth()
-{
- for(size_t i = 0; i < functions.size(); i++)
- {
- delete functions[i];
- }
-}
-
-bool AnalyzeCallDepth::visitSwitch(Visit visit, TIntermSwitch *node)
-{
- TIntermTyped* switchValue = node->getInit();
- TIntermAggregate* opList = node->getStatementList();
-
- if(!switchValue || !opList)
- {
- return false;
- }
-
- // TODO: We need to dig into switch statement cases from
- // visitSwitch for all traversers. Is there a way to
- // preserve existing functionality while moving the iteration
- // to the general traverser?
- TIntermSequence& sequence = opList->getSequence();
- TIntermSequence::iterator it = sequence.begin();
- TIntermSequence::iterator defaultIt = sequence.end();
- for(; it != sequence.end(); ++it)
- {
- TIntermCase* currentCase = (*it)->getAsCaseNode();
- if(currentCase)
- {
- TIntermSequence::iterator caseIt = it;
- TIntermTyped* condition = currentCase->getCondition();
- if(condition) // non default case
- {
- condition->traverse(this);
- traverseCaseBody(this, caseIt, sequence.end());
- }
- else
- {
- defaultIt = it; // The default case might not be the last case, keep it for last
- }
- }
- }
-
- // If there's a default case, traverse it here
- if(defaultIt != sequence.end())
- {
- traverseCaseBody(this, defaultIt, sequence.end());
- }
- return false;
-}
-
-bool AnalyzeCallDepth::visitAggregate(Visit visit, TIntermAggregate *node)
-{
- switch(node->getOp())
- {
- case EOpFunction: // Function definition
- {
- if(visit == PreVisit)
- {
- currentFunction = findFunctionByName(node->getName());
-
- if(!currentFunction)
- {
- currentFunction = new FunctionNode(node);
- functions.push_back(currentFunction);
- }
- }
- else if(visit == PostVisit)
- {
- currentFunction = 0;
- }
- }
- break;
- case EOpFunctionCall:
- {
- if(!node->isUserDefined())
- {
- return true; // Check the arguments for function calls
- }
-
- if(visit == PreVisit)
- {
- FunctionNode *function = findFunctionByName(node->getName());
-
- if(!function)
- {
- function = new FunctionNode(node);
- functions.push_back(function);
- }
-
- if(currentFunction)
- {
- currentFunction->addCallee(function);
- }
- else
- {
- globalFunctionCalls.insert(function);
- }
- }
- }
- break;
- default:
- break;
- }
-
- return true;
-}
-
-unsigned int AnalyzeCallDepth::analyzeCallDepth()
-{
- FunctionNode *main = findFunctionByName("main(");
-
- if(!main)
- {
- return 0;
- }
-
- unsigned int depth = main->analyzeCallDepth(this);
- if(depth != UINT_MAX) ++depth;
-
- for(FunctionSet::iterator globalCall = globalFunctionCalls.begin(); globalCall != globalFunctionCalls.end(); globalCall++)
- {
- unsigned int globalDepth = (*globalCall)->analyzeCallDepth(this);
- if(globalDepth != UINT_MAX) ++globalDepth;
-
- if(globalDepth > depth)
- {
- depth = globalDepth;
- }
- }
-
- for(size_t i = 0; i < functions.size(); i++)
- {
- functions[i]->removeIfUnreachable();
- }
-
- return depth;
-}
-
-AnalyzeCallDepth::FunctionNode *AnalyzeCallDepth::findFunctionByName(const TString &name)
-{
- for(size_t i = 0; i < functions.size(); i++)
- {
- if(functions[i]->getName() == name)
- {
- return functions[i];
- }
- }
-
- return 0;
-}
-
diff --git a/src/OpenGL/compiler/AnalyzeCallDepth.h b/src/OpenGL/compiler/AnalyzeCallDepth.h
deleted file mode 100644
index 76d652299..000000000
--- a/src/OpenGL/compiler/AnalyzeCallDepth.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_ANALYZE_CALL_DEPTH_H_
-#define COMPILER_ANALYZE_CALL_DEPTH_H_
-
-#include "intermediate.h"
-
-#include <set>
-#include <limits.h>
-
-// Traverses intermediate tree to analyze call depth or detect function recursion
-class AnalyzeCallDepth : public TIntermTraverser
-{
-public:
- AnalyzeCallDepth(TIntermNode *root);
- ~AnalyzeCallDepth();
-
- virtual bool visitSwitch(Visit, TIntermSwitch*);
- virtual bool visitAggregate(Visit, TIntermAggregate*);
-
- unsigned int analyzeCallDepth();
-
-private:
- class FunctionNode
- {
- public:
- FunctionNode(TIntermAggregate *node);
-
- const TString &getName() const;
- void addCallee(FunctionNode *callee);
- unsigned int analyzeCallDepth(AnalyzeCallDepth *analyzeCallDepth);
- unsigned int getLastDepth() const;
-
- void removeIfUnreachable();
-
- private:
- TIntermAggregate *const node;
- TVector<FunctionNode*> callees;
-
- Visit visit;
- unsigned int callDepth;
- };
-
- FunctionNode *findFunctionByName(const TString &name);
-
- std::vector<FunctionNode*> functions;
- typedef std::set<FunctionNode*> FunctionSet;
- FunctionSet globalFunctionCalls;
- FunctionNode *currentFunction;
-};
-
-#endif // COMPILER_ANALYZE_CALL_DEPTH_H_
diff --git a/src/OpenGL/compiler/BaseTypes.h b/src/OpenGL/compiler/BaseTypes.h
deleted file mode 100644
index 67b465de8..000000000
--- a/src/OpenGL/compiler/BaseTypes.h
+++ /dev/null
@@ -1,474 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _BASICTYPES_INCLUDED_
-#define _BASICTYPES_INCLUDED_
-
-#include "debug.h"
-
-//
-// Precision qualifiers
-//
-enum TPrecision : unsigned char
-{
- // These need to be kept sorted
- EbpUndefined,
- EbpLow,
- EbpMedium,
- EbpHigh
-};
-
-inline const char *getPrecisionString(TPrecision precision)
-{
- switch(precision)
- {
- case EbpHigh: return "highp"; break;
- case EbpMedium: return "mediump"; break;
- case EbpLow: return "lowp"; break;
- default: return "mediump"; break; // Safest fallback
- }
-}
-
-//
-// Basic type. Arrays, vectors, etc., are orthogonal to this.
-//
-enum TBasicType : unsigned char
-{
- EbtVoid,
- EbtFloat,
- EbtInt,
- EbtUInt,
- EbtBool,
- EbtGVec4, // non type: represents vec4, ivec4, and uvec4
- EbtGenType, // non type: represents float, vec2, vec3, and vec4
- EbtGenIType, // non type: represents int, ivec2, ivec3, and ivec4
- EbtGenUType, // non type: represents uint, uvec2, uvec3, and uvec4
- EbtGenBType, // non type: represents bool, bvec2, bvec3, and bvec4
- EbtVec, // non type: represents vec2, vec3, and vec4
- EbtIVec, // non type: represents ivec2, ivec3, and ivec4
- EbtUVec, // non type: represents uvec2, uvec3, and uvec4
- EbtBVec, // non type: represents bvec2, bvec3, and bvec4
- EbtGuardSamplerBegin, // non type: see implementation of IsSampler()
- EbtSampler2D,
- EbtSampler3D,
- EbtSamplerCube,
- EbtSampler2DArray,
- EbtSampler2DRect, // Only valid if ARB_texture_rectangle exists.
- EbtSamplerExternalOES, // Only valid if OES_EGL_image_external exists.
- EbtISampler2D,
- EbtISampler3D,
- EbtISamplerCube,
- EbtISampler2DArray,
- EbtUSampler2D,
- EbtUSampler3D,
- EbtUSamplerCube,
- EbtUSampler2DArray,
- EbtSampler2DShadow,
- EbtSamplerCubeShadow,
- EbtSampler2DArrayShadow,
- EbtGuardSamplerEnd, // non type: see implementation of IsSampler()
- EbtGSampler2D, // non type: represents sampler2D, isampler2D, and usampler2D
- EbtGSampler3D, // non type: represents sampler3D, isampler3D, and usampler3D
- EbtGSamplerCube, // non type: represents samplerCube, isamplerCube, and usamplerCube
- EbtGSampler2DArray, // non type: represents sampler2DArray, isampler2DArray, and usampler2DArray
- EbtStruct,
- EbtInterfaceBlock,
- EbtAddress, // should be deprecated??
- EbtInvariant // used as a type when qualifying a previously declared variable as being invariant
-};
-
-enum TLayoutMatrixPacking
-{
- EmpUnspecified,
- EmpRowMajor,
- EmpColumnMajor
-};
-
-enum TLayoutBlockStorage
-{
- EbsUnspecified,
- EbsShared,
- EbsPacked,
- EbsStd140
-};
-
-inline const char *getBasicString(TBasicType type)
-{
- switch(type)
- {
- case EbtVoid: return "void";
- case EbtFloat: return "float";
- case EbtInt: return "int";
- case EbtUInt: return "uint";
- case EbtBool: return "bool";
- case EbtSampler2D: return "sampler2D";
- case EbtSamplerCube: return "samplerCube";
- case EbtSampler2DRect: return "sampler2DRect";
- case EbtSamplerExternalOES: return "samplerExternalOES";
- case EbtSampler3D: return "sampler3D";
- case EbtStruct: return "structure";
- default: UNREACHABLE(type); return "unknown type";
- }
-}
-
-inline const char* getMatrixPackingString(TLayoutMatrixPacking mpq)
-{
- switch(mpq)
- {
- case EmpUnspecified: return "mp_unspecified";
- case EmpRowMajor: return "row_major";
- case EmpColumnMajor: return "column_major";
- default: UNREACHABLE(mpq); return "unknown matrix packing";
- }
-}
-
-inline const char* getBlockStorageString(TLayoutBlockStorage bsq)
-{
- switch(bsq)
- {
- case EbsUnspecified: return "bs_unspecified";
- case EbsShared: return "shared";
- case EbsPacked: return "packed";
- case EbsStd140: return "std140";
- default: UNREACHABLE(bsq); return "unknown block storage";
- }
-}
-
-inline bool IsSampler(TBasicType type)
-{
- return type > EbtGuardSamplerBegin && type < EbtGuardSamplerEnd;
-}
-
-inline bool IsIntegerSampler(TBasicType type)
-{
- switch(type)
- {
- case EbtISampler2D:
- case EbtISampler3D:
- case EbtISamplerCube:
- case EbtISampler2DArray:
- case EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- return true;
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler2DArray:
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSampler2D(TBasicType type)
-{
- switch(type)
- {
- case EbtSampler2D:
- case EbtISampler2D:
- case EbtUSampler2D:
- case EbtSampler2DArray:
- case EbtISampler2DArray:
- case EbtUSampler2DArray:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler2DShadow:
- case EbtSampler2DArrayShadow:
- return true;
- case EbtSampler3D:
- case EbtISampler3D:
- case EbtUSampler3D:
- case EbtISamplerCube:
- case EbtUSamplerCube:
- case EbtSamplerCube:
- case EbtSamplerCubeShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSamplerCube(TBasicType type)
-{
- switch(type)
- {
- case EbtSamplerCube:
- case EbtISamplerCube:
- case EbtUSamplerCube:
- case EbtSamplerCubeShadow:
- return true;
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler2DArray:
- case EbtISampler2D:
- case EbtISampler3D:
- case EbtISampler2DArray:
- case EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSampler2DArray:
- case EbtSampler2DShadow:
- case EbtSampler2DArrayShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSampler3D(TBasicType type)
-{
- switch(type)
- {
- case EbtSampler3D:
- case EbtISampler3D:
- case EbtUSampler3D:
- return true;
- case EbtSampler2D:
- case EbtSamplerCube:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler2DArray:
- case EbtISampler2D:
- case EbtISamplerCube:
- case EbtISampler2DArray:
- case EbtUSampler2D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsSamplerArray(TBasicType type)
-{
- switch(type)
- {
- case EbtSampler2DArray:
- case EbtISampler2DArray:
- case EbtUSampler2DArray:
- case EbtSampler2DArrayShadow:
- return true;
- case EbtSampler2D:
- case EbtISampler2D:
- case EbtUSampler2D:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler3D:
- case EbtISampler3D:
- case EbtUSampler3D:
- case EbtISamplerCube:
- case EbtUSamplerCube:
- case EbtSamplerCube:
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsShadowSampler(TBasicType type)
-{
- switch(type)
- {
- case EbtSampler2DShadow:
- case EbtSamplerCubeShadow:
- case EbtSampler2DArrayShadow:
- return true;
- case EbtISampler2D:
- case EbtISampler3D:
- case EbtISamplerCube:
- case EbtISampler2DArray:
- case EbtUSampler2D:
- case EbtUSampler3D:
- case EbtUSamplerCube:
- case EbtUSampler2DArray:
- case EbtSampler2D:
- case EbtSampler3D:
- case EbtSamplerCube:
- case EbtSampler2DRect:
- case EbtSamplerExternalOES:
- case EbtSampler2DArray:
- return false;
- default:
- assert(!IsSampler(type));
- }
-
- return false;
-}
-
-inline bool IsInteger(TBasicType type)
-{
- return type == EbtInt || type == EbtUInt;
-}
-
-inline bool SupportsPrecision(TBasicType type)
-{
- return type == EbtFloat || type == EbtInt || type == EbtUInt || IsSampler(type);
-}
-
-//
-// Qualifiers and built-ins. These are mainly used to see what can be read
-// or written, and by the machine dependent translator to know which registers
-// to allocate variables in. Since built-ins tend to go to different registers
-// than varying or uniform, it makes sense they are peers, not sub-classes.
-//
-enum TQualifier : unsigned char
-{
- EvqTemporary, // For temporaries (within a function), read/write
- EvqGlobal, // For globals read/write
- EvqConstExpr, // User defined constants
- EvqAttribute, // Readonly
- EvqVaryingIn, // readonly, fragment shaders only
- EvqVaryingOut, // vertex shaders only read/write
- EvqInvariantVaryingIn, // readonly, fragment shaders only
- EvqInvariantVaryingOut, // vertex shaders only read/write
- EvqUniform, // Readonly, vertex and fragment
-
- EvqVertexIn, // Vertex shader input
- EvqFragmentOut, // Fragment shader output
- EvqVertexOut, // Vertex shader output
- EvqFragmentIn, // Fragment shader input
-
- // pack/unpack input and output
- EvqInput,
- EvqOutput,
-
- // parameters
- EvqIn,
- EvqOut,
- EvqInOut,
- EvqConstReadOnly,
-
- // built-ins written by vertex shader
- EvqPosition,
- EvqPointSize,
- EvqInstanceID,
- EvqVertexID,
-
- // built-ins read by fragment shader
- EvqFragCoord,
- EvqFrontFacing,
- EvqPointCoord,
-
- // built-ins written by fragment shader
- EvqFragColor,
- EvqFragData,
- EvqFragDepth,
-
- // GLSL ES 3.0 vertex output and fragment input
- EvqSmooth, // Incomplete qualifier, smooth is the default
- EvqFlat, // Incomplete qualifier
- EvqSmoothOut = EvqSmooth,
- EvqFlatOut = EvqFlat,
- EvqCentroidOut, // Implies smooth
- EvqSmoothIn,
- EvqFlatIn,
- EvqCentroidIn, // Implies smooth
-
- // end of list
- EvqLast
-};
-
-struct TLayoutQualifier
-{
- static TLayoutQualifier create()
- {
- TLayoutQualifier layoutQualifier;
-
- layoutQualifier.location = -1;
- layoutQualifier.matrixPacking = EmpUnspecified;
- layoutQualifier.blockStorage = EbsUnspecified;
-
- return layoutQualifier;
- }
-
- bool isEmpty() const
- {
- return location == -1 && matrixPacking == EmpUnspecified && blockStorage == EbsUnspecified;
- }
-
- int location;
- TLayoutMatrixPacking matrixPacking;
- TLayoutBlockStorage blockStorage;
-};
-
-//
-// This is just for debug print out, carried along with the definitions above.
-//
-inline const char *getQualifierString(TQualifier qualifier)
-{
- switch(qualifier)
- {
- case EvqTemporary: return "Temporary"; break;
- case EvqGlobal: return "Global"; break;
- case EvqConstExpr: return "const"; break;
- case EvqConstReadOnly: return "const"; break;
- case EvqAttribute: return "attribute"; break;
- case EvqVaryingIn: return "varying"; break;
- case EvqVaryingOut: return "varying"; break;
- case EvqInvariantVaryingIn: return "invariant varying"; break;
- case EvqInvariantVaryingOut:return "invariant varying"; break;
- case EvqUniform: return "uniform"; break;
- case EvqVertexIn: return "in"; break;
- case EvqFragmentOut: return "out"; break;
- case EvqVertexOut: return "out"; break;
- case EvqFragmentIn: return "in"; break;
- case EvqIn: return "in"; break;
- case EvqOut: return "out"; break;
- case EvqInOut: return "inout"; break;
- case EvqInput: return "input"; break;
- case EvqOutput: return "output"; break;
- case EvqPosition: return "Position"; break;
- case EvqPointSize: return "PointSize"; break;
- case EvqInstanceID: return "InstanceID"; break;
- case EvqVertexID: return "VertexID"; break;
- case EvqFragCoord: return "FragCoord"; break;
- case EvqFrontFacing: return "FrontFacing"; break;
- case EvqFragColor: return "FragColor"; break;
- case EvqFragData: return "FragData"; break;
- case EvqFragDepth: return "FragDepth"; break;
- case EvqSmooth: return "Smooth"; break;
- case EvqFlat: return "Flat"; break;
- case EvqCentroidOut: return "CentroidOut"; break;
- case EvqSmoothIn: return "SmoothIn"; break;
- case EvqFlatIn: return "FlatIn"; break;
- case EvqCentroidIn: return "CentroidIn"; break;
- default: UNREACHABLE(qualifier); return "unknown qualifier";
- }
-}
-
-#endif // _BASICTYPES_INCLUDED_
diff --git a/src/OpenGL/compiler/Common.h b/src/OpenGL/compiler/Common.h
deleted file mode 100644
index b6fe5d6b5..000000000
--- a/src/OpenGL/compiler/Common.h
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _COMMON_INCLUDED_
-#define _COMMON_INCLUDED_
-
-#include <map>
-#include <sstream>
-#include <string>
-#include <vector>
-
-#include "PoolAlloc.h"
-
-struct TSourceLoc {
- int first_file;
- int first_line;
- int last_file;
- int last_line;
-};
-
-//
-// Put POOL_ALLOCATOR_NEW_DELETE in base classes to make them use this scheme.
-//
-#define POOL_ALLOCATOR_NEW_DELETE() \
- void* operator new(size_t s) { return GetGlobalPoolAllocator()->allocate(s); } \
- void* operator new(size_t, void *_Where) { return (_Where); } \
- void operator delete(void*) { } \
- void operator delete(void *, void *) { } \
- void* operator new[](size_t s) { return GetGlobalPoolAllocator()->allocate(s); } \
- void* operator new[](size_t, void *_Where) { return (_Where); } \
- void operator delete[](void*) { } \
- void operator delete[](void *, void *) { }
-
-//
-// Pool version of string.
-//
-typedef pool_allocator<char> TStringAllocator;
-typedef std::basic_string <char, std::char_traits<char>, TStringAllocator> TString;
-typedef std::basic_ostringstream<char, std::char_traits<char>, TStringAllocator> TStringStream;
-inline TString* NewPoolTString(const char* s)
-{
- void* memory = GetGlobalPoolAllocator()->allocate(sizeof(TString));
- return new(memory) TString(s);
-}
-
-//
-// Persistent string memory. Should only be used for strings that survive
-// across compiles.
-//
-#define TPersistString std::string
-#define TPersistStringStream std::ostringstream
-
-//
-// Pool allocator versions of vectors, lists, and maps
-//
-template <class T> class TVector : public std::vector<T, pool_allocator<T> > {
-public:
- typedef typename std::vector<T, pool_allocator<T> >::size_type size_type;
- TVector() : std::vector<T, pool_allocator<T> >() {}
- TVector(const pool_allocator<T>& a) : std::vector<T, pool_allocator<T> >(a) {}
- TVector(size_type i): std::vector<T, pool_allocator<T> >(i) {}
-};
-
-template <class K, class D, class CMP = std::less<K> >
-class TMap : public std::map<K, D, CMP, pool_allocator<std::pair<const K, D> > > {
-public:
- typedef pool_allocator<std::pair<const K, D> > tAllocator;
-
- TMap() : std::map<K, D, CMP, tAllocator>() {}
- // use correct two-stage name lookup supported in gcc 3.4 and above
- TMap(const tAllocator& a) : std::map<K, D, CMP, tAllocator>(std::map<K, D, CMP, tAllocator>::key_compare(), a) {}
-};
-
-#endif // _COMMON_INCLUDED_
diff --git a/src/OpenGL/compiler/Compiler.cpp b/src/OpenGL/compiler/Compiler.cpp
deleted file mode 100644
index 38446dcbd..000000000
--- a/src/OpenGL/compiler/Compiler.cpp
+++ /dev/null
@@ -1,274 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Compiler.h"
-
-#include "AnalyzeCallDepth.h"
-#include "Initialize.h"
-#include "InitializeParseContext.h"
-#include "InitializeGlobals.h"
-#include "ParseHelper.h"
-#include "ValidateLimitations.h"
-
-namespace
-{
-class TScopedPoolAllocator {
-public:
- TScopedPoolAllocator(TPoolAllocator* allocator, bool pushPop)
- : mAllocator(allocator), mPushPopAllocator(pushPop)
- {
- if (mPushPopAllocator) mAllocator->push();
- SetGlobalPoolAllocator(mAllocator);
- }
- ~TScopedPoolAllocator()
- {
- SetGlobalPoolAllocator(nullptr);
- if (mPushPopAllocator) mAllocator->pop();
- }
-
-private:
- TPoolAllocator* mAllocator;
- bool mPushPopAllocator;
-};
-} // namespace
-
-//
-// Initialize built-in resources with minimum expected values.
-//
-ShBuiltInResources::ShBuiltInResources()
-{
- // Constants.
- MaxVertexAttribs = 8;
- MaxVertexUniformVectors = 128;
- MaxVaryingVectors = 8;
- MaxVertexTextureImageUnits = 0;
- MaxCombinedTextureImageUnits = 8;
- MaxTextureImageUnits = 8;
- MaxFragmentUniformVectors = 16;
- MaxDrawBuffers = 1;
- MaxVertexOutputVectors = 16;
- MaxFragmentInputVectors = 15;
- MinProgramTexelOffset = -8;
- MaxProgramTexelOffset = 7;
-
- // Extensions.
- OES_standard_derivatives = 0;
- OES_fragment_precision_high = 0;
- OES_EGL_image_external = 0;
- OES_EGL_image_external_essl3 = 0;
-
- MaxCallStackDepth = UINT_MAX;
-}
-
-TCompiler::TCompiler(GLenum type)
- : shaderType(type),
- maxCallStackDepth(UINT_MAX)
-{
- allocator.push();
- SetGlobalPoolAllocator(&allocator);
-}
-
-TCompiler::~TCompiler()
-{
- SetGlobalPoolAllocator(nullptr);
- allocator.popAll();
-}
-
-bool TCompiler::Init(const ShBuiltInResources& resources)
-{
- shaderVersion = 100;
- maxCallStackDepth = resources.MaxCallStackDepth;
- TScopedPoolAllocator scopedAlloc(&allocator, false);
-
- // Generate built-in symbol table.
- if (!InitBuiltInSymbolTable(resources))
- return false;
- InitExtensionBehavior(resources, extensionBehavior);
-
- return true;
-}
-
-bool TCompiler::compile(const char* const shaderStrings[],
- const int numStrings,
- int compileOptions)
-{
- TScopedPoolAllocator scopedAlloc(&allocator, true);
- clearResults();
-
- if (numStrings == 0)
- return true;
-
- // First string is path of source file if flag is set. The actual source follows.
- const char* sourcePath = nullptr;
- int firstSource = 0;
- if (compileOptions & SH_SOURCE_PATH)
- {
- sourcePath = shaderStrings[0];
- ++firstSource;
- }
-
- TIntermediate intermediate(infoSink);
- TParseContext parseContext(symbolTable, extensionBehavior, intermediate,
- shaderType, compileOptions, true,
- sourcePath, infoSink);
- SetGlobalParseContext(&parseContext);
-
- // We preserve symbols at the built-in level from compile-to-compile.
- // Start pushing the user-defined symbols at global level.
- symbolTable.push();
- if (!symbolTable.atGlobalLevel())
- infoSink.info.message(EPrefixInternalError, "Wrong symbol table level");
-
- // Parse shader.
- bool success =
- (PaParseStrings(numStrings - firstSource, &shaderStrings[firstSource], nullptr, &parseContext) == 0) &&
- (parseContext.getTreeRoot() != nullptr);
-
- shaderVersion = parseContext.getShaderVersion();
-
- if (success) {
- TIntermNode* root = parseContext.getTreeRoot();
- success = intermediate.postProcess(root);
-
- if (success)
- success = validateCallDepth(root, infoSink);
-
- if (success && (compileOptions & SH_VALIDATE_LOOP_INDEXING))
- success = validateLimitations(root);
-
- if (success && (compileOptions & SH_INTERMEDIATE_TREE))
- intermediate.outputTree(root);
-
- if (success && (compileOptions & SH_OBJECT_CODE))
- success = translate(root);
- }
-
- // Ensure symbol table is returned to the built-in level,
- // throwing away all but the built-ins.
- while (!symbolTable.atBuiltInLevel())
- symbolTable.pop();
-
- return success;
-}
-
-bool TCompiler::InitBuiltInSymbolTable(const ShBuiltInResources &resources)
-{
- assert(symbolTable.isEmpty());
- symbolTable.push(); // COMMON_BUILTINS
- symbolTable.push(); // ESSL1_BUILTINS
- symbolTable.push(); // ESSL3_BUILTINS
-
- TPublicType integer;
- integer.type = EbtInt;
- integer.primarySize = 1;
- integer.secondarySize = 1;
- integer.array = false;
-
- TPublicType floatingPoint;
- floatingPoint.type = EbtFloat;
- floatingPoint.primarySize = 1;
- floatingPoint.secondarySize = 1;
- floatingPoint.array = false;
-
- switch(shaderType)
- {
- case GL_FRAGMENT_SHADER:
- symbolTable.setDefaultPrecision(integer, EbpMedium);
- break;
- case GL_VERTEX_SHADER:
- symbolTable.setDefaultPrecision(integer, EbpHigh);
- symbolTable.setDefaultPrecision(floatingPoint, EbpHigh);
- break;
- default: assert(false && "Language not supported");
- }
-
- InsertBuiltInFunctions(shaderType, resources, symbolTable);
-
- IdentifyBuiltIns(shaderType, resources, symbolTable);
-
- return true;
-}
-
-void TCompiler::clearResults()
-{
- infoSink.info.erase();
- infoSink.obj.erase();
- infoSink.debug.erase();
-}
-
-bool TCompiler::validateCallDepth(TIntermNode *root, TInfoSink &infoSink)
-{
- AnalyzeCallDepth validator(root);
-
- unsigned int depth = validator.analyzeCallDepth();
-
- if(depth == 0)
- {
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Missing main()";
- return false;
- }
- else if(depth == UINT_MAX)
- {
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function recursion detected";
- return false;
- }
- else if(depth > maxCallStackDepth)
- {
- infoSink.info.prefix(EPrefixError);
- infoSink.info << "Function call stack too deep (depth was ";
- infoSink.info << depth;
- infoSink.info << " while maximum call stack depth is ";
- infoSink.info << maxCallStackDepth;
- infoSink.info << ")";
- return false;
- }
-
- return true;
-}
-
-bool TCompiler::validateLimitations(TIntermNode* root) {
- ValidateLimitations validate(shaderType, infoSink.info);
- root->traverse(&validate);
- return validate.numErrors() == 0;
-}
-
-const TExtensionBehavior& TCompiler::getExtensionBehavior() const
-{
- return extensionBehavior;
-}
-
-bool InitCompilerGlobals()
-{
- if(!InitializePoolIndex())
- {
- assert(0 && "InitCompilerGlobals(): Failed to initalize global pool");
- return false;
- }
-
- if(!InitializeParseContextIndex())
- {
- assert(0 && "InitCompilerGlobals(): Failed to initalize parse context");
- return false;
- }
-
- return true;
-}
-
-void FreeCompilerGlobals()
-{
- FreeParseContextIndex();
- FreePoolIndex();
-}
diff --git a/src/OpenGL/compiler/Compiler.h b/src/OpenGL/compiler/Compiler.h
deleted file mode 100644
index dbb3e5e95..000000000
--- a/src/OpenGL/compiler/Compiler.h
+++ /dev/null
@@ -1,130 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _COMPILER_INCLUDED_
-#define _COMPILER_INCLUDED_
-
-#include "ExtensionBehavior.h"
-#include "InfoSink.h"
-#include "SymbolTable.h"
-
-enum ShCompileOptions
-{
- SH_VALIDATE = 0,
- SH_VALIDATE_LOOP_INDEXING = 0x0001,
- SH_INTERMEDIATE_TREE = 0x0002,
- SH_OBJECT_CODE = 0x0004,
- SH_ATTRIBUTES_UNIFORMS = 0x0008,
- SH_LINE_DIRECTIVES = 0x0010,
- SH_SOURCE_PATH = 0x0020
-};
-
-//
-// Implementation dependent built-in resources (constants and extensions).
-// The names for these resources has been obtained by stripping gl_/GL_.
-//
-struct ShBuiltInResources
-{
- ShBuiltInResources();
-
- // Constants.
- int MaxVertexAttribs;
- int MaxVertexUniformVectors;
- int MaxVaryingVectors;
- int MaxVertexTextureImageUnits;
- int MaxCombinedTextureImageUnits;
- int MaxTextureImageUnits;
- int MaxFragmentUniformVectors;
- int MaxDrawBuffers;
- int MaxVertexOutputVectors;
- int MaxFragmentInputVectors;
- int MinProgramTexelOffset;
- int MaxProgramTexelOffset;
-
- // Extensions.
- // Set to 1 to enable the extension, else 0.
- int OES_standard_derivatives;
- int OES_fragment_precision_high;
- int OES_EGL_image_external;
- int OES_EGL_image_external_essl3;
- int EXT_draw_buffers;
- int ARB_texture_rectangle;
-
- unsigned int MaxCallStackDepth;
-};
-
-typedef unsigned int GLenum;
-#define GL_FRAGMENT_SHADER 0x8B30
-#define GL_VERTEX_SHADER 0x8B31
-
-//
-// The base class for the machine dependent compiler to derive from
-// for managing object code from the compile.
-//
-class TCompiler
-{
-public:
- TCompiler(GLenum shaderType);
- virtual ~TCompiler();
- virtual TCompiler* getAsCompiler() { return this; }
-
- bool Init(const ShBuiltInResources& resources);
- bool compile(const char* const shaderStrings[],
- const int numStrings,
- int compileOptions);
-
- // Get results of the last compilation.
- int getShaderVersion() const { return shaderVersion; }
- TInfoSink& getInfoSink() { return infoSink; }
-
-protected:
- GLenum getShaderType() const { return shaderType; }
- // Initialize symbol-table with built-in symbols.
- bool InitBuiltInSymbolTable(const ShBuiltInResources& resources);
- // Clears the results from the previous compilation.
- void clearResults();
- // Return true if function recursion is detected or call depth exceeded.
- bool validateCallDepth(TIntermNode *root, TInfoSink &infoSink);
- // Returns true if the given shader does not exceed the minimum
- // functionality mandated in GLSL 1.0 spec Appendix A.
- bool validateLimitations(TIntermNode *root);
- // Translate to object code.
- virtual bool translate(TIntermNode *root) = 0;
- // Get built-in extensions with default behavior.
- const TExtensionBehavior& getExtensionBehavior() const;
-
-private:
- GLenum shaderType;
-
- unsigned int maxCallStackDepth;
-
- // Built-in symbol table for the given language, spec, and resources.
- // It is preserved from compile-to-compile.
- TSymbolTable symbolTable;
- // Built-in extensions with default behavior.
- TExtensionBehavior extensionBehavior;
-
- // Results of compilation.
- int shaderVersion;
- TInfoSink infoSink; // Output sink.
-
- // Memory allocator. Allocates and tracks memory required by the compiler.
- // Deallocates all memory when compiler is destructed.
- TPoolAllocator allocator;
-};
-
-bool InitCompilerGlobals();
-void FreeCompilerGlobals();
-
-#endif // _COMPILER_INCLUDED_
diff --git a/src/OpenGL/compiler/ConstantUnion.h b/src/OpenGL/compiler/ConstantUnion.h
deleted file mode 100644
index 8a5b77370..000000000
--- a/src/OpenGL/compiler/ConstantUnion.h
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _CONSTANT_UNION_INCLUDED_
-#define _CONSTANT_UNION_INCLUDED_
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "../../Common/DebugAndroid.hpp"
-#else
-#include <assert.h>
-#endif
-
-class ConstantUnion {
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- ConstantUnion()
- {
- iConst = 0;
- type = EbtVoid;
- }
-
- bool cast(TBasicType newType, const ConstantUnion &constant)
- {
- switch (newType)
- {
- case EbtFloat:
- switch (constant.type)
- {
- case EbtInt: setFConst(static_cast<float>(constant.getIConst())); break;
- case EbtUInt: setFConst(static_cast<float>(constant.getUConst())); break;
- case EbtBool: setFConst(static_cast<float>(constant.getBConst())); break;
- case EbtFloat: setFConst(static_cast<float>(constant.getFConst())); break;
- default: return false;
- }
- break;
- case EbtInt:
- switch (constant.type)
- {
- case EbtInt: setIConst(static_cast<int>(constant.getIConst())); break;
- case EbtUInt: setIConst(static_cast<int>(constant.getUConst())); break;
- case EbtBool: setIConst(static_cast<int>(constant.getBConst())); break;
- case EbtFloat: setIConst(static_cast<int>(constant.getFConst())); break;
- default: return false;
- }
- break;
- case EbtUInt:
- switch (constant.type)
- {
- case EbtInt: setUConst(static_cast<unsigned int>(constant.getIConst())); break;
- case EbtUInt: setUConst(static_cast<unsigned int>(constant.getUConst())); break;
- case EbtBool: setUConst(static_cast<unsigned int>(constant.getBConst())); break;
- case EbtFloat: setUConst(static_cast<unsigned int>(constant.getFConst())); break;
- default: return false;
- }
- break;
- case EbtBool:
- switch (constant.type)
- {
- case EbtInt: setBConst(constant.getIConst() != 0); break;
- case EbtUInt: setBConst(constant.getUConst() != 0); break;
- case EbtBool: setBConst(constant.getBConst()); break;
- case EbtFloat: setBConst(constant.getFConst() != 0.0f); break;
- default: return false;
- }
- break;
- case EbtStruct: // Struct fields don't get cast
- switch (constant.type)
- {
- case EbtInt: setIConst(constant.getIConst()); break;
- case EbtUInt: setUConst(constant.getUConst()); break;
- case EbtBool: setBConst(constant.getBConst()); break;
- case EbtFloat: setFConst(constant.getFConst()); break;
- default: return false;
- }
- break;
- default:
- return false;
- }
-
- return true;
- }
-
- void setIConst(int i) {iConst = i; type = EbtInt; }
- void setUConst(unsigned int u) { uConst = u; type = EbtUInt; }
- void setFConst(float f) {fConst = f; type = EbtFloat; }
- void setBConst(bool b) {bConst = b; type = EbtBool; }
-
- int getIConst() const { return iConst; }
- unsigned int getUConst() const { return uConst; }
- float getFConst() const { return fConst; }
- bool getBConst() const { return bConst; }
-
- float getAsFloat() const
- {
- const int FFFFFFFFh = 0xFFFFFFFF;
-
- switch(type)
- {
- case EbtInt: return reinterpret_cast<const float&>(iConst);
- case EbtUInt: return reinterpret_cast<const float&>(uConst);
- case EbtFloat: return fConst;
- case EbtBool: return (bConst == true) ? reinterpret_cast<const float&>(FFFFFFFFh) : 0;
- default: return 0;
- }
- }
-
- bool operator==(const int i) const
- {
- return i == iConst;
- }
-
- bool operator==(const unsigned int u) const
- {
- return u == uConst;
- }
-
- bool operator==(const float f) const
- {
- return f == fConst;
- }
-
- bool operator==(const bool b) const
- {
- return b == bConst;
- }
-
- bool operator==(const ConstantUnion& constant) const
- {
- if (constant.type != type)
- return false;
-
- switch (type) {
- case EbtInt:
- return constant.iConst == iConst;
- case EbtUInt:
- return constant.uConst == uConst;
- case EbtFloat:
- return constant.fConst == fConst;
- case EbtBool:
- return constant.bConst == bConst;
- default:
- return false;
- }
- }
-
- bool operator!=(const int i) const
- {
- return !operator==(i);
- }
-
- bool operator!=(const unsigned int u) const
- {
- return !operator==(u);
- }
-
- bool operator!=(const float f) const
- {
- return !operator==(f);
- }
-
- bool operator!=(const bool b) const
- {
- return !operator==(b);
- }
-
- bool operator!=(const ConstantUnion& constant) const
- {
- return !operator==(constant);
- }
-
- bool operator>(const ConstantUnion& constant) const
- {
- assert(type == constant.type);
- switch (type) {
- case EbtInt:
- return iConst > constant.iConst;
- case EbtUInt:
- return uConst > constant.uConst;
- case EbtFloat:
- return fConst > constant.fConst;
- default:
- return false; // Invalid operation, handled at semantic analysis
- }
- }
-
- bool operator<(const ConstantUnion& constant) const
- {
- assert(type == constant.type);
- switch (type) {
- case EbtInt:
- return iConst < constant.iConst;
- case EbtUInt:
- return uConst < constant.uConst;
- case EbtFloat:
- return fConst < constant.fConst;
- default:
- return false; // Invalid operation, handled at semantic analysis
- }
- }
-
- bool operator<=(const ConstantUnion& constant) const
- {
- assert(type == constant.type);
- switch (type) {
- case EbtInt:
- return iConst <= constant.iConst;
- case EbtUInt:
- return uConst <= constant.uConst;
- case EbtFloat:
- return fConst <= constant.fConst;
- default:
- return false; // Invalid operation, handled at semantic analysis
- }
- }
-
- bool operator>=(const ConstantUnion& constant) const
- {
- assert(type == constant.type);
- switch (type) {
- case EbtInt:
- return iConst >= constant.iConst;
- case EbtUInt:
- return uConst >= constant.uConst;
- case EbtFloat:
- return fConst >= constant.fConst;
- default:
- return false; // Invalid operation, handled at semantic analysis
- }
- }
-
- ConstantUnion operator+(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst + constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst + constant.uConst); break;
- case EbtFloat: returnValue.setFConst(fConst + constant.fConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator-(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst - constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst - constant.uConst); break;
- case EbtFloat: returnValue.setFConst(fConst - constant.fConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator*(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst * constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst * constant.uConst); break;
- case EbtFloat: returnValue.setFConst(fConst * constant.fConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator%(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst % constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst % constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator>>(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst >> constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst >> constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator<<(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- // The signedness of the second parameter might be different, but we
- // don't care, since the result is undefined if the second parameter is
- // negative, and aliasing should not be a problem with unions.
- assert(constant.type == EbtInt || constant.type == EbtUInt);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst << constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst << constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator&(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(constant.type == EbtInt || constant.type == EbtUInt);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst & constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst & constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator|(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst | constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst | constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator^(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtInt: returnValue.setIConst(iConst ^ constant.iConst); break;
- case EbtUInt: returnValue.setUConst(uConst ^ constant.uConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator&&(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtBool: returnValue.setBConst(bConst && constant.bConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- ConstantUnion operator||(const ConstantUnion& constant) const
- {
- ConstantUnion returnValue;
- assert(type == constant.type);
- switch (type) {
- case EbtBool: returnValue.setBConst(bConst || constant.bConst); break;
- default: assert(false && "Default missing");
- }
-
- return returnValue;
- }
-
- TBasicType getType() const { return type; }
-private:
-
- union {
- int iConst; // used for ivec, scalar ints
- unsigned int uConst; // used for uvec, scalar uints
- bool bConst; // used for bvec, scalar bools
- float fConst; // used for vec, mat, scalar floats
- } ;
-
- TBasicType type;
-};
-
-#endif // _CONSTANT_UNION_INCLUDED_
diff --git a/src/OpenGL/compiler/Diagnostics.cpp b/src/OpenGL/compiler/Diagnostics.cpp
deleted file mode 100644
index f199f5473..000000000
--- a/src/OpenGL/compiler/Diagnostics.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Diagnostics.h"
-
-#include "debug.h"
-#include "InfoSink.h"
-#include "preprocessor/SourceLocation.h"
-
-TDiagnostics::TDiagnostics(TInfoSink& infoSink) :
- mShaderVersion(100),
- mInfoSink(infoSink),
- mNumErrors(0),
- mNumWarnings(0),
- mNumInfos(0)
-{
-}
-
-TDiagnostics::~TDiagnostics()
-{
-}
-
-void TDiagnostics::setShaderVersion(int version)
-{
- mShaderVersion = version;
-}
-
-void TDiagnostics::writeInfo(Severity severity,
- const pp::SourceLocation& loc,
- const std::string& reason,
- const std::string& token,
- const std::string& extra)
-{
- TPrefixType prefix = EPrefixNone;
- switch(severity)
- {
- case PP_ERROR:
- ++mNumErrors;
- prefix = EPrefixError;
- break;
- case PP_WARNING:
- ++mNumWarnings;
- prefix = EPrefixWarning;
- break;
- case PP_INFO:
- ++mNumInfos;
- prefix = EPrefixInfo;
- break;
- default:
- UNREACHABLE(severity);
- break;
- }
-
- TInfoSinkBase& sink = mInfoSink.info;
- /* VC++ format: file(linenum) : error #: 'token' : extrainfo */
- sink.prefix(prefix);
- TSourceLoc sourceLoc;
- sourceLoc.first_file = sourceLoc.last_file = loc.file;
- sourceLoc.first_line = sourceLoc.last_line = loc.line;
- sink.location(sourceLoc);
- sink << "'" << token << "' : " << reason << " " << extra << "\n";
-}
-
-void TDiagnostics::writeDebug(const std::string& str)
-{
- mInfoSink.debug << str;
-}
-
-void TDiagnostics::print(ID id,
- const pp::SourceLocation& loc,
- const std::string& text)
-{
- writeInfo(severity(id), loc, message(id), text, "");
-}
diff --git a/src/OpenGL/compiler/Diagnostics.h b/src/OpenGL/compiler/Diagnostics.h
deleted file mode 100644
index 258efad34..000000000
--- a/src/OpenGL/compiler/Diagnostics.h
+++ /dev/null
@@ -1,59 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_DIAGNOSTICS_H_
-#define COMPILER_DIAGNOSTICS_H_
-
-#include "preprocessor/DiagnosticsBase.h"
-
-class TInfoSink;
-
-class TDiagnostics : public pp::Diagnostics
-{
-public:
- TDiagnostics(TInfoSink& infoSink);
- virtual ~TDiagnostics();
-
- int shaderVersion() const { return mShaderVersion; }
- TInfoSink& infoSink() { return mInfoSink; }
-
- int numErrors() const { return mNumErrors; }
- int numWarnings() const { return mNumWarnings; }
- int numInfos() const { return mNumInfos; }
-
- void setShaderVersion(int version);
-
- void writeInfo(Severity severity,
- const pp::SourceLocation& loc,
- const std::string& reason,
- const std::string& token,
- const std::string& extra);
-
- void writeDebug(const std::string& str);
-
-protected:
- virtual void print(ID id,
- const pp::SourceLocation& loc,
- const std::string& text);
-
-private:
- int mShaderVersion;
-
- TInfoSink& mInfoSink;
- int mNumErrors;
- int mNumWarnings;
- int mNumInfos;
-};
-
-#endif // COMPILER_DIAGNOSTICS_H_
diff --git a/src/OpenGL/compiler/DirectiveHandler.cpp b/src/OpenGL/compiler/DirectiveHandler.cpp
deleted file mode 100644
index 7616ce5a1..000000000
--- a/src/OpenGL/compiler/DirectiveHandler.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "DirectiveHandler.h"
-
-#include <sstream>
-
-#include "debug.h"
-#include "Diagnostics.h"
-
-static TBehavior getBehavior(const std::string& str)
-{
- static const char kRequire[] = "require";
- static const char kEnable[] = "enable";
- static const char kDisable[] = "disable";
- static const char kWarn[] = "warn";
-
- if (str == kRequire) return EBhRequire;
- else if (str == kEnable) return EBhEnable;
- else if (str == kDisable) return EBhDisable;
- else if (str == kWarn) return EBhWarn;
- return EBhUndefined;
-}
-
-TDirectiveHandler::TDirectiveHandler(TExtensionBehavior& extBehavior,
- TDiagnostics& diagnostics,
- int& shaderVersion)
- : mExtensionBehavior(extBehavior),
- mDiagnostics(diagnostics),
- mShaderVersion(shaderVersion)
-{
-}
-
-TDirectiveHandler::~TDirectiveHandler()
-{
-}
-
-void TDirectiveHandler::handleError(const pp::SourceLocation& loc,
- const std::string& msg)
-{
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc, msg, "", "");
-}
-
-void TDirectiveHandler::handlePragma(const pp::SourceLocation& loc,
- const std::string& name,
- const std::string& value,
- bool stdgl)
-{
- static const char kSTDGL[] = "STDGL";
- static const char kOptimize[] = "optimize";
- static const char kDebug[] = "debug";
- static const char kOn[] = "on";
- static const char kOff[] = "off";
-
- bool invalidValue = false;
- if (stdgl || (name == kSTDGL))
- {
- // The STDGL pragma is used to reserve pragmas for use by future
- // revisions of GLSL. Ignore it.
- return;
- }
- else if (name == kOptimize)
- {
- if (value == kOn) mPragma.optimize = true;
- else if (value == kOff) mPragma.optimize = false;
- else invalidValue = true;
- }
- else if (name == kDebug)
- {
- if (value == kOn) mPragma.debug = true;
- else if (value == kOff) mPragma.debug = false;
- else invalidValue = true;
- }
- else
- {
- mDiagnostics.report(pp::Diagnostics::PP_UNRECOGNIZED_PRAGMA, loc, name);
- return;
- }
-
- if (invalidValue)
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
- "invalid pragma value", value,
- "'on' or 'off' expected");
-}
-
-void TDirectiveHandler::handleExtension(const pp::SourceLocation& loc,
- const std::string& name,
- const std::string& behavior)
-{
- static const char kExtAll[] = "all";
-
- TBehavior behaviorVal = getBehavior(behavior);
- if (behaviorVal == EBhUndefined)
- {
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
- "behavior", name, "invalid");
- return;
- }
-
- if (name == kExtAll)
- {
- if (behaviorVal == EBhRequire)
- {
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
- "extension", name,
- "cannot have 'require' behavior");
- }
- else if (behaviorVal == EBhEnable)
- {
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
- "extension", name,
- "cannot have 'enable' behavior");
- }
- else
- {
- for (TExtensionBehavior::iterator iter = mExtensionBehavior.begin();
- iter != mExtensionBehavior.end(); ++iter)
- iter->second = behaviorVal;
- }
- return;
- }
-
- TExtensionBehavior::iterator iter = mExtensionBehavior.find(name);
- if (iter != mExtensionBehavior.end())
- {
- iter->second = behaviorVal;
- return;
- }
-
- pp::Diagnostics::Severity severity = pp::Diagnostics::PP_ERROR;
- switch (behaviorVal) {
- case EBhRequire:
- severity = pp::Diagnostics::PP_ERROR;
- break;
- case EBhEnable:
- case EBhWarn:
- case EBhDisable:
- severity = pp::Diagnostics::PP_WARNING;
- break;
- default:
- UNREACHABLE(behaviorVal);
- break;
- }
- mDiagnostics.writeInfo(severity, loc,
- "extension", name, "is not supported");
-}
-
-void TDirectiveHandler::handleVersion(const pp::SourceLocation& loc,
- int version)
-{
- if (version == 100 ||
- version == 300)
- {
- mShaderVersion = version;
- }
- else
- {
- std::stringstream stream;
- stream << version;
- std::string str = stream.str();
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR, loc,
- "version number", str, "not supported");
- }
-}
diff --git a/src/OpenGL/compiler/DirectiveHandler.h b/src/OpenGL/compiler/DirectiveHandler.h
deleted file mode 100644
index 0538c597a..000000000
--- a/src/OpenGL/compiler/DirectiveHandler.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_DIRECTIVE_HANDLER_H_
-#define COMPILER_DIRECTIVE_HANDLER_H_
-
-#include "ExtensionBehavior.h"
-#include "Pragma.h"
-#include "preprocessor/DirectiveHandlerBase.h"
-
-class TDiagnostics;
-
-class TDirectiveHandler : public pp::DirectiveHandler
-{
-public:
- TDirectiveHandler(TExtensionBehavior& extBehavior,
- TDiagnostics& diagnostics,
- int& shaderVersion);
- virtual ~TDirectiveHandler();
-
- const TPragma& pragma() const { return mPragma; }
- const TExtensionBehavior& extensionBehavior() const { return mExtensionBehavior; }
-
- virtual void handleError(const pp::SourceLocation& loc,
- const std::string& msg);
-
- virtual void handlePragma(const pp::SourceLocation& loc,
- const std::string& name,
- const std::string& value,
- bool stdgl);
-
- virtual void handleExtension(const pp::SourceLocation& loc,
- const std::string& name,
- const std::string& behavior);
-
- virtual void handleVersion(const pp::SourceLocation& loc,
- int version);
-
-private:
- TPragma mPragma;
- TExtensionBehavior& mExtensionBehavior;
- TDiagnostics& mDiagnostics;
- int& mShaderVersion;
-};
-
-#endif // COMPILER_DIRECTIVE_HANDLER_H_
diff --git a/src/OpenGL/compiler/ExtensionBehavior.h b/src/OpenGL/compiler/ExtensionBehavior.h
deleted file mode 100644
index eb035e5e5..000000000
--- a/src/OpenGL/compiler/ExtensionBehavior.h
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _EXTENSION_BEHAVIOR_INCLUDED_
-#define _EXTENSION_BEHAVIOR_INCLUDED_
-
-#include <map>
-#include <string>
-
-typedef enum
-{
- EBhRequire,
- EBhEnable,
- EBhWarn,
- EBhDisable,
- EBhUndefined
-} TBehavior;
-
-inline const char *getBehaviorString(TBehavior b)
-{
- switch(b)
- {
- case EBhRequire: return "require";
- case EBhEnable: return "enable";
- case EBhWarn: return "warn";
- case EBhDisable: return "disable";
- default: return nullptr;
- }
-}
-
-// Mapping between extension name and behavior.
-typedef std::map<std::string, TBehavior> TExtensionBehavior;
-
-#endif // _EXTENSION_TABLE_INCLUDED_
diff --git a/src/OpenGL/compiler/InfoSink.cpp b/src/OpenGL/compiler/InfoSink.cpp
deleted file mode 100644
index 84dd3374b..000000000
--- a/src/OpenGL/compiler/InfoSink.cpp
+++ /dev/null
@@ -1,69 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "InfoSink.h"
-
-void TInfoSinkBase::prefix(TPrefixType message) {
- switch(message) {
- case EPrefixNone:
- break;
- case EPrefixInfo:
- sink.append("INFO: ");
- break;
- case EPrefixWarning:
- sink.append("WARNING: ");
- break;
- case EPrefixError:
- sink.append("ERROR: ");
- break;
- case EPrefixInternalError:
- sink.append("INTERNAL ERROR: ");
- break;
- case EPrefixUnimplemented:
- sink.append("UNIMPLEMENTED: ");
- break;
- case EPrefixNote:
- sink.append("NOTE: ");
- break;
- default:
- sink.append("UNKOWN ERROR: ");
- break;
- }
-}
-
-void TInfoSinkBase::location(const TSourceLoc& loc) {
- int string = loc.first_file, line = loc.first_line;
-
- TPersistStringStream stream;
- if (line)
- stream << string << ":" << line;
- else
- stream << string << ":? ";
- stream << ": ";
-
- sink.append(stream.str());
-}
-
-void TInfoSinkBase::message(TPrefixType message, const char* s) {
- prefix(message);
- sink.append(s);
- sink.append("\n");
-}
-
-void TInfoSinkBase::message(TPrefixType message, const char* s, TSourceLoc loc) {
- prefix(message);
- location(loc);
- sink.append(s);
- sink.append("\n");
-}
diff --git a/src/OpenGL/compiler/InfoSink.h b/src/OpenGL/compiler/InfoSink.h
deleted file mode 100644
index fa1070a5e..000000000
--- a/src/OpenGL/compiler/InfoSink.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _INFOSINK_INCLUDED_
-#define _INFOSINK_INCLUDED_
-
-#include <math.h>
-#include "Common.h"
-
-// Returns the fractional part of the given floating-point number.
-inline float fractionalPart(float f) {
- float intPart = 0.0f;
- return modff(f, &intPart);
-}
-
-//
-// TPrefixType is used to centralize how info log messages start.
-// See below.
-//
-enum TPrefixType {
- EPrefixNone,
- EPrefixInfo,
- EPrefixWarning,
- EPrefixError,
- EPrefixInternalError,
- EPrefixUnimplemented,
- EPrefixNote
-};
-
-//
-// Encapsulate info logs for all objects that have them.
-//
-// The methods are a general set of tools for getting a variety of
-// messages and types inserted into the log.
-//
-class TInfoSinkBase {
-public:
- TInfoSinkBase() {}
-
- template <typename T>
- TInfoSinkBase& operator<<(const T& t) {
- TPersistStringStream stream;
- stream << t;
- sink.append(stream.str());
- return *this;
- }
- // Override << operator for specific types. It is faster to append strings
- // and characters directly to the sink.
- TInfoSinkBase& operator<<(char c) {
- sink.append(1, c);
- return *this;
- }
- TInfoSinkBase& operator<<(const char* str) {
- sink.append(str);
- return *this;
- }
- TInfoSinkBase& operator<<(const TPersistString& str) {
- sink.append(str);
- return *this;
- }
- TInfoSinkBase& operator<<(const TString& str) {
- sink.append(str.c_str());
- return *this;
- }
- // Make sure floats are written with correct precision.
- TInfoSinkBase& operator<<(float f) {
- // Make sure that at least one decimal point is written. If a number
- // does not have a fractional part, the default precision format does
- // not write the decimal portion which gets interpreted as integer by
- // the compiler.
- TPersistStringStream stream;
- if (fractionalPart(f) == 0.0f) {
- stream.precision(1);
- stream << std::showpoint << std::fixed << f;
- } else {
- stream.unsetf(std::ios::fixed);
- stream.unsetf(std::ios::scientific);
- stream.precision(8);
- stream << f;
- }
- sink.append(stream.str());
- return *this;
- }
- // Write boolean values as their names instead of integral value.
- TInfoSinkBase& operator<<(bool b) {
- const char* str = b ? "true" : "false";
- sink.append(str);
- return *this;
- }
-
- void erase() { sink.clear(); }
- int size() { return static_cast<int>(sink.size()); }
-
- const TPersistString& str() const { return sink; }
- const char* c_str() const { return sink.c_str(); }
-
- void prefix(TPrefixType message);
- void location(const TSourceLoc& loc);
- void message(TPrefixType message, const char* s);
- void message(TPrefixType message, const char* s, TSourceLoc loc);
-
-private:
- TPersistString sink;
-};
-
-class TInfoSink {
-public:
- TInfoSinkBase info;
- TInfoSinkBase debug;
- TInfoSinkBase obj;
-};
-
-#endif // _INFOSINK_INCLUDED_
diff --git a/src/OpenGL/compiler/Initialize.cpp b/src/OpenGL/compiler/Initialize.cpp
deleted file mode 100644
index 49fb335ba..000000000
--- a/src/OpenGL/compiler/Initialize.cpp
+++ /dev/null
@@ -1,534 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// Create strings that declare built-in definitions, add built-ins that
-// cannot be expressed in the files, and establish mappings between
-// built-in functions and operators.
-//
-
-#include "Initialize.h"
-
-#include "intermediate.h"
-
-void InsertBuiltInFunctions(GLenum type, const ShBuiltInResources &resources, TSymbolTable &symbolTable)
-{
- TType *float1 = new TType(EbtFloat);
- TType *float2 = new TType(EbtFloat, 2);
- TType *float3 = new TType(EbtFloat, 3);
- TType *float4 = new TType(EbtFloat, 4);
- TType *genType = new TType(EbtGenType);
-
- TType *int1 = new TType(EbtInt);
- TType *int2 = new TType(EbtInt, 2);
- TType *int3 = new TType(EbtInt, 3);
- TType *uint1 = new TType(EbtUInt);
- TType *genIType = new TType(EbtGenIType);
- TType *genUType = new TType(EbtGenUType);
- TType *genBType = new TType(EbtGenBType);
-
- //
- // Angle and Trigonometric Functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRadians, genType, "radians", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDegrees, genType, "degrees", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSin, genType, "sin", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCos, genType, "cos", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpTan, genType, "tan", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAsin, genType, "asin", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAcos, genType, "acos", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAtan, genType, "atan", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSinh, genType, "sinh", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpCosh, genType, "cosh", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTanh, genType, "tanh", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAsinh, genType, "asinh", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAcosh, genType, "acosh", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAtanh, genType, "atanh", genType);
-
- //
- // Exponential Functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpPow, genType, "pow", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp, genType, "exp", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog, genType, "log", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpExp2, genType, "exp2", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLog2, genType, "log2", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSqrt, genType, "sqrt", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpInverseSqrt, genType, "inversesqrt", genType);
-
- //
- // Common Functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAbs, genType, "abs", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpAbs, genIType, "abs", genIType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSign, genType, "sign", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpSign, genIType, "sign", genIType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFloor, genType, "floor", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTrunc, genType, "trunc", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRound, genType, "round", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpRoundEven, genType, "roundEven", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCeil, genType, "ceil", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFract, genType, "fract", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, float1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMod, genType, "mod", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, float1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMin, genType, "min", genType, genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, genIType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genIType, "min", genIType, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, genUType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMin, genUType, "min", genUType, uint1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, float1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMax, genType, "max", genType, genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, genIType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genIType, "max", genIType, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, genUType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMax, genUType, "max", genUType, uint1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, float1, float1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpClamp, genType, "clamp", genType, genType, genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, int1, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genIType, "clamp", genIType, genIType, genIType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, uint1, uint1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpClamp, genUType, "clamp", genUType, genUType, genUType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, float1);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMix, genType, "mix", genType, genType, genBType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpStep, genType, "step", float1, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", genType, genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpSmoothStep, genType, "smoothstep", float1, float1, genType);
-
- TType *outFloat1 = new TType(EbtFloat, EbpUndefined, EvqOut);
- TType *outFloat2 = new TType(EbtFloat, EbpUndefined, EvqOut, 2);
- TType *outFloat3 = new TType(EbtFloat, EbpUndefined, EvqOut, 3);
- TType *outFloat4 = new TType(EbtFloat, EbpUndefined, EvqOut, 4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float1, "modf", float1, outFloat1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float2, "modf", float2, outFloat2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float3, "modf", float3, outFloat3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpModf, float4, "modf", float4, outFloat4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsNan, genBType, "isnan", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIsInf, genBType, "isinf", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToInt, genIType, "floatBitsToInt", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFloatBitsToUint, genUType, "floatBitsToUint", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpIntBitsToFloat, genType, "intBitsToFloat", genIType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUintBitsToFloat, genType, "uintBitsToFloat", genUType);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackSnorm2x16, uint1, "packSnorm2x16", float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackUnorm2x16, uint1, "packUnorm2x16", float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpPackHalf2x16, uint1, "packHalf2x16", float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackSnorm2x16, float2, "unpackSnorm2x16", uint1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackUnorm2x16, float2, "unpackUnorm2x16", uint1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpUnpackHalf2x16, float2, "unpackHalf2x16", uint1);
-
- //
- // Geometric Functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLength, float1, "length", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDistance, float1, "distance", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpDot, float1, "dot", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpCross, float3, "cross", float3, float3);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpNormalize, genType, "normalize", genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpFaceForward, genType, "faceforward", genType, genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpReflect, genType, "reflect", genType, genType);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpRefract, genType, "refract", genType, genType, float1);
-
- TType *mat2 = new TType(EbtFloat, 2, 2);
- TType *mat2x3 = new TType(EbtFloat, 2, 3);
- TType *mat2x4 = new TType(EbtFloat, 2, 4);
- TType *mat3x2 = new TType(EbtFloat, 3, 2);
- TType *mat3 = new TType(EbtFloat, 3, 3);
- TType *mat3x4 = new TType(EbtFloat, 3, 4);
- TType *mat4x2 = new TType(EbtFloat, 4, 2);
- TType *mat4x3 = new TType(EbtFloat, 4, 3);
- TType *mat4 = new TType(EbtFloat, 4, 4);
-
- //
- // Matrix Functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat2, "matrixCompMult", mat2, mat2);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat3, "matrixCompMult", mat3, mat3);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpMul, mat4, "matrixCompMult", mat4, mat4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x3, "matrixCompMult", mat2x3, mat2x3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x2, "matrixCompMult", mat3x2, mat3x2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat2x4, "matrixCompMult", mat2x4, mat2x4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x2, "matrixCompMult", mat4x2, mat4x2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat3x4, "matrixCompMult", mat3x4, mat3x4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpMul, mat4x3, "matrixCompMult", mat4x3, mat4x3);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2, "outerProduct", float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3, "outerProduct", float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4, "outerProduct", float4, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x3, "outerProduct", float3, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x2, "outerProduct", float2, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat2x4, "outerProduct", float4, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x2, "outerProduct", float2, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat3x4, "outerProduct", float4, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpOuterProduct, mat4x3, "outerProduct", float3, float4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2, "transpose", mat2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3, "transpose", mat3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4, "transpose", mat4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x3, "transpose", mat3x2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x2, "transpose", mat2x3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat2x4, "transpose", mat4x2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x2, "transpose", mat2x4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat3x4, "transpose", mat4x3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpTranspose, mat4x3, "transpose", mat3x4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDeterminant, float1, "determinant", mat4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat2, "inverse", mat2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat3, "inverse", mat3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpInverse, mat4, "inverse", mat4);
-
-
- TType *bool1 = new TType(EbtBool);
- TType *vec = new TType(EbtVec);
- TType *ivec = new TType(EbtIVec);
- TType *uvec = new TType(EbtUVec);
- TType *bvec = new TType(EbtBVec);
-
- //
- // Vector relational functions.
- //
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThan, bvec, "lessThan", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThan, bvec, "lessThan", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpLessThanEqual, bvec, "lessThanEqual", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThan, bvec, "greaterThan", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThan, bvec, "greaterThan", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpGreaterThanEqual, bvec, "greaterThanEqual", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorEqual, bvec, "equal", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorEqual, bvec, "equal", bvec, bvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", vec, vec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", ivec, ivec);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", uvec, uvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorNotEqual, bvec, "notEqual", bvec, bvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAny, bool1, "any", bvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpAll, bool1, "all", bvec);
- symbolTable.insertBuiltIn(COMMON_BUILTINS, EOpVectorLogicalNot, bvec, "not", bvec);
-
- TType *sampler2D = new TType(EbtSampler2D);
- TType *samplerCube = new TType(EbtSamplerCube);
- TType *sampler3D = new TType(EbtSampler3D);
-
- //
- // Texture Functions for GLSL ES 1.0
- //
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3D", sampler3D, float3);
-
- if(resources.ARB_texture_rectangle)
- {
- TType *sampler2DRect = new TType(EbtSampler2DRect);
-
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRect", sampler2DRect, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DRectProj", sampler2DRect, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", sampler2DRect, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", sampler2DRect, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", sampler2DRect, float4);
- }
-
- if(resources.OES_EGL_image_external)
- {
- TType *samplerExternalOES = new TType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float3);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", samplerExternalOES, float4);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3D", samplerExternalOES, float3);
- }
-
- if(resources.OES_EGL_image_external_essl3)
- {
- TType *samplerExternalOES = new TType(EbtSamplerExternalOES);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texture", samplerExternalOES, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "textureProj", samplerExternalOES, float4);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerExternalOES, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float4, "texelFetch", samplerExternalOES, int2, int1);
- }
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2D", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProj", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCube", samplerCube, float3, float1);
-
- if(resources.OES_standard_derivatives)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdx, "GL_OES_standard_derivatives", genType, "dFdx", genType);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpDFdy, "GL_OES_standard_derivatives", genType, "dFdy", genType);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, EOpFwidth,"GL_OES_standard_derivatives", genType, "fwidth", genType);
- }
- }
-
- if(type == GL_VERTEX_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DLod", sampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture2DProjLod", sampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "textureCubeLod", samplerCube, float3, float1);
- symbolTable.insertBuiltIn(ESSL1_BUILTINS, float4, "texture3DLod", sampler3D, float3, float1);
- }
-
- TType *gvec4 = new TType(EbtGVec4);
-
- TType *gsampler2D = new TType(EbtGSampler2D);
- TType *gsamplerCube = new TType(EbtGSamplerCube);
- TType *gsampler3D = new TType(EbtGSampler3D);
- TType *gsampler2DArray = new TType(EbtGSampler2DArray);
-
- //
- // Texture Functions for GLSL ES 3.0
- //
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler3D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsamplerCube, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLod", gsampler2DArray, float3, float1);
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2D, float2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler3D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsamplerCube, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texture", gsampler2DArray, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProj", gsampler3D, float4, float1);
- }
-
- TType *sampler2DShadow = new TType(EbtSampler2DShadow);
- TType *samplerCubeShadow = new TType(EbtSamplerCubeShadow);
- TType *sampler2DArrayShadow = new TType(EbtSampler2DArrayShadow);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DArrayShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLod", sampler2DShadow, float3, float1);
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", sampler2DShadow, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "texture", samplerCubeShadow, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProj", sampler2DShadow, float4, float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsampler2D, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler3D, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", gsamplerCube, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", gsampler2DArray, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", sampler2DShadow, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int2, "textureSize", samplerCubeShadow, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, int3, "textureSize", sampler2DArrayShadow, int1);
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdx, genType, "dFdx", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpDFdy, genType, "dFdy", genType);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, EOpFwidth, genType, "fwidth", genType);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2);
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2D, float2, int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler3D, float3, int3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureOffset", sampler2DShadow, float3, int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureOffset", gsampler2DArray, float3, int2, float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2);
-
- if(type == GL_FRAGMENT_SHADER)
- {
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float3, int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler2D, float4, int2, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjOffset", gsampler3D, float4, int3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjOffset", sampler2DShadow, float4, int2, float1);
- }
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2D, float2, float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler3D, float3, float1, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureLodOffset", sampler2DShadow, float3, float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureLodOffset", gsampler2DArray, float3, float1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float3, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler2D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLod", gsampler3D, float4, float1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLod", sampler2DShadow, float4, float1);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float3, float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler2D, float4, float1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjLodOffset", gsampler3D, float4, float1, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjLodOffset", sampler2DShadow, float4, float1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2D, int2, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler3D, int3, int1);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetch", gsampler2DArray, int3, int1);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2D, int2, int1, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler3D, int3, int1, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "texelFetchOffset", gsampler2DArray, int3, int1, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2D, float2, float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler3D, float3, float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsamplerCube, float3, float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DShadow, float3, float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", samplerCubeShadow, float4, float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGrad", gsampler2DArray, float3, float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGrad", sampler2DArrayShadow, float4, float2, float2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2D, float2, float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler3D, float3, float3, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DShadow, float3, float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureGradOffset", gsampler2DArray, float3, float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureGradOffset", sampler2DArrayShadow, float4, float2, float2, int2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float3, float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler2D, float4, float2, float2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGrad", gsampler3D, float4, float3, float3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGrad", sampler2DShadow, float4, float2, float2);
-
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float3, float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler2D, float4, float2, float2, int2);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, gvec4, "textureProjGradOffset", gsampler3D, float4, float3, float3, int3);
- symbolTable.insertBuiltIn(ESSL3_BUILTINS, float1, "textureProjGradOffset", sampler2DShadow, float4, float2, float2, int2);
-
- //
- // Depth range in window coordinates
- //
- TFieldList *fields = NewPoolTFieldList();
- TSourceLoc zeroSourceLoc = { 0, 0, 0, 0 };
- TField *near = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("near"), zeroSourceLoc);
- TField *far = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("far"), zeroSourceLoc);
- TField *diff = new TField(new TType(EbtFloat, EbpHigh, EvqGlobal, 1), NewPoolTString("diff"), zeroSourceLoc);
- fields->push_back(near);
- fields->push_back(far);
- fields->push_back(diff);
- TStructure *depthRangeStruct = new TStructure(NewPoolTString("gl_DepthRangeParameters"), fields);
- TVariable *depthRangeParameters = new TVariable(&depthRangeStruct->name(), depthRangeStruct, true);
- symbolTable.insert(COMMON_BUILTINS, depthRangeParameters);
- TVariable *depthRange = new TVariable(NewPoolTString("gl_DepthRange"), TType(depthRangeStruct));
- depthRange->setQualifier(EvqUniform);
- symbolTable.insert(COMMON_BUILTINS, depthRange);
-
- //
- // Implementation dependent built-in constants.
- //
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexAttribs", resources.MaxVertexAttribs);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexUniformVectors", resources.MaxVertexUniformVectors);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxVertexTextureImageUnits", resources.MaxVertexTextureImageUnits);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxCombinedTextureImageUnits", resources.MaxCombinedTextureImageUnits);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxTextureImageUnits", resources.MaxTextureImageUnits);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxFragmentUniformVectors", resources.MaxFragmentUniformVectors);
- symbolTable.insertConstInt(COMMON_BUILTINS, "gl_MaxDrawBuffers", resources.MaxDrawBuffers);
- symbolTable.insertConstInt(ESSL1_BUILTINS, "gl_MaxVaryingVectors", resources.MaxVaryingVectors);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxVertexOutputVectors", resources.MaxVertexOutputVectors);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxFragmentInputVectors", resources.MaxFragmentInputVectors);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MinProgramTexelOffset", resources.MinProgramTexelOffset);
- symbolTable.insertConstInt(ESSL3_BUILTINS, "gl_MaxProgramTexelOffset", resources.MaxProgramTexelOffset);
-}
-
-void IdentifyBuiltIns(GLenum shaderType,
- const ShBuiltInResources &resources,
- TSymbolTable &symbolTable)
-{
- //
- // First, insert some special built-in variables that are not in
- // the built-in header files.
- //
- switch(shaderType)
- {
- case GL_FRAGMENT_SHADER:
- symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FragCoord"), TType(EbtFloat, EbpMedium, EvqFragCoord, 4)));
- symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_FrontFacing"), TType(EbtBool, EbpUndefined, EvqFrontFacing, 1)));
- symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointCoord"), TType(EbtFloat, EbpMedium, EvqPointCoord, 2)));
- symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString("gl_FragColor"), TType(EbtFloat, EbpMedium, EvqFragColor, 4)));
- symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString("gl_FragData[gl_MaxDrawBuffers]"), TType(EbtFloat, EbpMedium, EvqFragData, 4)));
- symbolTable.insert(ESSL3_BUILTINS, new TVariable(NewPoolTString("gl_FragDepth"), TType(EbtFloat, EbpHigh, EvqFragDepth, 1)));
- break;
- case GL_VERTEX_SHADER:
- symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_Position"), TType(EbtFloat, EbpHigh, EvqPosition, 4)));
- symbolTable.insert(COMMON_BUILTINS, new TVariable(NewPoolTString("gl_PointSize"), TType(EbtFloat, EbpMedium, EvqPointSize, 1)));
- symbolTable.insert(ESSL3_BUILTINS, new TVariable(NewPoolTString("gl_InstanceID"), TType(EbtInt, EbpHigh, EvqInstanceID, 1)));
- symbolTable.insert(ESSL3_BUILTINS, new TVariable(NewPoolTString("gl_VertexID"), TType(EbtInt, EbpHigh, EvqVertexID, 1)));
- break;
- default: assert(false && "Language not supported");
- }
-
- // Finally add resource-specific variables.
- switch(shaderType)
- {
- case GL_FRAGMENT_SHADER:
- {
- // Set up gl_FragData. The array size.
- TType fragData(EbtFloat, EbpMedium, EvqFragData, 4, 1, true);
- fragData.setArraySize(resources.MaxDrawBuffers);
- symbolTable.insert(ESSL1_BUILTINS, new TVariable(NewPoolTString("gl_FragData"), fragData));
- }
- break;
- default: break;
- }
-}
-
-void InitExtensionBehavior(const ShBuiltInResources& resources,
- TExtensionBehavior& extBehavior)
-{
- if(resources.OES_standard_derivatives)
- extBehavior["GL_OES_standard_derivatives"] = EBhUndefined;
- if(resources.OES_fragment_precision_high)
- extBehavior["GL_FRAGMENT_PRECISION_HIGH"] = EBhUndefined;
- if(resources.OES_EGL_image_external)
- extBehavior["GL_OES_EGL_image_external"] = EBhUndefined;
- if(resources.OES_EGL_image_external_essl3)
- extBehavior["GL_OES_EGL_image_external_essl3"] = EBhUndefined;
- if(resources.EXT_draw_buffers)
- extBehavior["GL_EXT_draw_buffers"] = EBhUndefined;
- if(resources.ARB_texture_rectangle)
- extBehavior["GL_ARB_texture_rectangle"] = EBhUndefined;
-}
diff --git a/src/OpenGL/compiler/Initialize.h b/src/OpenGL/compiler/Initialize.h
deleted file mode 100644
index e5fcbf2b2..000000000
--- a/src/OpenGL/compiler/Initialize.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _INITIALIZE_INCLUDED_
-#define _INITIALIZE_INCLUDED_
-
-#include "Common.h"
-#include "Compiler.h"
-#include "SymbolTable.h"
-
-void InsertBuiltInFunctions(GLenum shaderType, const ShBuiltInResources &resources, TSymbolTable &table);
-
-void IdentifyBuiltIns(GLenum shaderType,
- const ShBuiltInResources& resources,
- TSymbolTable& symbolTable);
-
-void InitExtensionBehavior(const ShBuiltInResources& resources,
- TExtensionBehavior& extensionBehavior);
-
-#endif // _INITIALIZE_INCLUDED_
diff --git a/src/OpenGL/compiler/InitializeGlobals.h b/src/OpenGL/compiler/InitializeGlobals.h
deleted file mode 100644
index 3ddb048b9..000000000
--- a/src/OpenGL/compiler/InitializeGlobals.h
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef __INITIALIZE_GLOBALS_INCLUDED_
-#define __INITIALIZE_GLOBALS_INCLUDED_
-
-bool InitializePoolIndex();
-void FreePoolIndex();
-
-#endif // __INITIALIZE_GLOBALS_INCLUDED_
diff --git a/src/OpenGL/compiler/InitializeParseContext.cpp b/src/OpenGL/compiler/InitializeParseContext.cpp
deleted file mode 100644
index 06b72d964..000000000
--- a/src/OpenGL/compiler/InitializeParseContext.cpp
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "InitializeParseContext.h"
-
-#include "osinclude.h"
-
-OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
-
-bool InitializeParseContextIndex()
-{
- assert(GlobalParseContextIndex == OS_INVALID_TLS_INDEX);
-
- GlobalParseContextIndex = OS_AllocTLSIndex();
- return GlobalParseContextIndex != OS_INVALID_TLS_INDEX;
-}
-
-void FreeParseContextIndex()
-{
- assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
-
- OS_FreeTLSIndex(GlobalParseContextIndex);
- GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
-}
-
-void SetGlobalParseContext(TParseContext* context)
-{
- assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
- OS_SetTLSValue(GlobalParseContextIndex, context);
-}
-
-TParseContext* GetGlobalParseContext()
-{
- assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
- return static_cast<TParseContext*>(OS_GetTLSValue(GlobalParseContextIndex));
-}
-
diff --git a/src/OpenGL/compiler/InitializeParseContext.h b/src/OpenGL/compiler/InitializeParseContext.h
deleted file mode 100644
index c55eae275..000000000
--- a/src/OpenGL/compiler/InitializeParseContext.h
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef __INITIALIZE_PARSE_CONTEXT_INCLUDED_
-#define __INITIALIZE_PARSE_CONTEXT_INCLUDED_
-
-bool InitializeParseContextIndex();
-void FreeParseContextIndex();
-
-class TParseContext;
-extern void SetGlobalParseContext(TParseContext* context);
-extern TParseContext* GetGlobalParseContext();
-
-#endif // __INITIALIZE_PARSE_CONTEXT_INCLUDED_
diff --git a/src/OpenGL/compiler/IntermTraverse.cpp b/src/OpenGL/compiler/IntermTraverse.cpp
deleted file mode 100644
index 44b1c3d4d..000000000
--- a/src/OpenGL/compiler/IntermTraverse.cpp
+++ /dev/null
@@ -1,340 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "intermediate.h"
-
-//
-// Traverse the intermediate representation tree, and
-// call a node type specific function for each node.
-// Done recursively through the member function Traverse().
-// Node types can be skipped if their function to call is 0,
-// but their subtree will still be traversed.
-// Nodes with children can have their whole subtree skipped
-// if preVisit is turned on and the type specific function
-// returns false.
-//
-// preVisit, postVisit, and rightToLeft control what order
-// nodes are visited in.
-//
-
-//
-// Traversal functions for terminals are straighforward....
-//
-void TIntermSymbol::traverse(TIntermTraverser* it)
-{
- it->visitSymbol(this);
-}
-
-void TIntermConstantUnion::traverse(TIntermTraverser* it)
-{
- it->visitConstantUnion(this);
-}
-
-//
-// Traverse a binary node.
-//
-void TIntermBinary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- //
- // visit the node before children if pre-visiting.
- //
- if(it->preVisit)
- {
- visit = it->visitBinary(PreVisit, this);
- }
-
- //
- // Visit the children, in the right order.
- //
- if(visit)
- {
- it->incrementDepth(this);
-
- if(it->rightToLeft)
- {
- if(right)
- {
- right->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && left)
- {
- left->traverse(it);
- }
- }
- else
- {
- if(left)
- {
- left->traverse(it);
- }
-
- if(it->inVisit)
- {
- visit = it->visitBinary(InVisit, this);
- }
-
- if(visit && right)
- {
- right->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- //
- // Visit the node after the children, if requested and the traversal
- // hasn't been cancelled yet.
- //
- if(visit && it->postVisit)
- {
- it->visitBinary(PostVisit, this);
- }
-}
-
-//
-// Traverse a unary node. Same comments in binary node apply here.
-//
-void TIntermUnary::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitUnary(PreVisit, this);
-
- if (visit) {
- it->incrementDepth(this);
- operand->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitUnary(PostVisit, this);
-}
-
-//
-// Traverse an aggregate node. Same comments in binary node apply here.
-//
-void TIntermAggregate::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitAggregate(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth(this);
-
- if(it->rightToLeft)
- {
- for(TIntermSequence::reverse_iterator sit = sequence.rbegin(); sit != sequence.rend(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.front())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
- else
- {
- for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- (*sit)->traverse(it);
-
- if(visit && it->inVisit)
- {
- if(*sit != sequence.back())
- {
- visit = it->visitAggregate(InVisit, this);
- }
- }
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitAggregate(PostVisit, this);
- }
-}
-
-//
-// Traverse a selection node. Same comments in binary node apply here.
-//
-void TIntermSelection::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitSelection(PreVisit, this);
-
- if (visit) {
- it->incrementDepth(this);
- if (it->rightToLeft) {
- if (falseBlock)
- falseBlock->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- condition->traverse(it);
- } else {
- condition->traverse(it);
- if (trueBlock)
- trueBlock->traverse(it);
- if (falseBlock)
- falseBlock->traverse(it);
- }
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitSelection(PostVisit, this);
-}
-
-//
-// Traverse a switch node. Same comments in binary node apply here.
-//
-void TIntermSwitch::traverse(TIntermTraverser *it)
-{
- bool visit = true;
-
- if(it->preVisit)
- visit = it->visitSwitch(PreVisit, this);
-
- if(visit)
- {
- it->incrementDepth(this);
- if(it->inVisit)
- visit = it->visitSwitch(InVisit, this);
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- it->visitSwitch(PostVisit, this);
-}
-
-//
-// Traverse a switch node. Same comments in binary node apply here.
-//
-void TIntermCase::traverse(TIntermTraverser *it)
-{
- bool visit = true;
-
- if(it->preVisit)
- visit = it->visitCase(PreVisit, this);
-
- if(visit && mCondition)
- mCondition->traverse(it);
-
- if(visit && it->postVisit)
- it->visitCase(PostVisit, this);
-}
-
-//
-// Traverse a loop node. Same comments in binary node apply here.
-//
-void TIntermLoop::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if(it->preVisit)
- {
- visit = it->visitLoop(PreVisit, this);
- }
-
- if(visit)
- {
- it->incrementDepth(this);
-
- if(it->rightToLeft)
- {
- if(expr)
- {
- expr->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(cond)
- {
- cond->traverse(it);
- }
- }
- else
- {
- if(cond)
- {
- cond->traverse(it);
- }
-
- if(body)
- {
- body->traverse(it);
- }
-
- if(expr)
- {
- expr->traverse(it);
- }
- }
-
- it->decrementDepth();
- }
-
- if(visit && it->postVisit)
- {
- it->visitLoop(PostVisit, this);
- }
-}
-
-//
-// Traverse a branch node. Same comments in binary node apply here.
-//
-void TIntermBranch::traverse(TIntermTraverser* it)
-{
- bool visit = true;
-
- if (it->preVisit)
- visit = it->visitBranch(PreVisit, this);
-
- if (visit && expression) {
- it->incrementDepth(this);
- expression->traverse(it);
- it->decrementDepth();
- }
-
- if (visit && it->postVisit)
- it->visitBranch(PostVisit, this);
-}
-
diff --git a/src/OpenGL/compiler/Intermediate.cpp b/src/OpenGL/compiler/Intermediate.cpp
deleted file mode 100644
index c5fb3a2e4..000000000
--- a/src/OpenGL/compiler/Intermediate.cpp
+++ /dev/null
@@ -1,2123 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// Build the intermediate representation.
-//
-
-#include <float.h>
-#include <limits.h>
-#include <algorithm>
-
-#include "localintermediate.h"
-#include "SymbolTable.h"
-#include "Common/Math.hpp"
-
-bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray);
-
-static TPrecision GetHigherPrecision( TPrecision left, TPrecision right ){
- return left > right ? left : right;
-}
-
-static bool ValidateMultiplication(TOperator op, const TType &left, const TType &right)
-{
- switch(op)
- {
- case EOpMul:
- case EOpMulAssign:
- return left.getNominalSize() == right.getNominalSize() &&
- left.getSecondarySize() == right.getSecondarySize();
- case EOpVectorTimesScalar:
- case EOpVectorTimesScalarAssign:
- return true;
- case EOpVectorTimesMatrix:
- return left.getNominalSize() == right.getSecondarySize();
- case EOpVectorTimesMatrixAssign:
- return left.getNominalSize() == right.getSecondarySize() &&
- left.getNominalSize() == right.getNominalSize();
- case EOpMatrixTimesVector:
- return left.getNominalSize() == right.getNominalSize();
- case EOpMatrixTimesScalar:
- case EOpMatrixTimesScalarAssign:
- return true;
- case EOpMatrixTimesMatrix:
- return left.getNominalSize() == right.getSecondarySize();
- case EOpMatrixTimesMatrixAssign:
- return left.getNominalSize() == right.getNominalSize() &&
- left.getSecondarySize() == right.getSecondarySize();
- default:
- UNREACHABLE(op);
- return false;
- }
-}
-
-TOperator TypeToConstructorOperator(const TType &type)
-{
- switch(type.getBasicType())
- {
- case EbtFloat:
- if(type.isMatrix())
- {
- switch(type.getNominalSize())
- {
- case 2:
- switch(type.getSecondarySize())
- {
- case 2:
- return EOpConstructMat2;
- case 3:
- return EOpConstructMat2x3;
- case 4:
- return EOpConstructMat2x4;
- default:
- break;
- }
- break;
-
- case 3:
- switch(type.getSecondarySize())
- {
- case 2:
- return EOpConstructMat3x2;
- case 3:
- return EOpConstructMat3;
- case 4:
- return EOpConstructMat3x4;
- default:
- break;
- }
- break;
-
- case 4:
- switch(type.getSecondarySize())
- {
- case 2:
- return EOpConstructMat4x2;
- case 3:
- return EOpConstructMat4x3;
- case 4:
- return EOpConstructMat4;
- default:
- break;
- }
- break;
- }
- }
- else
- {
- switch(type.getNominalSize())
- {
- case 1:
- return EOpConstructFloat;
- case 2:
- return EOpConstructVec2;
- case 3:
- return EOpConstructVec3;
- case 4:
- return EOpConstructVec4;
- default:
- break;
- }
- }
- break;
-
- case EbtInt:
- switch(type.getNominalSize())
- {
- case 1:
- return EOpConstructInt;
- case 2:
- return EOpConstructIVec2;
- case 3:
- return EOpConstructIVec3;
- case 4:
- return EOpConstructIVec4;
- default:
- break;
- }
- break;
-
- case EbtUInt:
- switch(type.getNominalSize())
- {
- case 1:
- return EOpConstructUInt;
- case 2:
- return EOpConstructUVec2;
- case 3:
- return EOpConstructUVec3;
- case 4:
- return EOpConstructUVec4;
- default:
- break;
- }
- break;
-
- case EbtBool:
- switch(type.getNominalSize())
- {
- case 1:
- return EOpConstructBool;
- case 2:
- return EOpConstructBVec2;
- case 3:
- return EOpConstructBVec3;
- case 4:
- return EOpConstructBVec4;
- default:
- break;
- }
- break;
-
- case EbtStruct:
- return EOpConstructStruct;
-
- default:
- break;
- }
-
- return EOpNull;
-}
-
-const char* getOperatorString(TOperator op) {
- switch (op) {
- case EOpInitialize: return "=";
- case EOpAssign: return "=";
- case EOpAddAssign: return "+=";
- case EOpSubAssign: return "-=";
- case EOpDivAssign: return "/=";
- case EOpIModAssign: return "%=";
- case EOpBitShiftLeftAssign: return "<<=";
- case EOpBitShiftRightAssign: return ">>=";
- case EOpBitwiseAndAssign: return "&=";
- case EOpBitwiseXorAssign: return "^=";
- case EOpBitwiseOrAssign: return "|=";
-
- // Fall-through.
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign: return "*=";
-
- // Fall-through.
- case EOpIndexDirect:
- case EOpIndexIndirect: return "[]";
-
- case EOpIndexDirectStruct: return ".";
- case EOpVectorSwizzle: return ".";
- case EOpAdd: return "+";
- case EOpSub: return "-";
- case EOpMul: return "*";
- case EOpDiv: return "/";
- case EOpMod: UNIMPLEMENTED(); break;
- case EOpEqual: return "==";
- case EOpNotEqual: return "!=";
- case EOpLessThan: return "<";
- case EOpGreaterThan: return ">";
- case EOpLessThanEqual: return "<=";
- case EOpGreaterThanEqual: return ">=";
-
- // Fall-through.
- case EOpVectorTimesScalar:
- case EOpVectorTimesMatrix:
- case EOpMatrixTimesVector:
- case EOpMatrixTimesScalar:
- case EOpMatrixTimesMatrix: return "*";
-
- case EOpLogicalOr: return "||";
- case EOpLogicalXor: return "^^";
- case EOpLogicalAnd: return "&&";
- case EOpIMod: return "%";
- case EOpBitShiftLeft: return "<<";
- case EOpBitShiftRight: return ">>";
- case EOpBitwiseAnd: return "&";
- case EOpBitwiseXor: return "^";
- case EOpBitwiseOr: return "|";
- case EOpNegative: return "-";
- case EOpVectorLogicalNot: return "not";
- case EOpLogicalNot: return "!";
- case EOpBitwiseNot: return "~";
- case EOpPostIncrement: return "++";
- case EOpPostDecrement: return "--";
- case EOpPreIncrement: return "++";
- case EOpPreDecrement: return "--";
-
- case EOpRadians: return "radians";
- case EOpDegrees: return "degrees";
- case EOpSin: return "sin";
- case EOpCos: return "cos";
- case EOpTan: return "tan";
- case EOpAsin: return "asin";
- case EOpAcos: return "acos";
- case EOpAtan: return "atan";
- case EOpSinh: return "sinh";
- case EOpCosh: return "cosh";
- case EOpTanh: return "tanh";
- case EOpAsinh: return "asinh";
- case EOpAcosh: return "acosh";
- case EOpAtanh: return "atanh";
- case EOpExp: return "exp";
- case EOpLog: return "log";
- case EOpExp2: return "exp2";
- case EOpLog2: return "log2";
- case EOpSqrt: return "sqrt";
- case EOpInverseSqrt: return "inversesqrt";
- case EOpAbs: return "abs";
- case EOpSign: return "sign";
- case EOpFloor: return "floor";
- case EOpTrunc: return "trunc";
- case EOpRound: return "round";
- case EOpRoundEven: return "roundEven";
- case EOpCeil: return "ceil";
- case EOpFract: return "fract";
- case EOpLength: return "length";
- case EOpNormalize: return "normalize";
- case EOpDFdx: return "dFdx";
- case EOpDFdy: return "dFdy";
- case EOpFwidth: return "fwidth";
- case EOpAny: return "any";
- case EOpAll: return "all";
- case EOpIsNan: return "isnan";
- case EOpIsInf: return "isinf";
- case EOpOuterProduct: return "outerProduct";
- case EOpTranspose: return "transpose";
- case EOpDeterminant: return "determinant";
- case EOpInverse: return "inverse";
-
- default: break;
- }
- return "";
-}
-
-////////////////////////////////////////////////////////////////////////////
-//
-// First set of functions are to help build the intermediate representation.
-// These functions are not member functions of the nodes.
-// They are called from parser productions.
-//
-/////////////////////////////////////////////////////////////////////////////
-
-//
-// Add a terminal node for an identifier in an expression.
-//
-// Returns the added node.
-//
-TIntermSymbol* TIntermediate::addSymbol(int id, const TString& name, const TType& type, const TSourceLoc &line)
-{
- TIntermSymbol* node = new TIntermSymbol(id, name, type);
- node->setLine(line);
-
- return node;
-}
-
-//
-// Connect two nodes with a new parent that does a binary operation on the nodes.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
-{
- bool isBitShift = false;
- switch (op) {
- case EOpEqual:
- case EOpNotEqual:
- break;
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if (left->isMatrix() || left->isArray() || left->isVector() || left->getBasicType() == EbtStruct) {
- return 0;
- }
- break;
- case EOpLogicalOr:
- case EOpLogicalXor:
- case EOpLogicalAnd:
- if (left->getBasicType() != EbtBool || left->isMatrix() || left->isArray() || left->isVector()) {
- return 0;
- }
- break;
- case EOpBitwiseOr:
- case EOpBitwiseXor:
- case EOpBitwiseAnd:
- if (!IsInteger(left->getBasicType()) || left->isMatrix() || left->isArray()) {
- return 0;
- }
- break;
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpMul:
- if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool) {
- return 0;
- }
- break;
- case EOpIMod:
- // Note that this is only for the % operator, not for mod()
- if (left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool || left->getBasicType() == EbtFloat) {
- return 0;
- }
- break;
- case EOpBitShiftLeft:
- case EOpBitShiftRight:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- // Unsigned can be bit-shifted by signed and vice versa, but we need to
- // check that the basic type is an integer type.
- isBitShift = true;
- if(!IsInteger(left->getBasicType()) || !IsInteger(right->getBasicType()))
- {
- return 0;
- }
- break;
- default: break;
- }
-
- if(!isBitShift && left->getBasicType() != right->getBasicType())
- {
- return 0;
- }
-
- //
- // Need a new node holding things together then. Make
- // one and promote it to the right type.
- //
- TIntermBinary* node = new TIntermBinary(op);
- node->setLine(line);
-
- node->setLeft(left);
- node->setRight(right);
- if (!node->promote(infoSink))
- {
- delete node;
- return 0;
- }
-
- //
- // See if we can fold constants.
- //
- TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
- TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
- if (leftTempConstant && rightTempConstant) {
- TIntermTyped *typedReturnNode = leftTempConstant->fold(node->getOp(), rightTempConstant, infoSink);
-
- if (typedReturnNode)
- return typedReturnNode;
- }
-
- return node;
-}
-
-//
-// Connect two nodes through an assignment.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
-{
- if (left->getType().getStruct() || right->getType().getStruct())
- {
- if (left->getType() != right->getType())
- {
- return 0;
- }
- }
-
- TIntermBinary* node = new TIntermBinary(op);
- node->setLine(line);
-
- node->setLeft(left);
- node->setRight(right);
- if (! node->promote(infoSink))
- return 0;
-
- return node;
-}
-
-//
-// Connect two nodes through an index operator, where the left node is the base
-// of an array or struct, and the right node is a direct or indirect offset.
-//
-// Returns the added node.
-// The caller should set the type of the returned node.
-//
-TIntermTyped* TIntermediate::addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc &line)
-{
- TIntermBinary* node = new TIntermBinary(op);
- node->setLine(line);
- node->setLeft(base);
- node->setRight(index);
-
- // caller should set the type
-
- return node;
-}
-
-//
-// Add one node as the parent of another that it operates on.
-//
-// Returns the added node.
-//
-TIntermTyped* TIntermediate::addUnaryMath(TOperator op, TIntermTyped* child, const TSourceLoc &line, const TType *funcReturnType)
-{
- if (child == 0) {
- infoSink.info.message(EPrefixInternalError, "Bad type in AddUnaryMath", line);
- return 0;
- }
-
- switch (op) {
- case EOpBitwiseNot:
- if (!IsInteger(child->getType().getBasicType()) || child->getType().isMatrix() || child->getType().isArray()) {
- return 0;
- }
- break;
-
- case EOpLogicalNot:
- if (child->getType().getBasicType() != EbtBool || child->getType().isMatrix() || child->getType().isArray() || child->getType().isVector()) {
- return 0;
- }
- break;
-
- case EOpPostIncrement:
- case EOpPreIncrement:
- case EOpPostDecrement:
- case EOpPreDecrement:
- case EOpNegative:
- if (!child->getType().isScalar() && !child->getType().isVector() && !child->getType().isMatrix())
- return 0;
- default: break;
- }
-
- TIntermConstantUnion *childTempConstant = 0;
- if (child->getAsConstantUnion())
- childTempConstant = child->getAsConstantUnion();
-
- //
- // Make a new node for the operator.
- //
- TIntermUnary *node = new TIntermUnary(op);
- node->setLine(line);
- node->setOperand(child);
-
- if (! node->promote(infoSink, funcReturnType))
- return 0;
-
- if (childTempConstant) {
- TIntermTyped* newChild = childTempConstant->fold(op, 0, infoSink);
-
- if (newChild)
- return newChild;
- }
-
- return node;
-}
-
-//
-// This is the safe way to change the operator on an aggregate, as it
-// does lots of error checking and fixing. Especially for establishing
-// a function call's operation on its set of parameters. Sequences
-// of instructions are also aggregates, but they just directly set
-// their operator to EOpSequence.
-//
-// Returns an aggregate node, which could be the one passed in if
-// it was already an aggregate but no operator was set.
-//
-TIntermAggregate* TIntermediate::setAggregateOperator(TIntermNode* node, TOperator op, const TSourceLoc &line)
-{
- TIntermAggregate* aggNode;
-
- //
- // Make sure we have an aggregate. If not turn it into one.
- //
- if (node) {
- aggNode = node->getAsAggregate();
- if (aggNode == 0 || aggNode->getOp() != EOpNull) {
- //
- // Make an aggregate containing this node.
- //
- aggNode = new TIntermAggregate();
- aggNode->getSequence().push_back(node);
- }
- } else
- aggNode = new TIntermAggregate();
-
- //
- // Set the operator.
- //
- aggNode->setOp(op);
-
- return aggNode;
-}
-
-//
-// Safe way to combine two nodes into an aggregate. Works with null pointers,
-// a node that's not a aggregate yet, etc.
-//
-// Returns the resulting aggregate, unless 0 was passed in for
-// both existing nodes.
-//
-TIntermAggregate* TIntermediate::growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc &line)
-{
- if (left == 0 && right == 0)
- return 0;
-
- TIntermAggregate* aggNode = 0;
- if (left)
- aggNode = left->getAsAggregate();
- if (!aggNode || aggNode->getOp() != EOpNull) {
- aggNode = new TIntermAggregate;
- if (left)
- aggNode->getSequence().push_back(left);
- }
-
- if (right)
- aggNode->getSequence().push_back(right);
-
- aggNode->setLine(line);
-
- return aggNode;
-}
-
-//
-// Turn an existing node into an aggregate.
-//
-// Returns an aggregate, unless 0 was passed in for the existing node.
-//
-TIntermAggregate* TIntermediate::makeAggregate(TIntermNode* node, const TSourceLoc &line)
-{
- if (node == 0)
- return 0;
-
- TIntermAggregate* aggNode = new TIntermAggregate;
- aggNode->getSequence().push_back(node);
-
- aggNode->setLine(line);
-
- return aggNode;
-}
-
-//
-// For "if" test nodes. There are three children; a condition,
-// a true path, and a false path. The two paths are in the
-// nodePair.
-//
-// Returns the selection node created.
-//
-TIntermNode* TIntermediate::addSelection(TIntermTyped* cond, TIntermNodePair nodePair, const TSourceLoc &line)
-{
- //
- // For compile time constant selections, prune the code and
- // test now.
- //
-
- if (cond->getAsTyped() && cond->getAsTyped()->getAsConstantUnion()) {
- if (cond->getAsConstantUnion()->getBConst(0) == true)
- return nodePair.node1 ? setAggregateOperator(nodePair.node1, EOpSequence, nodePair.node1->getLine()) : nullptr;
- else
- return nodePair.node2 ? setAggregateOperator(nodePair.node2, EOpSequence, nodePair.node2->getLine()) : nullptr;
- }
-
- TIntermSelection* node = new TIntermSelection(cond, nodePair.node1, nodePair.node2);
- node->setLine(line);
-
- return node;
-}
-
-
-TIntermTyped* TIntermediate::addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc &line)
-{
- if (left->getType().getQualifier() == EvqConstExpr && right->getType().getQualifier() == EvqConstExpr) {
- return right;
- } else {
- TIntermTyped *commaAggregate = growAggregate(left, right, line);
- commaAggregate->getAsAggregate()->setOp(EOpComma);
- commaAggregate->setType(right->getType());
- commaAggregate->getTypePointer()->setQualifier(EvqTemporary);
- return commaAggregate;
- }
-}
-
-//
-// For "?:" test nodes. There are three children; a condition,
-// a true path, and a false path. The two paths are specified
-// as separate parameters.
-//
-// Returns the selection node created, or 0 if one could not be.
-//
-TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc &line)
-{
- if (trueBlock->getType() != falseBlock->getType())
- {
- return 0;
- }
-
- //
- // See if all the operands are constant, then fold it otherwise not.
- //
-
- if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
- if (cond->getAsConstantUnion()->getBConst(0))
- return trueBlock;
- else
- return falseBlock;
- }
-
- //
- // Make a selection node.
- //
- TIntermSelection* node = new TIntermSelection(cond, trueBlock, falseBlock, trueBlock->getType());
- node->getTypePointer()->setQualifier(EvqTemporary);
- node->setLine(line);
-
- return node;
-}
-
-TIntermSwitch *TIntermediate::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line)
-{
- TIntermSwitch *node = new TIntermSwitch(init, statementList);
- node->setLine(line);
-
- return node;
-}
-
-TIntermCase *TIntermediate::addCase(TIntermTyped *condition, const TSourceLoc &line)
-{
- TIntermCase *node = new TIntermCase(condition);
- node->setLine(line);
-
- return node;
-}
-
-//
-// Constant terminal nodes. Has a union that contains bool, float or int constants
-//
-// Returns the constant union node created.
-//
-
-TIntermConstantUnion* TIntermediate::addConstantUnion(ConstantUnion* unionArrayPointer, const TType& t, const TSourceLoc &line)
-{
- TIntermConstantUnion* node = new TIntermConstantUnion(unionArrayPointer, t);
- node->setLine(line);
-
- return node;
-}
-
-TIntermTyped* TIntermediate::addSwizzle(TVectorFields& fields, const TSourceLoc &line)
-{
-
- TIntermAggregate* node = new TIntermAggregate(EOpSequence);
-
- node->setLine(line);
- TIntermConstantUnion* constIntNode;
- TIntermSequence &sequenceVector = node->getSequence();
- ConstantUnion* unionArray;
-
- for (int i = 0; i < fields.num; i++) {
- unionArray = new ConstantUnion[1];
- unionArray->setIConst(fields.offsets[i]);
- constIntNode = addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), line);
- sequenceVector.push_back(constIntNode);
- }
-
- return node;
-}
-
-//
-// Create loop nodes.
-//
-TIntermNode* TIntermediate::addLoop(TLoopType type, TIntermNode* init, TIntermTyped* cond, TIntermTyped* expr, TIntermNode* body, const TSourceLoc &line)
-{
- TIntermNode* node = new TIntermLoop(type, init, cond, expr, body);
- node->setLine(line);
-
- return node;
-}
-
-//
-// Add branches.
-//
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, const TSourceLoc &line)
-{
- return addBranch(branchOp, 0, line);
-}
-
-TIntermBranch* TIntermediate::addBranch(TOperator branchOp, TIntermTyped* expression, const TSourceLoc &line)
-{
- TIntermBranch* node = new TIntermBranch(branchOp, expression);
- node->setLine(line);
-
- return node;
-}
-
-//
-// This is to be executed once the final root is put on top by the parsing
-// process.
-//
-bool TIntermediate::postProcess(TIntermNode* root)
-{
- if (root == 0)
- return true;
-
- //
- // First, finish off the top level sequence, if any
- //
- TIntermAggregate* aggRoot = root->getAsAggregate();
- if (aggRoot && aggRoot->getOp() == EOpNull)
- aggRoot->setOp(EOpSequence);
-
- return true;
-}
-
-////////////////////////////////////////////////////////////////
-//
-// Member functions of the nodes used for building the tree.
-//
-////////////////////////////////////////////////////////////////
-
-// static
-TIntermTyped *TIntermTyped::CreateIndexNode(int index)
-{
- ConstantUnion *u = new ConstantUnion[1];
- u[0].setIConst(index);
-
- TType type(EbtInt, EbpUndefined, EvqConstExpr, 1);
- TIntermConstantUnion *node = new TIntermConstantUnion(u, type);
- return node;
-}
-
-//
-// Say whether or not an operation node changes the value of a variable.
-//
-// Returns true if state is modified.
-//
-bool TIntermOperator::modifiesState() const
-{
- switch (op) {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- case EOpAssign:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign:
- case EOpDivAssign:
- case EOpIModAssign:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- case EOpBitwiseAndAssign:
- case EOpBitwiseXorAssign:
- case EOpBitwiseOrAssign:
- return true;
- default:
- return false;
- }
-}
-
-//
-// returns true if the operator is for one of the constructors
-//
-bool TIntermOperator::isConstructor() const
-{
- switch (op) {
- case EOpConstructVec2:
- case EOpConstructVec3:
- case EOpConstructVec4:
- case EOpConstructMat2:
- case EOpConstructMat2x3:
- case EOpConstructMat2x4:
- case EOpConstructMat3x2:
- case EOpConstructMat3:
- case EOpConstructMat3x4:
- case EOpConstructMat4x2:
- case EOpConstructMat4x3:
- case EOpConstructMat4:
- case EOpConstructFloat:
- case EOpConstructIVec2:
- case EOpConstructIVec3:
- case EOpConstructIVec4:
- case EOpConstructInt:
- case EOpConstructUVec2:
- case EOpConstructUVec3:
- case EOpConstructUVec4:
- case EOpConstructUInt:
- case EOpConstructBVec2:
- case EOpConstructBVec3:
- case EOpConstructBVec4:
- case EOpConstructBool:
- case EOpConstructStruct:
- return true;
- default:
- return false;
- }
-}
-
-//
-// Make sure the type of a unary operator is appropriate for its
-// combination of operation and operand type.
-//
-// Returns false in nothing makes sense.
-//
-bool TIntermUnary::promote(TInfoSink&, const TType *funcReturnType)
-{
- setType(funcReturnType ? *funcReturnType : operand->getType());
-
- // Unary operations result in temporary variables unless const.
- if(type.getQualifier() != EvqConstExpr)
- {
- type.setQualifier(EvqTemporary);
- }
-
- switch (op) {
- case EOpLogicalNot:
- if (operand->getBasicType() != EbtBool)
- return false;
- break;
- case EOpBitwiseNot:
- if (!IsInteger(operand->getBasicType()))
- return false;
- break;
- case EOpNegative:
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- if (operand->getBasicType() == EbtBool)
- return false;
- break;
-
- // operators for built-ins are already type checked against their prototype
- case EOpAny:
- case EOpAll:
- case EOpVectorLogicalNot:
- case EOpAbs:
- case EOpSign:
- case EOpIsNan:
- case EOpIsInf:
- case EOpFloatBitsToInt:
- case EOpFloatBitsToUint:
- case EOpIntBitsToFloat:
- case EOpUintBitsToFloat:
- case EOpPackSnorm2x16:
- case EOpPackUnorm2x16:
- case EOpPackHalf2x16:
- case EOpUnpackSnorm2x16:
- case EOpUnpackUnorm2x16:
- case EOpUnpackHalf2x16:
- return true;
-
- default:
- if (operand->getBasicType() != EbtFloat)
- return false;
- }
-
- return true;
-}
-
-//
-// Establishes the type of the resultant operation, as well as
-// makes the operator the correct one for the operands.
-//
-// Returns false if operator can't work on operands.
-//
-bool TIntermBinary::promote(TInfoSink& infoSink)
-{
- ASSERT(left->isArray() == right->isArray());
-
- // GLSL ES 2.0 does not support implicit type casting.
- // So the basic type should always match.
- // GLSL ES 3.0 supports integer shift operands of different signedness.
- if(op != EOpBitShiftLeft &&
- op != EOpBitShiftRight &&
- op != EOpBitShiftLeftAssign &&
- op != EOpBitShiftRightAssign &&
- left->getBasicType() != right->getBasicType())
- {
- return false;
- }
-
- //
- // Base assumption: just make the type the same as the left
- // operand. Then only deviations from this need be coded.
- //
- setType(left->getType());
-
- // The result gets promoted to the highest precision.
- TPrecision higherPrecision = GetHigherPrecision(left->getPrecision(), right->getPrecision());
- getTypePointer()->setPrecision(higherPrecision);
-
- // Binary operations results in temporary variables unless both
- // operands are const.
- if (left->getQualifier() != EvqConstExpr || right->getQualifier() != EvqConstExpr) {
- getTypePointer()->setQualifier(EvqTemporary);
- }
-
- int primarySize = std::max(left->getNominalSize(), right->getNominalSize());
-
- //
- // All scalars. Code after this test assumes this case is removed!
- //
- if (primarySize == 1) {
- switch (op) {
- //
- // Promote to conditional
- //
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- //
- // And and Or operate on conditionals
- //
- case EOpLogicalAnd:
- case EOpLogicalOr:
- case EOpLogicalXor:
- // Both operands must be of type bool.
- if (left->getBasicType() != EbtBool || right->getBasicType() != EbtBool)
- return false;
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- default:
- break;
- }
- return true;
- }
-
- // If we reach here, at least one of the operands is vector or matrix.
- // The other operand could be a scalar, vector, or matrix.
- // Can these two operands be combined?
- //
- TBasicType basicType = left->getBasicType();
- switch (op) {
- case EOpMul:
- if (!left->isMatrix() && right->isMatrix()) {
- if (left->isVector())
- {
- op = EOpVectorTimesMatrix;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(right->getNominalSize()), 1));
- }
- else {
- op = EOpMatrixTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(right->getNominalSize()), static_cast<unsigned char>(right->getSecondarySize())));
- }
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
- op = EOpMatrixTimesVector;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(left->getSecondarySize()), 1));
- } else {
- op = EOpMatrixTimesScalar;
- }
- } else if (left->isMatrix() && right->isMatrix()) {
- op = EOpMatrixTimesMatrix;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(right->getNominalSize()), static_cast<unsigned char>(left->getSecondarySize())));
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
- // leave as component product
- } else if (left->isVector() || right->isVector()) {
- op = EOpVectorTimesScalar;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(primarySize), 1));
- }
- } else {
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
- return false;
- }
-
- if(!ValidateMultiplication(op, left->getType(), right->getType()))
- {
- return false;
- }
- break;
- case EOpMulAssign:
- if (!left->isMatrix() && right->isMatrix()) {
- if (left->isVector())
- op = EOpVectorTimesMatrixAssign;
- else {
- return false;
- }
- } else if (left->isMatrix() && !right->isMatrix()) {
- if (right->isVector()) {
- return false;
- } else {
- op = EOpMatrixTimesScalarAssign;
- }
- } else if (left->isMatrix() && right->isMatrix()) {
- op = EOpMatrixTimesMatrixAssign;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(right->getNominalSize()), static_cast<unsigned char>(left->getSecondarySize())));
- } else if (!left->isMatrix() && !right->isMatrix()) {
- if (left->isVector() && right->isVector()) {
- // leave as component product
- } else if (left->isVector() || right->isVector()) {
- if (! left->isVector())
- return false;
- op = EOpVectorTimesScalarAssign;
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(left->getNominalSize()), 1));
- }
- } else {
- infoSink.info.message(EPrefixInternalError, "Missing elses", getLine());
- return false;
- }
-
- if(!ValidateMultiplication(op, left->getType(), right->getType()))
- {
- return false;
- }
- break;
-
- case EOpAssign:
- case EOpInitialize:
- // No more additional checks are needed.
- if ((left->getNominalSize() != right->getNominalSize()) ||
- (left->getSecondarySize() != right->getSecondarySize()))
- return false;
- break;
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpIMod:
- case EOpBitShiftLeft:
- case EOpBitShiftRight:
- case EOpBitwiseAnd:
- case EOpBitwiseXor:
- case EOpBitwiseOr:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpDivAssign:
- case EOpIModAssign:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- case EOpBitwiseAndAssign:
- case EOpBitwiseXorAssign:
- case EOpBitwiseOrAssign:
- if ((left->isMatrix() && right->isVector()) ||
- (left->isVector() && right->isMatrix()))
- return false;
-
- // Are the sizes compatible?
- if(left->getNominalSize() != right->getNominalSize() ||
- left->getSecondarySize() != right->getSecondarySize())
- {
- // If the nominal sizes of operands do not match:
- // One of them must be a scalar.
- if(!left->isScalar() && !right->isScalar())
- return false;
-
- // In the case of compound assignment other than multiply-assign,
- // the right side needs to be a scalar. Otherwise a vector/matrix
- // would be assigned to a scalar. A scalar can't be shifted by a
- // vector either.
- if(!right->isScalar() && (modifiesState() || op == EOpBitShiftLeft || op == EOpBitShiftRight))
- return false;
- }
-
- {
- const int secondarySize = std::max(
- left->getSecondarySize(), right->getSecondarySize());
- setType(TType(basicType, higherPrecision, EvqTemporary,
- static_cast<unsigned char>(primarySize), static_cast<unsigned char>(secondarySize)));
- if(left->isArray())
- {
- ASSERT(left->getArraySize() == right->getArraySize());
- type.setArraySize(left->getArraySize());
- }
- }
- break;
-
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if ((left->getNominalSize() != right->getNominalSize()) ||
- (left->getSecondarySize() != right->getSecondarySize()))
- return false;
- setType(TType(EbtBool, EbpUndefined));
- break;
-
- case EOpOuterProduct:
- if(!left->isVector() || !right->isVector())
- return false;
- setType(TType(EbtFloat, right->getNominalSize(), left->getNominalSize()));
- break;
-
- case EOpTranspose:
- if(!right->isMatrix())
- return false;
- setType(TType(EbtFloat, right->getSecondarySize(), right->getNominalSize()));
- break;
-
- case EOpDeterminant:
- if(!right->isMatrix())
- return false;
- setType(TType(EbtFloat));
- break;
-
- case EOpInverse:
- if(!right->isMatrix() || right->getNominalSize() != right->getSecondarySize())
- return false;
- setType(right->getType());
- break;
-
- default:
- return false;
- }
-
- return true;
-}
-
-bool CompareStruct(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
-{
- const TFieldList& fields = leftNodeType.getStruct()->fields();
-
- size_t structSize = fields.size();
- int index = 0;
-
- for (size_t j = 0; j < structSize; j++) {
- size_t size = fields[j]->type()->getObjectSize();
- for(size_t i = 0; i < size; i++) {
- if (fields[j]->type()->getBasicType() == EbtStruct) {
- if (!CompareStructure(*(fields[j]->type()), &rightUnionArray[index], &leftUnionArray[index]))
- return false;
- } else {
- if (leftUnionArray[index] != rightUnionArray[index])
- return false;
- index++;
- }
-
- }
- }
- return true;
-}
-
-bool CompareStructure(const TType& leftNodeType, ConstantUnion* rightUnionArray, ConstantUnion* leftUnionArray)
-{
- if (leftNodeType.isArray()) {
- TType typeWithoutArrayness = leftNodeType;
- typeWithoutArrayness.clearArrayness();
-
- int arraySize = leftNodeType.getArraySize();
-
- for (int i = 0; i < arraySize; ++i) {
- size_t offset = typeWithoutArrayness.getObjectSize() * i;
- if (!CompareStruct(typeWithoutArrayness, &rightUnionArray[offset], &leftUnionArray[offset]))
- return false;
- }
- } else
- return CompareStruct(leftNodeType, rightUnionArray, leftUnionArray);
-
- return true;
-}
-
-float determinant2(float m00, float m01, float m10, float m11)
-{
- return m00 * m11 - m01 * m10;
-}
-
-float determinant3(float m00, float m01, float m02,
- float m10, float m11, float m12,
- float m20, float m21, float m22)
-{
- return m00 * determinant2(m11, m12, m21, m22) -
- m10 * determinant2(m01, m02, m21, m22) +
- m20 * determinant2(m01, m02, m11, m12);
-}
-
-float determinant4(float m00, float m01, float m02, float m03,
- float m10, float m11, float m12, float m13,
- float m20, float m21, float m22, float m23,
- float m30, float m31, float m32, float m33)
-{
- return m00 * determinant3(m11, m12, m13, m21, m22, m23, m31, m32, m33) -
- m10 * determinant3(m01, m02, m03, m21, m22, m23, m31, m32, m33) +
- m20 * determinant3(m01, m02, m03, m11, m12, m13, m31, m32, m33) -
- m30 * determinant3(m01, m02, m03, m11, m12, m13, m21, m22, m23);
-}
-
-float ComputeDeterminant(int size, ConstantUnion* unionArray)
-{
- switch(size)
- {
- case 2:
- return determinant2(unionArray[0].getFConst(),
- unionArray[1].getFConst(),
- unionArray[2].getFConst(),
- unionArray[3].getFConst());
- case 3:
- return determinant3(unionArray[0].getFConst(),
- unionArray[1].getFConst(),
- unionArray[2].getFConst(),
- unionArray[3].getFConst(),
- unionArray[4].getFConst(),
- unionArray[5].getFConst(),
- unionArray[6].getFConst(),
- unionArray[7].getFConst(),
- unionArray[8].getFConst());
- case 4:
- return determinant4(unionArray[0].getFConst(),
- unionArray[1].getFConst(),
- unionArray[2].getFConst(),
- unionArray[3].getFConst(),
- unionArray[4].getFConst(),
- unionArray[5].getFConst(),
- unionArray[6].getFConst(),
- unionArray[7].getFConst(),
- unionArray[8].getFConst(),
- unionArray[9].getFConst(),
- unionArray[10].getFConst(),
- unionArray[11].getFConst(),
- unionArray[12].getFConst(),
- unionArray[13].getFConst(),
- unionArray[14].getFConst(),
- unionArray[15].getFConst());
- default:
- UNREACHABLE(size);
- return 0.0f;
- }
-}
-
-ConstantUnion* CreateInverse(TIntermConstantUnion* node, ConstantUnion* unionArray)
-{
- ConstantUnion* tempConstArray = 0;
- int size = node->getNominalSize();
- float determinant = ComputeDeterminant(size, unionArray);
- if(determinant != 0.0f)
- {
- float invDet = 1.0f / determinant;
- tempConstArray = new ConstantUnion[size*size];
- switch(size)
- {
- case 2:
- {
- float m00 = unionArray[0].getFConst(); // Matrix is:
- float m01 = unionArray[1].getFConst(); // (m00, m01)
- float m10 = unionArray[2].getFConst(); // (m10, m11)
- float m11 = unionArray[3].getFConst();
- tempConstArray[0].setFConst( invDet * m11);
- tempConstArray[1].setFConst(-invDet * m01);
- tempConstArray[2].setFConst(-invDet * m10);
- tempConstArray[3].setFConst( invDet * m00);
- }
- break;
- case 3:
- {
- float m00 = unionArray[0].getFConst(); // Matrix is:
- float m01 = unionArray[1].getFConst(); // (m00, m01, m02)
- float m02 = unionArray[2].getFConst(); // (m10, m11, m12)
- float m10 = unionArray[3].getFConst(); // (m20, m21, m22)
- float m11 = unionArray[4].getFConst();
- float m12 = unionArray[5].getFConst();
- float m20 = unionArray[6].getFConst();
- float m21 = unionArray[7].getFConst();
- float m22 = unionArray[8].getFConst();
- tempConstArray[0].setFConst(invDet * determinant2(m11, m12, m21, m22)); // m00 = invDet * (m11 * m22 - m12 * m21)
- tempConstArray[1].setFConst(invDet * determinant2(m12, m10, m22, m20)); // m01 = -invDet * (m10 * m22 - m12 * m20)
- tempConstArray[2].setFConst(invDet * determinant2(m10, m11, m20, m21)); // m02 = invDet * (m10 * m21 - m11 * m20)
- tempConstArray[3].setFConst(invDet * determinant2(m21, m22, m01, m02)); // m10 = -invDet * (m01 * m22 - m02 * m21)
- tempConstArray[4].setFConst(invDet * determinant2(m00, m02, m20, m22)); // m11 = invDet * (m00 * m22 - m02 * m20)
- tempConstArray[5].setFConst(invDet * determinant2(m20, m21, m00, m01)); // m12 = -invDet * (m00 * m21 - m01 * m20)
- tempConstArray[6].setFConst(invDet * determinant2(m01, m02, m11, m12)); // m20 = invDet * (m01 * m12 - m02 * m11)
- tempConstArray[7].setFConst(invDet * determinant2(m10, m12, m00, m02)); // m21 = -invDet * (m00 * m12 - m02 * m10)
- tempConstArray[8].setFConst(invDet * determinant2(m00, m01, m10, m11)); // m22 = invDet * (m00 * m11 - m01 * m10)
- }
- break;
- case 4:
- {
- float m00 = unionArray[0].getFConst(); // Matrix is:
- float m01 = unionArray[1].getFConst(); // (m00, m01, m02, m03)
- float m02 = unionArray[2].getFConst(); // (m10, m11, m12, m13)
- float m03 = unionArray[3].getFConst(); // (m20, m21, m22, m23)
- float m10 = unionArray[4].getFConst(); // (m30, m31, m32, m33)
- float m11 = unionArray[5].getFConst();
- float m12 = unionArray[6].getFConst();
- float m13 = unionArray[7].getFConst();
- float m20 = unionArray[8].getFConst();
- float m21 = unionArray[9].getFConst();
- float m22 = unionArray[10].getFConst();
- float m23 = unionArray[11].getFConst();
- float m30 = unionArray[12].getFConst();
- float m31 = unionArray[13].getFConst();
- float m32 = unionArray[14].getFConst();
- float m33 = unionArray[15].getFConst();
- tempConstArray[ 0].setFConst( invDet * determinant3(m11, m12, m13, m21, m22, m23, m31, m32, m33)); // m00
- tempConstArray[ 1].setFConst(-invDet * determinant3(m10, m12, m13, m20, m22, m23, m30, m32, m33)); // m01
- tempConstArray[ 2].setFConst( invDet * determinant3(m10, m11, m13, m20, m21, m23, m30, m31, m33)); // m02
- tempConstArray[ 3].setFConst(-invDet * determinant3(m10, m11, m12, m20, m21, m22, m30, m31, m32)); // m03
- tempConstArray[ 4].setFConst( invDet * determinant3(m01, m02, m03, m21, m22, m23, m31, m32, m33)); // m10
- tempConstArray[ 5].setFConst(-invDet * determinant3(m00, m02, m03, m20, m22, m23, m30, m32, m33)); // m11
- tempConstArray[ 6].setFConst( invDet * determinant3(m00, m01, m03, m20, m21, m23, m30, m31, m33)); // m12
- tempConstArray[ 7].setFConst(-invDet * determinant3(m00, m01, m02, m20, m21, m22, m30, m31, m32)); // m13
- tempConstArray[ 8].setFConst( invDet * determinant3(m01, m02, m03, m11, m12, m13, m31, m32, m33)); // m20
- tempConstArray[ 9].setFConst(-invDet * determinant3(m00, m02, m03, m10, m12, m13, m30, m32, m33)); // m21
- tempConstArray[10].setFConst( invDet * determinant3(m00, m01, m03, m10, m11, m13, m30, m31, m33)); // m22
- tempConstArray[11].setFConst(-invDet * determinant3(m00, m01, m02, m10, m11, m12, m30, m31, m32)); // m23
- tempConstArray[12].setFConst( invDet * determinant3(m01, m02, m03, m11, m12, m13, m21, m22, m23)); // m30
- tempConstArray[13].setFConst(-invDet * determinant3(m00, m02, m03, m10, m12, m13, m20, m22, m23)); // m31
- tempConstArray[14].setFConst( invDet * determinant3(m00, m01, m03, m10, m11, m13, m20, m21, m23)); // m32
- tempConstArray[15].setFConst(-invDet * determinant3(m00, m01, m02, m10, m11, m12, m20, m21, m22)); // m33
- }
- break;
- default:
- UNREACHABLE(size);
- }
- }
- return tempConstArray;
-}
-
-//
-// The fold functions see if an operation on a constant can be done in place,
-// without generating run-time code.
-//
-// Returns the node to keep using, which may or may not be the node passed in.
-//
-
-TIntermTyped* TIntermConstantUnion::fold(TOperator op, TIntermTyped* constantNode, TInfoSink& infoSink)
-{
- ConstantUnion *unionArray = getUnionArrayPointer();
- size_t objectSize = getType().getObjectSize();
-
- if (constantNode) { // binary operations
- TIntermConstantUnion *node = constantNode->getAsConstantUnion();
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- TType returnType = getType();
-
- // for a case like float f = 1.2 + vec4(2,3,4,5);
- if (constantNode->getType().getObjectSize() == 1 && objectSize > 1) {
- rightUnionArray = new ConstantUnion[objectSize];
- for (size_t i = 0; i < objectSize; ++i)
- rightUnionArray[i] = *node->getUnionArrayPointer();
- returnType = getType();
- } else if (constantNode->getType().getObjectSize() > 1 && objectSize == 1) {
- // for a case like float f = vec4(2,3,4,5) + 1.2;
- unionArray = new ConstantUnion[constantNode->getType().getObjectSize()];
- for (size_t i = 0; i < constantNode->getType().getObjectSize(); ++i)
- unionArray[i] = *getUnionArrayPointer();
- returnType = node->getType();
- objectSize = constantNode->getType().getObjectSize();
- }
-
- ConstantUnion* tempConstArray = 0;
- TIntermConstantUnion *tempNode;
-
- switch(op) {
- case EOpAdd:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] + rightUnionArray[i];
- }
- break;
- case EOpSub:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] - rightUnionArray[i];
- }
- break;
-
- case EOpMul:
- case EOpVectorTimesScalar:
- case EOpMatrixTimesScalar:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] * rightUnionArray[i];
- }
- break;
- case EOpMatrixTimesMatrix:
- if (getType().getBasicType() != EbtFloat || node->getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", getLine());
- return 0;
- }
- {// support MSVC++6.0
- int leftNumCols = getNominalSize();
- int leftNumRows = getSecondarySize();
- int rightNumCols = node->getNominalSize();
- int rightNumRows = node->getSecondarySize();
- if(leftNumCols != rightNumRows) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix multiply", getLine());
- return 0;
- }
- int tempNumCols = rightNumCols;
- int tempNumRows = leftNumRows;
- int tempNumAdds = leftNumCols;
- tempConstArray = new ConstantUnion[tempNumCols*tempNumRows];
- for (int row = 0; row < tempNumRows; row++) {
- for (int column = 0; column < tempNumCols; column++) {
- tempConstArray[tempNumRows * column + row].setFConst(0.0f);
- for (int i = 0; i < tempNumAdds; i++) {
- tempConstArray[tempNumRows * column + row].setFConst(tempConstArray[tempNumRows * column + row].getFConst() + unionArray[i * leftNumRows + row].getFConst() * (rightUnionArray[column * rightNumRows + i].getFConst()));
- }
- }
- }
- // update return type for matrix product
- returnType.setNominalSize(static_cast<unsigned char>(tempNumCols));
- returnType.setSecondarySize(static_cast<unsigned char>(tempNumRows));
- }
- break;
-
- case EOpOuterProduct:
- {
- int leftSize = getNominalSize();
- int rightSize = node->getNominalSize();
- tempConstArray = new ConstantUnion[leftSize*rightSize];
- for(int row = 0; row < leftSize; row++) {
- for(int column = 0; column < rightSize; column++) {
- tempConstArray[leftSize * column + row].setFConst(unionArray[row].getFConst() * rightUnionArray[column].getFConst());
- }
- }
- // update return type for outer product
- returnType.setNominalSize(static_cast<unsigned char>(rightSize));
- returnType.setSecondarySize(static_cast<unsigned char>(leftSize));
- }
- break;
-
- case EOpTranspose:
- {
- int rightCol = node->getNominalSize();
- int rightRow = node->getSecondarySize();
- tempConstArray = new ConstantUnion[rightCol*rightRow];
- for(int row = 0; row < rightRow; row++) {
- for(int column = 0; column < rightCol; column++) {
- tempConstArray[rightRow * column + row].setFConst(rightUnionArray[rightCol * row + column].getFConst());
- }
- }
- // update return type for transpose
- returnType.setNominalSize(static_cast<unsigned char>(rightRow));
- returnType.setSecondarySize(static_cast<unsigned char>(rightCol));
- }
- break;
-
- case EOpDeterminant:
- {
- ASSERT(node->getNominalSize() == node->getSecondarySize());
-
- tempConstArray = new ConstantUnion[1];
- tempConstArray[0].setFConst(ComputeDeterminant(node->getNominalSize(), rightUnionArray));
- // update return type for determinant
- returnType.setNominalSize(1);
- returnType.setSecondarySize(1);
- }
- break;
-
- case EOpInverse:
- {
- ASSERT(node->getNominalSize() == node->getSecondarySize());
-
- tempConstArray = CreateInverse(node, rightUnionArray);
- if(!tempConstArray)
- {
- // Singular matrix, just copy
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = rightUnionArray[i];
- }
- }
- break;
-
- case EOpDiv:
- case EOpIMod:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++) {
- switch (getType().getBasicType()) {
- case EbtFloat:
- if (rightUnionArray[i] == 0.0f) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
- tempConstArray[i].setFConst(FLT_MAX);
- } else {
- ASSERT(op == EOpDiv);
- tempConstArray[i].setFConst(unionArray[i].getFConst() / rightUnionArray[i].getFConst());
- }
- break;
-
- case EbtInt:
- if (rightUnionArray[i] == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
- tempConstArray[i].setIConst(INT_MAX);
- } else {
- if(op == EOpDiv) {
- tempConstArray[i].setIConst(unionArray[i].getIConst() / rightUnionArray[i].getIConst());
- } else {
- ASSERT(op == EOpIMod);
- tempConstArray[i].setIConst(unionArray[i].getIConst() % rightUnionArray[i].getIConst());
- }
- }
- break;
- case EbtUInt:
- if (rightUnionArray[i] == 0) {
- infoSink.info.message(EPrefixWarning, "Divide by zero error during constant folding", getLine());
- tempConstArray[i].setUConst(UINT_MAX);
- } else {
- if(op == EOpDiv) {
- tempConstArray[i].setUConst(unionArray[i].getUConst() / rightUnionArray[i].getUConst());
- } else {
- ASSERT(op == EOpIMod);
- tempConstArray[i].setUConst(unionArray[i].getUConst() % rightUnionArray[i].getUConst());
- }
- }
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Constant folding cannot be done for \"/\"", getLine());
- return 0;
- }
- }
- }
- break;
-
- case EOpMatrixTimesVector:
- if (node->getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for matrix times vector", getLine());
- return 0;
- }
- tempConstArray = new ConstantUnion[getSecondarySize()];
-
- {// support MSVC++6.0
- for (int rows = getSecondarySize(), i = 0; i < rows; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int cols = getNominalSize(), j = 0; j < cols; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j*rows + i].getFConst()) * rightUnionArray[j].getFConst()));
- }
- }
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtFloat, EbpUndefined, EvqConstExpr, getSecondarySize()));
- tempNode->setLine(getLine());
-
- return tempNode;
-
- case EOpVectorTimesMatrix:
- if (getType().getBasicType() != EbtFloat) {
- infoSink.info.message(EPrefixInternalError, "Constant Folding cannot be done for vector times matrix", getLine());
- return 0;
- }
-
- tempConstArray = new ConstantUnion[node->getNominalSize()];
- {// support MSVC++6.0
- for (int cols = node->getNominalSize(), i = 0; i < cols; i++) {
- tempConstArray[i].setFConst(0.0f);
- for (int rows = node->getSecondarySize(), j = 0; j < rows; j++) {
- tempConstArray[i].setFConst(tempConstArray[i].getFConst() + ((unionArray[j].getFConst()) * rightUnionArray[i*rows + j].getFConst()));
- }
- }
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtFloat, EbpUndefined, EvqConstExpr, node->getNominalSize()));
- tempNode->setLine(getLine());
- return tempNode;
-
- case EOpLogicalAnd: // this code is written for possible future use, will not get executed currently
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] && rightUnionArray[i];
- }
- break;
-
- case EOpLogicalOr: // this code is written for possible future use, will not get executed currently
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] || rightUnionArray[i];
- }
- break;
-
- case EOpLogicalXor:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- switch (getType().getBasicType()) {
- case EbtBool: tempConstArray[i].setBConst((unionArray[i] == rightUnionArray[i]) ? false : true); break;
- default: assert(false && "Default missing");
- }
- }
- break;
-
- case EOpBitwiseAnd:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] & rightUnionArray[i];
- break;
- case EOpBitwiseXor:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] ^ rightUnionArray[i];
- break;
- case EOpBitwiseOr:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] | rightUnionArray[i];
- break;
- case EOpBitShiftLeft:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] << rightUnionArray[i];
- break;
- case EOpBitShiftRight:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] >> rightUnionArray[i];
- break;
-
- case EOpLessThan:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i].setBConst(unionArray[i] < rightUnionArray[i]);
- returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
- break;
- case EOpGreaterThan:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i].setBConst(unionArray[i] > rightUnionArray[i]);
- returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
- break;
- case EOpLessThanEqual:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i].setBConst(unionArray[i] <= rightUnionArray[i]);
- returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
- break;
- case EOpGreaterThanEqual:
- tempConstArray = new ConstantUnion[objectSize];
- for(size_t i = 0; i < objectSize; i++)
- tempConstArray[i].setBConst(unionArray[i] >= rightUnionArray[i]);
- returnType = TType(EbtBool, EbpUndefined, EvqConstExpr, objectSize);
- break;
- case EOpEqual:
- tempConstArray = new ConstantUnion[1];
-
- if(getType().getBasicType() == EbtStruct) {
- tempConstArray->setBConst(CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray));
- } else {
- bool boolNodeFlag = true;
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] != rightUnionArray[i]) {
- boolNodeFlag = false;
- break; // break out of for loop
- }
- }
- tempConstArray->setBConst(boolNodeFlag);
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConstExpr));
- tempNode->setLine(getLine());
-
- return tempNode;
-
- case EOpNotEqual:
- tempConstArray = new ConstantUnion[1];
-
- if(getType().getBasicType() == EbtStruct) {
- tempConstArray->setBConst(!CompareStructure(node->getType(), node->getUnionArrayPointer(), unionArray));
- } else {
- bool boolNodeFlag = false;
- for (size_t i = 0; i < objectSize; i++) {
- if (unionArray[i] != rightUnionArray[i]) {
- boolNodeFlag = true;
- break; // break out of for loop
- }
- }
- tempConstArray->setBConst(boolNodeFlag);
- }
-
- tempNode = new TIntermConstantUnion(tempConstArray, TType(EbtBool, EbpUndefined, EvqConstExpr));
- tempNode->setLine(getLine());
-
- return tempNode;
- case EOpMax:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] > rightUnionArray[i] ? unionArray[i] : rightUnionArray[i];
- }
- break;
- case EOpMin:
- tempConstArray = new ConstantUnion[objectSize];
- {// support MSVC++6.0
- for (size_t i = 0; i < objectSize; i++)
- tempConstArray[i] = unionArray[i] < rightUnionArray[i] ? unionArray[i] : rightUnionArray[i];
- }
- break;
- default:
- return 0;
- }
- tempNode = new TIntermConstantUnion(tempConstArray, returnType);
- tempNode->setLine(getLine());
-
- return tempNode;
- } else {
- //
- // Do unary operations
- //
- TIntermConstantUnion *newNode = 0;
- ConstantUnion* tempConstArray = new ConstantUnion[objectSize];
- TType type = getType();
- TBasicType basicType = type.getBasicType();
- for (size_t i = 0; i < objectSize; i++) {
- switch(op) {
- case EOpNegative:
- switch (basicType) {
- case EbtFloat: tempConstArray[i].setFConst(-unionArray[i].getFConst()); break;
- case EbtInt: tempConstArray[i].setIConst(-unionArray[i].getIConst()); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpLogicalNot: // this code is written for possible future use, will not get executed currently
- switch (basicType) {
- case EbtBool: tempConstArray[i].setBConst(!unionArray[i].getBConst()); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpBitwiseNot:
- switch(basicType) {
- case EbtInt: tempConstArray[i].setIConst(~unionArray[i].getIConst()); break;
- case EbtUInt: tempConstArray[i].setUConst(~unionArray[i].getUConst()); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpRadians:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(unionArray[i].getFConst() * 1.74532925e-2f); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpDegrees:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(unionArray[i].getFConst() * 5.72957795e+1f); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpSin:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(sinf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpCos:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(cosf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpTan:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(tanf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAsin:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(asinf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAcos:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(acosf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAtan:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(atanf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpSinh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(sinhf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpCosh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(coshf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpTanh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(tanhf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAsinh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(asinhf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAcosh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(acoshf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpAtanh:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(atanhf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpLog:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(logf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpLog2:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(sw::log2(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpExp:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(expf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpExp2:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(exp2f(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpSqrt:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(sqrtf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpInverseSqrt:
- switch(basicType) {
- case EbtFloat: tempConstArray[i].setFConst(1.0f / sqrtf(unionArray[i].getFConst())); break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpFloatBitsToInt:
- switch(basicType) {
- case EbtFloat:
- tempConstArray[i].setIConst(sw::bit_cast<int>(unionArray[i].getFConst()));
- type.setBasicType(EbtInt);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- break;
- case EOpFloatBitsToUint:
- switch(basicType) {
- case EbtFloat:
- tempConstArray[i].setUConst(sw::bit_cast<unsigned int>(unionArray[i].getFConst()));
- type.setBasicType(EbtUInt);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpIntBitsToFloat:
- switch(basicType) {
- case EbtInt:
- tempConstArray[i].setFConst(sw::bit_cast<float>(unionArray[i].getIConst()));
- type.setBasicType(EbtFloat);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- case EOpUintBitsToFloat:
- switch(basicType) {
- case EbtUInt:
- tempConstArray[i].setFConst(sw::bit_cast<float>(unionArray[i].getUConst()));
- type.setBasicType(EbtFloat);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Unary operation not folded into constant", getLine());
- return 0;
- }
- break;
- default:
- return 0;
- }
- }
- newNode = new TIntermConstantUnion(tempConstArray, type);
- newNode->setLine(getLine());
- return newNode;
- }
-}
-
-TIntermTyped* TIntermediate::promoteConstantUnion(TBasicType promoteTo, TIntermConstantUnion* node)
-{
- size_t size = node->getType().getObjectSize();
-
- ConstantUnion *leftUnionArray = new ConstantUnion[size];
-
- for(size_t i = 0; i < size; i++) {
- switch (promoteTo) {
- case EbtFloat:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- leftUnionArray[i].setFConst(static_cast<float>(node->getIConst(i)));
- break;
- case EbtUInt:
- leftUnionArray[i].setFConst(static_cast<float>(node->getUConst(i)));
- break;
- case EbtBool:
- leftUnionArray[i].setFConst(static_cast<float>(node->getBConst(i)));
- break;
- case EbtFloat:
- leftUnionArray[i].setFConst(static_cast<float>(node->getFConst(i)));
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
- break;
- case EbtInt:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- leftUnionArray[i].setIConst(static_cast<int>(node->getIConst(i)));
- break;
- case EbtUInt:
- leftUnionArray[i].setIConst(static_cast<int>(node->getUConst(i)));
- break;
- case EbtBool:
- leftUnionArray[i].setIConst(static_cast<int>(node->getBConst(i)));
- break;
- case EbtFloat:
- leftUnionArray[i].setIConst(static_cast<int>(node->getFConst(i)));
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
- break;
- case EbtUInt:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getIConst(i)));
- break;
- case EbtUInt:
- leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getUConst(i)));
- break;
- case EbtBool:
- leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getBConst(i)));
- break;
- case EbtFloat:
- leftUnionArray[i].setUConst(static_cast<unsigned int>(node->getFConst(i)));
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
- break;
- case EbtBool:
- switch (node->getType().getBasicType()) {
- case EbtInt:
- leftUnionArray[i].setBConst(node->getIConst(i) != 0);
- break;
- case EbtUInt:
- leftUnionArray[i].setBConst(node->getUConst(i) != 0);
- break;
- case EbtBool:
- leftUnionArray[i].setBConst(node->getBConst(i));
- break;
- case EbtFloat:
- leftUnionArray[i].setBConst(node->getFConst(i) != 0.0f);
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Cannot promote", node->getLine());
- return 0;
- }
-
- break;
- default:
- infoSink.info.message(EPrefixInternalError, "Incorrect data type found", node->getLine());
- return 0;
- }
-
- }
-
- const TType& t = node->getType();
-
- return addConstantUnion(leftUnionArray, TType(promoteTo, t.getPrecision(), t.getQualifier(), t.getNominalSize(), t.getSecondarySize(), t.isArray()), node->getLine());
-}
-
diff --git a/src/OpenGL/compiler/MMap.h b/src/OpenGL/compiler/MMap.h
deleted file mode 100644
index 925cf6edd..000000000
--- a/src/OpenGL/compiler/MMap.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _MMAP_INCLUDED_
-#define _MMAP_INCLUDED_
-
-//
-// Encapsulate memory mapped files
-//
-
-class TMMap {
-public:
- TMMap(const char* fileName) :
- fSize(-1), // -1 is the error value returned by GetFileSize()
- fp(nullptr),
- fBuff(0) // 0 is the error value returned by MapViewOfFile()
- {
- if ((fp = fopen(fileName, "r")) == NULL)
- return;
- char c = getc(fp);
- fSize = 0;
- while (c != EOF) {
- fSize++;
- c = getc(fp);
- }
- if (c == EOF)
- fSize++;
- rewind(fp);
- fBuff = (char*)malloc(sizeof(char) * fSize);
- int count = 0;
- c = getc(fp);
- while (c != EOF) {
- fBuff[count++] = c;
- c = getc(fp);
- }
- fBuff[count++] = c;
- }
-
- char* getData() { return fBuff; }
- int getSize() { return fSize; }
-
- ~TMMap() {
- if (fp != NULL)
- fclose(fp);
- }
-
-private:
- int fSize; // size of file to map in
- FILE *fp;
- char* fBuff; // the actual data;
-};
-
-#endif // _MMAP_INCLUDED_
diff --git a/src/OpenGL/compiler/OutputASM.cpp b/src/OpenGL/compiler/OutputASM.cpp
deleted file mode 100644
index 9d0d88b3e..000000000
--- a/src/OpenGL/compiler/OutputASM.cpp
+++ /dev/null
@@ -1,4076 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "OutputASM.h"
-#include "Common/Math.hpp"
-
-#include "common/debug.h"
-#include "InfoSink.h"
-
-#include "libGLESv2/Shader.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-#include <GL/glcorearb.h>
-#include <GL/glext.h>
-
-#include <stdlib.h>
-
-namespace
-{
- GLenum glVariableType(const TType &type)
- {
- switch(type.getBasicType())
- {
- case EbtFloat:
- if(type.isScalar())
- {
- return GL_FLOAT;
- }
- else if(type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_FLOAT_VEC2;
- case 3: return GL_FLOAT_VEC3;
- case 4: return GL_FLOAT_VEC4;
- default: UNREACHABLE(type.getNominalSize());
- }
- }
- else if(type.isMatrix())
- {
- switch(type.getNominalSize())
- {
- case 2:
- switch(type.getSecondarySize())
- {
- case 2: return GL_FLOAT_MAT2;
- case 3: return GL_FLOAT_MAT2x3;
- case 4: return GL_FLOAT_MAT2x4;
- default: UNREACHABLE(type.getSecondarySize());
- }
- case 3:
- switch(type.getSecondarySize())
- {
- case 2: return GL_FLOAT_MAT3x2;
- case 3: return GL_FLOAT_MAT3;
- case 4: return GL_FLOAT_MAT3x4;
- default: UNREACHABLE(type.getSecondarySize());
- }
- case 4:
- switch(type.getSecondarySize())
- {
- case 2: return GL_FLOAT_MAT4x2;
- case 3: return GL_FLOAT_MAT4x3;
- case 4: return GL_FLOAT_MAT4;
- default: UNREACHABLE(type.getSecondarySize());
- }
- default: UNREACHABLE(type.getNominalSize());
- }
- }
- else UNREACHABLE(0);
- break;
- case EbtInt:
- if(type.isScalar())
- {
- return GL_INT;
- }
- else if(type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_INT_VEC2;
- case 3: return GL_INT_VEC3;
- case 4: return GL_INT_VEC4;
- default: UNREACHABLE(type.getNominalSize());
- }
- }
- else UNREACHABLE(0);
- break;
- case EbtUInt:
- if(type.isScalar())
- {
- return GL_UNSIGNED_INT;
- }
- else if(type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_UNSIGNED_INT_VEC2;
- case 3: return GL_UNSIGNED_INT_VEC3;
- case 4: return GL_UNSIGNED_INT_VEC4;
- default: UNREACHABLE(type.getNominalSize());
- }
- }
- else UNREACHABLE(0);
- break;
- case EbtBool:
- if(type.isScalar())
- {
- return GL_BOOL;
- }
- else if(type.isVector())
- {
- switch(type.getNominalSize())
- {
- case 2: return GL_BOOL_VEC2;
- case 3: return GL_BOOL_VEC3;
- case 4: return GL_BOOL_VEC4;
- default: UNREACHABLE(type.getNominalSize());
- }
- }
- else UNREACHABLE(0);
- break;
- case EbtSampler2D:
- return GL_SAMPLER_2D;
- case EbtISampler2D:
- return GL_INT_SAMPLER_2D;
- case EbtUSampler2D:
- return GL_UNSIGNED_INT_SAMPLER_2D;
- case EbtSamplerCube:
- return GL_SAMPLER_CUBE;
- case EbtSampler2DRect:
- return GL_SAMPLER_2D_RECT_ARB;
- case EbtISamplerCube:
- return GL_INT_SAMPLER_CUBE;
- case EbtUSamplerCube:
- return GL_UNSIGNED_INT_SAMPLER_CUBE;
- case EbtSamplerExternalOES:
- return GL_SAMPLER_EXTERNAL_OES;
- case EbtSampler3D:
- return GL_SAMPLER_3D_OES;
- case EbtISampler3D:
- return GL_INT_SAMPLER_3D;
- case EbtUSampler3D:
- return GL_UNSIGNED_INT_SAMPLER_3D;
- case EbtSampler2DArray:
- return GL_SAMPLER_2D_ARRAY;
- case EbtISampler2DArray:
- return GL_INT_SAMPLER_2D_ARRAY;
- case EbtUSampler2DArray:
- return GL_UNSIGNED_INT_SAMPLER_2D_ARRAY;
- case EbtSampler2DShadow:
- return GL_SAMPLER_2D_SHADOW;
- case EbtSamplerCubeShadow:
- return GL_SAMPLER_CUBE_SHADOW;
- case EbtSampler2DArrayShadow:
- return GL_SAMPLER_2D_ARRAY_SHADOW;
- default:
- UNREACHABLE(type.getBasicType());
- break;
- }
-
- return GL_NONE;
- }
-
- GLenum glVariablePrecision(const TType &type)
- {
- if(type.getBasicType() == EbtFloat)
- {
- switch(type.getPrecision())
- {
- case EbpHigh: return GL_HIGH_FLOAT;
- case EbpMedium: return GL_MEDIUM_FLOAT;
- case EbpLow: return GL_LOW_FLOAT;
- case EbpUndefined:
- // Should be defined as the default precision by the parser
- default: UNREACHABLE(type.getPrecision());
- }
- }
- else if(type.getBasicType() == EbtInt)
- {
- switch(type.getPrecision())
- {
- case EbpHigh: return GL_HIGH_INT;
- case EbpMedium: return GL_MEDIUM_INT;
- case EbpLow: return GL_LOW_INT;
- case EbpUndefined:
- // Should be defined as the default precision by the parser
- default: UNREACHABLE(type.getPrecision());
- }
- }
-
- // Other types (boolean, sampler) don't have a precision
- return GL_NONE;
- }
-}
-
-namespace glsl
-{
- // Integer to TString conversion
- TString str(int i)
- {
- char buffer[20];
- sprintf(buffer, "%d", i);
- return buffer;
- }
-
- class Temporary : public TIntermSymbol
- {
- public:
- Temporary(OutputASM *assembler) : TIntermSymbol(TSymbolTableLevel::nextUniqueId(), "tmp", TType(EbtFloat, EbpHigh, EvqTemporary, 4, 1, false)), assembler(assembler)
- {
- }
-
- ~Temporary()
- {
- assembler->freeTemporary(this);
- }
-
- private:
- OutputASM *const assembler;
- };
-
- class Constant : public TIntermConstantUnion
- {
- public:
- Constant(float x, float y, float z, float w) : TIntermConstantUnion(constants, TType(EbtFloat, EbpHigh, EvqConstExpr, 4, 1, false))
- {
- constants[0].setFConst(x);
- constants[1].setFConst(y);
- constants[2].setFConst(z);
- constants[3].setFConst(w);
- }
-
- Constant(bool b) : TIntermConstantUnion(constants, TType(EbtBool, EbpHigh, EvqConstExpr, 1, 1, false))
- {
- constants[0].setBConst(b);
- }
-
- Constant(int i) : TIntermConstantUnion(constants, TType(EbtInt, EbpHigh, EvqConstExpr, 1, 1, false))
- {
- constants[0].setIConst(i);
- }
-
- ~Constant()
- {
- }
-
- private:
- ConstantUnion constants[4];
- };
-
- ShaderVariable::ShaderVariable(const TType& type, const std::string& name, int registerIndex) :
- type(type.isStruct() ? GL_NONE : glVariableType(type)), precision(glVariablePrecision(type)),
- name(name), arraySize(type.getArraySize()), registerIndex(registerIndex)
- {
- if(type.isStruct())
- {
- for(const auto& field : type.getStruct()->fields())
- {
- fields.push_back(ShaderVariable(*(field->type()), field->name().c_str(), -1));
- }
- }
- }
-
- Uniform::Uniform(const TType& type, const std::string &name, int registerIndex, int blockId, const BlockMemberInfo& blockMemberInfo) :
- ShaderVariable(type, name, registerIndex), blockId(blockId), blockInfo(blockMemberInfo)
- {
- }
-
- UniformBlock::UniformBlock(const std::string& name, unsigned int dataSize, unsigned int arraySize,
- TLayoutBlockStorage layout, bool isRowMajorLayout, int registerIndex, int blockId) :
- name(name), dataSize(dataSize), arraySize(arraySize), layout(layout),
- isRowMajorLayout(isRowMajorLayout), registerIndex(registerIndex), blockId(blockId)
- {
- }
-
- BlockLayoutEncoder::BlockLayoutEncoder()
- : mCurrentOffset(0)
- {
- }
-
- BlockMemberInfo BlockLayoutEncoder::encodeType(const TType &type)
- {
- int arrayStride;
- int matrixStride;
-
- bool isRowMajor = type.getLayoutQualifier().matrixPacking == EmpRowMajor;
- getBlockLayoutInfo(type, type.getArraySize(), isRowMajor, &arrayStride, &matrixStride);
-
- const BlockMemberInfo memberInfo(static_cast<int>(mCurrentOffset * BytesPerComponent),
- static_cast<int>(arrayStride * BytesPerComponent),
- static_cast<int>(matrixStride * BytesPerComponent),
- (matrixStride > 0) && isRowMajor);
-
- advanceOffset(type, type.getArraySize(), isRowMajor, arrayStride, matrixStride);
-
- return memberInfo;
- }
-
- // static
- size_t BlockLayoutEncoder::getBlockRegister(const BlockMemberInfo &info)
- {
- return (info.offset / BytesPerComponent) / ComponentsPerRegister;
- }
-
- // static
- size_t BlockLayoutEncoder::getBlockRegisterElement(const BlockMemberInfo &info)
- {
- return (info.offset / BytesPerComponent) % ComponentsPerRegister;
- }
-
- void BlockLayoutEncoder::nextRegister()
- {
- mCurrentOffset = sw::align(mCurrentOffset, ComponentsPerRegister);
- }
-
- Std140BlockEncoder::Std140BlockEncoder() : BlockLayoutEncoder()
- {
- }
-
- void Std140BlockEncoder::enterAggregateType()
- {
- nextRegister();
- }
-
- void Std140BlockEncoder::exitAggregateType()
- {
- nextRegister();
- }
-
- void Std140BlockEncoder::getBlockLayoutInfo(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut)
- {
- size_t baseAlignment = 0;
- int matrixStride = 0;
- int arrayStride = 0;
-
- if(type.isMatrix())
- {
- baseAlignment = ComponentsPerRegister;
- matrixStride = ComponentsPerRegister;
-
- if(arraySize > 0)
- {
- const int numRegisters = isRowMajorMatrix ? type.getSecondarySize() : type.getNominalSize();
- arrayStride = ComponentsPerRegister * numRegisters;
- }
- }
- else if(arraySize > 0)
- {
- baseAlignment = ComponentsPerRegister;
- arrayStride = ComponentsPerRegister;
- }
- else
- {
- const size_t numComponents = type.getElementSize();
- baseAlignment = (numComponents == 3 ? 4u : numComponents);
- }
-
- mCurrentOffset = sw::align(mCurrentOffset, baseAlignment);
-
- *matrixStrideOut = matrixStride;
- *arrayStrideOut = arrayStride;
- }
-
- void Std140BlockEncoder::advanceOffset(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride)
- {
- if(arraySize > 0)
- {
- mCurrentOffset += arrayStride * arraySize;
- }
- else if(type.isMatrix())
- {
- ASSERT(matrixStride == ComponentsPerRegister);
- const int numRegisters = isRowMajorMatrix ? type.getSecondarySize() : type.getNominalSize();
- mCurrentOffset += ComponentsPerRegister * numRegisters;
- }
- else
- {
- mCurrentOffset += type.getElementSize();
- }
- }
-
- Attribute::Attribute()
- {
- type = GL_NONE;
- arraySize = 0;
- registerIndex = 0;
- }
-
- Attribute::Attribute(GLenum type, const std::string &name, int arraySize, int layoutLocation, int registerIndex)
- {
- this->type = type;
- this->name = name;
- this->arraySize = arraySize;
- this->layoutLocation = layoutLocation;
- this->registerIndex = registerIndex;
- }
-
- sw::PixelShader *Shader::getPixelShader() const
- {
- return nullptr;
- }
-
- sw::VertexShader *Shader::getVertexShader() const
- {
- return nullptr;
- }
-
- OutputASM::TextureFunction::TextureFunction(const TString& nodeName) : method(IMPLICIT), proj(false), offset(false)
- {
- TString name = TFunction::unmangleName(nodeName);
-
- if(name == "texture2D" || name == "textureCube" || name == "texture" || name == "texture3D" || name == "texture2DRect")
- {
- method = IMPLICIT;
- }
- else if(name == "texture2DProj" || name == "textureProj" || name == "texture2DRectProj")
- {
- method = IMPLICIT;
- proj = true;
- }
- else if(name == "texture2DLod" || name == "textureCubeLod" || name == "textureLod")
- {
- method = LOD;
- }
- else if(name == "texture2DProjLod" || name == "textureProjLod")
- {
- method = LOD;
- proj = true;
- }
- else if(name == "textureSize")
- {
- method = SIZE;
- }
- else if(name == "textureOffset")
- {
- method = IMPLICIT;
- offset = true;
- }
- else if(name == "textureProjOffset")
- {
- method = IMPLICIT;
- offset = true;
- proj = true;
- }
- else if(name == "textureLodOffset")
- {
- method = LOD;
- offset = true;
- }
- else if(name == "textureProjLodOffset")
- {
- method = LOD;
- proj = true;
- offset = true;
- }
- else if(name == "texelFetch")
- {
- method = FETCH;
- }
- else if(name == "texelFetchOffset")
- {
- method = FETCH;
- offset = true;
- }
- else if(name == "textureGrad")
- {
- method = GRAD;
- }
- else if(name == "textureGradOffset")
- {
- method = GRAD;
- offset = true;
- }
- else if(name == "textureProjGrad")
- {
- method = GRAD;
- proj = true;
- }
- else if(name == "textureProjGradOffset")
- {
- method = GRAD;
- proj = true;
- offset = true;
- }
- else UNREACHABLE(0);
- }
-
- OutputASM::OutputASM(TParseContext &context, Shader *shaderObject) : TIntermTraverser(true, true, true), shaderObject(shaderObject), mContext(context)
- {
- shader = nullptr;
- pixelShader = nullptr;
- vertexShader = nullptr;
-
- if(shaderObject)
- {
- shader = shaderObject->getShader();
- pixelShader = shaderObject->getPixelShader();
- vertexShader = shaderObject->getVertexShader();
- }
-
- functionArray.push_back(Function(0, "main(", nullptr, nullptr));
- currentFunction = 0;
- outputQualifier = EvqOutput; // Initialize outputQualifier to any value other than EvqFragColor or EvqFragData
- }
-
- OutputASM::~OutputASM()
- {
- }
-
- void OutputASM::output()
- {
- if(shader)
- {
- emitShader(GLOBAL);
-
- if(functionArray.size() > 1) // Only call main() when there are other functions
- {
- Instruction *callMain = emit(sw::Shader::OPCODE_CALL);
- callMain->dst.type = sw::Shader::PARAMETER_LABEL;
- callMain->dst.index = 0; // main()
-
- emit(sw::Shader::OPCODE_RET);
- }
-
- emitShader(FUNCTION);
- }
- }
-
- void OutputASM::emitShader(Scope scope)
- {
- emitScope = scope;
- currentScope = GLOBAL;
- mContext.getTreeRoot()->traverse(this);
- }
-
- void OutputASM::freeTemporary(Temporary *temporary)
- {
- free(temporaries, temporary);
- }
-
- sw::Shader::Opcode OutputASM::getOpcode(sw::Shader::Opcode op, TIntermTyped *in) const
- {
- TBasicType baseType = in->getType().getBasicType();
-
- switch(op)
- {
- case sw::Shader::OPCODE_NEG:
- switch(baseType)
- {
- case EbtInt:
- case EbtUInt:
- return sw::Shader::OPCODE_INEG;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_ABS:
- switch(baseType)
- {
- case EbtInt:
- return sw::Shader::OPCODE_IABS;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_SGN:
- switch(baseType)
- {
- case EbtInt:
- return sw::Shader::OPCODE_ISGN;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_ADD:
- switch(baseType)
- {
- case EbtInt:
- case EbtUInt:
- return sw::Shader::OPCODE_IADD;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_SUB:
- switch(baseType)
- {
- case EbtInt:
- case EbtUInt:
- return sw::Shader::OPCODE_ISUB;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_MUL:
- switch(baseType)
- {
- case EbtInt:
- case EbtUInt:
- return sw::Shader::OPCODE_IMUL;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_DIV:
- switch(baseType)
- {
- case EbtInt:
- return sw::Shader::OPCODE_IDIV;
- case EbtUInt:
- return sw::Shader::OPCODE_UDIV;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_IMOD:
- return baseType == EbtUInt ? sw::Shader::OPCODE_UMOD : op;
- case sw::Shader::OPCODE_ISHR:
- return baseType == EbtUInt ? sw::Shader::OPCODE_USHR : op;
- case sw::Shader::OPCODE_MIN:
- switch(baseType)
- {
- case EbtInt:
- return sw::Shader::OPCODE_IMIN;
- case EbtUInt:
- return sw::Shader::OPCODE_UMIN;
- case EbtFloat:
- default:
- return op;
- }
- case sw::Shader::OPCODE_MAX:
- switch(baseType)
- {
- case EbtInt:
- return sw::Shader::OPCODE_IMAX;
- case EbtUInt:
- return sw::Shader::OPCODE_UMAX;
- case EbtFloat:
- default:
- return op;
- }
- default:
- return op;
- }
- }
-
- void OutputASM::visitSymbol(TIntermSymbol *symbol)
- {
- // The type of vertex outputs and fragment inputs with the same name must match (validated at link time),
- // so declare them but don't assign a register index yet (one will be assigned when referenced in reachable code).
- switch(symbol->getQualifier())
- {
- case EvqVaryingIn:
- case EvqVaryingOut:
- case EvqInvariantVaryingIn:
- case EvqInvariantVaryingOut:
- case EvqVertexOut:
- case EvqFragmentIn:
- if(symbol->getBasicType() != EbtInvariant) // Typeless declarations are not new varyings
- {
- declareVarying(symbol, -1);
- }
- break;
- case EvqFragmentOut:
- declareFragmentOutput(symbol);
- break;
- default:
- break;
- }
-
- TInterfaceBlock* block = symbol->getType().getInterfaceBlock();
- // OpenGL ES 3.0.4 spec, section 2.12.6 Uniform Variables:
- // "All members of a named uniform block declared with a shared or std140 layout qualifier
- // are considered active, even if they are not referenced in any shader in the program.
- // The uniform block itself is also considered active, even if no member of the block is referenced."
- if(block && ((block->blockStorage() == EbsShared) || (block->blockStorage() == EbsStd140)))
- {
- uniformRegister(symbol);
- }
- }
-
- bool OutputASM::visitBinary(Visit visit, TIntermBinary *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- TIntermTyped *result = node;
- TIntermTyped *left = node->getLeft();
- TIntermTyped *right = node->getRight();
- const TType &leftType = left->getType();
- const TType &rightType = right->getType();
-
- if(isSamplerRegister(result))
- {
- return false; // Don't traverse, the register index is determined statically
- }
-
- switch(node->getOp())
- {
- case EOpAssign:
- assert(visit == PreVisit);
- right->traverse(this);
- assignLvalue(left, right);
- copy(result, right);
- return false;
- case EOpInitialize:
- assert(visit == PreVisit);
- // Constant arrays go into the constant register file.
- if(leftType.getQualifier() == EvqConstExpr && leftType.isArray() && leftType.getArraySize() > 1)
- {
- for(int i = 0; i < left->totalRegisterCount(); i++)
- {
- emit(sw::Shader::OPCODE_DEF, left, i, right, i);
- }
- }
- else
- {
- right->traverse(this);
- copy(left, right);
- }
- return false;
- case EOpMatrixTimesScalarAssign:
- assert(visit == PreVisit);
- right->traverse(this);
- for(int i = 0; i < leftType.getNominalSize(); i++)
- {
- emit(sw::Shader::OPCODE_MUL, result, i, left, i, right);
- }
-
- assignLvalue(left, result);
- return false;
- case EOpVectorTimesMatrixAssign:
- assert(visit == PreVisit);
- {
- // The left operand may contain a swizzle serving double-duty as
- // swizzle and writemask, so it's important that we traverse it
- // first. Otherwise we may end up never setting up our left
- // operand correctly.
- left->traverse(this);
- right->traverse(this);
- int size = leftType.getNominalSize();
-
- for(int i = 0; i < size; i++)
- {
- Instruction *dot = emit(sw::Shader::OPCODE_DP(size), result, 0, left, 0, right, i);
- dot->dst.mask = 1 << i;
- }
-
- assignLvalue(left, result);
- }
- return false;
- case EOpMatrixTimesMatrixAssign:
- assert(visit == PreVisit);
- {
- right->traverse(this);
- int dim = leftType.getNominalSize();
-
- for(int i = 0; i < dim; i++)
- {
- Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
- mul->src[1].swizzle = 0x00;
-
- for(int j = 1; j < dim; j++)
- {
- Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, i, left, j, right, i, result, i);
- mad->src[1].swizzle = j * 0x55;
- }
- }
-
- assignLvalue(left, result);
- }
- return false;
- case EOpIndexDirect:
- case EOpIndexIndirect:
- case EOpIndexDirectStruct:
- case EOpIndexDirectInterfaceBlock:
- assert(visit == PreVisit);
- evaluateRvalue(node);
- return false;
- case EOpVectorSwizzle:
- if(visit == PostVisit)
- {
- int swizzle = 0;
- TIntermAggregate *components = right->getAsAggregate();
-
- if(components)
- {
- TIntermSequence &sequence = components->getSequence();
- int component = 0;
-
- for(TIntermSequence::iterator sit = sequence.begin(); sit != sequence.end(); sit++)
- {
- TIntermConstantUnion *element = (*sit)->getAsConstantUnion();
-
- if(element)
- {
- int i = element->getUnionArrayPointer()[0].getIConst();
- swizzle |= i << (component * 2);
- component++;
- }
- else UNREACHABLE(0);
- }
- }
- else UNREACHABLE(0);
-
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, left);
- mov->src[0].swizzle = swizzle;
- }
- break;
- case EOpAddAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_ADD, result), result, left, left, right); break;
- case EOpAdd: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_ADD, result), result, left, right); break;
- case EOpSubAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_SUB, result), result, left, left, right); break;
- case EOpSub: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_SUB, result), result, left, right); break;
- case EOpMulAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_MUL, result), result, left, left, right); break;
- case EOpMul: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_MUL, result), result, left, right); break;
- case EOpDivAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_DIV, result), result, left, left, right); break;
- case EOpDiv: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_DIV, result), result, left, right); break;
- case EOpIModAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_IMOD, result), result, left, left, right); break;
- case EOpIMod: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_IMOD, result), result, left, right); break;
- case EOpBitShiftLeftAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_SHL, result, left, left, right); break;
- case EOpBitShiftLeft: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_SHL, result, left, right); break;
- case EOpBitShiftRightAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_ISHR, result), result, left, left, right); break;
- case EOpBitShiftRight: if(visit == PostVisit) emitBinary(getOpcode(sw::Shader::OPCODE_ISHR, result), result, left, right); break;
- case EOpBitwiseAndAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_AND, result, left, left, right); break;
- case EOpBitwiseAnd: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_AND, result, left, right); break;
- case EOpBitwiseXorAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_XOR, result, left, left, right); break;
- case EOpBitwiseXor: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_XOR, result, left, right); break;
- case EOpBitwiseOrAssign: if(visit == PostVisit) emitAssign(sw::Shader::OPCODE_OR, result, left, left, right); break;
- case EOpBitwiseOr: if(visit == PostVisit) emitBinary(sw::Shader::OPCODE_OR, result, left, right); break;
- case EOpEqual:
- if(visit == PostVisit)
- {
- emitBinary(sw::Shader::OPCODE_EQ, result, left, right);
-
- for(int index = 1; index < left->totalRegisterCount(); index++)
- {
- Temporary equal(this);
- emit(sw::Shader::OPCODE_EQ, &equal, 0, left, index, right, index);
- emit(sw::Shader::OPCODE_AND, result, result, &equal);
- }
- }
- break;
- case EOpNotEqual:
- if(visit == PostVisit)
- {
- emitBinary(sw::Shader::OPCODE_NE, result, left, right);
-
- for(int index = 1; index < left->totalRegisterCount(); index++)
- {
- Temporary notEqual(this);
- emit(sw::Shader::OPCODE_NE, &notEqual, 0, left, index, right, index);
- emit(sw::Shader::OPCODE_OR, result, result, &notEqual);
- }
- }
- break;
- case EOpLessThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LT, result, left, right); break;
- case EOpGreaterThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GT, result, left, right); break;
- case EOpLessThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LE, result, left, right); break;
- case EOpGreaterThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GE, result, left, right); break;
- case EOpVectorTimesScalarAssign: if(visit == PostVisit) emitAssign(getOpcode(sw::Shader::OPCODE_MUL, left), result, left, left, right); break;
- case EOpVectorTimesScalar: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MUL, left), result, left, right); break;
- case EOpMatrixTimesScalar:
- if(visit == PostVisit)
- {
- if(left->isMatrix())
- {
- for(int i = 0; i < leftType.getNominalSize(); i++)
- {
- emit(sw::Shader::OPCODE_MUL, result, i, left, i, right, 0);
- }
- }
- else if(right->isMatrix())
- {
- for(int i = 0; i < rightType.getNominalSize(); i++)
- {
- emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
- }
- }
- else UNREACHABLE(0);
- }
- break;
- case EOpVectorTimesMatrix:
- if(visit == PostVisit)
- {
- sw::Shader::Opcode dpOpcode = sw::Shader::OPCODE_DP(leftType.getNominalSize());
-
- int size = rightType.getNominalSize();
- for(int i = 0; i < size; i++)
- {
- Instruction *dot = emit(dpOpcode, result, 0, left, 0, right, i);
- dot->dst.mask = 1 << i;
- }
- }
- break;
- case EOpMatrixTimesVector:
- if(visit == PostVisit)
- {
- Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, left, right);
- mul->src[1].swizzle = 0x00;
-
- int size = rightType.getNominalSize();
- for(int i = 1; i < size; i++)
- {
- Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, 0, left, i, right, 0, result);
- mad->src[1].swizzle = i * 0x55;
- }
- }
- break;
- case EOpMatrixTimesMatrix:
- if(visit == PostVisit)
- {
- int dim = leftType.getNominalSize();
-
- int size = rightType.getNominalSize();
- for(int i = 0; i < size; i++)
- {
- Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, left, 0, right, i);
- mul->src[1].swizzle = 0x00;
-
- for(int j = 1; j < dim; j++)
- {
- Instruction *mad = emit(sw::Shader::OPCODE_MAD, result, i, left, j, right, i, result, i);
- mad->src[1].swizzle = j * 0x55;
- }
- }
- }
- break;
- case EOpLogicalOr:
- if(trivial(right, 6))
- {
- if(visit == PostVisit)
- {
- emit(sw::Shader::OPCODE_OR, result, left, right);
- }
- }
- else // Short-circuit evaluation
- {
- if(visit == InVisit)
- {
- emit(sw::Shader::OPCODE_MOV, result, left);
- Instruction *ifnot = emit(sw::Shader::OPCODE_IF, 0, result);
- ifnot->src[0].modifier = sw::Shader::MODIFIER_NOT;
- }
- else if(visit == PostVisit)
- {
- emit(sw::Shader::OPCODE_MOV, result, right);
- emit(sw::Shader::OPCODE_ENDIF);
- }
- }
- break;
- case EOpLogicalXor: if(visit == PostVisit) emit(sw::Shader::OPCODE_XOR, result, left, right); break;
- case EOpLogicalAnd:
- if(trivial(right, 6))
- {
- if(visit == PostVisit)
- {
- emit(sw::Shader::OPCODE_AND, result, left, right);
- }
- }
- else // Short-circuit evaluation
- {
- if(visit == InVisit)
- {
- emit(sw::Shader::OPCODE_MOV, result, left);
- emit(sw::Shader::OPCODE_IF, 0, result);
- }
- else if(visit == PostVisit)
- {
- emit(sw::Shader::OPCODE_MOV, result, right);
- emit(sw::Shader::OPCODE_ENDIF);
- }
- }
- break;
- default: UNREACHABLE(node->getOp());
- }
-
- return true;
- }
-
- void OutputASM::emitDeterminant(TIntermTyped *result, TIntermTyped *arg, int size, int col, int row, int outCol, int outRow)
- {
- switch(size)
- {
- case 1: // Used for cofactor computation only
- {
- // For a 2x2 matrix, the cofactor is simply a transposed move or negate
- bool isMov = (row == col);
- sw::Shader::Opcode op = isMov ? sw::Shader::OPCODE_MOV : sw::Shader::OPCODE_NEG;
- Instruction *mov = emit(op, result, outCol, arg, isMov ? 1 - row : row);
- mov->src[0].swizzle = 0x55 * (isMov ? 1 - col : col);
- mov->dst.mask = 1 << outRow;
- }
- break;
- case 2:
- {
- static const unsigned int swizzle[3] = { 0x99, 0x88, 0x44 }; // xy?? : yzyz, xzxz, xyxy
-
- bool isCofactor = (col >= 0) && (row >= 0);
- int col0 = (isCofactor && (col <= 0)) ? 1 : 0;
- int col1 = (isCofactor && (col <= 1)) ? 2 : 1;
- bool negate = isCofactor && ((col & 0x01) ^ (row & 0x01));
-
- Instruction *det = emit(sw::Shader::OPCODE_DET2, result, outCol, arg, negate ? col1 : col0, arg, negate ? col0 : col1);
- det->src[0].swizzle = det->src[1].swizzle = swizzle[isCofactor ? row : 2];
- det->dst.mask = 1 << outRow;
- }
- break;
- case 3:
- {
- static const unsigned int swizzle[4] = { 0xF9, 0xF8, 0xF4, 0xE4 }; // xyz? : yzww, xzww, xyww, xyzw
-
- bool isCofactor = (col >= 0) && (row >= 0);
- int col0 = (isCofactor && (col <= 0)) ? 1 : 0;
- int col1 = (isCofactor && (col <= 1)) ? 2 : 1;
- int col2 = (isCofactor && (col <= 2)) ? 3 : 2;
- bool negate = isCofactor && ((col & 0x01) ^ (row & 0x01));
-
- Instruction *det = emit(sw::Shader::OPCODE_DET3, result, outCol, arg, col0, arg, negate ? col2 : col1, arg, negate ? col1 : col2);
- det->src[0].swizzle = det->src[1].swizzle = det->src[2].swizzle = swizzle[isCofactor ? row : 3];
- det->dst.mask = 1 << outRow;
- }
- break;
- case 4:
- {
- Instruction *det = emit(sw::Shader::OPCODE_DET4, result, outCol, arg, 0, arg, 1, arg, 2, arg, 3);
- det->dst.mask = 1 << outRow;
- }
- break;
- default:
- UNREACHABLE(size);
- break;
- }
- }
-
- bool OutputASM::visitUnary(Visit visit, TIntermUnary *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- TIntermTyped *result = node;
- TIntermTyped *arg = node->getOperand();
- TBasicType basicType = arg->getType().getBasicType();
-
- union
- {
- float f;
- int i;
- } one_value;
-
- if(basicType == EbtInt || basicType == EbtUInt)
- {
- one_value.i = 1;
- }
- else
- {
- one_value.f = 1.0f;
- }
-
- Constant one(one_value.f, one_value.f, one_value.f, one_value.f);
- Constant rad(1.74532925e-2f, 1.74532925e-2f, 1.74532925e-2f, 1.74532925e-2f);
- Constant deg(5.72957795e+1f, 5.72957795e+1f, 5.72957795e+1f, 5.72957795e+1f);
-
- switch(node->getOp())
- {
- case EOpNegative:
- if(visit == PostVisit)
- {
- sw::Shader::Opcode negOpcode = getOpcode(sw::Shader::OPCODE_NEG, arg);
- for(int index = 0; index < arg->totalRegisterCount(); index++)
- {
- emit(negOpcode, result, index, arg, index);
- }
- }
- break;
- case EOpVectorLogicalNot: if(visit == PostVisit) emit(sw::Shader::OPCODE_NOT, result, arg); break;
- case EOpLogicalNot: if(visit == PostVisit) emit(sw::Shader::OPCODE_NOT, result, arg); break;
- case EOpBitwiseNot: if(visit == PostVisit) emit(sw::Shader::OPCODE_NOT, result, arg); break;
- case EOpPostIncrement:
- if(visit == PostVisit)
- {
- copy(result, arg);
-
- sw::Shader::Opcode addOpcode = getOpcode(sw::Shader::OPCODE_ADD, arg);
- for(int index = 0; index < arg->totalRegisterCount(); index++)
- {
- emit(addOpcode, arg, index, arg, index, &one);
- }
-
- assignLvalue(arg, arg);
- }
- break;
- case EOpPostDecrement:
- if(visit == PostVisit)
- {
- copy(result, arg);
-
- sw::Shader::Opcode subOpcode = getOpcode(sw::Shader::OPCODE_SUB, arg);
- for(int index = 0; index < arg->totalRegisterCount(); index++)
- {
- emit(subOpcode, arg, index, arg, index, &one);
- }
-
- assignLvalue(arg, arg);
- }
- break;
- case EOpPreIncrement:
- if(visit == PostVisit)
- {
- sw::Shader::Opcode addOpcode = getOpcode(sw::Shader::OPCODE_ADD, arg);
- for(int index = 0; index < arg->totalRegisterCount(); index++)
- {
- emit(addOpcode, result, index, arg, index, &one);
- }
-
- assignLvalue(arg, result);
- }
- break;
- case EOpPreDecrement:
- if(visit == PostVisit)
- {
- sw::Shader::Opcode subOpcode = getOpcode(sw::Shader::OPCODE_SUB, arg);
- for(int index = 0; index < arg->totalRegisterCount(); index++)
- {
- emit(subOpcode, result, index, arg, index, &one);
- }
-
- assignLvalue(arg, result);
- }
- break;
- case EOpRadians: if(visit == PostVisit) emit(sw::Shader::OPCODE_MUL, result, arg, &rad); break;
- case EOpDegrees: if(visit == PostVisit) emit(sw::Shader::OPCODE_MUL, result, arg, &deg); break;
- case EOpSin: if(visit == PostVisit) emit(sw::Shader::OPCODE_SIN, result, arg); break;
- case EOpCos: if(visit == PostVisit) emit(sw::Shader::OPCODE_COS, result, arg); break;
- case EOpTan: if(visit == PostVisit) emit(sw::Shader::OPCODE_TAN, result, arg); break;
- case EOpAsin: if(visit == PostVisit) emit(sw::Shader::OPCODE_ASIN, result, arg); break;
- case EOpAcos: if(visit == PostVisit) emit(sw::Shader::OPCODE_ACOS, result, arg); break;
- case EOpAtan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATAN, result, arg); break;
- case EOpSinh: if(visit == PostVisit) emit(sw::Shader::OPCODE_SINH, result, arg); break;
- case EOpCosh: if(visit == PostVisit) emit(sw::Shader::OPCODE_COSH, result, arg); break;
- case EOpTanh: if(visit == PostVisit) emit(sw::Shader::OPCODE_TANH, result, arg); break;
- case EOpAsinh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ASINH, result, arg); break;
- case EOpAcosh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ACOSH, result, arg); break;
- case EOpAtanh: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATANH, result, arg); break;
- case EOpExp: if(visit == PostVisit) emit(sw::Shader::OPCODE_EXP, result, arg); break;
- case EOpLog: if(visit == PostVisit) emit(sw::Shader::OPCODE_LOG, result, arg); break;
- case EOpExp2: if(visit == PostVisit) emit(sw::Shader::OPCODE_EXP2, result, arg); break;
- case EOpLog2: if(visit == PostVisit) emit(sw::Shader::OPCODE_LOG2, result, arg); break;
- case EOpSqrt: if(visit == PostVisit) emit(sw::Shader::OPCODE_SQRT, result, arg); break;
- case EOpInverseSqrt: if(visit == PostVisit) emit(sw::Shader::OPCODE_RSQ, result, arg); break;
- case EOpAbs: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_ABS, result), result, arg); break;
- case EOpSign: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_SGN, result), result, arg); break;
- case EOpFloor: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOOR, result, arg); break;
- case EOpTrunc: if(visit == PostVisit) emit(sw::Shader::OPCODE_TRUNC, result, arg); break;
- case EOpRound: if(visit == PostVisit) emit(sw::Shader::OPCODE_ROUND, result, arg); break;
- case EOpRoundEven: if(visit == PostVisit) emit(sw::Shader::OPCODE_ROUNDEVEN, result, arg); break;
- case EOpCeil: if(visit == PostVisit) emit(sw::Shader::OPCODE_CEIL, result, arg, result); break;
- case EOpFract: if(visit == PostVisit) emit(sw::Shader::OPCODE_FRC, result, arg); break;
- case EOpIsNan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ISNAN, result, arg); break;
- case EOpIsInf: if(visit == PostVisit) emit(sw::Shader::OPCODE_ISINF, result, arg); break;
- case EOpLength: if(visit == PostVisit) emit(sw::Shader::OPCODE_LEN(dim(arg)), result, arg); break;
- case EOpNormalize: if(visit == PostVisit) emit(sw::Shader::OPCODE_NRM(dim(arg)), result, arg); break;
- case EOpDFdx: if(visit == PostVisit) emit(sw::Shader::OPCODE_DFDX, result, arg); break;
- case EOpDFdy: if(visit == PostVisit) emit(sw::Shader::OPCODE_DFDY, result, arg); break;
- case EOpFwidth: if(visit == PostVisit) emit(sw::Shader::OPCODE_FWIDTH, result, arg); break;
- case EOpAny: if(visit == PostVisit) emit(sw::Shader::OPCODE_ANY, result, arg); break;
- case EOpAll: if(visit == PostVisit) emit(sw::Shader::OPCODE_ALL, result, arg); break;
- case EOpFloatBitsToInt: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOATBITSTOINT, result, arg); break;
- case EOpFloatBitsToUint: if(visit == PostVisit) emit(sw::Shader::OPCODE_FLOATBITSTOUINT, result, arg); break;
- case EOpIntBitsToFloat: if(visit == PostVisit) emit(sw::Shader::OPCODE_INTBITSTOFLOAT, result, arg); break;
- case EOpUintBitsToFloat: if(visit == PostVisit) emit(sw::Shader::OPCODE_UINTBITSTOFLOAT, result, arg); break;
- case EOpPackSnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_PACKSNORM2x16, result, arg); break;
- case EOpPackUnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_PACKUNORM2x16, result, arg); break;
- case EOpPackHalf2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_PACKHALF2x16, result, arg); break;
- case EOpUnpackSnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKSNORM2x16, result, arg); break;
- case EOpUnpackUnorm2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKUNORM2x16, result, arg); break;
- case EOpUnpackHalf2x16: if(visit == PostVisit) emit(sw::Shader::OPCODE_UNPACKHALF2x16, result, arg); break;
- case EOpTranspose:
- if(visit == PostVisit)
- {
- int numCols = arg->getNominalSize();
- int numRows = arg->getSecondarySize();
- for(int i = 0; i < numCols; ++i)
- {
- for(int j = 0; j < numRows; ++j)
- {
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, j, arg, i);
- mov->src[0].swizzle = 0x55 * j;
- mov->dst.mask = 1 << i;
- }
- }
- }
- break;
- case EOpDeterminant:
- if(visit == PostVisit)
- {
- int size = arg->getNominalSize();
- ASSERT(size == arg->getSecondarySize());
-
- emitDeterminant(result, arg, size);
- }
- break;
- case EOpInverse:
- if(visit == PostVisit)
- {
- int size = arg->getNominalSize();
- ASSERT(size == arg->getSecondarySize());
-
- // Compute transposed matrix of cofactors
- for(int i = 0; i < size; ++i)
- {
- for(int j = 0; j < size; ++j)
- {
- // For a 2x2 matrix, the cofactor is simply a transposed move or negate
- // For a 3x3 or 4x4 matrix, the cofactor is a transposed determinant
- emitDeterminant(result, arg, size - 1, j, i, i, j);
- }
- }
-
- // Compute 1 / determinant
- Temporary invDet(this);
- emitDeterminant(&invDet, arg, size);
- Constant one(1.0f, 1.0f, 1.0f, 1.0f);
- Instruction *div = emit(sw::Shader::OPCODE_DIV, &invDet, &one, &invDet);
- div->src[1].swizzle = 0x00; // xxxx
-
- // Divide transposed matrix of cofactors by determinant
- for(int i = 0; i < size; ++i)
- {
- emit(sw::Shader::OPCODE_MUL, result, i, result, i, &invDet);
- }
- }
- break;
- default: UNREACHABLE(node->getOp());
- }
-
- return true;
- }
-
- bool OutputASM::visitAggregate(Visit visit, TIntermAggregate *node)
- {
- if(currentScope != emitScope && node->getOp() != EOpFunction && node->getOp() != EOpSequence)
- {
- return false;
- }
-
- Constant zero(0.0f, 0.0f, 0.0f, 0.0f);
-
- TIntermTyped *result = node;
- const TType &resultType = node->getType();
- TIntermSequence &arg = node->getSequence();
- int argumentCount = static_cast<int>(arg.size());
-
- switch(node->getOp())
- {
- case EOpSequence: break;
- case EOpDeclaration: break;
- case EOpInvariantDeclaration: break;
- case EOpPrototype: break;
- case EOpComma:
- if(visit == PostVisit)
- {
- copy(result, arg[1]);
- }
- break;
- case EOpFunction:
- if(visit == PreVisit)
- {
- const TString &name = node->getName();
-
- if(emitScope == FUNCTION)
- {
- if(functionArray.size() > 1) // No need for a label when there's only main()
- {
- Instruction *label = emit(sw::Shader::OPCODE_LABEL);
- label->dst.type = sw::Shader::PARAMETER_LABEL;
-
- const Function *function = findFunction(name);
- ASSERT(function); // Should have been added during global pass
- label->dst.index = function->label;
- currentFunction = function->label;
- }
- }
- else if(emitScope == GLOBAL)
- {
- if(name != "main(")
- {
- TIntermSequence &arguments = node->getSequence()[0]->getAsAggregate()->getSequence();
- functionArray.push_back(Function(functionArray.size(), name, &arguments, node));
- }
- }
- else UNREACHABLE(emitScope);
-
- currentScope = FUNCTION;
- }
- else if(visit == PostVisit)
- {
- if(emitScope == FUNCTION)
- {
- if(functionArray.size() > 1) // No need to return when there's only main()
- {
- emit(sw::Shader::OPCODE_RET);
- }
- }
-
- currentScope = GLOBAL;
- }
- break;
- case EOpFunctionCall:
- if(visit == PostVisit)
- {
- if(node->isUserDefined())
- {
- const TString &name = node->getName();
- const Function *function = findFunction(name);
-
- if(!function)
- {
- mContext.error(node->getLine(), "function definition not found", name.c_str());
- return false;
- }
-
- TIntermSequence &arguments = *function->arg;
-
- for(int i = 0; i < argumentCount; i++)
- {
- TIntermTyped *in = arguments[i]->getAsTyped();
-
- if(in->getQualifier() == EvqIn ||
- in->getQualifier() == EvqInOut ||
- in->getQualifier() == EvqConstReadOnly)
- {
- copy(in, arg[i]);
- }
- }
-
- Instruction *call = emit(sw::Shader::OPCODE_CALL);
- call->dst.type = sw::Shader::PARAMETER_LABEL;
- call->dst.index = function->label;
-
- if(function->ret && function->ret->getType().getBasicType() != EbtVoid)
- {
- copy(result, function->ret);
- }
-
- for(int i = 0; i < argumentCount; i++)
- {
- TIntermTyped *argument = arguments[i]->getAsTyped();
- TIntermTyped *out = arg[i]->getAsTyped();
-
- if(argument->getQualifier() == EvqOut ||
- argument->getQualifier() == EvqInOut)
- {
- assignLvalue(out, argument);
- }
- }
- }
- else
- {
- const TextureFunction textureFunction(node->getName());
- TIntermTyped *s = arg[0]->getAsTyped();
- TIntermTyped *t = arg[1]->getAsTyped();
-
- Temporary coord(this);
-
- if(textureFunction.proj)
- {
- Instruction *rcp = emit(sw::Shader::OPCODE_RCPX, &coord, arg[1]);
- rcp->src[0].swizzle = 0x55 * (t->getNominalSize() - 1);
- rcp->dst.mask = 0x7;
-
- Instruction *mul = emit(sw::Shader::OPCODE_MUL, &coord, arg[1], &coord);
- mul->dst.mask = 0x7;
-
- if(IsShadowSampler(s->getBasicType()))
- {
- ASSERT(s->getBasicType() == EbtSampler2DShadow);
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, &coord, &coord);
- mov->src[0].swizzle = 0xA4;
- }
- }
- else
- {
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, &coord, arg[1]);
-
- if(IsShadowSampler(s->getBasicType()) && t->getNominalSize() == 3)
- {
- ASSERT(s->getBasicType() == EbtSampler2DShadow);
- mov->src[0].swizzle = 0xA4;
- }
- }
-
- switch(textureFunction.method)
- {
- case TextureFunction::IMPLICIT:
- if(!textureFunction.offset)
- {
- if(argumentCount == 2)
- {
- emit(sw::Shader::OPCODE_TEX, result, &coord, s);
- }
- else if(argumentCount == 3) // Bias
- {
- emit(sw::Shader::OPCODE_TEXBIAS, result, &coord, s, arg[2]);
- }
- else UNREACHABLE(argumentCount);
- }
- else // Offset
- {
- if(argumentCount == 3)
- {
- emit(sw::Shader::OPCODE_TEXOFFSET, result, &coord, s, arg[2]);
- }
- else if(argumentCount == 4) // Bias
- {
- emit(sw::Shader::OPCODE_TEXOFFSETBIAS, result, &coord, s, arg[2], arg[3]);
- }
- else UNREACHABLE(argumentCount);
- }
- break;
- case TextureFunction::LOD:
- if(!textureFunction.offset && argumentCount == 3)
- {
- emit(sw::Shader::OPCODE_TEXLOD, result, &coord, s, arg[2]);
- }
- else if(argumentCount == 4) // Offset
- {
- emit(sw::Shader::OPCODE_TEXLODOFFSET, result, &coord, s, arg[3], arg[2]);
- }
- else UNREACHABLE(argumentCount);
- break;
- case TextureFunction::FETCH:
- if(!textureFunction.offset && argumentCount == 3)
- {
- emit(sw::Shader::OPCODE_TEXELFETCH, result, &coord, s, arg[2]);
- }
- else if(argumentCount == 4) // Offset
- {
- emit(sw::Shader::OPCODE_TEXELFETCHOFFSET, result, &coord, s, arg[3], arg[2]);
- }
- else UNREACHABLE(argumentCount);
- break;
- case TextureFunction::GRAD:
- if(!textureFunction.offset && argumentCount == 4)
- {
- emit(sw::Shader::OPCODE_TEXGRAD, result, &coord, s, arg[2], arg[3]);
- }
- else if(argumentCount == 5) // Offset
- {
- emit(sw::Shader::OPCODE_TEXGRADOFFSET, result, &coord, s, arg[2], arg[3], arg[4]);
- }
- else UNREACHABLE(argumentCount);
- break;
- case TextureFunction::SIZE:
- emit(sw::Shader::OPCODE_TEXSIZE, result, arg[1], s);
- break;
- default:
- UNREACHABLE(textureFunction.method);
- }
- }
- }
- break;
- case EOpParameters:
- break;
- case EOpConstructFloat:
- case EOpConstructVec2:
- case EOpConstructVec3:
- case EOpConstructVec4:
- case EOpConstructBool:
- case EOpConstructBVec2:
- case EOpConstructBVec3:
- case EOpConstructBVec4:
- case EOpConstructInt:
- case EOpConstructIVec2:
- case EOpConstructIVec3:
- case EOpConstructIVec4:
- case EOpConstructUInt:
- case EOpConstructUVec2:
- case EOpConstructUVec3:
- case EOpConstructUVec4:
- if(visit == PostVisit)
- {
- int component = 0;
- int arrayMaxIndex = result->isArray() ? result->getArraySize() - 1 : 0;
- int arrayComponents = result->getType().getElementSize();
- for(int i = 0; i < argumentCount; i++)
- {
- TIntermTyped *argi = arg[i]->getAsTyped();
- int size = argi->getNominalSize();
- int arrayIndex = std::min(component / arrayComponents, arrayMaxIndex);
- int swizzle = component - (arrayIndex * arrayComponents);
-
- if(!argi->isMatrix())
- {
- Instruction *mov = emitCast(result, arrayIndex, argi, 0);
- mov->dst.mask = (0xF << swizzle) & 0xF;
- mov->src[0].swizzle = readSwizzle(argi, size) << (swizzle * 2);
-
- component += size;
- }
- else if(!result->isMatrix()) // Construct a non matrix from a matrix
- {
- Instruction *mov = emitCast(result, arrayIndex, argi, 0);
- mov->dst.mask = (0xF << swizzle) & 0xF;
- mov->src[0].swizzle = readSwizzle(argi, size) << (swizzle * 2);
-
- // At most one more instruction when constructing a vec3 from a mat2 or a vec4 from a mat2/mat3
- if(result->getNominalSize() > size)
- {
- Instruction *mov = emitCast(result, arrayIndex, argi, 1);
- mov->dst.mask = (0xF << (swizzle + size)) & 0xF;
- // mat2: xxxy (0x40), mat3: xxxx (0x00)
- mov->src[0].swizzle = ((size == 2) ? 0x40 : 0x00) << (swizzle * 2);
- }
-
- component += size;
- }
- else // Matrix
- {
- int column = 0;
-
- while(component < resultType.getNominalSize())
- {
- Instruction *mov = emitCast(result, arrayIndex, argi, column);
- mov->dst.mask = (0xF << swizzle) & 0xF;
- mov->src[0].swizzle = readSwizzle(argi, size) << (swizzle * 2);
-
- column++;
- component += size;
- }
- }
- }
- }
- break;
- case EOpConstructMat2:
- case EOpConstructMat2x3:
- case EOpConstructMat2x4:
- case EOpConstructMat3x2:
- case EOpConstructMat3:
- case EOpConstructMat3x4:
- case EOpConstructMat4x2:
- case EOpConstructMat4x3:
- case EOpConstructMat4:
- if(visit == PostVisit)
- {
- TIntermTyped *arg0 = arg[0]->getAsTyped();
- const int outCols = result->getNominalSize();
- const int outRows = result->getSecondarySize();
-
- if(arg0->isScalar() && arg.size() == 1) // Construct scale matrix
- {
- for(int i = 0; i < outCols; i++)
- {
- emit(sw::Shader::OPCODE_MOV, result, i, &zero);
- if (i < outRows)
- {
- // Insert the scalar value on the main diagonal.
- // For non-square matrices, Avoid emitting in
- // a column which doesn't /have/ a main diagonal
- // element, even though it would be fairly benign --
- // it's not necessarily trivial for downstream
- // passes to see that this is redundant and strip it
- // out.
- Instruction *mov = emitCast(result, i, arg0, 0);
- mov->dst.mask = 1 << i;
- ASSERT(mov->src[0].swizzle == 0x00);
- }
- }
- }
- else if(arg0->isMatrix())
- {
- int arraySize = result->isArray() ? result->getArraySize() : 1;
-
- for(int n = 0; n < arraySize; n++)
- {
- TIntermTyped *argi = arg[n]->getAsTyped();
- const int inCols = argi->getNominalSize();
- const int inRows = argi->getSecondarySize();
-
- for(int i = 0; i < outCols; i++)
- {
- if(i >= inCols || outRows > inRows)
- {
- // Initialize to identity matrix
- Constant col((i == 0 ? 1.0f : 0.0f), (i == 1 ? 1.0f : 0.0f), (i == 2 ? 1.0f : 0.0f), (i == 3 ? 1.0f : 0.0f));
- emitCast(result, i + n * outCols, &col, 0);
- }
-
- if(i < inCols)
- {
- Instruction *mov = emitCast(result, i + n * outCols, argi, i);
- mov->dst.mask = 0xF >> (4 - inRows);
- }
- }
- }
- }
- else
- {
- int column = 0;
- int row = 0;
-
- for(int i = 0; i < argumentCount; i++)
- {
- TIntermTyped *argi = arg[i]->getAsTyped();
- int size = argi->getNominalSize();
- int element = 0;
-
- while(element < size)
- {
- Instruction *mov = emitCast(result, column, argi, 0);
- mov->dst.mask = (0xF << row) & 0xF;
- mov->src[0].swizzle = (readSwizzle(argi, size) << (row * 2)) + 0x55 * element;
-
- int end = row + size - element;
- column = end >= outRows ? column + 1 : column;
- element = element + outRows - row;
- row = end >= outRows ? 0 : end;
- }
- }
- }
- }
- break;
- case EOpConstructStruct:
- if(visit == PostVisit)
- {
- int offset = 0;
- for(int i = 0; i < argumentCount; i++)
- {
- TIntermTyped *argi = arg[i]->getAsTyped();
- int size = argi->totalRegisterCount();
-
- for(int index = 0; index < size; index++)
- {
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, result, index + offset, argi, index);
- mov->dst.mask = writeMask(result, offset + index);
- }
-
- offset += size;
- }
- }
- break;
- case EOpLessThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LT, result, arg[0], arg[1]); break;
- case EOpGreaterThan: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GT, result, arg[0], arg[1]); break;
- case EOpLessThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_LE, result, arg[0], arg[1]); break;
- case EOpGreaterThanEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_GE, result, arg[0], arg[1]); break;
- case EOpVectorEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_EQ, result, arg[0], arg[1]); break;
- case EOpVectorNotEqual: if(visit == PostVisit) emitCmp(sw::Shader::CONTROL_NE, result, arg[0], arg[1]); break;
- case EOpMod: if(visit == PostVisit) emit(sw::Shader::OPCODE_MOD, result, arg[0], arg[1]); break;
- case EOpModf:
- if(visit == PostVisit)
- {
- TIntermTyped* arg1 = arg[1]->getAsTyped();
- emit(sw::Shader::OPCODE_TRUNC, arg1, arg[0]);
- assignLvalue(arg1, arg1);
- emitBinary(sw::Shader::OPCODE_SUB, result, arg[0], arg1);
- }
- break;
- case EOpPow: if(visit == PostVisit) emit(sw::Shader::OPCODE_POW, result, arg[0], arg[1]); break;
- case EOpAtan: if(visit == PostVisit) emit(sw::Shader::OPCODE_ATAN2, result, arg[0], arg[1]); break;
- case EOpMin: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MIN, result), result, arg[0], arg[1]); break;
- case EOpMax: if(visit == PostVisit) emit(getOpcode(sw::Shader::OPCODE_MAX, result), result, arg[0], arg[1]); break;
- case EOpClamp:
- if(visit == PostVisit)
- {
- emit(getOpcode(sw::Shader::OPCODE_MAX, result), result, arg[0], arg[1]);
- emit(getOpcode(sw::Shader::OPCODE_MIN, result), result, result, arg[2]);
- }
- break;
- case EOpMix:
- if(visit == PostVisit)
- {
- if(arg[2]->getAsTyped()->getBasicType() == EbtBool)
- {
- emit(sw::Shader::OPCODE_SELECT, result, arg[2], arg[1], arg[0]);
- }
- else
- {
- emit(sw::Shader::OPCODE_LRP, result, arg[2], arg[1], arg[0]);
- }
- }
- break;
- case EOpStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_STEP, result, arg[0], arg[1]); break;
- case EOpSmoothStep: if(visit == PostVisit) emit(sw::Shader::OPCODE_SMOOTH, result, arg[0], arg[1], arg[2]); break;
- case EOpDistance: if(visit == PostVisit) emit(sw::Shader::OPCODE_DIST(dim(arg[0])), result, arg[0], arg[1]); break;
- case EOpDot: if(visit == PostVisit) emit(sw::Shader::OPCODE_DP(dim(arg[0])), result, arg[0], arg[1]); break;
- case EOpCross: if(visit == PostVisit) emit(sw::Shader::OPCODE_CRS, result, arg[0], arg[1]); break;
- case EOpFaceForward: if(visit == PostVisit) emit(sw::Shader::OPCODE_FORWARD(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
- case EOpReflect: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFLECT(dim(arg[0])), result, arg[0], arg[1]); break;
- case EOpRefract: if(visit == PostVisit) emit(sw::Shader::OPCODE_REFRACT(dim(arg[0])), result, arg[0], arg[1], arg[2]); break;
- case EOpMul:
- if(visit == PostVisit)
- {
- TIntermTyped *arg0 = arg[0]->getAsTyped();
- ASSERT((arg0->getNominalSize() == arg[1]->getAsTyped()->getNominalSize()) &&
- (arg0->getSecondarySize() == arg[1]->getAsTyped()->getSecondarySize()));
-
- int size = arg0->getNominalSize();
- for(int i = 0; i < size; i++)
- {
- emit(sw::Shader::OPCODE_MUL, result, i, arg[0], i, arg[1], i);
- }
- }
- break;
- case EOpOuterProduct:
- if(visit == PostVisit)
- {
- for(int i = 0; i < dim(arg[1]); i++)
- {
- Instruction *mul = emit(sw::Shader::OPCODE_MUL, result, i, arg[0], 0, arg[1]);
- mul->src[1].swizzle = 0x55 * i;
- }
- }
- break;
- default: UNREACHABLE(node->getOp());
- }
-
- return true;
- }
-
- bool OutputASM::visitSelection(Visit visit, TIntermSelection *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- TIntermTyped *condition = node->getCondition();
- TIntermNode *trueBlock = node->getTrueBlock();
- TIntermNode *falseBlock = node->getFalseBlock();
- TIntermConstantUnion *constantCondition = condition->getAsConstantUnion();
-
- condition->traverse(this);
-
- if(node->usesTernaryOperator())
- {
- if(constantCondition)
- {
- bool trueCondition = constantCondition->getUnionArrayPointer()->getBConst();
-
- if(trueCondition)
- {
- trueBlock->traverse(this);
- copy(node, trueBlock);
- }
- else
- {
- falseBlock->traverse(this);
- copy(node, falseBlock);
- }
- }
- else if(trivial(node, 6)) // Fast to compute both potential results and no side effects
- {
- trueBlock->traverse(this);
- falseBlock->traverse(this);
- emit(sw::Shader::OPCODE_SELECT, node, condition, trueBlock, falseBlock);
- }
- else
- {
- emit(sw::Shader::OPCODE_IF, 0, condition);
-
- if(trueBlock)
- {
- trueBlock->traverse(this);
- copy(node, trueBlock);
- }
-
- if(falseBlock)
- {
- emit(sw::Shader::OPCODE_ELSE);
- falseBlock->traverse(this);
- copy(node, falseBlock);
- }
-
- emit(sw::Shader::OPCODE_ENDIF);
- }
- }
- else // if/else statement
- {
- if(constantCondition)
- {
- bool trueCondition = constantCondition->getUnionArrayPointer()->getBConst();
-
- if(trueCondition)
- {
- if(trueBlock)
- {
- trueBlock->traverse(this);
- }
- }
- else
- {
- if(falseBlock)
- {
- falseBlock->traverse(this);
- }
- }
- }
- else
- {
- emit(sw::Shader::OPCODE_IF, 0, condition);
-
- if(trueBlock)
- {
- trueBlock->traverse(this);
- }
-
- if(falseBlock)
- {
- emit(sw::Shader::OPCODE_ELSE);
- falseBlock->traverse(this);
- }
-
- emit(sw::Shader::OPCODE_ENDIF);
- }
- }
-
- return false;
- }
-
- bool OutputASM::visitLoop(Visit visit, TIntermLoop *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- LoopInfo loop(node);
-
- if(loop.iterations == 0)
- {
- return false;
- }
-
- bool unroll = (loop.iterations <= 4);
-
- TIntermNode *init = node->getInit();
- TIntermTyped *condition = node->getCondition();
- TIntermTyped *expression = node->getExpression();
- TIntermNode *body = node->getBody();
- Constant True(true);
-
- if(loop.isDeterministic())
- {
- deterministicVariables.insert(loop.index->getId());
-
- if(!unroll)
- {
- emit(sw::Shader::OPCODE_SCALAR); // Unrolled loops don't have an ENDWHILE to disable scalar mode.
- }
- }
-
- if(node->getType() == ELoopDoWhile)
- {
- Temporary iterate(this);
- emit(sw::Shader::OPCODE_MOV, &iterate, &True);
-
- emit(sw::Shader::OPCODE_WHILE, 0, &iterate); // FIXME: Implement real do-while
-
- if(body)
- {
- body->traverse(this);
- }
-
- emit(sw::Shader::OPCODE_TEST);
-
- condition->traverse(this);
- emit(sw::Shader::OPCODE_MOV, &iterate, condition);
-
- emit(sw::Shader::OPCODE_ENDWHILE);
- }
- else
- {
- if(init)
- {
- init->traverse(this);
- }
-
- if(unroll)
- {
- mContext.info(node->getLine(), "loop unrolled", "for");
-
- for(unsigned int i = 0; i < loop.iterations; i++)
- {
- // condition->traverse(this); // Condition could contain statements, but not in an unrollable loop
-
- if(body)
- {
- body->traverse(this);
- }
-
- if(expression)
- {
- expression->traverse(this);
- }
- }
- }
- else
- {
- if(condition)
- {
- condition->traverse(this);
- }
- else
- {
- condition = &True;
- }
-
- emit(sw::Shader::OPCODE_WHILE, 0, condition);
-
- if(body)
- {
- body->traverse(this);
- }
-
- emit(sw::Shader::OPCODE_TEST);
-
- if(loop.isDeterministic())
- {
- emit(sw::Shader::OPCODE_SCALAR);
- }
-
- if(expression)
- {
- expression->traverse(this);
- }
-
- if(condition)
- {
- condition->traverse(this);
- }
-
- emit(sw::Shader::OPCODE_ENDWHILE);
- }
- }
-
- if(loop.isDeterministic())
- {
- deterministicVariables.erase(loop.index->getId());
- }
-
- return false;
- }
-
- bool OutputASM::visitBranch(Visit visit, TIntermBranch *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- switch(node->getFlowOp())
- {
- case EOpKill: if(visit == PostVisit) emit(sw::Shader::OPCODE_DISCARD); break;
- case EOpBreak: if(visit == PostVisit) emit(sw::Shader::OPCODE_BREAK); break;
- case EOpContinue: if(visit == PostVisit) emit(sw::Shader::OPCODE_CONTINUE); break;
- case EOpReturn:
- if(visit == PostVisit)
- {
- TIntermTyped *value = node->getExpression();
-
- if(value)
- {
- copy(functionArray[currentFunction].ret, value);
- }
-
- emit(sw::Shader::OPCODE_LEAVE);
- }
- break;
- default: UNREACHABLE(node->getFlowOp());
- }
-
- return true;
- }
-
- bool OutputASM::visitSwitch(Visit visit, TIntermSwitch *node)
- {
- if(currentScope != emitScope)
- {
- return false;
- }
-
- TIntermTyped* switchValue = node->getInit();
- TIntermAggregate* opList = node->getStatementList();
-
- if(!switchValue || !opList)
- {
- return false;
- }
-
- switchValue->traverse(this);
-
- emit(sw::Shader::OPCODE_SWITCH);
-
- TIntermSequence& sequence = opList->getSequence();
- TIntermSequence::iterator it = sequence.begin();
- TIntermSequence::iterator defaultIt = sequence.end();
- int nbCases = 0;
- for(; it != sequence.end(); ++it)
- {
- TIntermCase* currentCase = (*it)->getAsCaseNode();
- if(currentCase)
- {
- TIntermSequence::iterator caseIt = it;
-
- TIntermTyped* condition = currentCase->getCondition();
- if(condition) // non default case
- {
- if(nbCases != 0)
- {
- emit(sw::Shader::OPCODE_ELSE);
- }
-
- condition->traverse(this);
- Temporary result(this);
- emitBinary(sw::Shader::OPCODE_EQ, &result, switchValue, condition);
- emit(sw::Shader::OPCODE_IF, 0, &result);
- nbCases++;
-
- // Emit the code for this case and all subsequent cases until we hit a break statement.
- // TODO: This can repeat a lot of code for switches with many fall-through cases.
- for(++caseIt; caseIt != sequence.end(); ++caseIt)
- {
- (*caseIt)->traverse(this);
-
- // Stop if we encounter an unconditional branch (break, continue, return, or kill).
- // TODO: This doesn't work if the statement is at a deeper scope level (e.g. {break;}).
- // Note that this eliminates useless operations but shouldn't affect correctness.
- if((*caseIt)->getAsBranchNode())
- {
- break;
- }
- }
- }
- else
- {
- defaultIt = it; // The default case might not be the last case, keep it for last
- }
- }
- }
-
- // If there's a default case, traverse it here
- if(defaultIt != sequence.end())
- {
- if(nbCases != 0)
- {
- emit(sw::Shader::OPCODE_ELSE);
- }
-
- for(++defaultIt; defaultIt != sequence.end(); ++defaultIt)
- {
- (*defaultIt)->traverse(this);
- if((*defaultIt)->getAsBranchNode()) // Kill, Break, Continue or Return
- {
- break;
- }
- }
- }
-
- for(int i = 0; i < nbCases; ++i)
- {
- emit(sw::Shader::OPCODE_ENDIF);
- }
-
- emit(sw::Shader::OPCODE_ENDSWITCH);
-
- return false;
- }
-
- Instruction *OutputASM::emit(sw::Shader::Opcode op, TIntermTyped *dst, TIntermNode *src0, TIntermNode *src1, TIntermNode *src2, TIntermNode *src3, TIntermNode *src4)
- {
- return emit(op, dst, 0, src0, 0, src1, 0, src2, 0, src3, 0, src4, 0);
- }
-
- Instruction *OutputASM::emit(sw::Shader::Opcode op, TIntermTyped *dst, int dstIndex, TIntermNode *src0, int index0, TIntermNode *src1, int index1,
- TIntermNode *src2, int index2, TIntermNode *src3, int index3, TIntermNode *src4, int index4)
- {
- Instruction *instruction = new Instruction(op);
-
- if(dst)
- {
- destination(instruction->dst, dst, dstIndex);
- }
-
- if(src0)
- {
- TIntermTyped* src = src0->getAsTyped();
- instruction->dst.partialPrecision = src && (src->getPrecision() <= EbpLow);
- }
-
- source(instruction->src[0], src0, index0);
- source(instruction->src[1], src1, index1);
- source(instruction->src[2], src2, index2);
- source(instruction->src[3], src3, index3);
- source(instruction->src[4], src4, index4);
-
- shader->append(instruction);
-
- return instruction;
- }
-
- Instruction *OutputASM::emitCast(TIntermTyped *dst, TIntermTyped *src)
- {
- return emitCast(dst, 0, src, 0);
- }
-
- Instruction *OutputASM::emitCast(TIntermTyped *dst, int dstIndex, TIntermTyped *src, int srcIndex)
- {
- switch(src->getBasicType())
- {
- case EbtBool:
- switch(dst->getBasicType())
- {
- case EbtInt: return emit(sw::Shader::OPCODE_B2I, dst, dstIndex, src, srcIndex);
- case EbtUInt: return emit(sw::Shader::OPCODE_B2I, dst, dstIndex, src, srcIndex);
- case EbtFloat: return emit(sw::Shader::OPCODE_B2F, dst, dstIndex, src, srcIndex);
- default: break;
- }
- break;
- case EbtInt:
- switch(dst->getBasicType())
- {
- case EbtBool: return emit(sw::Shader::OPCODE_I2B, dst, dstIndex, src, srcIndex);
- case EbtFloat: return emit(sw::Shader::OPCODE_I2F, dst, dstIndex, src, srcIndex);
- default: break;
- }
- break;
- case EbtUInt:
- switch(dst->getBasicType())
- {
- case EbtBool: return emit(sw::Shader::OPCODE_I2B, dst, dstIndex, src, srcIndex);
- case EbtFloat: return emit(sw::Shader::OPCODE_U2F, dst, dstIndex, src, srcIndex);
- default: break;
- }
- break;
- case EbtFloat:
- switch(dst->getBasicType())
- {
- case EbtBool: return emit(sw::Shader::OPCODE_F2B, dst, dstIndex, src, srcIndex);
- case EbtInt: return emit(sw::Shader::OPCODE_F2I, dst, dstIndex, src, srcIndex);
- case EbtUInt: return emit(sw::Shader::OPCODE_F2U, dst, dstIndex, src, srcIndex);
- default: break;
- }
- break;
- default:
- break;
- }
-
- ASSERT((src->getBasicType() == dst->getBasicType()) ||
- ((src->getBasicType() == EbtInt) && (dst->getBasicType() == EbtUInt)) ||
- ((src->getBasicType() == EbtUInt) && (dst->getBasicType() == EbtInt)));
-
- return emit(sw::Shader::OPCODE_MOV, dst, dstIndex, src, srcIndex);
- }
-
- void OutputASM::emitBinary(sw::Shader::Opcode op, TIntermTyped *dst, TIntermNode *src0, TIntermNode *src1, TIntermNode *src2)
- {
- for(int index = 0; index < dst->elementRegisterCount(); index++)
- {
- emit(op, dst, index, src0, index, src1, index, src2, index);
- }
- }
-
- void OutputASM::emitAssign(sw::Shader::Opcode op, TIntermTyped *result, TIntermTyped *lhs, TIntermTyped *src0, TIntermTyped *src1)
- {
- emitBinary(op, result, src0, src1);
- assignLvalue(lhs, result);
- }
-
- void OutputASM::emitCmp(sw::Shader::Control cmpOp, TIntermTyped *dst, TIntermNode *left, TIntermNode *right, int index)
- {
- sw::Shader::Opcode opcode;
- switch(left->getAsTyped()->getBasicType())
- {
- case EbtBool:
- case EbtInt:
- opcode = sw::Shader::OPCODE_ICMP;
- break;
- case EbtUInt:
- opcode = sw::Shader::OPCODE_UCMP;
- break;
- default:
- opcode = sw::Shader::OPCODE_CMP;
- break;
- }
-
- Instruction *cmp = emit(opcode, dst, 0, left, index, right, index);
- cmp->control = cmpOp;
- }
-
- int componentCount(const TType &type, int registers)
- {
- if(registers == 0)
- {
- return 0;
- }
-
- if(type.isArray() && registers >= type.elementRegisterCount())
- {
- int index = registers / type.elementRegisterCount();
- registers -= index * type.elementRegisterCount();
- return index * type.getElementSize() + componentCount(type, registers);
- }
-
- if(type.isStruct() || type.isInterfaceBlock())
- {
- const TFieldList& fields = type.getStruct() ? type.getStruct()->fields() : type.getInterfaceBlock()->fields();
- int elements = 0;
-
- for(const auto &field : fields)
- {
- const TType &fieldType = *(field->type());
-
- if(fieldType.totalRegisterCount() <= registers)
- {
- registers -= fieldType.totalRegisterCount();
- elements += fieldType.getObjectSize();
- }
- else // Register within this field
- {
- return elements + componentCount(fieldType, registers);
- }
- }
- }
- else if(type.isMatrix())
- {
- return registers * type.registerSize();
- }
-
- UNREACHABLE(0);
- return 0;
- }
-
- int registerSize(const TType &type, int registers)
- {
- if(registers == 0)
- {
- if(type.isStruct())
- {
- return registerSize(*((*(type.getStruct()->fields().begin()))->type()), 0);
- }
- else if(type.isInterfaceBlock())
- {
- return registerSize(*((*(type.getInterfaceBlock()->fields().begin()))->type()), 0);
- }
-
- return type.registerSize();
- }
-
- if(type.isArray() && registers >= type.elementRegisterCount())
- {
- int index = registers / type.elementRegisterCount();
- registers -= index * type.elementRegisterCount();
- return registerSize(type, registers);
- }
-
- if(type.isStruct() || type.isInterfaceBlock())
- {
- const TFieldList& fields = type.getStruct() ? type.getStruct()->fields() : type.getInterfaceBlock()->fields();
-
- for(const auto &field : fields)
- {
- const TType &fieldType = *(field->type());
-
- if(fieldType.totalRegisterCount() <= registers)
- {
- registers -= fieldType.totalRegisterCount();
- }
- else // Register within this field
- {
- return registerSize(fieldType, registers);
- }
- }
- }
- else if(type.isMatrix())
- {
- return registerSize(type, 0);
- }
-
- UNREACHABLE(0);
- return 0;
- }
-
- int OutputASM::getBlockId(TIntermTyped *arg)
- {
- if(arg)
- {
- const TType &type = arg->getType();
- TInterfaceBlock* block = type.getInterfaceBlock();
- if(block && (type.getQualifier() == EvqUniform))
- {
- // Make sure the uniform block is declared
- uniformRegister(arg);
-
- const char* blockName = block->name().c_str();
-
- // Fetch uniform block index from array of blocks
- for(ActiveUniformBlocks::const_iterator it = shaderObject->activeUniformBlocks.begin(); it != shaderObject->activeUniformBlocks.end(); ++it)
- {
- if(blockName == it->name)
- {
- return it->blockId;
- }
- }
-
- ASSERT(false);
- }
- }
-
- return -1;
- }
-
- OutputASM::ArgumentInfo OutputASM::getArgumentInfo(TIntermTyped *arg, int index)
- {
- const TType &type = arg->getType();
- int blockId = getBlockId(arg);
- ArgumentInfo argumentInfo(BlockMemberInfo::getDefaultBlockInfo(), type, -1, -1);
- if(blockId != -1)
- {
- argumentInfo.bufferIndex = 0;
- for(int i = 0; i < blockId; ++i)
- {
- int blockArraySize = shaderObject->activeUniformBlocks[i].arraySize;
- argumentInfo.bufferIndex += blockArraySize > 0 ? blockArraySize : 1;
- }
-
- const BlockDefinitionIndexMap& blockDefinition = blockDefinitions[blockId];
-
- BlockDefinitionIndexMap::const_iterator itEnd = blockDefinition.end();
- BlockDefinitionIndexMap::const_iterator it = itEnd;
-
- argumentInfo.clampedIndex = index;
- if(type.isInterfaceBlock())
- {
- // Offset index to the beginning of the selected instance
- int blockRegisters = type.elementRegisterCount();
- int bufferOffset = argumentInfo.clampedIndex / blockRegisters;
- argumentInfo.bufferIndex += bufferOffset;
- argumentInfo.clampedIndex -= bufferOffset * blockRegisters;
- }
-
- int regIndex = registerIndex(arg);
- for(int i = regIndex + argumentInfo.clampedIndex; i >= regIndex; --i)
- {
- it = blockDefinition.find(i);
- if(it != itEnd)
- {
- argumentInfo.clampedIndex -= (i - regIndex);
- break;
- }
- }
- ASSERT(it != itEnd);
-
- argumentInfo.typedMemberInfo = it->second;
-
- int registerCount = argumentInfo.typedMemberInfo.type.totalRegisterCount();
- argumentInfo.clampedIndex = (argumentInfo.clampedIndex >= registerCount) ? registerCount - 1 : argumentInfo.clampedIndex;
- }
- else
- {
- argumentInfo.clampedIndex = (index >= arg->totalRegisterCount()) ? arg->totalRegisterCount() - 1 : index;
- }
-
- return argumentInfo;
- }
-
- void OutputASM::source(sw::Shader::SourceParameter &parameter, TIntermNode *argument, int index)
- {
- if(argument)
- {
- TIntermTyped *arg = argument->getAsTyped();
- Temporary unpackedUniform(this);
-
- const TType& srcType = arg->getType();
- TInterfaceBlock* srcBlock = srcType.getInterfaceBlock();
- if(srcBlock && (srcType.getQualifier() == EvqUniform))
- {
- const ArgumentInfo argumentInfo = getArgumentInfo(arg, index);
- const TType &memberType = argumentInfo.typedMemberInfo.type;
-
- if(memberType.getBasicType() == EbtBool)
- {
- ASSERT(argumentInfo.clampedIndex < (memberType.isArray() ? memberType.getArraySize() : 1)); // index < arraySize
-
- // Convert the packed bool, which is currently an int, to a true bool
- Instruction *instruction = new Instruction(sw::Shader::OPCODE_I2B);
- instruction->dst.type = sw::Shader::PARAMETER_TEMP;
- instruction->dst.index = registerIndex(&unpackedUniform);
- instruction->src[0].type = sw::Shader::PARAMETER_CONST;
- instruction->src[0].bufferIndex = argumentInfo.bufferIndex;
- instruction->src[0].index = argumentInfo.typedMemberInfo.offset + argumentInfo.clampedIndex * argumentInfo.typedMemberInfo.arrayStride;
-
- shader->append(instruction);
-
- arg = &unpackedUniform;
- index = 0;
- }
- else if((memberType.getLayoutQualifier().matrixPacking == EmpRowMajor) && memberType.isMatrix())
- {
- int numCols = memberType.getNominalSize();
- int numRows = memberType.getSecondarySize();
-
- ASSERT(argumentInfo.clampedIndex < (numCols * (memberType.isArray() ? memberType.getArraySize() : 1))); // index < cols * arraySize
-
- unsigned int dstIndex = registerIndex(&unpackedUniform);
- unsigned int srcSwizzle = (argumentInfo.clampedIndex % numCols) * 0x55;
- int arrayIndex = argumentInfo.clampedIndex / numCols;
- int matrixStartOffset = argumentInfo.typedMemberInfo.offset + arrayIndex * argumentInfo.typedMemberInfo.arrayStride;
-
- for(int j = 0; j < numRows; ++j)
- {
- // Transpose the row major matrix
- Instruction *instruction = new Instruction(sw::Shader::OPCODE_MOV);
- instruction->dst.type = sw::Shader::PARAMETER_TEMP;
- instruction->dst.index = dstIndex;
- instruction->dst.mask = 1 << j;
- instruction->src[0].type = sw::Shader::PARAMETER_CONST;
- instruction->src[0].bufferIndex = argumentInfo.bufferIndex;
- instruction->src[0].index = matrixStartOffset + j * argumentInfo.typedMemberInfo.matrixStride;
- instruction->src[0].swizzle = srcSwizzle;
-
- shader->append(instruction);
- }
-
- arg = &unpackedUniform;
- index = 0;
- }
- }
-
- const ArgumentInfo argumentInfo = getArgumentInfo(arg, index);
- const TType &type = argumentInfo.typedMemberInfo.type;
-
- int size = registerSize(type, argumentInfo.clampedIndex);
-
- parameter.type = registerType(arg);
- parameter.bufferIndex = argumentInfo.bufferIndex;
-
- if(arg->getAsConstantUnion() && arg->getAsConstantUnion()->getUnionArrayPointer())
- {
- int component = componentCount(type, argumentInfo.clampedIndex);
- ConstantUnion *constants = arg->getAsConstantUnion()->getUnionArrayPointer();
-
- for(int i = 0; i < 4; i++)
- {
- if(size == 1) // Replicate
- {
- parameter.value[i] = constants[component + 0].getAsFloat();
- }
- else if(i < size)
- {
- parameter.value[i] = constants[component + i].getAsFloat();
- }
- else
- {
- parameter.value[i] = 0.0f;
- }
- }
- }
- else
- {
- parameter.index = registerIndex(arg) + argumentInfo.clampedIndex;
-
- if(parameter.bufferIndex != -1)
- {
- int stride = (argumentInfo.typedMemberInfo.matrixStride > 0) ? argumentInfo.typedMemberInfo.matrixStride : argumentInfo.typedMemberInfo.arrayStride;
- parameter.index = argumentInfo.typedMemberInfo.offset + argumentInfo.clampedIndex * stride;
- }
-
- if(parameter.index >= sw::NUM_TEMPORARY_REGISTERS)
- {
- mContext.error(arg->getLine(),
- "Too many temporary registers required to compile shader",
- pixelShader ? "pixel shader" : "vertex shader");
- }
- }
-
- if(!IsSampler(arg->getBasicType()))
- {
- parameter.swizzle = readSwizzle(arg, size);
- }
- }
- }
-
- void OutputASM::destination(sw::Shader::DestinationParameter &parameter, TIntermTyped *arg, int index)
- {
- parameter.type = registerType(arg);
- parameter.index = registerIndex(arg) + index;
- parameter.mask = writeMask(arg, index);
-
- if(parameter.index >= sw::NUM_TEMPORARY_REGISTERS)
- {
- mContext.error(arg->getLine(),
- "Too many temporary registers required to compile shader",
- pixelShader ? "pixel shader" : "vertex shader");
- }
-
- }
-
- void OutputASM::copy(TIntermTyped *dst, TIntermNode *src, int offset)
- {
- for(int index = 0; index < dst->totalRegisterCount(); index++)
- {
- emit(sw::Shader::OPCODE_MOV, dst, index, src, offset + index);
- }
- }
-
- int swizzleElement(int swizzle, int index)
- {
- return (swizzle >> (index * 2)) & 0x03;
- }
-
- int swizzleSwizzle(int leftSwizzle, int rightSwizzle)
- {
- return (swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 0)) << 0) |
- (swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 1)) << 2) |
- (swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 2)) << 4) |
- (swizzleElement(leftSwizzle, swizzleElement(rightSwizzle, 3)) << 6);
- }
-
- void OutputASM::assignLvalue(TIntermTyped *dst, TIntermTyped *src)
- {
- if((src->isVector() && (!dst->isVector() || (src->getNominalSize() != dst->getNominalSize()))) ||
- (src->isMatrix() && (!dst->isMatrix() || (src->getNominalSize() != dst->getNominalSize()) || (src->getSecondarySize() != dst->getSecondarySize()))))
- {
- return mContext.error(src->getLine(), "Result type should match the l-value type in compound assignment", src->isVector() ? "vector" : "matrix");
- }
-
- TIntermBinary *binary = dst->getAsBinaryNode();
-
- if(binary && binary->getOp() == EOpIndexIndirect && binary->getLeft()->isVector() && dst->isScalar())
- {
- Instruction *insert = new Instruction(sw::Shader::OPCODE_INSERT);
-
- lvalue(insert->dst, dst);
-
- insert->src[0].type = insert->dst.type;
- insert->src[0].index = insert->dst.index;
- insert->src[0].rel = insert->dst.rel;
- source(insert->src[1], src);
- source(insert->src[2], binary->getRight());
-
- shader->append(insert);
- }
- else
- {
- Instruction *mov1 = new Instruction(sw::Shader::OPCODE_MOV);
-
- int swizzle = lvalue(mov1->dst, dst);
-
- source(mov1->src[0], src);
- mov1->src[0].swizzle = swizzleSwizzle(mov1->src[0].swizzle, swizzle);
-
- shader->append(mov1);
-
- for(int offset = 1; offset < dst->totalRegisterCount(); offset++)
- {
- Instruction *mov = new Instruction(sw::Shader::OPCODE_MOV);
-
- mov->dst = mov1->dst;
- mov->dst.index += offset;
- mov->dst.mask = writeMask(dst, offset);
-
- source(mov->src[0], src, offset);
-
- shader->append(mov);
- }
- }
- }
-
- void OutputASM::evaluateRvalue(TIntermTyped *node)
- {
- TIntermBinary *binary = node->getAsBinaryNode();
-
- if(binary && binary->getOp() == EOpIndexIndirect && binary->getLeft()->isVector() && node->isScalar())
- {
- Instruction *insert = new Instruction(sw::Shader::OPCODE_EXTRACT);
-
- destination(insert->dst, node);
-
- Temporary address(this);
- unsigned char mask;
- TIntermTyped *root = nullptr;
- unsigned int offset = 0;
- int swizzle = lvalue(root, offset, insert->src[0].rel, mask, address, node);
-
- source(insert->src[0], root, offset);
- insert->src[0].swizzle = swizzleSwizzle(insert->src[0].swizzle, swizzle);
-
- source(insert->src[1], binary->getRight());
-
- shader->append(insert);
- }
- else
- {
- Instruction *mov1 = new Instruction(sw::Shader::OPCODE_MOV);
-
- destination(mov1->dst, node, 0);
-
- Temporary address(this);
- unsigned char mask;
- TIntermTyped *root = nullptr;
- unsigned int offset = 0;
- int swizzle = lvalue(root, offset, mov1->src[0].rel, mask, address, node);
-
- source(mov1->src[0], root, offset);
- mov1->src[0].swizzle = swizzleSwizzle(mov1->src[0].swizzle, swizzle);
-
- shader->append(mov1);
-
- for(int i = 1; i < node->totalRegisterCount(); i++)
- {
- Instruction *mov = emit(sw::Shader::OPCODE_MOV, node, i, root, offset + i);
- mov->src[0].rel = mov1->src[0].rel;
- }
- }
- }
-
- int OutputASM::lvalue(sw::Shader::DestinationParameter &dst, TIntermTyped *node)
- {
- Temporary address(this);
- TIntermTyped *root = nullptr;
- unsigned int offset = 0;
- unsigned char mask = 0xF;
- int swizzle = lvalue(root, offset, dst.rel, mask, address, node);
-
- dst.type = registerType(root);
- dst.index = registerIndex(root) + offset;
- dst.mask = mask;
-
- return swizzle;
- }
-
- int OutputASM::lvalue(TIntermTyped *&root, unsigned int &offset, sw::Shader::Relative &rel, unsigned char &mask, Temporary &address, TIntermTyped *node)
- {
- TIntermTyped *result = node;
- TIntermBinary *binary = node->getAsBinaryNode();
- TIntermSymbol *symbol = node->getAsSymbolNode();
-
- if(binary)
- {
- TIntermTyped *left = binary->getLeft();
- TIntermTyped *right = binary->getRight();
-
- int leftSwizzle = lvalue(root, offset, rel, mask, address, left); // Resolve the l-value of the left side
-
- switch(binary->getOp())
- {
- case EOpIndexDirect:
- {
- int rightIndex = right->getAsConstantUnion()->getIConst(0);
-
- if(left->isRegister())
- {
- int leftMask = mask;
-
- mask = 1;
- while((leftMask & mask) == 0)
- {
- mask = mask << 1;
- }
-
- int element = swizzleElement(leftSwizzle, rightIndex);
- mask = 1 << element;
-
- return element;
- }
- else if(left->isArray() || left->isMatrix())
- {
- offset += rightIndex * result->totalRegisterCount();
- return 0xE4;
- }
- else UNREACHABLE(0);
- }
- break;
- case EOpIndexIndirect:
- {
- right->traverse(this);
-
- if(left->isRegister())
- {
- // Requires INSERT instruction (handled by calling function)
- }
- else if(left->isArray() || left->isMatrix())
- {
- int scale = result->totalRegisterCount();
-
- if(rel.type == sw::Shader::PARAMETER_VOID) // Use the index register as the relative address directly
- {
- if(left->totalRegisterCount() > 1)
- {
- sw::Shader::SourceParameter relativeRegister;
- source(relativeRegister, right);
-
- int indexId = right->getAsSymbolNode() ? right->getAsSymbolNode()->getId() : 0;
-
- rel.index = relativeRegister.index;
- rel.type = relativeRegister.type;
- rel.scale = scale;
- rel.dynamic = (right->getQualifier() != EvqUniform) && (deterministicVariables.count(indexId) == 0);
- }
- }
- else if(rel.index != registerIndex(&address)) // Move the previous index register to the address register
- {
- if(scale == 1)
- {
- Constant oldScale((int)rel.scale);
- Instruction *mad = emit(sw::Shader::OPCODE_IMAD, &address, &address, &oldScale, right);
- mad->src[0].index = rel.index;
- mad->src[0].type = rel.type;
- }
- else
- {
- Constant oldScale((int)rel.scale);
- Instruction *mul = emit(sw::Shader::OPCODE_IMUL, &address, &address, &oldScale);
- mul->src[0].index = rel.index;
- mul->src[0].type = rel.type;
-
- Constant newScale(scale);
- emit(sw::Shader::OPCODE_IMAD, &address, right, &newScale, &address);
- }
-
- rel.type = sw::Shader::PARAMETER_TEMP;
- rel.index = registerIndex(&address);
- rel.scale = 1;
- }
- else // Just add the new index to the address register
- {
- if(scale == 1)
- {
- emit(sw::Shader::OPCODE_IADD, &address, &address, right);
- }
- else
- {
- Constant newScale(scale);
- emit(sw::Shader::OPCODE_IMAD, &address, right, &newScale, &address);
- }
- }
- }
- else UNREACHABLE(0);
- }
- break;
- case EOpIndexDirectStruct:
- case EOpIndexDirectInterfaceBlock:
- {
- const TFieldList& fields = (binary->getOp() == EOpIndexDirectStruct) ?
- left->getType().getStruct()->fields() :
- left->getType().getInterfaceBlock()->fields();
- int index = right->getAsConstantUnion()->getIConst(0);
- int fieldOffset = 0;
-
- for(int i = 0; i < index; i++)
- {
- fieldOffset += fields[i]->type()->totalRegisterCount();
- }
-
- offset += fieldOffset;
- mask = writeMask(result);
-
- return 0xE4;
- }
- break;
- case EOpVectorSwizzle:
- {
- ASSERT(left->isRegister());
-
- int leftMask = mask;
-
- int swizzle = 0;
- int rightMask = 0;
-
- TIntermSequence &sequence = right->getAsAggregate()->getSequence();
-
- for(unsigned int i = 0; i < sequence.size(); i++)
- {
- int index = sequence[i]->getAsConstantUnion()->getIConst(0);
-
- int element = swizzleElement(leftSwizzle, index);
- rightMask = rightMask | (1 << element);
- swizzle = swizzle | swizzleElement(leftSwizzle, i) << (element * 2);
- }
-
- mask = leftMask & rightMask;
-
- return swizzle;
- }
- break;
- default:
- UNREACHABLE(binary->getOp()); // Not an l-value operator
- break;
- }
- }
- else if(symbol)
- {
- root = symbol;
- offset = 0;
- mask = writeMask(symbol);
-
- return 0xE4;
- }
- else
- {
- node->traverse(this);
-
- root = node;
- offset = 0;
- mask = writeMask(node);
-
- return 0xE4;
- }
-
- return 0xE4;
- }
-
- sw::Shader::ParameterType OutputASM::registerType(TIntermTyped *operand)
- {
- if(isSamplerRegister(operand))
- {
- return sw::Shader::PARAMETER_SAMPLER;
- }
-
- const TQualifier qualifier = operand->getQualifier();
- if((qualifier == EvqFragColor) || (qualifier == EvqFragData))
- {
- if(((qualifier == EvqFragData) && (outputQualifier == EvqFragColor)) ||
- ((qualifier == EvqFragColor) && (outputQualifier == EvqFragData)))
- {
- mContext.error(operand->getLine(), "static assignment to both gl_FragData and gl_FragColor", "");
- }
- outputQualifier = qualifier;
- }
-
- if(qualifier == EvqConstExpr && (!operand->getAsConstantUnion() || !operand->getAsConstantUnion()->getUnionArrayPointer()))
- {
- // Constant arrays are in the constant register file.
- if(operand->isArray() && operand->getArraySize() > 1)
- {
- return sw::Shader::PARAMETER_CONST;
- }
- else
- {
- return sw::Shader::PARAMETER_TEMP;
- }
- }
-
- switch(qualifier)
- {
- case EvqTemporary: return sw::Shader::PARAMETER_TEMP;
- case EvqGlobal: return sw::Shader::PARAMETER_TEMP;
- case EvqConstExpr: return sw::Shader::PARAMETER_FLOAT4LITERAL; // All converted to float
- case EvqAttribute: return sw::Shader::PARAMETER_INPUT;
- case EvqVaryingIn: return sw::Shader::PARAMETER_INPUT;
- case EvqVaryingOut: return sw::Shader::PARAMETER_OUTPUT;
- case EvqVertexIn: return sw::Shader::PARAMETER_INPUT;
- case EvqFragmentOut: return sw::Shader::PARAMETER_COLOROUT;
- case EvqVertexOut: return sw::Shader::PARAMETER_OUTPUT;
- case EvqFragmentIn: return sw::Shader::PARAMETER_INPUT;
- case EvqInvariantVaryingIn: return sw::Shader::PARAMETER_INPUT; // FIXME: Guarantee invariance at the backend
- case EvqInvariantVaryingOut: return sw::Shader::PARAMETER_OUTPUT; // FIXME: Guarantee invariance at the backend
- case EvqSmooth: return sw::Shader::PARAMETER_OUTPUT;
- case EvqFlat: return sw::Shader::PARAMETER_OUTPUT;
- case EvqCentroidOut: return sw::Shader::PARAMETER_OUTPUT;
- case EvqSmoothIn: return sw::Shader::PARAMETER_INPUT;
- case EvqFlatIn: return sw::Shader::PARAMETER_INPUT;
- case EvqCentroidIn: return sw::Shader::PARAMETER_INPUT;
- case EvqUniform: return sw::Shader::PARAMETER_CONST;
- case EvqIn: return sw::Shader::PARAMETER_TEMP;
- case EvqOut: return sw::Shader::PARAMETER_TEMP;
- case EvqInOut: return sw::Shader::PARAMETER_TEMP;
- case EvqConstReadOnly: return sw::Shader::PARAMETER_TEMP;
- case EvqPosition: return sw::Shader::PARAMETER_OUTPUT;
- case EvqPointSize: return sw::Shader::PARAMETER_OUTPUT;
- case EvqInstanceID: return sw::Shader::PARAMETER_MISCTYPE;
- case EvqVertexID: return sw::Shader::PARAMETER_MISCTYPE;
- case EvqFragCoord: return sw::Shader::PARAMETER_MISCTYPE;
- case EvqFrontFacing: return sw::Shader::PARAMETER_MISCTYPE;
- case EvqPointCoord: return sw::Shader::PARAMETER_INPUT;
- case EvqFragColor: return sw::Shader::PARAMETER_COLOROUT;
- case EvqFragData: return sw::Shader::PARAMETER_COLOROUT;
- case EvqFragDepth: return sw::Shader::PARAMETER_DEPTHOUT;
- default: UNREACHABLE(qualifier);
- }
-
- return sw::Shader::PARAMETER_VOID;
- }
-
- bool OutputASM::hasFlatQualifier(TIntermTyped *operand)
- {
- const TQualifier qualifier = operand->getQualifier();
- return qualifier == EvqFlat || qualifier == EvqFlatOut || qualifier == EvqFlatIn;
- }
-
- unsigned int OutputASM::registerIndex(TIntermTyped *operand)
- {
- if(isSamplerRegister(operand))
- {
- return samplerRegister(operand);
- }
- else if(operand->getType().totalSamplerRegisterCount() > 0) // Struct containing a sampler
- {
- samplerRegister(operand); // Make sure the sampler is declared
- }
-
- const TQualifier qualifier = operand->getQualifier();
- if(qualifier == EvqConstExpr && (!operand->getAsConstantUnion() || !operand->getAsConstantUnion()->getUnionArrayPointer()))
- {
- // Constant arrays are in the constant register file.
- if(operand->isArray() && operand->getArraySize() > 1)
- {
- return uniformRegister(operand);
- }
- else
- {
- return temporaryRegister(operand);
- }
- }
-
- switch(operand->getQualifier())
- {
- case EvqTemporary: return temporaryRegister(operand);
- case EvqGlobal: return temporaryRegister(operand);
- case EvqConstExpr: return temporaryRegister(operand); // Unevaluated constant expression
- case EvqAttribute: return attributeRegister(operand);
- case EvqVaryingIn: return varyingRegister(operand);
- case EvqVaryingOut: return varyingRegister(operand);
- case EvqVertexIn: return attributeRegister(operand);
- case EvqFragmentOut: return fragmentOutputRegister(operand);
- case EvqVertexOut: return varyingRegister(operand);
- case EvqFragmentIn: return varyingRegister(operand);
- case EvqInvariantVaryingIn: return varyingRegister(operand);
- case EvqInvariantVaryingOut: return varyingRegister(operand);
- case EvqSmooth: return varyingRegister(operand);
- case EvqFlat: return varyingRegister(operand);
- case EvqCentroidOut: return varyingRegister(operand);
- case EvqSmoothIn: return varyingRegister(operand);
- case EvqFlatIn: return varyingRegister(operand);
- case EvqCentroidIn: return varyingRegister(operand);
- case EvqUniform: return uniformRegister(operand);
- case EvqIn: return temporaryRegister(operand);
- case EvqOut: return temporaryRegister(operand);
- case EvqInOut: return temporaryRegister(operand);
- case EvqConstReadOnly: return temporaryRegister(operand);
- case EvqPosition: return varyingRegister(operand);
- case EvqPointSize: return varyingRegister(operand);
- case EvqInstanceID: vertexShader->declareInstanceId(); return sw::Shader::InstanceIDIndex;
- case EvqVertexID: vertexShader->declareVertexId(); return sw::Shader::VertexIDIndex;
- case EvqFragCoord: pixelShader->declareVPos(); return sw::Shader::VPosIndex;
- case EvqFrontFacing: pixelShader->declareVFace(); return sw::Shader::VFaceIndex;
- case EvqPointCoord: return varyingRegister(operand);
- case EvqFragColor: return 0;
- case EvqFragData: return fragmentOutputRegister(operand);
- case EvqFragDepth: return 0;
- default: UNREACHABLE(operand->getQualifier());
- }
-
- return 0;
- }
-
- int OutputASM::writeMask(TIntermTyped *destination, int index)
- {
- if(destination->getQualifier() == EvqPointSize)
- {
- return 0x2; // Point size stored in the y component
- }
-
- return 0xF >> (4 - registerSize(destination->getType(), index));
- }
-
- int OutputASM::readSwizzle(TIntermTyped *argument, int size)
- {
- if(argument->getQualifier() == EvqPointSize)
- {
- return 0x55; // Point size stored in the y component
- }
-
- static const unsigned char swizzleSize[5] = {0x00, 0x00, 0x54, 0xA4, 0xE4}; // (void), xxxx, xyyy, xyzz, xyzw
-
- return swizzleSize[size];
- }
-
- // Conservatively checks whether an expression is fast to compute and has no side effects
- bool OutputASM::trivial(TIntermTyped *expression, int budget)
- {
- if(!expression->isRegister())
- {
- return false;
- }
-
- return cost(expression, budget) >= 0;
- }
-
- // Returns the remaining computing budget (if < 0 the expression is too expensive or has side effects)
- int OutputASM::cost(TIntermNode *expression, int budget)
- {
- if(budget < 0)
- {
- return budget;
- }
-
- if(expression->getAsSymbolNode())
- {
- return budget;
- }
- else if(expression->getAsConstantUnion())
- {
- return budget;
- }
- else if(expression->getAsBinaryNode())
- {
- TIntermBinary *binary = expression->getAsBinaryNode();
-
- switch(binary->getOp())
- {
- case EOpVectorSwizzle:
- case EOpIndexDirect:
- case EOpIndexDirectStruct:
- case EOpIndexDirectInterfaceBlock:
- return cost(binary->getLeft(), budget - 0);
- case EOpAdd:
- case EOpSub:
- case EOpMul:
- return cost(binary->getLeft(), cost(binary->getRight(), budget - 1));
- default:
- return -1;
- }
- }
- else if(expression->getAsUnaryNode())
- {
- TIntermUnary *unary = expression->getAsUnaryNode();
-
- switch(unary->getOp())
- {
- case EOpAbs:
- case EOpNegative:
- return cost(unary->getOperand(), budget - 1);
- default:
- return -1;
- }
- }
- else if(expression->getAsSelectionNode())
- {
- TIntermSelection *selection = expression->getAsSelectionNode();
-
- if(selection->usesTernaryOperator())
- {
- TIntermTyped *condition = selection->getCondition();
- TIntermNode *trueBlock = selection->getTrueBlock();
- TIntermNode *falseBlock = selection->getFalseBlock();
- TIntermConstantUnion *constantCondition = condition->getAsConstantUnion();
-
- if(constantCondition)
- {
- bool trueCondition = constantCondition->getUnionArrayPointer()->getBConst();
-
- if(trueCondition)
- {
- return cost(trueBlock, budget - 0);
- }
- else
- {
- return cost(falseBlock, budget - 0);
- }
- }
- else
- {
- return cost(trueBlock, cost(falseBlock, budget - 2));
- }
- }
- }
-
- return -1;
- }
-
- const Function *OutputASM::findFunction(const TString &name)
- {
- for(unsigned int f = 0; f < functionArray.size(); f++)
- {
- if(functionArray[f].name == name)
- {
- return &functionArray[f];
- }
- }
-
- return 0;
- }
-
- int OutputASM::temporaryRegister(TIntermTyped *temporary)
- {
- int index = allocate(temporaries, temporary);
- if(index >= sw::NUM_TEMPORARY_REGISTERS)
- {
- mContext.error(temporary->getLine(),
- "Too many temporary registers required to compile shader",
- pixelShader ? "pixel shader" : "vertex shader");
- }
- return index;
- }
-
- void OutputASM::setPixelShaderInputs(const TType& type, int var, bool flat)
- {
- if(type.isStruct())
- {
- const TFieldList &fields = type.getStruct()->fields();
- int fieldVar = var;
- for(const auto &field : fields)
- {
- const TType& fieldType = *(field->type());
- setPixelShaderInputs(fieldType, fieldVar, flat);
- fieldVar += fieldType.totalRegisterCount();
- }
- }
- else
- {
- for(int i = 0; i < type.totalRegisterCount(); i++)
- {
- pixelShader->setInput(var + i, type.registerSize(), sw::Shader::Semantic(sw::Shader::USAGE_COLOR, var + i, flat));
- }
- }
- }
-
- int OutputASM::varyingRegister(TIntermTyped *varying)
- {
- int var = lookup(varyings, varying);
-
- if(var == -1)
- {
- var = allocate(varyings, varying);
- if (var == -1)
- {
- return 0;
- }
- int registerCount = varying->totalRegisterCount();
-
- if(pixelShader)
- {
- if((var + registerCount) > sw::MAX_FRAGMENT_INPUTS)
- {
- mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "fragment shader");
- return 0;
- }
-
- if(varying->getQualifier() == EvqPointCoord)
- {
- ASSERT(varying->isRegister());
- pixelShader->setInput(var, varying->registerSize(), sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, var));
- }
- else
- {
- setPixelShaderInputs(varying->getType(), var, hasFlatQualifier(varying));
- }
- }
- else if(vertexShader)
- {
- if((var + registerCount) > sw::MAX_VERTEX_OUTPUTS)
- {
- mContext.error(varying->getLine(), "Varyings packing failed: Too many varyings", "vertex shader");
- return 0;
- }
-
- if(varying->getQualifier() == EvqPosition)
- {
- ASSERT(varying->isRegister());
- vertexShader->setPositionRegister(var);
- }
- else if(varying->getQualifier() == EvqPointSize)
- {
- ASSERT(varying->isRegister());
- vertexShader->setPointSizeRegister(var);
- }
- else
- {
- // Semantic indexes for user varyings will be assigned during program link to match the pixel shader
- }
- }
- else UNREACHABLE(0);
-
- declareVarying(varying, var);
- }
-
- return var;
- }
-
- void OutputASM::declareVarying(TIntermTyped *varying, int reg)
- {
- if(varying->getQualifier() != EvqPointCoord) // gl_PointCoord does not need linking
- {
- TIntermSymbol *symbol = varying->getAsSymbolNode();
- declareVarying(varying->getType(), symbol->getSymbol(), reg);
- }
- }
-
- void OutputASM::declareVarying(const TType &type, const TString &varyingName, int registerIndex)
- {
- const char *name = varyingName.c_str();
- VaryingList &activeVaryings = shaderObject->varyings;
-
- TStructure* structure = type.getStruct();
- if(structure)
- {
- int fieldRegisterIndex = registerIndex;
-
- const TFieldList &fields = type.getStruct()->fields();
- for(const auto &field : fields)
- {
- const TType& fieldType = *(field->type());
- declareVarying(fieldType, varyingName + "." + field->name(), fieldRegisterIndex);
- if(fieldRegisterIndex >= 0)
- {
- fieldRegisterIndex += fieldType.totalRegisterCount();
- }
- }
- }
- else
- {
- // Check if this varying has been declared before without having a register assigned
- for(VaryingList::iterator v = activeVaryings.begin(); v != activeVaryings.end(); v++)
- {
- if(v->name == name)
- {
- if(registerIndex >= 0)
- {
- ASSERT(v->registerIndex < 0 || v->registerIndex == registerIndex);
- v->registerIndex = registerIndex;
- }
-
- return;
- }
- }
-
- activeVaryings.push_back(glsl::Varying(type, name, registerIndex, 0));
- }
- }
-
- void OutputASM::declareFragmentOutput(TIntermTyped *fragmentOutput)
- {
- int requestedLocation = fragmentOutput->getType().getLayoutQualifier().location;
- int registerCount = fragmentOutput->totalRegisterCount();
- if(requestedLocation < 0)
- {
- ASSERT(requestedLocation == -1); // All other negative values would have been prevented in TParseContext::parseLayoutQualifier
- return; // No requested location
- }
- else if((requestedLocation + registerCount) > sw::RENDERTARGETS)
- {
- mContext.error(fragmentOutput->getLine(), "Fragment output location larger or equal to MAX_DRAW_BUFFERS", "fragment shader");
- }
- else
- {
- int currentIndex = lookup(fragmentOutputs, fragmentOutput);
- if(requestedLocation != currentIndex)
- {
- if(currentIndex != -1)
- {
- mContext.error(fragmentOutput->getLine(), "Multiple locations for fragment output", "fragment shader");
- }
- else
- {
- if(fragmentOutputs.size() <= (size_t)requestedLocation)
- {
- while(fragmentOutputs.size() < (size_t)requestedLocation)
- {
- fragmentOutputs.push_back(nullptr);
- }
- for(int i = 0; i < registerCount; i++)
- {
- fragmentOutputs.push_back(fragmentOutput);
- }
- }
- else
- {
- for(int i = 0; i < registerCount; i++)
- {
- if(!fragmentOutputs[requestedLocation + i])
- {
- fragmentOutputs[requestedLocation + i] = fragmentOutput;
- }
- else
- {
- mContext.error(fragmentOutput->getLine(), "Fragment output location aliasing", "fragment shader");
- return;
- }
- }
- }
- }
- }
- }
- }
-
- int OutputASM::uniformRegister(TIntermTyped *uniform)
- {
- const TType &type = uniform->getType();
- ASSERT(!IsSampler(type.getBasicType()));
- TInterfaceBlock *block = type.getAsInterfaceBlock();
- TIntermSymbol *symbol = uniform->getAsSymbolNode();
- ASSERT(symbol || block);
-
- if(symbol || block)
- {
- TInterfaceBlock* parentBlock = type.getInterfaceBlock();
- bool isBlockMember = (!block && parentBlock);
- int index = isBlockMember ? lookup(uniforms, parentBlock) : lookup(uniforms, uniform);
-
- if(index == -1 || isBlockMember)
- {
- if(index == -1)
- {
- index = allocate(uniforms, uniform);
- if (index == -1)
- {
- return 0;
- }
- }
-
- // Verify if the current uniform is a member of an already declared block
- const TString &name = symbol ? symbol->getSymbol() : block->name();
- int blockMemberIndex = blockMemberLookup(type, name, index);
- if(blockMemberIndex == -1)
- {
- declareUniform(type, name, index, false);
- }
- else
- {
- index = blockMemberIndex;
- }
- }
-
- return index;
- }
-
- return 0;
- }
-
- int OutputASM::attributeRegister(TIntermTyped *attribute)
- {
- ASSERT(!attribute->isArray());
-
- int index = lookup(attributes, attribute);
-
- if(index == -1)
- {
- TIntermSymbol *symbol = attribute->getAsSymbolNode();
- ASSERT(symbol);
-
- if(symbol)
- {
- index = allocate(attributes, attribute);
- if (index == -1)
- {
- return -1;
- }
- const TType &type = attribute->getType();
- int registerCount = attribute->totalRegisterCount();
- sw::VertexShader::AttribType attribType = sw::VertexShader::ATTRIBTYPE_FLOAT;
- switch(type.getBasicType())
- {
- case EbtInt:
- attribType = sw::VertexShader::ATTRIBTYPE_INT;
- break;
- case EbtUInt:
- attribType = sw::VertexShader::ATTRIBTYPE_UINT;
- break;
- case EbtFloat:
- default:
- break;
- }
-
- if(vertexShader && (index + registerCount) <= sw::MAX_VERTEX_INPUTS)
- {
- for(int i = 0; i < registerCount; i++)
- {
- vertexShader->setInput(index + i, sw::Shader::Semantic(sw::Shader::USAGE_TEXCOORD, index + i, false), attribType);
- }
- }
-
- ActiveAttributes &activeAttributes = shaderObject->activeAttributes;
-
- const char *name = symbol->getSymbol().c_str();
- activeAttributes.push_back(Attribute(glVariableType(type), name, type.getArraySize(), type.getLayoutQualifier().location, index));
- }
- }
-
- return index;
- }
-
- int OutputASM::fragmentOutputRegister(TIntermTyped *fragmentOutput)
- {
- return allocate(fragmentOutputs, fragmentOutput);
- }
-
- int OutputASM::samplerRegister(TIntermTyped *sampler)
- {
- const TType &type = sampler->getType();
- ASSERT(IsSampler(type.getBasicType()) || type.isStruct()); // Structures can contain samplers
-
- TIntermSymbol *symbol = sampler->getAsSymbolNode();
- TIntermBinary *binary = sampler->getAsBinaryNode();
-
- if(symbol)
- {
- switch(type.getQualifier())
- {
- case EvqUniform:
- return samplerRegister(symbol);
- case EvqIn:
- case EvqConstReadOnly:
- // Function arguments are not (uniform) sampler registers
- return -1;
- default:
- UNREACHABLE(type.getQualifier());
- }
- }
- else if(binary)
- {
- TIntermTyped *left = binary->getLeft();
- TIntermTyped *right = binary->getRight();
- const TType &leftType = left->getType();
- int index = right->getAsConstantUnion() ? right->getAsConstantUnion()->getIConst(0) : 0;
- int offset = 0;
-
- switch(binary->getOp())
- {
- case EOpIndexDirect:
- ASSERT(left->isArray());
- offset = index * leftType.samplerRegisterCount();
- break;
- case EOpIndexDirectStruct:
- ASSERT(leftType.isStruct());
- {
- const TFieldList &fields = leftType.getStruct()->fields();
-
- for(int i = 0; i < index; i++)
- {
- offset += fields[i]->type()->totalSamplerRegisterCount();
- }
- }
- break;
- case EOpIndexIndirect: // Indirect indexing produces a temporary, not a sampler register
- return -1;
- case EOpIndexDirectInterfaceBlock: // Interface blocks can't contain samplers
- default:
- UNREACHABLE(binary->getOp());
- return -1;
- }
-
- int base = samplerRegister(left);
-
- if(base < 0)
- {
- return -1;
- }
-
- return base + offset;
- }
-
- UNREACHABLE(0);
- return -1; // Not a (uniform) sampler register
- }
-
- int OutputASM::samplerRegister(TIntermSymbol *sampler)
- {
- const TType &type = sampler->getType();
- ASSERT(IsSampler(type.getBasicType()) || type.isStruct()); // Structures can contain samplers
-
- int index = lookup(samplers, sampler);
-
- if(index == -1)
- {
- index = allocate(samplers, sampler, true);
- if (index == -1)
- {
- return 0;
- }
-
- if(sampler->getQualifier() == EvqUniform)
- {
- const char *name = sampler->getSymbol().c_str();
- declareUniform(type, name, index, true);
- }
- }
-
- return index;
- }
-
- bool OutputASM::isSamplerRegister(TIntermTyped *operand)
- {
- return operand && IsSampler(operand->getBasicType()) && samplerRegister(operand) >= 0;
- }
-
- bool OutputASM::arrayExceedsLimits(TIntermTyped *operand)
- {
- const TVariable *maxUniformVectors = nullptr;
- TString builtinName = "";
- if (vertexShader)
- {
- builtinName = "gl_MaxVertexUniformVectors";
- }
- else if (pixelShader)
- {
- builtinName = "gl_MaxFragmentUniformVectors";
- }
- maxUniformVectors = static_cast<const TVariable *>(mContext.symbolTable.findBuiltIn(builtinName.c_str(), mContext.getShaderVersion()));
- if (operand->getArraySize() > maxUniformVectors->getConstPointer()->getIConst())
- {
- std::stringstream extraInfoStream;
- extraInfoStream << "Array size (" << operand->getArraySize() << ") "
- << "exceeds limit of " << builtinName
- << " (" << maxUniformVectors->getConstPointer()->getIConst() << ")";
- std::string errorStr = extraInfoStream.str();
- mContext.error(operand->getLine(), errorStr.c_str(),
- operand->getBasicString());
- return true;
- }
- return false;
- }
-
- int OutputASM::lookup(VariableArray &list, TIntermTyped *variable)
- {
- for(unsigned int i = 0; i < list.size(); i++)
- {
- if(list[i] == variable)
- {
- return i; // Pointer match
- }
- }
-
- TIntermSymbol *varSymbol = variable->getAsSymbolNode();
- TInterfaceBlock *varBlock = variable->getType().getAsInterfaceBlock();
-
- if(varBlock)
- {
- for(unsigned int i = 0; i < list.size(); i++)
- {
- if(list[i])
- {
- TInterfaceBlock *listBlock = list[i]->getType().getAsInterfaceBlock();
-
- if(listBlock)
- {
- if(listBlock->name() == varBlock->name())
- {
- ASSERT(listBlock->arraySize() == varBlock->arraySize());
- ASSERT(listBlock->fields() == varBlock->fields());
- ASSERT(listBlock->blockStorage() == varBlock->blockStorage());
- ASSERT(listBlock->matrixPacking() == varBlock->matrixPacking());
-
- return i;
- }
- }
- }
- }
- }
- else if(varSymbol)
- {
- for(unsigned int i = 0; i < list.size(); i++)
- {
- if(list[i])
- {
- TIntermSymbol *listSymbol = list[i]->getAsSymbolNode();
-
- if(listSymbol)
- {
- if(listSymbol->getId() == varSymbol->getId())
- {
- ASSERT(listSymbol->getSymbol() == varSymbol->getSymbol());
- ASSERT(listSymbol->getType() == varSymbol->getType());
- ASSERT(listSymbol->getQualifier() == varSymbol->getQualifier());
-
- return i;
- }
- }
- }
- }
- }
-
- return -1;
- }
-
- int OutputASM::lookup(VariableArray &list, TInterfaceBlock *block)
- {
- for(unsigned int i = 0; i < list.size(); i++)
- {
- if(list[i] && (list[i]->getType().getInterfaceBlock() == block))
- {
- return i; // Pointer match
- }
- }
- return -1;
- }
-
- int OutputASM::allocate(VariableArray &list, TIntermTyped *variable, bool samplersOnly)
- {
- int index = lookup(list, variable);
-
- if(index == -1)
- {
- if (arrayExceedsLimits(variable))
- {
- return -1;
- }
- unsigned int registerCount = variable->blockRegisterCount(samplersOnly);
-
- for(unsigned int i = 0; i < list.size(); i++)
- {
- if(list[i] == 0)
- {
- unsigned int j = 1;
- for( ; j < registerCount && (i + j) < list.size(); j++)
- {
- if(list[i + j] != 0)
- {
- break;
- }
- }
-
- if(j == registerCount) // Found free slots
- {
- for(unsigned int j = 0; j < registerCount; j++)
- {
- list[i + j] = variable;
- }
-
- return i;
- }
- }
- }
-
- index = list.size();
-
- for(unsigned int i = 0; i < registerCount; i++)
- {
- list.push_back(variable);
- }
- }
-
- return index;
- }
-
- void OutputASM::free(VariableArray &list, TIntermTyped *variable)
- {
- int index = lookup(list, variable);
-
- if(index >= 0)
- {
- list[index] = 0;
- }
- }
-
- int OutputASM::blockMemberLookup(const TType &type, const TString &name, int registerIndex)
- {
- const TInterfaceBlock *block = type.getInterfaceBlock();
-
- if(block)
- {
- ActiveUniformBlocks &activeUniformBlocks = shaderObject->activeUniformBlocks;
- const TFieldList& fields = block->fields();
- const TString &blockName = block->name();
- int fieldRegisterIndex = registerIndex;
-
- if(!type.isInterfaceBlock())
- {
- // This is a uniform that's part of a block, let's see if the block is already defined
- for(size_t i = 0; i < activeUniformBlocks.size(); ++i)
- {
- if(activeUniformBlocks[i].name == blockName.c_str())
- {
- // The block is already defined, find the register for the current uniform and return it
- for(size_t j = 0; j < fields.size(); j++)
- {
- const TString &fieldName = fields[j]->name();
- if(fieldName == name)
- {
- return fieldRegisterIndex;
- }
-
- fieldRegisterIndex += fields[j]->type()->totalRegisterCount();
- }
-
- ASSERT(false);
- return fieldRegisterIndex;
- }
- }
- }
- }
-
- return -1;
- }
-
- void OutputASM::declareUniform(const TType &type, const TString &name, int registerIndex, bool samplersOnly, int blockId, BlockLayoutEncoder* encoder)
- {
- const TStructure *structure = type.getStruct();
- const TInterfaceBlock *block = (type.isInterfaceBlock() || (blockId == -1)) ? type.getInterfaceBlock() : nullptr;
-
- if(!structure && !block)
- {
- ActiveUniforms &activeUniforms = shaderObject->activeUniforms;
- const BlockMemberInfo blockInfo = encoder ? encoder->encodeType(type) : BlockMemberInfo::getDefaultBlockInfo();
- if(blockId >= 0)
- {
- blockDefinitions[blockId].insert(BlockDefinitionIndexMap::value_type(registerIndex, TypedMemberInfo(blockInfo, type)));
- shaderObject->activeUniformBlocks[blockId].fields.push_back(activeUniforms.size());
- }
- int fieldRegisterIndex = encoder ? shaderObject->activeUniformBlocks[blockId].registerIndex + BlockLayoutEncoder::getBlockRegister(blockInfo) : registerIndex;
- bool isSampler = IsSampler(type.getBasicType());
- if(isSampler && samplersOnly)
- {
- for(int i = 0; i < type.totalRegisterCount(); i++)
- {
- shader->declareSampler(fieldRegisterIndex + i);
- }
- }
- if(isSampler == samplersOnly)
- {
- activeUniforms.push_back(Uniform(type, name.c_str(), fieldRegisterIndex, blockId, blockInfo));
- }
- }
- else if(block)
- {
- ActiveUniformBlocks &activeUniformBlocks = shaderObject->activeUniformBlocks;
- const TFieldList& fields = block->fields();
- const TString &blockName = block->name();
- int fieldRegisterIndex = registerIndex;
- bool isUniformBlockMember = !type.isInterfaceBlock() && (blockId == -1);
-
- blockId = activeUniformBlocks.size();
- bool isRowMajor = block->matrixPacking() == EmpRowMajor;
- activeUniformBlocks.push_back(UniformBlock(blockName.c_str(), 0, block->arraySize(),
- block->blockStorage(), isRowMajor, registerIndex, blockId));
- blockDefinitions.push_back(BlockDefinitionIndexMap());
-
- Std140BlockEncoder currentBlockEncoder;
- currentBlockEncoder.enterAggregateType();
- for(const auto &field : fields)
- {
- const TType &fieldType = *(field->type());
- const TString &fieldName = field->name();
- if(isUniformBlockMember && (fieldName == name))
- {
- registerIndex = fieldRegisterIndex;
- }
-
- const TString uniformName = block->hasInstanceName() ? blockName + "." + fieldName : fieldName;
-
- declareUniform(fieldType, uniformName, fieldRegisterIndex, samplersOnly, blockId, &currentBlockEncoder);
- fieldRegisterIndex += fieldType.totalRegisterCount();
- }
- currentBlockEncoder.exitAggregateType();
- activeUniformBlocks[blockId].dataSize = currentBlockEncoder.getBlockSize();
- }
- else
- {
- // Store struct for program link time validation
- shaderObject->activeUniformStructs.push_back(Uniform(type, name.c_str(), registerIndex, -1, BlockMemberInfo::getDefaultBlockInfo()));
-
- int fieldRegisterIndex = registerIndex;
-
- const TFieldList& fields = structure->fields();
- if(type.isArray() && (structure || type.isInterfaceBlock()))
- {
- for(int i = 0; i < type.getArraySize(); i++)
- {
- if(encoder)
- {
- encoder->enterAggregateType();
- }
- for(const auto &field : fields)
- {
- const TType &fieldType = *(field->type());
- const TString &fieldName = field->name();
- const TString uniformName = name + "[" + str(i) + "]." + fieldName;
-
- declareUniform(fieldType, uniformName, fieldRegisterIndex, samplersOnly, blockId, encoder);
- fieldRegisterIndex += samplersOnly ? fieldType.totalSamplerRegisterCount() : fieldType.totalRegisterCount();
- }
- if(encoder)
- {
- encoder->exitAggregateType();
- }
- }
- }
- else
- {
- if(encoder)
- {
- encoder->enterAggregateType();
- }
- for(const auto &field : fields)
- {
- const TType &fieldType = *(field->type());
- const TString &fieldName = field->name();
- const TString uniformName = name + "." + fieldName;
-
- declareUniform(fieldType, uniformName, fieldRegisterIndex, samplersOnly, blockId, encoder);
- fieldRegisterIndex += samplersOnly ? fieldType.totalSamplerRegisterCount() : fieldType.totalRegisterCount();
- }
- if(encoder)
- {
- encoder->exitAggregateType();
- }
- }
- }
- }
-
- int OutputASM::dim(TIntermNode *v)
- {
- TIntermTyped *vector = v->getAsTyped();
- ASSERT(vector && vector->isRegister());
- return vector->getNominalSize();
- }
-
- int OutputASM::dim2(TIntermNode *m)
- {
- TIntermTyped *matrix = m->getAsTyped();
- ASSERT(matrix && matrix->isMatrix() && !matrix->isArray());
- return matrix->getSecondarySize();
- }
-
- // Sets iterations to ~0u if no loop count could be statically determined.
- OutputASM::LoopInfo::LoopInfo(TIntermLoop *node)
- {
- // Parse loops of the form:
- // for(int index = initial; index [comparator] limit; index [op] increment)
-
- // Parse index name and intial value
- if(node->getInit())
- {
- TIntermAggregate *init = node->getInit()->getAsAggregate();
-
- if(init)
- {
- TIntermSequence &sequence = init->getSequence();
- TIntermTyped *variable = sequence[0]->getAsTyped();
-
- if(variable && variable->getQualifier() == EvqTemporary && variable->getBasicType() == EbtInt)
- {
- TIntermBinary *assign = variable->getAsBinaryNode();
-
- if(assign && assign->getOp() == EOpInitialize)
- {
- TIntermSymbol *symbol = assign->getLeft()->getAsSymbolNode();
- TIntermConstantUnion *constant = assign->getRight()->getAsConstantUnion();
-
- if(symbol && constant)
- {
- if(constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- index = symbol;
- initial = constant->getUnionArrayPointer()[0].getIConst();
- }
- }
- }
- }
- }
- }
-
- // Parse comparator and limit value
- if(index && node->getCondition())
- {
- TIntermBinary *test = node->getCondition()->getAsBinaryNode();
- TIntermSymbol *left = test ? test->getLeft()->getAsSymbolNode() : nullptr;
-
- if(left && (left->getId() == index->getId()))
- {
- TIntermConstantUnion *constant = test->getRight()->getAsConstantUnion();
-
- if(constant)
- {
- if(constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- comparator = test->getOp();
- limit = constant->getUnionArrayPointer()[0].getIConst();
- }
- }
- }
- }
-
- // Parse increment
- if(index && comparator != EOpNull && node->getExpression())
- {
- TIntermBinary *binaryTerminal = node->getExpression()->getAsBinaryNode();
- TIntermUnary *unaryTerminal = node->getExpression()->getAsUnaryNode();
-
- if(binaryTerminal)
- {
- TIntermSymbol *operand = binaryTerminal->getLeft()->getAsSymbolNode();
-
- if(operand && operand->getId() == index->getId())
- {
- TOperator op = binaryTerminal->getOp();
- TIntermConstantUnion *constant = binaryTerminal->getRight()->getAsConstantUnion();
-
- if(constant)
- {
- if(constant->getBasicType() == EbtInt && constant->getNominalSize() == 1)
- {
- int value = constant->getUnionArrayPointer()[0].getIConst();
-
- switch(op)
- {
- case EOpAddAssign: increment = value; break;
- case EOpSubAssign: increment = -value; break;
- default: increment = 0; break; // Rare cases left unhandled. Treated as non-deterministic.
- }
- }
- }
- }
- }
- else if(unaryTerminal)
- {
- TIntermSymbol *operand = unaryTerminal->getOperand()->getAsSymbolNode();
-
- if(operand && operand->getId() == index->getId())
- {
- TOperator op = unaryTerminal->getOp();
-
- switch(op)
- {
- case EOpPostIncrement: increment = 1; break;
- case EOpPostDecrement: increment = -1; break;
- case EOpPreIncrement: increment = 1; break;
- case EOpPreDecrement: increment = -1; break;
- default: increment = 0; break; // Rare cases left unhandled. Treated as non-deterministic.
- }
- }
- }
- }
-
- if(index && comparator != EOpNull && increment != 0)
- {
- // Check the loop body for return statements or changes to the index variable that make it non-deterministic.
- LoopUnrollable loopUnrollable;
- bool unrollable = loopUnrollable.traverse(node, index->getId());
-
- if(!unrollable)
- {
- iterations = ~0u;
- return;
- }
-
- if(comparator == EOpLessThanEqual)
- {
- comparator = EOpLessThan;
- limit += 1;
- }
- else if(comparator == EOpGreaterThanEqual)
- {
- comparator = EOpLessThan;
- limit -= 1;
- std::swap(initial, limit);
- increment = -increment;
- }
- else if(comparator == EOpGreaterThan)
- {
- comparator = EOpLessThan;
- std::swap(initial, limit);
- increment = -increment;
- }
-
- if(comparator == EOpLessThan)
- {
- if(!(initial < limit)) // Never loops
- {
- iterations = 0;
- }
- else if(increment < 0)
- {
- iterations = ~0u;
- }
- else
- {
- iterations = (limit - initial + abs(increment) - 1) / increment; // Ceiling division
- }
- }
- else
- {
- // Rare cases left unhandled. Treated as non-deterministic.
- iterations = ~0u;
- }
- }
- }
-
- bool LoopUnrollable::traverse(TIntermLoop *loop, int indexId)
- {
- loopUnrollable = true;
-
- loopIndexId = indexId;
- TIntermNode *body = loop->getBody();
-
- if(body)
- {
- body->traverse(this);
- }
-
- return loopUnrollable;
- }
-
- void LoopUnrollable::visitSymbol(TIntermSymbol *node)
- {
- // Check that the loop index is not used as the argument to a function out or inout parameter.
- if(node->getId() == loopIndexId)
- {
- if(node->getQualifier() == EvqOut || node->getQualifier() == EvqInOut)
- {
- loopUnrollable = false;
- }
- }
- }
-
- bool LoopUnrollable::visitBinary(Visit visit, TIntermBinary *node)
- {
- if(!loopUnrollable)
- {
- return false;
- }
-
- // Check that the loop index is not statically assigned to.
- TIntermSymbol *symbol = node->getLeft()->getAsSymbolNode();
- loopUnrollable = !(node->modifiesState() && symbol && (symbol->getId() == loopIndexId));
-
- return loopUnrollable;
- }
-
- bool LoopUnrollable::visitUnary(Visit visit, TIntermUnary *node)
- {
- if(!loopUnrollable)
- {
- return false;
- }
-
- // Check that the loop index is not statically assigned to.
- TIntermSymbol *symbol = node->getOperand()->getAsSymbolNode();
- loopUnrollable = !(node->modifiesState() && symbol && (symbol->getId() == loopIndexId));
-
- return loopUnrollable;
- }
-
- bool LoopUnrollable::visitBranch(Visit visit, TIntermBranch *node)
- {
- if(!loopUnrollable)
- {
- return false;
- }
-
- switch(node->getFlowOp())
- {
- case EOpKill:
- case EOpReturn:
- case EOpBreak:
- case EOpContinue:
- loopUnrollable = false;
- break;
- default: UNREACHABLE(node->getFlowOp());
- }
-
- return loopUnrollable;
- }
-
- bool LoopUnrollable::visitAggregate(Visit visit, TIntermAggregate *node)
- {
- return loopUnrollable;
- }
-}
diff --git a/src/OpenGL/compiler/OutputASM.h b/src/OpenGL/compiler/OutputASM.h
deleted file mode 100644
index 9ac2e8dc8..000000000
--- a/src/OpenGL/compiler/OutputASM.h
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_OUTPUTASM_H_
-#define COMPILER_OUTPUTASM_H_
-
-#include "intermediate.h"
-#include "ParseHelper.h"
-#include "Shader/PixelShader.hpp"
-#include "Shader/VertexShader.hpp"
-
-#include <list>
-#include <set>
-#include <map>
-
-namespace es2
-{
- class Shader;
-}
-
-typedef unsigned int GLenum;
-
-namespace glsl
-{
- struct BlockMemberInfo
- {
- BlockMemberInfo() : offset(-1), arrayStride(-1), matrixStride(-1), isRowMajorMatrix(false) {}
-
- BlockMemberInfo(int offset, int arrayStride, int matrixStride, bool isRowMajorMatrix)
- : offset(offset),
- arrayStride(arrayStride),
- matrixStride(matrixStride),
- isRowMajorMatrix(isRowMajorMatrix)
- {}
-
- static BlockMemberInfo getDefaultBlockInfo()
- {
- return BlockMemberInfo(-1, -1, -1, false);
- }
-
- int offset;
- int arrayStride;
- int matrixStride;
- bool isRowMajorMatrix;
- };
-
- struct ShaderVariable
- {
- ShaderVariable(const TType& type, const std::string& name, int registerIndex);
-
- GLenum type;
- GLenum precision;
- std::string name;
- int arraySize;
-
- int registerIndex;
-
- std::vector<ShaderVariable> fields;
- };
-
- struct Uniform : public ShaderVariable
- {
- Uniform(const TType& type, const std::string &name, int registerIndex, int blockId, const BlockMemberInfo& blockMemberInfo);
-
- int blockId;
- BlockMemberInfo blockInfo;
- };
-
- typedef std::vector<Uniform> ActiveUniforms;
-
- struct UniformBlock
- {
- UniformBlock(const std::string& name, unsigned int dataSize, unsigned int arraySize,
- TLayoutBlockStorage layout, bool isRowMajorLayout, int registerIndex, int blockId);
-
- std::string name;
- unsigned int dataSize;
- unsigned int arraySize;
- TLayoutBlockStorage layout;
- bool isRowMajorLayout;
- std::vector<int> fields;
-
- int registerIndex;
-
- int blockId;
- };
-
- class BlockLayoutEncoder
- {
- public:
- BlockLayoutEncoder();
- virtual ~BlockLayoutEncoder() {}
-
- BlockMemberInfo encodeType(const TType &type);
-
- size_t getBlockSize() const { return mCurrentOffset * BytesPerComponent; }
-
- virtual void enterAggregateType() = 0;
- virtual void exitAggregateType() = 0;
-
- static const size_t BytesPerComponent = 4u;
- static const unsigned int ComponentsPerRegister = 4u;
-
- static size_t getBlockRegister(const BlockMemberInfo &info);
- static size_t getBlockRegisterElement(const BlockMemberInfo &info);
-
- protected:
- size_t mCurrentOffset;
-
- void nextRegister();
-
- virtual void getBlockLayoutInfo(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) = 0;
- virtual void advanceOffset(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) = 0;
- };
-
- // Block layout according to the std140 block layout
- // See "Standard Uniform Block Layout" in Section 2.11.6 of the OpenGL ES 3.0 specification
- class Std140BlockEncoder : public BlockLayoutEncoder
- {
- public:
- Std140BlockEncoder();
-
- void enterAggregateType() override;
- void exitAggregateType() override;
-
- protected:
- void getBlockLayoutInfo(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int *arrayStrideOut, int *matrixStrideOut) override;
- void advanceOffset(const TType &type, unsigned int arraySize, bool isRowMajorMatrix, int arrayStride, int matrixStride) override;
- };
-
- typedef std::vector<UniformBlock> ActiveUniformBlocks;
-
- struct Attribute
- {
- Attribute();
- Attribute(GLenum type, const std::string &name, int arraySize, int layoutLocation, int registerIndex);
-
- GLenum type;
- std::string name;
- int arraySize;
- int layoutLocation;
-
- int registerIndex;
- };
-
- typedef std::vector<Attribute> ActiveAttributes;
-
- struct Varying : public ShaderVariable
- {
- Varying(const TType& type, const std::string &name, int reg = -1, int col = -1)
- : ShaderVariable(type, name, reg), qualifier(type.getQualifier()), column(col)
- {
- }
-
- bool isArray() const
- {
- return arraySize >= 1;
- }
-
- int size() const // Unify with es2::Uniform?
- {
- return arraySize > 0 ? arraySize : 1;
- }
-
- TQualifier qualifier;
- int column; // First register element, assigned during link
- };
-
- typedef std::list<Varying> VaryingList;
-
- class Shader
- {
- friend class OutputASM;
- public:
- virtual ~Shader() {}
- virtual sw::Shader *getShader() const = 0;
- virtual sw::PixelShader *getPixelShader() const;
- virtual sw::VertexShader *getVertexShader() const;
- int getShaderVersion() const { return shaderVersion; }
-
- protected:
- VaryingList varyings;
- ActiveUniforms activeUniforms;
- ActiveUniforms activeUniformStructs;
- ActiveAttributes activeAttributes;
- ActiveUniformBlocks activeUniformBlocks;
- int shaderVersion;
- };
-
- struct Function
- {
- Function(int label, const char *name, TIntermSequence *arg, TIntermTyped *ret) : label(label), name(name), arg(arg), ret(ret)
- {
- }
-
- Function(int label, const TString &name, TIntermSequence *arg, TIntermTyped *ret) : label(label), name(name), arg(arg), ret(ret)
- {
- }
-
- int label;
- TString name;
- TIntermSequence *arg;
- TIntermTyped *ret;
- };
-
- typedef sw::Shader::Instruction Instruction;
-
- class Temporary;
-
- class OutputASM : public TIntermTraverser
- {
- public:
- explicit OutputASM(TParseContext &context, Shader *shaderObject);
- ~OutputASM();
-
- void output();
-
- void freeTemporary(Temporary *temporary);
-
- private:
- enum Scope
- {
- GLOBAL,
- FUNCTION
- };
-
- struct TextureFunction
- {
- TextureFunction(const TString& name);
-
- enum Method
- {
- IMPLICIT, // Mipmap LOD determined implicitly (standard lookup)
- LOD,
- SIZE, // textureSize()
- FETCH,
- GRAD,
- };
-
- Method method;
- bool proj;
- bool offset;
- };
-
- void emitShader(Scope scope);
-
- // Visit AST nodes and output their code to the body stream
- void visitSymbol(TIntermSymbol*) override;
- bool visitBinary(Visit visit, TIntermBinary*) override;
- bool visitUnary(Visit visit, TIntermUnary*) override;
- bool visitSelection(Visit visit, TIntermSelection*) override;
- bool visitAggregate(Visit visit, TIntermAggregate*) override;
- bool visitLoop(Visit visit, TIntermLoop*) override;
- bool visitBranch(Visit visit, TIntermBranch*) override;
- bool visitSwitch(Visit, TIntermSwitch*) override;
-
- sw::Shader::Opcode getOpcode(sw::Shader::Opcode op, TIntermTyped *in) const;
- Instruction *emit(sw::Shader::Opcode op, TIntermTyped *dst = 0, TIntermNode *src0 = 0, TIntermNode *src1 = 0, TIntermNode *src2 = 0, TIntermNode *src3 = 0, TIntermNode *src4 = 0);
- Instruction *emit(sw::Shader::Opcode op, TIntermTyped *dst, int dstIndex, TIntermNode *src0 = 0, int index0 = 0, TIntermNode *src1 = 0, int index1 = 0,
- TIntermNode *src2 = 0, int index2 = 0, TIntermNode *src3 = 0, int index3 = 0, TIntermNode *src4 = 0, int index4 = 0);
- Instruction *emitCast(TIntermTyped *dst, TIntermTyped *src);
- Instruction *emitCast(TIntermTyped *dst, int dstIndex, TIntermTyped *src, int srcIndex);
- void emitBinary(sw::Shader::Opcode op, TIntermTyped *dst = 0, TIntermNode *src0 = 0, TIntermNode *src1 = 0, TIntermNode *src2 = 0);
- void emitAssign(sw::Shader::Opcode op, TIntermTyped *result, TIntermTyped *lhs, TIntermTyped *src0, TIntermTyped *src1 = 0);
- void emitCmp(sw::Shader::Control cmpOp, TIntermTyped *dst, TIntermNode *left, TIntermNode *right, int index = 0);
- void emitDeterminant(TIntermTyped *result, TIntermTyped *arg, int size, int col = -1, int row = -1, int outCol = 0, int outRow = 0);
- void source(sw::Shader::SourceParameter &parameter, TIntermNode *argument, int index = 0);
- void destination(sw::Shader::DestinationParameter &parameter, TIntermTyped *argument, int index = 0);
- void copy(TIntermTyped *dst, TIntermNode *src, int offset = 0);
- void assignLvalue(TIntermTyped *dst, TIntermTyped *src);
- void evaluateRvalue(TIntermTyped *node);
- int lvalue(sw::Shader::DestinationParameter &dst, TIntermTyped *node);
- int lvalue(TIntermTyped *&root, unsigned int &offset, sw::Shader::Relative &rel, unsigned char &mask, Temporary &address, TIntermTyped *node);
- sw::Shader::ParameterType registerType(TIntermTyped *operand);
- bool hasFlatQualifier(TIntermTyped *operand);
- unsigned int registerIndex(TIntermTyped *operand);
- int writeMask(TIntermTyped *destination, int index = 0);
- int readSwizzle(TIntermTyped *argument, int size);
- bool trivial(TIntermTyped *expression, int budget); // Fast to compute and no side effects
- int cost(TIntermNode *expression, int budget);
- const Function *findFunction(const TString &name);
-
- int temporaryRegister(TIntermTyped *temporary);
- int varyingRegister(TIntermTyped *varying);
- void setPixelShaderInputs(const TType& type, int var, bool flat);
- void declareVarying(TIntermTyped *varying, int reg);
- void declareVarying(const TType &type, const TString &name, int registerIndex);
- void declareFragmentOutput(TIntermTyped *fragmentOutput);
- int uniformRegister(TIntermTyped *uniform);
- int attributeRegister(TIntermTyped *attribute);
- int fragmentOutputRegister(TIntermTyped *fragmentOutput);
- int samplerRegister(TIntermTyped *sampler);
- int samplerRegister(TIntermSymbol *sampler);
- bool isSamplerRegister(TIntermTyped *operand);
- bool arrayExceedsLimits(TIntermTyped *operand);
-
- typedef std::vector<TIntermTyped*> VariableArray;
-
- int lookup(VariableArray &list, TIntermTyped *variable);
- int lookup(VariableArray &list, TInterfaceBlock *block);
- int blockMemberLookup(const TType &type, const TString &name, int registerIndex);
- // Returns -1 if it fails to allocate variable.
- int allocate(VariableArray &list, TIntermTyped *variable, bool samplersOnly = false);
- void free(VariableArray &list, TIntermTyped *variable);
-
- void declareUniform(const TType &type, const TString &name, int registerIndex, bool samplersOnly, int blockId = -1, BlockLayoutEncoder* encoder = nullptr);
-
- static int dim(TIntermNode *v);
- static int dim2(TIntermNode *m);
-
- struct LoopInfo
- {
- LoopInfo(TIntermLoop *node);
-
- bool isDeterministic()
- {
- return (iterations != ~0u);
- }
-
- unsigned int iterations = ~0u;
-
- TIntermSymbol *index = nullptr;
- TOperator comparator = EOpNull;
- int initial = 0;
- int limit = 0;
- int increment = 0;
- };
-
- Shader *const shaderObject;
- sw::Shader *shader;
- sw::PixelShader *pixelShader;
- sw::VertexShader *vertexShader;
-
- VariableArray temporaries;
- VariableArray uniforms;
- VariableArray varyings;
- VariableArray attributes;
- VariableArray samplers;
- VariableArray fragmentOutputs;
-
- struct TypedMemberInfo : public BlockMemberInfo
- {
- TypedMemberInfo(const BlockMemberInfo& b, const TType& t) : BlockMemberInfo(b), type(t) {}
- TType type;
- };
- struct ArgumentInfo
- {
- ArgumentInfo(const BlockMemberInfo& b, const TType& t, int clampedIndex, int bufferIndex) :
- typedMemberInfo(b, t), clampedIndex(clampedIndex), bufferIndex(bufferIndex) {}
- TypedMemberInfo typedMemberInfo;
- int clampedIndex;
- int bufferIndex;
- };
- int getBlockId(TIntermTyped *argument);
- ArgumentInfo getArgumentInfo(TIntermTyped *argument, int index);
-
- typedef std::map<int, TypedMemberInfo> BlockDefinitionIndexMap;
- std::vector<BlockDefinitionIndexMap> blockDefinitions;
-
- Scope emitScope;
- Scope currentScope;
-
- int currentFunction;
- std::vector<Function> functionArray;
-
- TQualifier outputQualifier;
-
- std::set<int> deterministicVariables;
-
- TParseContext &mContext;
- };
-
- class LoopUnrollable : public TIntermTraverser
- {
- public:
- bool traverse(TIntermLoop *loop, int loopIndexId);
-
- private:
- void visitSymbol(TIntermSymbol *node) override;
- bool visitBinary(Visit visit, TIntermBinary *node) override;
- bool visitUnary(Visit visit, TIntermUnary *node) override;
- bool visitBranch(Visit visit, TIntermBranch *node) override;
- bool visitAggregate(Visit visit, TIntermAggregate *node) override;
-
- bool loopUnrollable;
-
- int loopIndexId;
- };
-}
-
-#endif // COMPILER_OUTPUTASM_H_
diff --git a/src/OpenGL/compiler/ParseHelper.cpp b/src/OpenGL/compiler/ParseHelper.cpp
deleted file mode 100644
index 2bee48e37..000000000
--- a/src/OpenGL/compiler/ParseHelper.cpp
+++ /dev/null
@@ -1,3765 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ParseHelper.h"
-
-#include <limits>
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "glslang.h"
-#include "preprocessor/SourceLocation.h"
-#include "ValidateSwitch.h"
-
-///////////////////////////////////////////////////////////////////////
-//
-// Sub- vector and matrix fields
-//
-////////////////////////////////////////////////////////////////////////
-
-namespace
-{
- bool IsVaryingOut(TQualifier qualifier)
- {
- switch(qualifier)
- {
- case EvqVaryingOut:
- case EvqSmoothOut:
- case EvqFlatOut:
- case EvqCentroidOut:
- case EvqVertexOut:
- return true;
-
- default: break;
- }
-
- return false;
- }
-
- bool IsVaryingIn(TQualifier qualifier)
- {
- switch(qualifier)
- {
- case EvqVaryingIn:
- case EvqSmoothIn:
- case EvqFlatIn:
- case EvqCentroidIn:
- case EvqFragmentIn:
- return true;
-
- default: break;
- }
-
- return false;
- }
-
- bool IsVarying(TQualifier qualifier)
- {
- return IsVaryingIn(qualifier) || IsVaryingOut(qualifier);
- }
-
- bool IsAssignment(TOperator op)
- {
- switch(op)
- {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- case EOpAssign:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpMulAssign:
- case EOpVectorTimesMatrixAssign:
- case EOpVectorTimesScalarAssign:
- case EOpMatrixTimesScalarAssign:
- case EOpMatrixTimesMatrixAssign:
- case EOpDivAssign:
- case EOpIModAssign:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- case EOpBitwiseAndAssign:
- case EOpBitwiseXorAssign:
- case EOpBitwiseOrAssign:
- return true;
- default:
- return false;
- }
- }
-}
-
-//
-// Look at a '.' field selector string and change it into offsets
-// for a vector.
-//
-bool TParseContext::parseVectorFields(const TString& compString, int vecSize, TVectorFields& fields, const TSourceLoc &line)
-{
- fields.num = (int) compString.size();
- if (fields.num > 4) {
- error(line, "illegal vector field selection", compString.c_str());
- return false;
- }
-
- enum {
- exyzw,
- ergba,
- estpq
- } fieldSet[4];
-
- for (int i = 0; i < fields.num; ++i) {
- switch (compString[i]) {
- case 'x':
- fields.offsets[i] = 0;
- fieldSet[i] = exyzw;
- break;
- case 'r':
- fields.offsets[i] = 0;
- fieldSet[i] = ergba;
- break;
- case 's':
- fields.offsets[i] = 0;
- fieldSet[i] = estpq;
- break;
- case 'y':
- fields.offsets[i] = 1;
- fieldSet[i] = exyzw;
- break;
- case 'g':
- fields.offsets[i] = 1;
- fieldSet[i] = ergba;
- break;
- case 't':
- fields.offsets[i] = 1;
- fieldSet[i] = estpq;
- break;
- case 'z':
- fields.offsets[i] = 2;
- fieldSet[i] = exyzw;
- break;
- case 'b':
- fields.offsets[i] = 2;
- fieldSet[i] = ergba;
- break;
- case 'p':
- fields.offsets[i] = 2;
- fieldSet[i] = estpq;
- break;
- case 'w':
- fields.offsets[i] = 3;
- fieldSet[i] = exyzw;
- break;
- case 'a':
- fields.offsets[i] = 3;
- fieldSet[i] = ergba;
- break;
- case 'q':
- fields.offsets[i] = 3;
- fieldSet[i] = estpq;
- break;
- default:
- error(line, "illegal vector field selection", compString.c_str());
- return false;
- }
- }
-
- for (int i = 0; i < fields.num; ++i) {
- if (fields.offsets[i] >= vecSize) {
- error(line, "vector field selection out of range", compString.c_str());
- return false;
- }
-
- if (i > 0) {
- if (fieldSet[i] != fieldSet[i-1]) {
- error(line, "illegal - vector component fields not from the same set", compString.c_str());
- return false;
- }
- }
- }
-
- return true;
-}
-
-///////////////////////////////////////////////////////////////////////
-//
-// Errors
-//
-////////////////////////////////////////////////////////////////////////
-
-//
-// Track whether errors have occurred.
-//
-void TParseContext::recover()
-{
-}
-
-//
-// Used by flex/bison to output all syntax and parsing errors.
-//
-void TParseContext::error(const TSourceLoc& loc,
- const char* reason, const char* token,
- const char* extraInfo)
-{
- pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
- mDiagnostics.writeInfo(pp::Diagnostics::PP_ERROR,
- srcLoc, reason, token, extraInfo);
-
-}
-
-void TParseContext::warning(const TSourceLoc& loc,
- const char* reason, const char* token,
- const char* extraInfo) {
- pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
- mDiagnostics.writeInfo(pp::Diagnostics::PP_WARNING,
- srcLoc, reason, token, extraInfo);
-}
-
-void TParseContext::info(const TSourceLoc& loc,
- const char* reason, const char* token,
- const char* extraInfo) {
- pp::SourceLocation srcLoc(loc.first_file, loc.first_line);
- mDiagnostics.writeInfo(pp::Diagnostics::PP_INFO,
- srcLoc, reason, token, extraInfo);
-}
-
-void TParseContext::trace(const char* str)
-{
- mDiagnostics.writeDebug(str);
-}
-
-//
-// Same error message for all places assignments don't work.
-//
-void TParseContext::assignError(const TSourceLoc &line, const char* op, TString left, TString right)
-{
- std::stringstream extraInfoStream;
- extraInfoStream << "cannot convert from '" << right << "' to '" << left << "'";
- std::string extraInfo = extraInfoStream.str();
- error(line, "", op, extraInfo.c_str());
-}
-
-//
-// Same error message for all places unary operations don't work.
-//
-void TParseContext::unaryOpError(const TSourceLoc &line, const char* op, TString operand)
-{
- std::stringstream extraInfoStream;
- extraInfoStream << "no operation '" << op << "' exists that takes an operand of type " << operand
- << " (or there is no acceptable conversion)";
- std::string extraInfo = extraInfoStream.str();
- error(line, " wrong operand type", op, extraInfo.c_str());
-}
-
-//
-// Same error message for all binary operations don't work.
-//
-void TParseContext::binaryOpError(const TSourceLoc &line, const char* op, TString left, TString right)
-{
- std::stringstream extraInfoStream;
- extraInfoStream << "no operation '" << op << "' exists that takes a left-hand operand of type '" << left
- << "' and a right operand of type '" << right << "' (or there is no acceptable conversion)";
- std::string extraInfo = extraInfoStream.str();
- error(line, " wrong operand types ", op, extraInfo.c_str());
-}
-
-bool TParseContext::precisionErrorCheck(const TSourceLoc &line, TPrecision precision, TBasicType type){
- if (!mChecksPrecisionErrors)
- return false;
- switch( type ){
- case EbtFloat:
- if( precision == EbpUndefined ){
- error( line, "No precision specified for (float)", "" );
- return true;
- }
- break;
- case EbtInt:
- if( precision == EbpUndefined ){
- error( line, "No precision specified (int)", "" );
- return true;
- }
- break;
- default:
- return false;
- }
- return false;
-}
-
-//
-// Both test and if necessary, spit out an error, to see if the node is really
-// an l-value that can be operated on this way.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::lValueErrorCheck(const TSourceLoc &line, const char* op, TIntermTyped* node)
-{
- TIntermSymbol* symNode = node->getAsSymbolNode();
- TIntermBinary* binaryNode = node->getAsBinaryNode();
-
- if (binaryNode) {
- bool errorReturn;
-
- switch(binaryNode->getOp()) {
- case EOpIndexDirect:
- case EOpIndexIndirect:
- case EOpIndexDirectStruct:
- return lValueErrorCheck(line, op, binaryNode->getLeft());
- case EOpVectorSwizzle:
- errorReturn = lValueErrorCheck(line, op, binaryNode->getLeft());
- if (!errorReturn) {
- int offset[4] = {0,0,0,0};
-
- TIntermTyped* rightNode = binaryNode->getRight();
- TIntermAggregate *aggrNode = rightNode->getAsAggregate();
-
- for (TIntermSequence::iterator p = aggrNode->getSequence().begin();
- p != aggrNode->getSequence().end(); p++) {
- int value = (*p)->getAsTyped()->getAsConstantUnion()->getIConst(0);
- offset[value]++;
- if (offset[value] > 1) {
- error(line, " l-value of swizzle cannot have duplicate components", op);
-
- return true;
- }
- }
- }
-
- return errorReturn;
- case EOpIndexDirectInterfaceBlock:
- default:
- break;
- }
- error(line, " l-value required", op);
-
- return true;
- }
-
-
- const char* symbol = 0;
- if (symNode != 0)
- symbol = symNode->getSymbol().c_str();
-
- const char* message = 0;
- switch (node->getQualifier()) {
- case EvqConstExpr: message = "can't modify a const"; break;
- case EvqConstReadOnly: message = "can't modify a const"; break;
- case EvqAttribute: message = "can't modify an attribute"; break;
- case EvqFragmentIn: message = "can't modify an input"; break;
- case EvqVertexIn: message = "can't modify an input"; break;
- case EvqUniform: message = "can't modify a uniform"; break;
- case EvqSmoothIn:
- case EvqFlatIn:
- case EvqCentroidIn:
- case EvqVaryingIn: message = "can't modify a varying"; break;
- case EvqInput: message = "can't modify an input"; break;
- case EvqFragCoord: message = "can't modify gl_FragCoord"; break;
- case EvqFrontFacing: message = "can't modify gl_FrontFacing"; break;
- case EvqPointCoord: message = "can't modify gl_PointCoord"; break;
- case EvqInstanceID: message = "can't modify gl_InstanceID"; break;
- case EvqVertexID: message = "can't modify gl_VertexID"; break;
- default:
-
- //
- // Type that can't be written to?
- //
- if(IsSampler(node->getBasicType()))
- {
- message = "can't modify a sampler";
- }
- else if(node->getBasicType() == EbtVoid)
- {
- message = "can't modify void";
- }
- }
-
- if (message == 0 && binaryNode == 0 && symNode == 0) {
- error(line, " l-value required", op);
-
- return true;
- }
-
-
- //
- // Everything else is okay, no error.
- //
- if (message == 0)
- return false;
-
- //
- // If we get here, we have an error and a message.
- //
- if (symNode) {
- std::stringstream extraInfoStream;
- extraInfoStream << "\"" << symbol << "\" (" << message << ")";
- std::string extraInfo = extraInfoStream.str();
- error(line, " l-value required", op, extraInfo.c_str());
- }
- else {
- std::stringstream extraInfoStream;
- extraInfoStream << "(" << message << ")";
- std::string extraInfo = extraInfoStream.str();
- error(line, " l-value required", op, extraInfo.c_str());
- }
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if the node is really
-// a constant.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::constErrorCheck(TIntermTyped* node)
-{
- if (node->getQualifier() == EvqConstExpr)
- return false;
-
- error(node->getLine(), "constant expression required", "");
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if the node is really
-// an integer.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::integerErrorCheck(TIntermTyped* node, const char* token)
-{
- if (node->isScalarInt())
- return false;
-
- error(node->getLine(), "integer expression required", token);
-
- return true;
-}
-
-//
-// Both test, and if necessary spit out an error, to see if we are currently
-// globally scoped.
-//
-// Returns true if the was an error.
-//
-bool TParseContext::globalErrorCheck(const TSourceLoc &line, bool global, const char* token)
-{
- if (global)
- return false;
-
- error(line, "only allowed at global scope", token);
-
- return true;
-}
-
-//
-// For now, keep it simple: if it starts "gl_", it's reserved, independent
-// of scope. Except, if the symbol table is at the built-in push-level,
-// which is when we are parsing built-ins.
-// Also checks for "webgl_" and "_webgl_" reserved identifiers if parsing a
-// webgl shader.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::reservedErrorCheck(const TSourceLoc &line, const TString& identifier)
-{
- static const char* reservedErrMsg = "reserved built-in name";
- if (!symbolTable.atBuiltInLevel()) {
- if (identifier.compare(0, 3, "gl_") == 0) {
- error(line, reservedErrMsg, "gl_");
- return true;
- }
- if (identifier.find("__") != TString::npos) {
- error(line, "identifiers containing two consecutive underscores (__) are reserved as possible future keywords", identifier.c_str());
- return true;
- }
- }
-
- return false;
-}
-
-//
-// Make sure there is enough data provided to the constructor to build
-// something of the type of the constructor. Also returns the type of
-// the constructor.
-//
-// Returns true if there was an error in construction.
-//
-bool TParseContext::constructorErrorCheck(const TSourceLoc &line, TIntermNode* node, TFunction& function, TOperator op, TType* type)
-{
- *type = function.getReturnType();
-
- bool constructingMatrix = false;
- switch(op) {
- case EOpConstructMat2:
- case EOpConstructMat2x3:
- case EOpConstructMat2x4:
- case EOpConstructMat3x2:
- case EOpConstructMat3:
- case EOpConstructMat3x4:
- case EOpConstructMat4x2:
- case EOpConstructMat4x3:
- case EOpConstructMat4:
- constructingMatrix = true;
- break;
- default:
- break;
- }
-
- //
- // Note: It's okay to have too many components available, but not okay to have unused
- // arguments. 'full' will go to true when enough args have been seen. If we loop
- // again, there is an extra argument, so 'overfull' will become true.
- //
-
- size_t size = 0;
- bool full = false;
- bool overFull = false;
- bool matrixInMatrix = false;
- bool arrayArg = false;
- for (size_t i = 0; i < function.getParamCount(); ++i) {
- const TParameter& param = function.getParam(i);
- size += param.type->getObjectSize();
-
- if (constructingMatrix && param.type->isMatrix())
- matrixInMatrix = true;
- if (full)
- overFull = true;
- if (op != EOpConstructStruct && !type->isArray() && size >= type->getObjectSize())
- full = true;
- if (param.type->isArray())
- arrayArg = true;
- }
-
- if(type->isArray()) {
- if(type->getArraySize() == 0) {
- type->setArraySize(function.getParamCount());
- } else if(type->getArraySize() != (int)function.getParamCount()) {
- error(line, "array constructor needs one argument per array element", "constructor");
- return true;
- }
- }
-
- if (arrayArg && op != EOpConstructStruct) {
- error(line, "constructing from a non-dereferenced array", "constructor");
- return true;
- }
-
- if (matrixInMatrix && !type->isArray()) {
- if (function.getParamCount() != 1) {
- error(line, "constructing matrix from matrix can only take one argument", "constructor");
- return true;
- }
- }
-
- if (overFull) {
- error(line, "too many arguments", "constructor");
- return true;
- }
-
- if (op == EOpConstructStruct && !type->isArray() && type->getStruct()->fields().size() != function.getParamCount()) {
- error(line, "Number of constructor parameters does not match the number of structure fields", "constructor");
- return true;
- }
-
- if (!type->isMatrix() || !matrixInMatrix) {
- if ((op != EOpConstructStruct && size != 1 && size < type->getObjectSize()) ||
- (op == EOpConstructStruct && size < type->getObjectSize())) {
- error(line, "not enough data provided for construction", "constructor");
- return true;
- }
- }
-
- TIntermTyped *typed = node ? node->getAsTyped() : 0;
- if (typed == 0) {
- error(line, "constructor argument does not have a type", "constructor");
- return true;
- }
- if (op != EOpConstructStruct && IsSampler(typed->getBasicType())) {
- error(line, "cannot convert a sampler", "constructor");
- return true;
- }
- if (typed->getBasicType() == EbtVoid) {
- error(line, "cannot convert a void", "constructor");
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if a void variable has been declared and raise an error message for such a case
-//
-// returns true in case of an error
-//
-bool TParseContext::voidErrorCheck(const TSourceLoc &line, const TString& identifier, const TBasicType& type)
-{
- if(type == EbtVoid) {
- error(line, "illegal use of type 'void'", identifier.c_str());
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
-//
-// returns true in case of an error
-//
-bool TParseContext::boolErrorCheck(const TSourceLoc &line, const TIntermTyped* type)
-{
- if (type->getBasicType() != EbtBool || type->isArray() || type->isMatrix() || type->isVector()) {
- error(line, "boolean expression expected", "");
- return true;
- }
-
- return false;
-}
-
-// This function checks to see if the node (for the expression) contains a scalar boolean expression or not
-//
-// returns true in case of an error
-//
-bool TParseContext::boolErrorCheck(const TSourceLoc &line, const TPublicType& pType)
-{
- if (pType.type != EbtBool || pType.array || (pType.primarySize > 1) || (pType.secondarySize > 1)) {
- error(line, "boolean expression expected", "");
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::samplerErrorCheck(const TSourceLoc &line, const TPublicType& pType, const char* reason)
-{
- if (pType.type == EbtStruct) {
- if (containsSampler(*pType.userDef)) {
- error(line, reason, getBasicString(pType.type), "(structure contains a sampler)");
-
- return true;
- }
-
- return false;
- } else if (IsSampler(pType.type)) {
- error(line, reason, getBasicString(pType.type));
-
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::structQualifierErrorCheck(const TSourceLoc &line, const TPublicType& pType)
-{
- switch(pType.qualifier)
- {
- case EvqVaryingOut:
- case EvqSmooth:
- case EvqFlat:
- case EvqCentroidOut:
- case EvqVaryingIn:
- case EvqSmoothIn:
- case EvqFlatIn:
- case EvqCentroidIn:
- case EvqAttribute:
- case EvqVertexIn:
- case EvqFragmentOut:
- if(pType.type == EbtStruct)
- {
- error(line, "cannot be used with a structure", getQualifierString(pType.qualifier));
-
- return true;
- }
- break;
- default:
- break;
- }
-
- if (pType.qualifier != EvqUniform && samplerErrorCheck(line, pType, "samplers must be uniform"))
- return true;
-
- // check for layout qualifier issues
- if (pType.qualifier != EvqVertexIn && pType.qualifier != EvqFragmentOut &&
- layoutLocationErrorCheck(line, pType.layoutQualifier))
- {
- return true;
- }
-
- return false;
-}
-
-// These checks are common for all declarations starting a declarator list, and declarators that follow an empty
-// declaration.
-//
-bool TParseContext::singleDeclarationErrorCheck(const TPublicType &publicType, const TSourceLoc &identifierLocation)
-{
- switch(publicType.qualifier)
- {
- case EvqVaryingIn:
- case EvqVaryingOut:
- case EvqAttribute:
- case EvqVertexIn:
- case EvqFragmentOut:
- if(publicType.type == EbtStruct)
- {
- error(identifierLocation, "cannot be used with a structure",
- getQualifierString(publicType.qualifier));
- return true;
- }
-
- default: break;
- }
-
- if(publicType.qualifier != EvqUniform && samplerErrorCheck(identifierLocation, publicType,
- "samplers must be uniform"))
- {
- return true;
- }
-
- // check for layout qualifier issues
- const TLayoutQualifier layoutQualifier = publicType.layoutQualifier;
-
- if(layoutQualifier.matrixPacking != EmpUnspecified)
- {
- error(identifierLocation, "layout qualifier", getMatrixPackingString(layoutQualifier.matrixPacking),
- "only valid for interface blocks");
- return true;
- }
-
- if(layoutQualifier.blockStorage != EbsUnspecified)
- {
- error(identifierLocation, "layout qualifier", getBlockStorageString(layoutQualifier.blockStorage),
- "only valid for interface blocks");
- return true;
- }
-
- if(publicType.qualifier != EvqVertexIn && publicType.qualifier != EvqFragmentOut &&
- layoutLocationErrorCheck(identifierLocation, publicType.layoutQualifier))
- {
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::layoutLocationErrorCheck(const TSourceLoc &location, const TLayoutQualifier &layoutQualifier)
-{
- if(layoutQualifier.location != -1)
- {
- error(location, "invalid layout qualifier:", "location", "only valid on program inputs and outputs");
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::locationDeclaratorListCheck(const TSourceLoc& line, const TPublicType &pType)
-{
- if(pType.layoutQualifier.location != -1)
- {
- error(line, "location must only be specified for a single input or output variable", "location");
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::parameterSamplerErrorCheck(const TSourceLoc &line, TQualifier qualifier, const TType& type)
-{
- if ((qualifier == EvqOut || qualifier == EvqInOut) &&
- type.getBasicType() != EbtStruct && IsSampler(type.getBasicType())) {
- error(line, "samplers cannot be output parameters", type.getBasicString());
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::containsSampler(TType& type)
-{
- if (IsSampler(type.getBasicType()))
- return true;
-
- if (type.getBasicType() == EbtStruct || type.isInterfaceBlock()) {
- for(const auto &field : type.getStruct()->fields()) {
- if (containsSampler(*(field->type())))
- return true;
- }
- }
-
- return false;
-}
-
-//
-// Do size checking for an array type's size.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped* expr, int& size)
-{
- TIntermConstantUnion* constant = expr->getAsConstantUnion();
-
- if (expr->getQualifier() != EvqConstExpr || constant == 0 || !constant->isScalarInt())
- {
- error(line, "array size must be a constant integer expression", "");
- size = 1;
- return true;
- }
-
- if (constant->getBasicType() == EbtUInt)
- {
- unsigned int uintSize = constant->getUConst(0);
- if (uintSize > static_cast<unsigned int>(std::numeric_limits<int>::max()))
- {
- error(line, "array size too large", "");
- size = 1;
- return true;
- }
-
- size = static_cast<int>(uintSize);
- }
- else
- {
- size = constant->getIConst(0);
-
- if (size < 0)
- {
- error(line, "array size must be non-negative", "");
- size = 1;
- return true;
- }
- }
-
- if(size == 0)
- {
- error(line, "array size must be greater than zero", "");
- return true;
- }
-
- return false;
-}
-
-//
-// See if this qualifier can be an array.
-//
-// Returns true if there is an error.
-//
-bool TParseContext::arrayQualifierErrorCheck(const TSourceLoc &line, TPublicType type)
-{
- if ((type.qualifier == EvqAttribute) || (type.qualifier == EvqVertexIn) || (type.qualifier == EvqConstExpr && mShaderVersion < 300)) {
- error(line, "cannot declare arrays of this qualifier", TType(type).getCompleteString().c_str());
- return true;
- }
-
- return false;
-}
-
-//
-// See if this type can be an array.
-//
-// Returns true if there is an error.
-//
-bool TParseContext::arrayTypeErrorCheck(const TSourceLoc &line, TPublicType type)
-{
- //
- // Can the type be an array?
- //
- if (type.array) {
- error(line, "cannot declare arrays of arrays", TType(type).getCompleteString().c_str());
- return true;
- }
-
- // In ESSL1.00 shaders, structs cannot be varying (section 4.3.5). This is checked elsewhere.
- // In ESSL3.00 shaders, struct inputs/outputs are allowed but not arrays of structs (section 4.3.4).
- if(mShaderVersion >= 300 && type.type == EbtStruct && IsVarying(type.qualifier))
- {
- error(line, "cannot declare arrays of structs of this qualifier",
- TType(type).getCompleteString().c_str());
- return true;
- }
-
- return false;
-}
-
-bool TParseContext::arraySetMaxSize(TIntermSymbol *node, TType* type, int size, bool updateFlag, const TSourceLoc &line)
-{
- bool builtIn = false;
- TSymbol* symbol = symbolTable.find(node->getSymbol(), mShaderVersion, &builtIn);
- if (symbol == 0) {
- error(line, " undeclared identifier", node->getSymbol().c_str());
- return true;
- }
- TVariable* variable = static_cast<TVariable*>(symbol);
-
- type->setArrayInformationType(variable->getArrayInformationType());
- variable->updateArrayInformationType(type);
-
- // special casing to test index value of gl_FragData. If the accessed index is >= gl_MaxDrawBuffers
- // its an error
- if (node->getSymbol() == "gl_FragData") {
- TSymbol* fragData = symbolTable.find("gl_MaxDrawBuffers", mShaderVersion, &builtIn);
- ASSERT(fragData);
-
- int fragDataValue = static_cast<TVariable*>(fragData)->getConstPointer()[0].getIConst();
- if (fragDataValue <= size) {
- error(line, "", "[", "gl_FragData can only have a max array size of up to gl_MaxDrawBuffers");
- return true;
- }
- }
-
- // we dont want to update the maxArraySize when this flag is not set, we just want to include this
- // node type in the chain of node types so that its updated when a higher maxArraySize comes in.
- if (!updateFlag)
- return false;
-
- size++;
- variable->getType().setMaxArraySize(size);
- type->setMaxArraySize(size);
- TType* tt = type;
-
- while(tt->getArrayInformationType() != 0) {
- tt = tt->getArrayInformationType();
- tt->setMaxArraySize(size);
- }
-
- return false;
-}
-
-//
-// Enforce non-initializer type/qualifier rules.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::nonInitConstErrorCheck(const TSourceLoc &line, TString& identifier, TPublicType& type, bool array)
-{
- if (type.qualifier == EvqConstExpr)
- {
- // Make the qualifier make sense.
- type.qualifier = EvqTemporary;
-
- if (array)
- {
- error(line, "arrays may not be declared constant since they cannot be initialized", identifier.c_str());
- }
- else if (type.isStructureContainingArrays())
- {
- error(line, "structures containing arrays may not be declared constant since they cannot be initialized", identifier.c_str());
- }
- else
- {
- error(line, "variables with qualifier 'const' must be initialized", identifier.c_str());
- }
-
- return true;
- }
-
- return false;
-}
-
-//
-// Do semantic checking for a variable declaration that has no initializer,
-// and update the symbol table.
-//
-// Returns true if there was an error.
-//
-bool TParseContext::nonInitErrorCheck(const TSourceLoc &line, const TString& identifier, TPublicType& type)
-{
- if(type.qualifier == EvqConstExpr)
- {
- // Make the qualifier make sense.
- type.qualifier = EvqTemporary;
-
- // Generate informative error messages for ESSL1.
- // In ESSL3 arrays and structures containing arrays can be constant.
- if(mShaderVersion < 300 && type.isStructureContainingArrays())
- {
- error(line,
- "structures containing arrays may not be declared constant since they cannot be initialized",
- identifier.c_str());
- }
- else
- {
- error(line, "variables with qualifier 'const' must be initialized", identifier.c_str());
- }
-
- return true;
- }
- if(type.isUnsizedArray())
- {
- error(line, "implicitly sized arrays need to be initialized", identifier.c_str());
- return true;
- }
- return false;
-}
-
-// Do some simple checks that are shared between all variable declarations,
-// and update the symbol table.
-//
-// Returns true if declaring the variable succeeded.
-//
-bool TParseContext::declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type,
- TVariable **variable)
-{
- ASSERT((*variable) == nullptr);
-
- // gl_LastFragData may be redeclared with a new precision qualifier
- if(type.isArray() && identifier.compare(0, 15, "gl_LastFragData") == 0)
- {
- const TVariable *maxDrawBuffers =
- static_cast<const TVariable *>(symbolTable.findBuiltIn("gl_MaxDrawBuffers", mShaderVersion));
- if(type.getArraySize() != maxDrawBuffers->getConstPointer()->getIConst())
- {
- error(line, "redeclaration of gl_LastFragData with size != gl_MaxDrawBuffers", identifier.c_str());
- return false;
- }
- }
-
- if(reservedErrorCheck(line, identifier))
- return false;
-
- (*variable) = new TVariable(&identifier, type);
- if(!symbolTable.declare(*variable))
- {
- error(line, "redefinition", identifier.c_str());
- delete (*variable);
- (*variable) = nullptr;
- return false;
- }
-
- if(voidErrorCheck(line, identifier, type.getBasicType()))
- return false;
-
- return true;
-}
-
-bool TParseContext::paramErrorCheck(const TSourceLoc &line, TQualifier qualifier, TQualifier paramQualifier, TType* type)
-{
- if (qualifier != EvqConstReadOnly && qualifier != EvqTemporary) {
- error(line, "qualifier not allowed on function parameter", getQualifierString(qualifier));
- return true;
- }
- if (qualifier == EvqConstReadOnly && paramQualifier != EvqIn) {
- error(line, "qualifier not allowed with ", getQualifierString(qualifier), getQualifierString(paramQualifier));
- return true;
- }
-
- if (qualifier == EvqConstReadOnly)
- type->setQualifier(EvqConstReadOnly);
- else
- type->setQualifier(paramQualifier);
-
- return false;
-}
-
-bool TParseContext::extensionErrorCheck(const TSourceLoc &line, const TString& extension)
-{
- const TExtensionBehavior& extBehavior = extensionBehavior();
- TExtensionBehavior::const_iterator iter = extBehavior.find(extension.c_str());
- if (iter == extBehavior.end()) {
- error(line, "extension", extension.c_str(), "is not supported");
- return true;
- }
- // In GLSL ES, an extension's default behavior is "disable".
- if (iter->second == EBhDisable || iter->second == EBhUndefined) {
- error(line, "extension", extension.c_str(), "is disabled");
- return true;
- }
- if (iter->second == EBhWarn) {
- warning(line, "extension", extension.c_str(), "is being used");
- return false;
- }
-
- return false;
-}
-
-bool TParseContext::functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *aggregate)
-{
- for(size_t i = 0; i < fnCandidate->getParamCount(); ++i)
- {
- TQualifier qual = fnCandidate->getParam(i).type->getQualifier();
- if(qual == EvqOut || qual == EvqInOut)
- {
- TIntermTyped *node = (aggregate->getSequence())[i]->getAsTyped();
- if(lValueErrorCheck(node->getLine(), "assign", node))
- {
- error(node->getLine(),
- "Constant value cannot be passed for 'out' or 'inout' parameters.", "Error");
- recover();
- return true;
- }
- }
- }
- return false;
-}
-
-void TParseContext::es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation)
-{
- switch(qualifier)
- {
- case EvqVaryingOut:
- case EvqSmoothOut:
- case EvqFlatOut:
- case EvqCentroidOut:
- case EvqVertexOut:
- case EvqFragmentOut:
- break;
- default:
- error(invariantLocation, "Only out variables can be invariant.", "invariant");
- recover();
- break;
- }
-}
-
-bool TParseContext::supportsExtension(const char* extension)
-{
- const TExtensionBehavior& extbehavior = extensionBehavior();
- TExtensionBehavior::const_iterator iter = extbehavior.find(extension);
- return (iter != extbehavior.end());
-}
-
-void TParseContext::handleExtensionDirective(const TSourceLoc &line, const char* extName, const char* behavior)
-{
- pp::SourceLocation loc(line.first_file, line.first_line);
- mDirectiveHandler.handleExtension(loc, extName, behavior);
-}
-
-void TParseContext::handlePragmaDirective(const TSourceLoc &line, const char* name, const char* value, bool stdgl)
-{
- pp::SourceLocation loc(line.first_file, line.first_line);
- mDirectiveHandler.handlePragma(loc, name, value, stdgl);
-}
-
-/////////////////////////////////////////////////////////////////////////////////
-//
-// Non-Errors.
-//
-/////////////////////////////////////////////////////////////////////////////////
-
-const TVariable *TParseContext::getNamedVariable(const TSourceLoc &location,
- const TString *name,
- const TSymbol *symbol)
-{
- const TVariable *variable = nullptr;
-
- if(!symbol)
- {
- error(location, "undeclared identifier", name->c_str());
- recover();
- }
- else if(!symbol->isVariable())
- {
- error(location, "variable expected", name->c_str());
- recover();
- }
- else
- {
- variable = static_cast<const TVariable*>(symbol);
-
- if(symbolTable.findBuiltIn(variable->getName(), mShaderVersion))
- {
- recover();
- }
-
- // Reject shaders using both gl_FragData and gl_FragColor
- TQualifier qualifier = variable->getType().getQualifier();
- if(qualifier == EvqFragData)
- {
- mUsesFragData = true;
- }
- else if(qualifier == EvqFragColor)
- {
- mUsesFragColor = true;
- }
-
- // This validation is not quite correct - it's only an error to write to
- // both FragData and FragColor. For simplicity, and because users shouldn't
- // be rewarded for reading from undefined variables, return an error
- // if they are both referenced, rather than assigned.
- if(mUsesFragData && mUsesFragColor)
- {
- error(location, "cannot use both gl_FragData and gl_FragColor", name->c_str());
- recover();
- }
- }
-
- if(!variable)
- {
- TType type(EbtFloat, EbpUndefined);
- TVariable *fakeVariable = new TVariable(name, type);
- symbolTable.declare(fakeVariable);
- variable = fakeVariable;
- }
-
- return variable;
-}
-
-//
-// Look up a function name in the symbol table, and make sure it is a function.
-//
-// Return the function symbol if found, otherwise 0.
-//
-const TFunction* TParseContext::findFunction(const TSourceLoc &line, TFunction* call, bool *builtIn)
-{
- // First find by unmangled name to check whether the function name has been
- // hidden by a variable name or struct typename.
- const TSymbol* symbol = symbolTable.find(call->getName(), mShaderVersion, builtIn);
- if (!symbol || symbol->isFunction()) {
- symbol = symbolTable.find(call->getMangledName(), mShaderVersion, builtIn);
- }
-
- if (!symbol) {
- error(line, "no matching overloaded function found", call->getName().c_str());
- return nullptr;
- }
-
- if (!symbol->isFunction()) {
- error(line, "function name expected", call->getName().c_str());
- return nullptr;
- }
-
- return static_cast<const TFunction*>(symbol);
-}
-
-//
-// Initializers show up in several places in the grammar. Have one set of
-// code to handle them here.
-//
-bool TParseContext::executeInitializer(const TSourceLoc& line, const TString& identifier, const TPublicType& pType,
- TIntermTyped *initializer, TIntermNode **intermNode)
-{
- ASSERT(intermNode != nullptr);
- TType type = TType(pType);
-
- if(type.isUnsizedArray())
- {
- // We have not checked yet whether the initializer actually is an array or not.
- if(initializer->isArray())
- {
- type.setArraySize(initializer->getArraySize());
- }
- else
- {
- // Having a non-array initializer for an unsized array will result in an error later,
- // so we don't generate an error message here.
- type.setArraySize(1u);
- }
- }
-
- TVariable *variable = nullptr;
- if(!declareVariable(line, identifier, type, &variable))
- {
- return true;
- }
-
- if(symbolTable.atGlobalLevel() && initializer->getQualifier() != EvqConstExpr)
- {
- error(line, "global variable initializers must be constant expressions", "=");
- return true;
- }
-
- //
- // identifier must be of type constant, a global, or a temporary
- //
- TQualifier qualifier = type.getQualifier();
- if ((qualifier != EvqTemporary) && (qualifier != EvqGlobal) && (qualifier != EvqConstExpr)) {
- error(line, " cannot initialize this type of qualifier ", variable->getType().getQualifierString());
- return true;
- }
- //
- // test for and propagate constant
- //
-
- if (qualifier == EvqConstExpr) {
- if (qualifier != initializer->getQualifier()) {
- std::stringstream extraInfoStream;
- extraInfoStream << "'" << variable->getType().getCompleteString() << "'";
- std::string extraInfo = extraInfoStream.str();
- error(line, " assigning non-constant to", "=", extraInfo.c_str());
- variable->getType().setQualifier(EvqTemporary);
- return true;
- }
-
- if (type != initializer->getType()) {
- error(line, " non-matching types for const initializer ",
- variable->getType().getQualifierString());
- variable->getType().setQualifier(EvqTemporary);
- return true;
- }
-
- if (initializer->getAsConstantUnion()) {
- variable->shareConstPointer(initializer->getAsConstantUnion()->getUnionArrayPointer());
- } else if (initializer->getAsSymbolNode()) {
- const TSymbol* symbol = symbolTable.find(initializer->getAsSymbolNode()->getSymbol(), 0);
- const TVariable* tVar = static_cast<const TVariable*>(symbol);
-
- ConstantUnion* constArray = tVar->getConstPointer();
- variable->shareConstPointer(constArray);
- }
- }
-
- // Constants which aren't indexable arrays get propagated by value
- // and thus don't need to initialize the symbol.
- if (variable->isConstant() && !(type.isArray() && type.getArraySize() > 1))
- {
- *intermNode = nullptr;
- }
- else
- {
- TIntermSymbol* intermSymbol = intermediate.addSymbol(variable->getUniqueId(), variable->getName(), variable->getType(), line);
- *intermNode = createAssign(EOpInitialize, intermSymbol, initializer, line);
- if(*intermNode == nullptr) {
- assignError(line, "=", intermSymbol->getCompleteString(), initializer->getCompleteString());
- return true;
- }
- }
-
- return false;
-}
-
-TPublicType TParseContext::addFullySpecifiedType(TQualifier qualifier, bool invariant, TLayoutQualifier layoutQualifier, const TPublicType &typeSpecifier)
-{
- TPublicType returnType = typeSpecifier;
- returnType.qualifier = qualifier;
- returnType.invariant = invariant;
- returnType.layoutQualifier = layoutQualifier;
-
- if(mShaderVersion < 300)
- {
- if(typeSpecifier.array)
- {
- error(typeSpecifier.line, "not supported", "first-class array");
- returnType.clearArrayness();
- }
-
- if(qualifier == EvqAttribute && (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
- {
- error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
- recover();
- }
-
- if((qualifier == EvqVaryingIn || qualifier == EvqVaryingOut) &&
- (typeSpecifier.type == EbtBool || typeSpecifier.type == EbtInt))
- {
- error(typeSpecifier.line, "cannot be bool or int", getQualifierString(qualifier));
- recover();
- }
- }
- else
- {
- if(!returnType.layoutQualifier.isEmpty())
- {
- globalErrorCheck(typeSpecifier.line, symbolTable.atGlobalLevel(), "layout");
- }
-
- if(IsVarying(returnType.qualifier) || returnType.qualifier == EvqVertexIn || returnType.qualifier == EvqFragmentOut)
- {
- checkInputOutputTypeIsValidES3(returnType.qualifier, typeSpecifier, typeSpecifier.line);
- }
- }
-
- return returnType;
-}
-
-void TParseContext::checkInputOutputTypeIsValidES3(const TQualifier qualifier,
- const TPublicType &type,
- const TSourceLoc &qualifierLocation)
-{
- // An input/output variable can never be bool or a sampler. Samplers are checked elsewhere.
- if(type.type == EbtBool)
- {
- error(qualifierLocation, "cannot be bool", getQualifierString(qualifier));
- }
-
- // Specific restrictions apply for vertex shader inputs and fragment shader outputs.
- switch(qualifier)
- {
- case EvqVertexIn:
- // ESSL 3.00 section 4.3.4
- if(type.array)
- {
- error(qualifierLocation, "cannot be array", getQualifierString(qualifier));
- }
- // Vertex inputs with a struct type are disallowed in singleDeclarationErrorCheck
- return;
- case EvqFragmentOut:
- // ESSL 3.00 section 4.3.6
- if(type.isMatrix())
- {
- error(qualifierLocation, "cannot be matrix", getQualifierString(qualifier));
- }
- // Fragment outputs with a struct type are disallowed in singleDeclarationErrorCheck
- return;
- default:
- break;
- }
-
- // Vertex shader outputs / fragment shader inputs have a different, slightly more lenient set of
- // restrictions.
- bool typeContainsIntegers = (type.type == EbtInt || type.type == EbtUInt ||
- type.isStructureContainingType(EbtInt) ||
- type.isStructureContainingType(EbtUInt));
- if(typeContainsIntegers && qualifier != EvqFlatIn && qualifier != EvqFlatOut)
- {
- error(qualifierLocation, "must use 'flat' interpolation here", getQualifierString(qualifier));
- }
-
- if(type.type == EbtStruct)
- {
- // ESSL 3.00 sections 4.3.4 and 4.3.6.
- // These restrictions are only implied by the ESSL 3.00 spec, but
- // the ESSL 3.10 spec lists these restrictions explicitly.
- if(type.array)
- {
- error(qualifierLocation, "cannot be an array of structures", getQualifierString(qualifier));
- }
- if(type.isStructureContainingArrays())
- {
- error(qualifierLocation, "cannot be a structure containing an array", getQualifierString(qualifier));
- }
- if(type.isStructureContainingType(EbtStruct))
- {
- error(qualifierLocation, "cannot be a structure containing a structure", getQualifierString(qualifier));
- }
- if(type.isStructureContainingType(EbtBool))
- {
- error(qualifierLocation, "cannot be a structure containing a bool", getQualifierString(qualifier));
- }
- }
-}
-
-TIntermAggregate *TParseContext::parseSingleDeclaration(TPublicType &publicType,
- const TSourceLoc &identifierOrTypeLocation,
- const TString &identifier)
-{
- TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierOrTypeLocation);
-
- bool emptyDeclaration = (identifier == "");
-
- mDeferredSingleDeclarationErrorCheck = emptyDeclaration;
-
- if(emptyDeclaration)
- {
- if(publicType.isUnsizedArray())
- {
- // ESSL3 spec section 4.1.9: Array declaration which leaves the size unspecified is an error.
- // It is assumed that this applies to empty declarations as well.
- error(identifierOrTypeLocation, "empty array declaration needs to specify a size", identifier.c_str());
- }
- }
- else
- {
- if(singleDeclarationErrorCheck(publicType, identifierOrTypeLocation))
- recover();
-
- if(nonInitErrorCheck(identifierOrTypeLocation, identifier, publicType))
- recover();
-
- TVariable *variable = nullptr;
- if(!declareVariable(identifierOrTypeLocation, identifier, TType(publicType), &variable))
- recover();
-
- if(variable && symbol)
- symbol->setId(variable->getUniqueId());
- }
-
- return intermediate.makeAggregate(symbol, identifierOrTypeLocation);
-}
-
-TIntermAggregate *TParseContext::parseSingleArrayDeclaration(TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &indexLocation,
- TIntermTyped *indexExpression)
-{
- mDeferredSingleDeclarationErrorCheck = false;
-
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
-
- if(nonInitErrorCheck(identifierLocation, identifier, publicType))
- recover();
-
- if(arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
- {
- recover();
- }
-
- TType arrayType(publicType);
-
- int size = 0;
- if(arraySizeErrorCheck(identifierLocation, indexExpression, size))
- {
- recover();
- }
- // Make the type an array even if size check failed.
- // This ensures useless error messages regarding the variable's non-arrayness won't follow.
- arrayType.setArraySize(size);
-
- TVariable *variable = nullptr;
- if(!declareVariable(identifierLocation, identifier, arrayType, &variable))
- recover();
-
- TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, arrayType, identifierLocation);
- if(variable && symbol)
- symbol->setId(variable->getUniqueId());
-
- return intermediate.makeAggregate(symbol, identifierLocation);
-}
-
-TIntermAggregate *TParseContext::parseSingleInitDeclaration(const TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &initLocation,
- TIntermTyped *initializer)
-{
- mDeferredSingleDeclarationErrorCheck = false;
-
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
-
- TIntermNode *intermNode = nullptr;
- if(!executeInitializer(identifierLocation, identifier, publicType, initializer, &intermNode))
- {
- //
- // Build intermediate representation
- //
- return intermNode ? intermediate.makeAggregate(intermNode, initLocation) : nullptr;
- }
- else
- {
- recover();
- return nullptr;
- }
-}
-
-TIntermAggregate *TParseContext::parseSingleArrayInitDeclaration(TPublicType &publicType,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &indexLocation,
- TIntermTyped *indexExpression,
- const TSourceLoc &initLocation,
- TIntermTyped *initializer)
-{
- mDeferredSingleDeclarationErrorCheck = false;
-
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
-
- if(arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
- {
- recover();
- }
-
- TPublicType arrayType(publicType);
-
- int size = 0;
- // If indexExpression is nullptr, then the array will eventually get its size implicitly from the initializer.
- if(indexExpression != nullptr && arraySizeErrorCheck(identifierLocation, indexExpression, size))
- {
- recover();
- }
- // Make the type an array even if size check failed.
- // This ensures useless error messages regarding the variable's non-arrayness won't follow.
- arrayType.setArray(true, size);
-
- // initNode will correspond to the whole of "type b[n] = initializer".
- TIntermNode *initNode = nullptr;
- if(!executeInitializer(identifierLocation, identifier, arrayType, initializer, &initNode))
- {
- return initNode ? intermediate.makeAggregate(initNode, initLocation) : nullptr;
- }
- else
- {
- recover();
- return nullptr;
- }
-}
-
-TIntermAggregate *TParseContext::parseInvariantDeclaration(const TSourceLoc &invariantLoc,
- const TSourceLoc &identifierLoc,
- const TString *identifier,
- const TSymbol *symbol)
-{
- // invariant declaration
- if(globalErrorCheck(invariantLoc, symbolTable.atGlobalLevel(), "invariant varying"))
- {
- recover();
- }
-
- if(!symbol)
- {
- error(identifierLoc, "undeclared identifier declared as invariant", identifier->c_str());
- recover();
- return nullptr;
- }
- else
- {
- const TString kGlFrontFacing("gl_FrontFacing");
- if(*identifier == kGlFrontFacing)
- {
- error(identifierLoc, "identifier should not be declared as invariant", identifier->c_str());
- recover();
- return nullptr;
- }
- symbolTable.addInvariantVarying(std::string(identifier->c_str()));
- const TVariable *variable = getNamedVariable(identifierLoc, identifier, symbol);
- ASSERT(variable);
- const TType &type = variable->getType();
- TIntermSymbol *intermSymbol = intermediate.addSymbol(variable->getUniqueId(),
- *identifier, type, identifierLoc);
-
- TIntermAggregate *aggregate = intermediate.makeAggregate(intermSymbol, identifierLoc);
- aggregate->setOp(EOpInvariantDeclaration);
- return aggregate;
- }
-}
-
-TIntermAggregate *TParseContext::parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration,
- const TSourceLoc &identifierLocation, const TString &identifier)
-{
- // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
- if(mDeferredSingleDeclarationErrorCheck)
- {
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
- mDeferredSingleDeclarationErrorCheck = false;
- }
-
- if(locationDeclaratorListCheck(identifierLocation, publicType))
- recover();
-
- if(nonInitErrorCheck(identifierLocation, identifier, publicType))
- recover();
-
- TVariable *variable = nullptr;
- if(!declareVariable(identifierLocation, identifier, TType(publicType), &variable))
- recover();
-
- TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, TType(publicType), identifierLocation);
- if(variable && symbol)
- symbol->setId(variable->getUniqueId());
-
- return intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
-}
-
-TIntermAggregate *TParseContext::parseArrayDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration,
- const TSourceLoc &identifierLocation, const TString &identifier,
- const TSourceLoc &arrayLocation, TIntermTyped *indexExpression)
-{
- // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
- if(mDeferredSingleDeclarationErrorCheck)
- {
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
- mDeferredSingleDeclarationErrorCheck = false;
- }
-
- if(locationDeclaratorListCheck(identifierLocation, publicType))
- recover();
-
- if(nonInitErrorCheck(identifierLocation, identifier, publicType))
- recover();
-
- if(arrayTypeErrorCheck(arrayLocation, publicType) || arrayQualifierErrorCheck(arrayLocation, publicType))
- {
- recover();
- }
- else
- {
- TType arrayType = TType(publicType);
- int size = 0;
- if(arraySizeErrorCheck(arrayLocation, indexExpression, size))
- {
- recover();
- }
- arrayType.setArraySize(size);
-
- TVariable *variable = nullptr;
- if(!declareVariable(identifierLocation, identifier, arrayType, &variable))
- recover();
-
- TIntermSymbol *symbol = intermediate.addSymbol(0, identifier, arrayType, identifierLocation);
- if(variable && symbol)
- symbol->setId(variable->getUniqueId());
-
- return intermediate.growAggregate(aggregateDeclaration, symbol, identifierLocation);
- }
-
- return nullptr;
-}
-
-TIntermAggregate *TParseContext::parseInitDeclarator(const TPublicType &publicType, TIntermAggregate *aggregateDeclaration,
- const TSourceLoc &identifierLocation, const TString &identifier,
- const TSourceLoc &initLocation, TIntermTyped *initializer)
-{
- // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
- if(mDeferredSingleDeclarationErrorCheck)
- {
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
- mDeferredSingleDeclarationErrorCheck = false;
- }
-
- if(locationDeclaratorListCheck(identifierLocation, publicType))
- recover();
-
- TIntermNode *intermNode = nullptr;
- if(!executeInitializer(identifierLocation, identifier, publicType, initializer, &intermNode))
- {
- //
- // build the intermediate representation
- //
- if(intermNode)
- {
- return intermediate.growAggregate(aggregateDeclaration, intermNode, initLocation);
- }
- else
- {
- return aggregateDeclaration;
- }
- }
- else
- {
- recover();
- return nullptr;
- }
-}
-
-TIntermAggregate *TParseContext::parseArrayInitDeclarator(const TPublicType &publicType,
- TIntermAggregate *aggregateDeclaration,
- const TSourceLoc &identifierLocation,
- const TString &identifier,
- const TSourceLoc &indexLocation,
- TIntermTyped *indexExpression,
- const TSourceLoc &initLocation, TIntermTyped *initializer)
-{
- // If the declaration starting this declarator list was empty (example: int,), some checks were not performed.
- if(mDeferredSingleDeclarationErrorCheck)
- {
- if(singleDeclarationErrorCheck(publicType, identifierLocation))
- recover();
- mDeferredSingleDeclarationErrorCheck = false;
- }
-
- if(locationDeclaratorListCheck(identifierLocation, publicType))
- recover();
-
- if(arrayTypeErrorCheck(indexLocation, publicType) || arrayQualifierErrorCheck(indexLocation, publicType))
- {
- recover();
- }
-
- TPublicType arrayType(publicType);
-
- int size = 0;
- // If indexExpression is nullptr, then the array will eventually get its size implicitly from the initializer.
- if(indexExpression != nullptr && arraySizeErrorCheck(identifierLocation, indexExpression, size))
- {
- recover();
- }
- // Make the type an array even if size check failed.
- // This ensures useless error messages regarding the variable's non-arrayness won't follow.
- arrayType.setArray(true, size);
-
- // initNode will correspond to the whole of "b[n] = initializer".
- TIntermNode *initNode = nullptr;
- if(!executeInitializer(identifierLocation, identifier, arrayType, initializer, &initNode))
- {
- if(initNode)
- {
- return intermediate.growAggregate(aggregateDeclaration, initNode, initLocation);
- }
- else
- {
- return aggregateDeclaration;
- }
- }
- else
- {
- recover();
- return nullptr;
- }
-}
-
-void TParseContext::parseGlobalLayoutQualifier(const TPublicType &typeQualifier)
-{
- if(mShaderVersion < 300)
- {
- error(typeQualifier.line, "layout qualifiers supported in GLSL ES 3.00 only", "layout");
- recover();
- return;
- }
-
- if(typeQualifier.qualifier != EvqUniform)
- {
- error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "global layout must be uniform");
- recover();
- return;
- }
-
- const TLayoutQualifier layoutQualifier = typeQualifier.layoutQualifier;
- ASSERT(!layoutQualifier.isEmpty());
-
- if(layoutLocationErrorCheck(typeQualifier.line, typeQualifier.layoutQualifier))
- {
- recover();
- return;
- }
-
- if(layoutQualifier.matrixPacking != EmpUnspecified)
- {
- mDefaultMatrixPacking = layoutQualifier.matrixPacking;
- }
-
- if(layoutQualifier.blockStorage != EbsUnspecified)
- {
- mDefaultBlockStorage = layoutQualifier.blockStorage;
- }
-}
-
-TIntermAggregate *TParseContext::addFunctionPrototypeDeclaration(const TFunction &function, const TSourceLoc &location)
-{
- // Note: symbolTableFunction could be the same as function if this is the first declaration.
- // Either way the instance in the symbol table is used to track whether the function is declared
- // multiple times.
- TFunction *symbolTableFunction =
- static_cast<TFunction *>(symbolTable.find(function.getMangledName(), getShaderVersion()));
- if(symbolTableFunction->hasPrototypeDeclaration() && mShaderVersion == 100)
- {
- // ESSL 1.00.17 section 4.2.7.
- // Doesn't apply to ESSL 3.00.4: see section 4.2.3.
- error(location, "duplicate function prototype declarations are not allowed", "function");
- recover();
- }
- symbolTableFunction->setHasPrototypeDeclaration();
-
- TIntermAggregate *prototype = new TIntermAggregate;
- prototype->setType(function.getReturnType());
- prototype->setName(function.getMangledName());
-
- for(size_t i = 0; i < function.getParamCount(); i++)
- {
- const TParameter &param = function.getParam(i);
- if(param.name != 0)
- {
- TVariable variable(param.name, *param.type);
-
- TIntermSymbol *paramSymbol = intermediate.addSymbol(
- variable.getUniqueId(), variable.getName(), variable.getType(), location);
- prototype = intermediate.growAggregate(prototype, paramSymbol, location);
- }
- else
- {
- TIntermSymbol *paramSymbol = intermediate.addSymbol(0, "", *param.type, location);
- prototype = intermediate.growAggregate(prototype, paramSymbol, location);
- }
- }
-
- prototype->setOp(EOpPrototype);
-
- symbolTable.pop();
-
- if(!symbolTable.atGlobalLevel())
- {
- // ESSL 3.00.4 section 4.2.4.
- error(location, "local function prototype declarations are not allowed", "function");
- recover();
- }
-
- return prototype;
-}
-
-TIntermAggregate *TParseContext::addFunctionDefinition(const TFunction &function, TIntermAggregate *functionPrototype, TIntermAggregate *functionBody, const TSourceLoc &location)
-{
- //?? Check that all paths return a value if return type != void ?
- // May be best done as post process phase on intermediate code
- if(mCurrentFunctionType->getBasicType() != EbtVoid && !mFunctionReturnsValue)
- {
- error(location, "function does not return a value:", "", function.getName().c_str());
- recover();
- }
-
- TIntermAggregate *aggregate = intermediate.growAggregate(functionPrototype, functionBody, location);
- intermediate.setAggregateOperator(aggregate, EOpFunction, location);
- aggregate->setName(function.getMangledName().c_str());
- aggregate->setType(function.getReturnType());
-
- // store the pragma information for debug and optimize and other vendor specific
- // information. This information can be queried from the parse tree
- aggregate->setOptimize(pragma().optimize);
- aggregate->setDebug(pragma().debug);
-
- if(functionBody && functionBody->getAsAggregate())
- aggregate->setEndLine(functionBody->getAsAggregate()->getEndLine());
-
- symbolTable.pop();
- return aggregate;
-}
-
-void TParseContext::parseFunctionPrototype(const TSourceLoc &location, TFunction *function, TIntermAggregate **aggregateOut)
-{
- const TSymbol *builtIn = symbolTable.findBuiltIn(function->getMangledName(), getShaderVersion());
-
- if(builtIn)
- {
- error(location, "built-in functions cannot be redefined", function->getName().c_str());
- recover();
- }
-
- TFunction *prevDec = static_cast<TFunction *>(symbolTable.find(function->getMangledName(), getShaderVersion()));
- //
- // Note: 'prevDec' could be 'function' if this is the first time we've seen function
- // as it would have just been put in the symbol table. Otherwise, we're looking up
- // an earlier occurance.
- //
- if(prevDec->isDefined())
- {
- // Then this function already has a body.
- error(location, "function already has a body", function->getName().c_str());
- recover();
- }
- prevDec->setDefined();
- //
- // Overload the unique ID of the definition to be the same unique ID as the declaration.
- // Eventually we will probably want to have only a single definition and just swap the
- // arguments to be the definition's arguments.
- //
- function->setUniqueId(prevDec->getUniqueId());
-
- // Raise error message if main function takes any parameters or return anything other than void
- if(function->getName() == "main")
- {
- if(function->getParamCount() > 0)
- {
- error(location, "function cannot take any parameter(s)", function->getName().c_str());
- recover();
- }
- if(function->getReturnType().getBasicType() != EbtVoid)
- {
- error(location, "", function->getReturnType().getBasicString(), "main function cannot return a value");
- recover();
- }
- }
-
- //
- // Remember the return type for later checking for RETURN statements.
- //
- mCurrentFunctionType = &(prevDec->getReturnType());
- mFunctionReturnsValue = false;
-
- //
- // Insert parameters into the symbol table.
- // If the parameter has no name, it's not an error, just don't insert it
- // (could be used for unused args).
- //
- // Also, accumulate the list of parameters into the HIL, so lower level code
- // knows where to find parameters.
- //
- TIntermAggregate *paramNodes = new TIntermAggregate;
- for(size_t i = 0; i < function->getParamCount(); i++)
- {
- const TParameter &param = function->getParam(i);
- if(param.name != 0)
- {
- TVariable *variable = new TVariable(param.name, *param.type);
- //
- // Insert the parameters with name in the symbol table.
- //
- if(!symbolTable.declare(variable))
- {
- error(location, "redefinition", variable->getName().c_str());
- recover();
- paramNodes = intermediate.growAggregate(
- paramNodes, intermediate.addSymbol(0, "", *param.type, location), location);
- continue;
- }
-
- //
- // Add the parameter to the HIL
- //
- TIntermSymbol *symbol = intermediate.addSymbol(
- variable->getUniqueId(), variable->getName(), variable->getType(), location);
-
- paramNodes = intermediate.growAggregate(paramNodes, symbol, location);
- }
- else
- {
- paramNodes = intermediate.growAggregate(
- paramNodes, intermediate.addSymbol(0, "", *param.type, location), location);
- }
- }
- intermediate.setAggregateOperator(paramNodes, EOpParameters, location);
- *aggregateOut = paramNodes;
- setLoopNestingLevel(0);
-}
-
-TFunction *TParseContext::parseFunctionDeclarator(const TSourceLoc &location, TFunction *function)
-{
- //
- // We don't know at this point whether this is a function definition or a prototype.
- // The definition production code will check for redefinitions.
- // In the case of ESSL 1.00 the prototype production code will also check for redeclarations.
- //
- // Return types and parameter qualifiers must match in all redeclarations, so those are checked
- // here.
- //
- TFunction *prevDec = static_cast<TFunction *>(symbolTable.find(function->getMangledName(), getShaderVersion()));
- if(getShaderVersion() >= 300 && symbolTable.hasUnmangledBuiltIn(function->getName().c_str()))
- {
- // With ESSL 3.00, names of built-in functions cannot be redeclared as functions.
- // Therefore overloading or redefining builtin functions is an error.
- error(location, "Name of a built-in function cannot be redeclared as function", function->getName().c_str());
- }
- else if(prevDec)
- {
- if(prevDec->getReturnType() != function->getReturnType())
- {
- error(location, "overloaded functions must have the same return type",
- function->getReturnType().getBasicString());
- recover();
- }
- for(size_t i = 0; i < prevDec->getParamCount(); ++i)
- {
- if(prevDec->getParam(i).type->getQualifier() != function->getParam(i).type->getQualifier())
- {
- error(location, "overloaded functions must have the same parameter qualifiers",
- function->getParam(i).type->getQualifierString());
- recover();
- }
- }
- }
-
- //
- // Check for previously declared variables using the same name.
- //
- TSymbol *prevSym = symbolTable.find(function->getName(), getShaderVersion());
- if(prevSym)
- {
- if(!prevSym->isFunction())
- {
- error(location, "redefinition", function->getName().c_str(), "function");
- recover();
- }
- }
- else
- {
- // Insert the unmangled name to detect potential future redefinition as a variable.
- TFunction *unmangledFunction = new TFunction(NewPoolTString(function->getName().c_str()), function->getReturnType());
- symbolTable.getOuterLevel()->insertUnmangled(unmangledFunction);
- }
-
- // We're at the inner scope level of the function's arguments and body statement.
- // Add the function prototype to the surrounding scope instead.
- symbolTable.getOuterLevel()->insert(function);
-
- //
- // If this is a redeclaration, it could also be a definition, in which case, we want to use the
- // variable names from this one, and not the one that's
- // being redeclared. So, pass back up this declaration, not the one in the symbol table.
- //
- return function;
-}
-
-TFunction *TParseContext::addConstructorFunc(const TPublicType &publicTypeIn)
-{
- TPublicType publicType = publicTypeIn;
- TOperator op = EOpNull;
- if(publicType.userDef)
- {
- op = EOpConstructStruct;
- }
- else
- {
- op = TypeToConstructorOperator(TType(publicType));
- if(op == EOpNull)
- {
- error(publicType.line, "cannot construct this type", getBasicString(publicType.type));
- recover();
- publicType.type = EbtFloat;
- op = EOpConstructFloat;
- }
- }
-
- TString tempString;
- TType type(publicType);
- return new TFunction(&tempString, type, op);
-}
-
-// This function is used to test for the correctness of the parameters passed to various constructor functions
-// and also convert them to the right datatype if it is allowed and required.
-//
-// Returns 0 for an error or the constructed node (aggregate or typed) for no error.
-//
-TIntermTyped* TParseContext::addConstructor(TIntermNode* arguments, const TType* type, TOperator op, TFunction* fnCall, const TSourceLoc &line)
-{
- TIntermAggregate *aggregateArguments = arguments->getAsAggregate();
-
- if(!aggregateArguments)
- {
- aggregateArguments = new TIntermAggregate;
- aggregateArguments->getSequence().push_back(arguments);
- }
-
- if(type->isArray())
- {
- // GLSL ES 3.00 section 5.4.4: Each argument must be the same type as the element type of
- // the array.
- for(TIntermNode *&argNode : aggregateArguments->getSequence())
- {
- const TType &argType = argNode->getAsTyped()->getType();
- // It has already been checked that the argument is not an array.
- ASSERT(!argType.isArray());
- if(!argType.sameElementType(*type))
- {
- error(line, "Array constructor argument has an incorrect type", "Error");
- return nullptr;
- }
- }
- }
- else if(op == EOpConstructStruct)
- {
- const TFieldList &fields = type->getStruct()->fields();
- TIntermSequence &args = aggregateArguments->getSequence();
-
- for(size_t i = 0; i < fields.size(); i++)
- {
- if(args[i]->getAsTyped()->getType() != *fields[i]->type())
- {
- error(line, "Structure constructor arguments do not match structure fields", "Error");
- recover();
-
- return nullptr;
- }
- }
- }
-
- // Turn the argument list itself into a constructor
- TIntermAggregate *constructor = intermediate.setAggregateOperator(aggregateArguments, op, line);
- TIntermTyped *constConstructor = foldConstConstructor(constructor, *type);
- if(constConstructor)
- {
- return constConstructor;
- }
-
- return constructor;
-}
-
-TIntermTyped* TParseContext::foldConstConstructor(TIntermAggregate* aggrNode, const TType& type)
-{
- aggrNode->setType(type);
- if (aggrNode->isConstantFoldable()) {
- bool returnVal = false;
- ConstantUnion* unionArray = new ConstantUnion[type.getObjectSize()];
- if (aggrNode->getSequence().size() == 1) {
- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type, true);
- }
- else {
- returnVal = intermediate.parseConstTree(aggrNode->getLine(), aggrNode, unionArray, aggrNode->getOp(), type);
- }
- if (returnVal)
- return nullptr;
-
- return intermediate.addConstantUnion(unionArray, type, aggrNode->getLine());
- }
-
- return nullptr;
-}
-
-//
-// This function returns the tree representation for the vector field(s) being accessed from contant vector.
-// If only one component of vector is accessed (v.x or v[0] where v is a contant vector), then a contant node is
-// returned, else an aggregate node is returned (for v.xy). The input to this function could either be the symbol
-// node or it could be the intermediate tree representation of accessing fields in a constant structure or column of
-// a constant matrix.
-//
-TIntermTyped* TParseContext::addConstVectorNode(TVectorFields& fields, TIntermTyped* node, const TSourceLoc &line)
-{
- TIntermTyped* typedNode;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
-
- ConstantUnion *unionArray;
- if (tempConstantNode) {
- unionArray = tempConstantNode->getUnionArrayPointer();
-
- if (!unionArray) {
- return node;
- }
- } else { // The node has to be either a symbol node or an aggregate node or a tempConstant node, else, its an error
- error(line, "Cannot offset into the vector", "Error");
- recover();
-
- return nullptr;
- }
-
- ConstantUnion* constArray = new ConstantUnion[fields.num];
-
- int objSize = static_cast<int>(node->getType().getObjectSize());
- for (int i = 0; i < fields.num; i++) {
- if (fields.offsets[i] >= objSize) {
- std::stringstream extraInfoStream;
- extraInfoStream << "vector field selection out of range '" << fields.offsets[i] << "'";
- std::string extraInfo = extraInfoStream.str();
- error(line, "", "[", extraInfo.c_str());
- recover();
- fields.offsets[i] = 0;
- }
-
- constArray[i] = unionArray[fields.offsets[i]];
-
- }
-
- TType type(node->getType().getBasicType(), node->getType().getPrecision(), EvqConstExpr, fields.num);
- typedNode = intermediate.addConstantUnion(constArray, type, line);
- return typedNode;
-}
-
-//
-// This function returns the column being accessed from a constant matrix. The values are retrieved from
-// the symbol table and parse-tree is built for a vector (each column of a matrix is a vector). The input
-// to the function could either be a symbol node (m[0] where m is a constant matrix)that represents a
-// constant matrix or it could be the tree representation of the constant matrix (s.m1[0] where s is a constant structure)
-//
-TIntermTyped* TParseContext::addConstMatrixNode(int index, TIntermTyped* node, const TSourceLoc &line)
-{
- TIntermTyped* typedNode;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
-
- if (index >= node->getType().getNominalSize()) {
- std::stringstream extraInfoStream;
- extraInfoStream << "matrix field selection out of range '" << index << "'";
- std::string extraInfo = extraInfoStream.str();
- error(line, "", "[", extraInfo.c_str());
- recover();
- index = 0;
- }
-
- if (tempConstantNode) {
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- int size = tempConstantNode->getType().getNominalSize();
- typedNode = intermediate.addConstantUnion(&unionArray[size*index], tempConstantNode->getType(), line);
- } else {
- error(line, "Cannot offset into the matrix", "Error");
- recover();
-
- return nullptr;
- }
-
- return typedNode;
-}
-
-
-//
-// This function returns an element of an array accessed from a constant array. The values are retrieved from
-// the symbol table and parse-tree is built for the type of the element. The input
-// to the function could either be a symbol node (a[0] where a is a constant array)that represents a
-// constant array or it could be the tree representation of the constant array (s.a1[0] where s is a constant structure)
-//
-TIntermTyped* TParseContext::addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc &line)
-{
- TIntermTyped* typedNode;
- TIntermConstantUnion* tempConstantNode = node->getAsConstantUnion();
- TType arrayElementType = node->getType();
- arrayElementType.clearArrayness();
-
- if (index >= node->getType().getArraySize()) {
- std::stringstream extraInfoStream;
- extraInfoStream << "array field selection out of range '" << index << "'";
- std::string extraInfo = extraInfoStream.str();
- error(line, "", "[", extraInfo.c_str());
- recover();
- index = 0;
- }
-
- size_t arrayElementSize = arrayElementType.getObjectSize();
-
- if (tempConstantNode) {
- ConstantUnion* unionArray = tempConstantNode->getUnionArrayPointer();
- typedNode = intermediate.addConstantUnion(&unionArray[arrayElementSize * index], tempConstantNode->getType(), line);
- } else {
- error(line, "Cannot offset into the array", "Error");
- recover();
-
- return nullptr;
- }
-
- return typedNode;
-}
-
-
-//
-// This function returns the value of a particular field inside a constant structure from the symbol table.
-// If there is an embedded/nested struct, it appropriately calls addConstStructNested or addConstStructFromAggr
-// function and returns the parse-tree with the values of the embedded/nested struct.
-//
-TIntermTyped* TParseContext::addConstStruct(const TString& identifier, TIntermTyped* node, const TSourceLoc &line)
-{
- const TFieldList &fields = node->getType().getStruct()->fields();
- TIntermTyped *typedNode;
- size_t instanceSize = 0;
- TIntermConstantUnion *tempConstantNode = node->getAsConstantUnion();
-
- for(const auto &field : fields) {
- if (field->name() == identifier) {
- break;
- } else {
- instanceSize += field->type()->getObjectSize();
- }
- }
-
- if (tempConstantNode) {
- ConstantUnion* constArray = tempConstantNode->getUnionArrayPointer();
-
- typedNode = intermediate.addConstantUnion(constArray+instanceSize, tempConstantNode->getType(), line); // type will be changed in the calling function
- } else {
- error(line, "Cannot offset into the structure", "Error");
- recover();
-
- return nullptr;
- }
-
- return typedNode;
-}
-
-//
-// Interface/uniform blocks
-//
-TIntermAggregate* TParseContext::addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
- const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine)
-{
- if(reservedErrorCheck(nameLine, blockName))
- recover();
-
- if(typeQualifier.qualifier != EvqUniform)
- {
- error(typeQualifier.line, "invalid qualifier:", getQualifierString(typeQualifier.qualifier), "interface blocks must be uniform");
- recover();
- }
-
- TLayoutQualifier blockLayoutQualifier = typeQualifier.layoutQualifier;
- if(layoutLocationErrorCheck(typeQualifier.line, blockLayoutQualifier))
- {
- recover();
- }
-
- if(blockLayoutQualifier.matrixPacking == EmpUnspecified)
- {
- blockLayoutQualifier.matrixPacking = mDefaultMatrixPacking;
- }
-
- if(blockLayoutQualifier.blockStorage == EbsUnspecified)
- {
- blockLayoutQualifier.blockStorage = mDefaultBlockStorage;
- }
-
- TSymbol* blockNameSymbol = new TSymbol(&blockName);
- if(!symbolTable.declare(blockNameSymbol)) {
- error(nameLine, "redefinition", blockName.c_str(), "interface block name");
- recover();
- }
-
- // check for sampler types and apply layout qualifiers
- for(const auto &field : *fieldList) {
- TType* fieldType = field->type();
- if(IsSampler(fieldType->getBasicType())) {
- error(field->line(), "unsupported type", fieldType->getBasicString(), "sampler types are not allowed in interface blocks");
- recover();
- }
-
- const TQualifier qualifier = fieldType->getQualifier();
- switch(qualifier)
- {
- case EvqGlobal:
- case EvqUniform:
- break;
- default:
- error(field->line(), "invalid qualifier on interface block member", getQualifierString(qualifier));
- recover();
- break;
- }
-
- // check layout qualifiers
- TLayoutQualifier fieldLayoutQualifier = fieldType->getLayoutQualifier();
- if(layoutLocationErrorCheck(field->line(), fieldLayoutQualifier))
- {
- recover();
- }
-
- if(fieldLayoutQualifier.blockStorage != EbsUnspecified)
- {
- error(field->line(), "invalid layout qualifier:", getBlockStorageString(fieldLayoutQualifier.blockStorage), "cannot be used here");
- recover();
- }
-
- if(fieldLayoutQualifier.matrixPacking == EmpUnspecified)
- {
- fieldLayoutQualifier.matrixPacking = blockLayoutQualifier.matrixPacking;
- }
- else if(!fieldType->isMatrix() && (fieldType->getBasicType() != EbtStruct))
- {
- warning(field->line(), "extraneous layout qualifier:", getMatrixPackingString(fieldLayoutQualifier.matrixPacking), "only has an effect on matrix types");
- }
-
- fieldType->setLayoutQualifier(fieldLayoutQualifier);
-
- // Recursively propagate the matrix packing setting down to all block/structure members
- fieldType->setMatrixPackingIfUnspecified(fieldLayoutQualifier.matrixPacking);
- }
-
- // add array index
- int arraySize = 0;
- if(arrayIndex)
- {
- if(arraySizeErrorCheck(arrayIndexLine, arrayIndex, arraySize))
- recover();
- }
-
- TInterfaceBlock* interfaceBlock = new TInterfaceBlock(&blockName, fieldList, instanceName, arraySize, blockLayoutQualifier);
- TType interfaceBlockType(interfaceBlock, typeQualifier.qualifier, blockLayoutQualifier, arraySize);
-
- TString symbolName = "";
- int symbolId = 0;
-
- if(!instanceName)
- {
- // define symbols for the members of the interface block
- for(const auto &field : *fieldList)
- {
- TType* fieldType = field->type();
-
- // set parent pointer of the field variable
- fieldType->setInterfaceBlock(interfaceBlock);
-
- TVariable* fieldVariable = new TVariable(&field->name(), *fieldType);
- fieldVariable->setQualifier(typeQualifier.qualifier);
-
- if(!symbolTable.declare(fieldVariable)) {
- error(field->line(), "redefinition", field->name().c_str(), "interface block member name");
- recover();
- }
- }
- }
- else
- {
- if(reservedErrorCheck(nameLine, *instanceName))
- recover();
-
- // add a symbol for this interface block
- TVariable* instanceTypeDef = new TVariable(instanceName, interfaceBlockType, false);
- instanceTypeDef->setQualifier(typeQualifier.qualifier);
-
- if(!symbolTable.declare(instanceTypeDef)) {
- error(instanceLine, "redefinition", instanceName->c_str(), "interface block instance name");
- recover();
- }
-
- symbolId = instanceTypeDef->getUniqueId();
- symbolName = instanceTypeDef->getName();
- }
-
- TIntermAggregate *aggregate = intermediate.makeAggregate(intermediate.addSymbol(symbolId, symbolName, interfaceBlockType, typeQualifier.line), nameLine);
- aggregate->setOp(EOpDeclaration);
-
- exitStructDeclaration();
- return aggregate;
-}
-
-//
-// Parse an array index expression
-//
-TIntermTyped *TParseContext::addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc &location, TIntermTyped *indexExpression)
-{
- TIntermTyped *indexedExpression = nullptr;
-
- if(!baseExpression->isArray() && !baseExpression->isMatrix() && !baseExpression->isVector())
- {
- if(baseExpression->getAsSymbolNode())
- {
- error(location, " left of '[' is not of type array, matrix, or vector ",
- baseExpression->getAsSymbolNode()->getSymbol().c_str());
- }
- else
- {
- error(location, " left of '[' is not of type array, matrix, or vector ", "expression");
- }
- recover();
- }
-
- TIntermConstantUnion *indexConstantUnion = indexExpression->getAsConstantUnion();
-
- if(indexExpression->getQualifier() == EvqConstExpr && indexConstantUnion) // TODO: Qualifier check redundant?
- {
- int index = indexConstantUnion->getIConst(0);
- if(index < 0)
- {
- std::stringstream infoStream;
- infoStream << index;
- std::string info = infoStream.str();
- error(location, "negative index", info.c_str());
- recover();
- index = 0;
- }
- if(baseExpression->getType().getQualifier() == EvqConstExpr && baseExpression->getAsConstantUnion()) // TODO: Qualifier check redundant?
- {
- if(baseExpression->isArray())
- {
- // constant folding for arrays
- indexedExpression = addConstArrayNode(index, baseExpression, location);
- }
- else if(baseExpression->isVector())
- {
- // constant folding for vectors
- TVectorFields fields;
- fields.num = 1;
- fields.offsets[0] = index; // need to do it this way because v.xy sends fields integer array
- indexedExpression = addConstVectorNode(fields, baseExpression, location);
- }
- else if(baseExpression->isMatrix())
- {
- // constant folding for matrices
- indexedExpression = addConstMatrixNode(index, baseExpression, location);
- }
- }
- else
- {
- int safeIndex = -1;
-
- if(baseExpression->isArray())
- {
- if(index >= baseExpression->getType().getArraySize())
- {
- std::stringstream extraInfoStream;
- extraInfoStream << "array index out of range '" << index << "'";
- std::string extraInfo = extraInfoStream.str();
- error(location, "", "[", extraInfo.c_str());
- recover();
- safeIndex = baseExpression->getType().getArraySize() - 1;
- }
- }
- else if((baseExpression->isVector() || baseExpression->isMatrix()) &&
- baseExpression->getType().getNominalSize() <= index)
- {
- std::stringstream extraInfoStream;
- extraInfoStream << "field selection out of range '" << index << "'";
- std::string extraInfo = extraInfoStream.str();
- error(location, "", "[", extraInfo.c_str());
- recover();
- safeIndex = baseExpression->getType().getNominalSize() - 1;
- }
-
- // Don't modify the data of the previous constant union, because it can point
- // to builtins, like gl_MaxDrawBuffers. Instead use a new sanitized object.
- if(safeIndex != -1)
- {
- ConstantUnion *safeConstantUnion = new ConstantUnion();
- safeConstantUnion->setIConst(safeIndex);
- indexConstantUnion->replaceConstantUnion(safeConstantUnion);
- }
-
- indexedExpression = intermediate.addIndex(EOpIndexDirect, baseExpression, indexExpression, location);
- }
- }
- else
- {
- if(baseExpression->isInterfaceBlock())
- {
- error(location, "",
- "[", "array indexes for interface blocks arrays must be constant integral expressions");
- recover();
- }
- else if(baseExpression->getQualifier() == EvqFragmentOut)
- {
- error(location, "", "[", "array indexes for fragment outputs must be constant integral expressions");
- recover();
- }
-
- indexedExpression = intermediate.addIndex(EOpIndexIndirect, baseExpression, indexExpression, location);
- }
-
- if(indexedExpression == 0)
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setFConst(0.0f);
- indexedExpression = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpHigh, EvqConstExpr), location);
- }
- else if(baseExpression->isArray())
- {
- const TType &baseType = baseExpression->getType();
- if(baseType.getStruct())
- {
- TType copyOfType(baseType.getStruct());
- indexedExpression->setType(copyOfType);
- }
- else if(baseType.isInterfaceBlock())
- {
- TType copyOfType(baseType.getInterfaceBlock(), EvqTemporary, baseType.getLayoutQualifier(), 0);
- indexedExpression->setType(copyOfType);
- }
- else
- {
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),
- EvqTemporary, static_cast<unsigned char>(baseExpression->getNominalSize()),
- static_cast<unsigned char>(baseExpression->getSecondarySize())));
- }
-
- if(baseExpression->getType().getQualifier() == EvqConstExpr)
- {
- indexedExpression->getTypePointer()->setQualifier(EvqConstExpr);
- }
- }
- else if(baseExpression->isMatrix())
- {
- TQualifier qualifier = baseExpression->getType().getQualifier() == EvqConstExpr ? EvqConstExpr : EvqTemporary;
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),
- qualifier, static_cast<unsigned char>(baseExpression->getSecondarySize())));
- }
- else if(baseExpression->isVector())
- {
- TQualifier qualifier = baseExpression->getType().getQualifier() == EvqConstExpr ? EvqConstExpr : EvqTemporary;
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(), qualifier));
- }
- else
- {
- indexedExpression->setType(baseExpression->getType());
- }
-
- return indexedExpression;
-}
-
-TIntermTyped *TParseContext::addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc &dotLocation,
- const TString &fieldString, const TSourceLoc &fieldLocation)
-{
- TIntermTyped *indexedExpression = nullptr;
-
- if(baseExpression->isArray())
- {
- error(fieldLocation, "cannot apply dot operator to an array", ".");
- recover();
- }
-
- if(baseExpression->isVector())
- {
- TVectorFields fields;
- if(!parseVectorFields(fieldString, baseExpression->getNominalSize(), fields, fieldLocation))
- {
- fields.num = 1;
- fields.offsets[0] = 0;
- recover();
- }
-
- if(baseExpression->getAsConstantUnion())
- {
- // constant folding for vector fields
- indexedExpression = addConstVectorNode(fields, baseExpression, fieldLocation);
- if(indexedExpression == 0)
- {
- recover();
- indexedExpression = baseExpression;
- }
- }
- else
- {
- TString vectorString = fieldString;
- TIntermTyped *index = intermediate.addSwizzle(fields, fieldLocation);
- indexedExpression = intermediate.addIndex(EOpVectorSwizzle, baseExpression, index, dotLocation);
- indexedExpression->setType(TType(baseExpression->getBasicType(), baseExpression->getPrecision(),
- baseExpression->getQualifier() == EvqConstExpr ? EvqConstExpr : EvqTemporary, (unsigned char)vectorString.size()));
- }
- }
- else if(baseExpression->getBasicType() == EbtStruct)
- {
- bool fieldFound = false;
- const TFieldList &fields = baseExpression->getType().getStruct()->fields();
- if(fields.empty())
- {
- error(dotLocation, "structure has no fields", "Internal Error");
- recover();
- indexedExpression = baseExpression;
- }
- else
- {
- unsigned int i;
- for(i = 0; i < fields.size(); ++i)
- {
- if(fields[i]->name() == fieldString)
- {
- fieldFound = true;
- break;
- }
- }
- if(fieldFound)
- {
- if(baseExpression->getType().getQualifier() == EvqConstExpr)
- {
- indexedExpression = addConstStruct(fieldString, baseExpression, dotLocation);
- if(indexedExpression == 0)
- {
- recover();
- indexedExpression = baseExpression;
- }
- else
- {
- indexedExpression->setType(*fields[i]->type());
- // change the qualifier of the return type, not of the structure field
- // as the structure definition is shared between various structures.
- indexedExpression->getTypePointer()->setQualifier(EvqConstExpr);
- }
- }
- else
- {
- TIntermTyped *index = TIntermTyped::CreateIndexNode(i);
- index->setLine(fieldLocation);
- indexedExpression = intermediate.addIndex(EOpIndexDirectStruct, baseExpression, index, dotLocation);
- indexedExpression->setType(*fields[i]->type());
- }
- }
- else
- {
- error(dotLocation, " no such field in structure", fieldString.c_str());
- recover();
- indexedExpression = baseExpression;
- }
- }
- }
- else if(baseExpression->isInterfaceBlock())
- {
- bool fieldFound = false;
- const TFieldList &fields = baseExpression->getType().getInterfaceBlock()->fields();
- if(fields.empty())
- {
- error(dotLocation, "interface block has no fields", "Internal Error");
- recover();
- indexedExpression = baseExpression;
- }
- else
- {
- unsigned int i;
- for(i = 0; i < fields.size(); ++i)
- {
- if(fields[i]->name() == fieldString)
- {
- fieldFound = true;
- break;
- }
- }
- if(fieldFound)
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst(i);
- TIntermTyped *index = intermediate.addConstantUnion(unionArray, *fields[i]->type(), fieldLocation);
- indexedExpression = intermediate.addIndex(EOpIndexDirectInterfaceBlock, baseExpression, index,
- dotLocation);
- indexedExpression->setType(*fields[i]->type());
- }
- else
- {
- error(dotLocation, " no such field in interface block", fieldString.c_str());
- recover();
- indexedExpression = baseExpression;
- }
- }
- }
- else
- {
- if(mShaderVersion < 300)
- {
- error(dotLocation, " field selection requires structure or vector on left hand side",
- fieldString.c_str());
- }
- else
- {
- error(dotLocation,
- " field selection requires structure, vector, or interface block on left hand side",
- fieldString.c_str());
- }
- recover();
- indexedExpression = baseExpression;
- }
-
- return indexedExpression;
-}
-
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine)
-{
- TLayoutQualifier qualifier;
-
- qualifier.location = -1;
- qualifier.matrixPacking = EmpUnspecified;
- qualifier.blockStorage = EbsUnspecified;
-
- if(qualifierType == "shared")
- {
- qualifier.blockStorage = EbsShared;
- }
- else if(qualifierType == "packed")
- {
- qualifier.blockStorage = EbsPacked;
- }
- else if(qualifierType == "std140")
- {
- qualifier.blockStorage = EbsStd140;
- }
- else if(qualifierType == "row_major")
- {
- qualifier.matrixPacking = EmpRowMajor;
- }
- else if(qualifierType == "column_major")
- {
- qualifier.matrixPacking = EmpColumnMajor;
- }
- else if(qualifierType == "location")
- {
- error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "location requires an argument");
- recover();
- }
- else
- {
- error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str());
- recover();
- }
-
- return qualifier;
-}
-
-TLayoutQualifier TParseContext::parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, int intValue, const TSourceLoc& intValueLine)
-{
- TLayoutQualifier qualifier;
-
- qualifier.location = -1; // -1 isn't a valid location, it means the value isn't set. Negative values are checked lower in this function.
- qualifier.matrixPacking = EmpUnspecified;
- qualifier.blockStorage = EbsUnspecified;
-
- if (qualifierType != "location")
- {
- error(qualifierTypeLine, "invalid layout qualifier", qualifierType.c_str(), "only location may have arguments");
- recover();
- }
- else
- {
- // must check that location is non-negative
- if (intValue < 0)
- {
- error(intValueLine, "out of range:", "", "location must be non-negative");
- recover();
- }
- else
- {
- qualifier.location = intValue;
- }
- }
-
- return qualifier;
-}
-
-TLayoutQualifier TParseContext::joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier)
-{
- TLayoutQualifier joinedQualifier = leftQualifier;
-
- if (rightQualifier.location != -1)
- {
- joinedQualifier.location = rightQualifier.location;
- }
- if(rightQualifier.matrixPacking != EmpUnspecified)
- {
- joinedQualifier.matrixPacking = rightQualifier.matrixPacking;
- }
- if(rightQualifier.blockStorage != EbsUnspecified)
- {
- joinedQualifier.blockStorage = rightQualifier.blockStorage;
- }
-
- return joinedQualifier;
-}
-
-
-TPublicType TParseContext::joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier,
- const TSourceLoc &storageLoc, TQualifier storageQualifier)
-{
- TQualifier mergedQualifier = EvqSmoothIn;
-
- if(storageQualifier == EvqFragmentIn) {
- if(interpolationQualifier == EvqSmooth)
- mergedQualifier = EvqSmoothIn;
- else if(interpolationQualifier == EvqFlat)
- mergedQualifier = EvqFlatIn;
- else UNREACHABLE(interpolationQualifier);
- }
- else if(storageQualifier == EvqCentroidIn) {
- if(interpolationQualifier == EvqSmooth)
- mergedQualifier = EvqCentroidIn;
- else if(interpolationQualifier == EvqFlat)
- mergedQualifier = EvqFlatIn;
- else UNREACHABLE(interpolationQualifier);
- }
- else if(storageQualifier == EvqVertexOut) {
- if(interpolationQualifier == EvqSmooth)
- mergedQualifier = EvqSmoothOut;
- else if(interpolationQualifier == EvqFlat)
- mergedQualifier = EvqFlatOut;
- else UNREACHABLE(interpolationQualifier);
- }
- else if(storageQualifier == EvqCentroidOut) {
- if(interpolationQualifier == EvqSmooth)
- mergedQualifier = EvqCentroidOut;
- else if(interpolationQualifier == EvqFlat)
- mergedQualifier = EvqFlatOut;
- else UNREACHABLE(interpolationQualifier);
- }
- else {
- error(interpolationLoc, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString(interpolationQualifier));
- recover();
-
- mergedQualifier = storageQualifier;
- }
-
- TPublicType type;
- type.setBasic(EbtVoid, mergedQualifier, storageLoc);
- return type;
-}
-
-TFieldList *TParseContext::addStructDeclaratorList(const TPublicType &typeSpecifier, TFieldList *fieldList)
-{
- if(voidErrorCheck(typeSpecifier.line, (*fieldList)[0]->name(), typeSpecifier.type))
- {
- recover();
- }
-
- for(const auto &field : *fieldList)
- {
- //
- // Careful not to replace already known aspects of type, like array-ness
- //
- TType *type = field->type();
- type->setBasicType(typeSpecifier.type);
- type->setNominalSize(typeSpecifier.primarySize);
- type->setSecondarySize(typeSpecifier.secondarySize);
- type->setPrecision(typeSpecifier.precision);
- type->setQualifier(typeSpecifier.qualifier);
- type->setLayoutQualifier(typeSpecifier.layoutQualifier);
-
- // don't allow arrays of arrays
- if(type->isArray())
- {
- if(arrayTypeErrorCheck(typeSpecifier.line, typeSpecifier))
- recover();
- }
- if(typeSpecifier.array)
- type->setArraySize(typeSpecifier.arraySize);
- if(typeSpecifier.userDef)
- {
- type->setStruct(typeSpecifier.userDef->getStruct());
- }
-
- if(structNestingErrorCheck(typeSpecifier.line, *field))
- {
- recover();
- }
- }
-
- return fieldList;
-}
-
-TPublicType TParseContext::addStructure(const TSourceLoc &structLine, const TSourceLoc &nameLine,
- const TString *structName, TFieldList *fieldList)
-{
- TStructure *structure = new TStructure(structName, fieldList);
- TType *structureType = new TType(structure);
-
- // Store a bool in the struct if we're at global scope, to allow us to
- // skip the local struct scoping workaround in HLSL.
- structure->setUniqueId(TSymbolTableLevel::nextUniqueId());
- structure->setAtGlobalScope(symbolTable.atGlobalLevel());
-
- if(!structName->empty())
- {
- if(reservedErrorCheck(nameLine, *structName))
- {
- recover();
- }
- TVariable *userTypeDef = new TVariable(structName, *structureType, true);
- if(!symbolTable.declare(userTypeDef))
- {
- error(nameLine, "redefinition", structName->c_str(), "struct");
- recover();
- }
- }
-
- // ensure we do not specify any storage qualifiers on the struct members
- for(const auto &field : *fieldList)
- {
- const TQualifier qualifier = field->type()->getQualifier();
- switch(qualifier)
- {
- case EvqGlobal:
- case EvqTemporary:
- break;
- default:
- error(field->line(), "invalid qualifier on struct member", getQualifierString(qualifier));
- recover();
- break;
- }
- }
-
- TPublicType publicType;
- publicType.setBasic(EbtStruct, EvqTemporary, structLine);
- publicType.userDef = structureType;
- exitStructDeclaration();
-
- return publicType;
-}
-
-bool TParseContext::enterStructDeclaration(const TSourceLoc &line, const TString& identifier)
-{
- ++mStructNestingLevel;
-
- // Embedded structure definitions are not supported per GLSL ES spec.
- // They aren't allowed in GLSL either, but we need to detect this here
- // so we don't rely on the GLSL compiler to catch it.
- if (mStructNestingLevel > 1) {
- error(line, "", "Embedded struct definitions are not allowed");
- return true;
- }
-
- return false;
-}
-
-void TParseContext::exitStructDeclaration()
-{
- --mStructNestingLevel;
-}
-
-bool TParseContext::structNestingErrorCheck(const TSourceLoc &line, const TField &field)
-{
- static const int kWebGLMaxStructNesting = 4;
-
- if(field.type()->getBasicType() != EbtStruct)
- {
- return false;
- }
-
- // We're already inside a structure definition at this point, so add
- // one to the field's struct nesting.
- if(1 + field.type()->getDeepestStructNesting() > kWebGLMaxStructNesting)
- {
- std::stringstream reasonStream;
- reasonStream << "Reference of struct type "
- << field.type()->getStruct()->name().c_str()
- << " exceeds maximum allowed nesting level of "
- << kWebGLMaxStructNesting;
- std::string reason = reasonStream.str();
- error(line, reason.c_str(), field.name().c_str(), "");
- return true;
- }
-
- return false;
-}
-
-TIntermTyped *TParseContext::createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc, const TType *funcReturnType)
-{
- if(child == nullptr)
- {
- return nullptr;
- }
-
- switch(op)
- {
- case EOpLogicalNot:
- if(child->getBasicType() != EbtBool ||
- child->isMatrix() ||
- child->isArray() ||
- child->isVector())
- {
- return nullptr;
- }
- break;
- case EOpBitwiseNot:
- if((child->getBasicType() != EbtInt && child->getBasicType() != EbtUInt) ||
- child->isMatrix() ||
- child->isArray())
- {
- return nullptr;
- }
- break;
- case EOpPostIncrement:
- case EOpPreIncrement:
- case EOpPostDecrement:
- case EOpPreDecrement:
- case EOpNegative:
- if(child->getBasicType() == EbtStruct ||
- child->getBasicType() == EbtBool ||
- child->isArray())
- {
- return nullptr;
- }
- // Operators for built-ins are already type checked against their prototype.
- default:
- break;
- }
-
- return intermediate.addUnaryMath(op, child, loc, funcReturnType);
-}
-
-TIntermTyped *TParseContext::addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc)
-{
- TIntermTyped *node = createUnaryMath(op, child, loc, nullptr);
- if(node == nullptr)
- {
- unaryOpError(loc, getOperatorString(op), child->getCompleteString());
- recover();
- return child;
- }
- return node;
-}
-
-TIntermTyped *TParseContext::addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &loc)
-{
- if(lValueErrorCheck(loc, getOperatorString(op), child))
- recover();
- return addUnaryMath(op, child, loc);
-}
-
-bool TParseContext::binaryOpCommonCheck(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc)
-{
- if(left->isArray() || right->isArray())
- {
- if(mShaderVersion < 300)
- {
- error(loc, "Invalid operation for arrays", getOperatorString(op));
- return false;
- }
-
- if(left->isArray() != right->isArray())
- {
- error(loc, "array / non-array mismatch", getOperatorString(op));
- return false;
- }
-
- switch(op)
- {
- case EOpEqual:
- case EOpNotEqual:
- case EOpAssign:
- case EOpInitialize:
- break;
- default:
- error(loc, "Invalid operation for arrays", getOperatorString(op));
- return false;
- }
- // At this point, size of implicitly sized arrays should be resolved.
- if(left->getArraySize() != right->getArraySize())
- {
- error(loc, "array size mismatch", getOperatorString(op));
- return false;
- }
- }
-
- // Check ops which require integer / ivec parameters
- bool isBitShift = false;
- switch(op)
- {
- case EOpBitShiftLeft:
- case EOpBitShiftRight:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- // Unsigned can be bit-shifted by signed and vice versa, but we need to
- // check that the basic type is an integer type.
- isBitShift = true;
- if(!IsInteger(left->getBasicType()) || !IsInteger(right->getBasicType()))
- {
- return false;
- }
- break;
- case EOpBitwiseAnd:
- case EOpBitwiseXor:
- case EOpBitwiseOr:
- case EOpBitwiseAndAssign:
- case EOpBitwiseXorAssign:
- case EOpBitwiseOrAssign:
- // It is enough to check the type of only one operand, since later it
- // is checked that the operand types match.
- if(!IsInteger(left->getBasicType()))
- {
- return false;
- }
- break;
- default:
- break;
- }
-
- // GLSL ES 1.00 and 3.00 do not support implicit type casting.
- // So the basic type should usually match.
- if(!isBitShift && left->getBasicType() != right->getBasicType())
- {
- return false;
- }
-
- // Check that type sizes match exactly on ops that require that.
- // Also check restrictions for structs that contain arrays or samplers.
- switch(op)
- {
- case EOpAssign:
- case EOpInitialize:
- case EOpEqual:
- case EOpNotEqual:
- // ESSL 1.00 sections 5.7, 5.8, 5.9
- if(mShaderVersion < 300 && left->getType().isStructureContainingArrays())
- {
- error(loc, "undefined operation for structs containing arrays", getOperatorString(op));
- return false;
- }
- // Samplers as l-values are disallowed also in ESSL 3.00, see section 4.1.7,
- // we interpret the spec so that this extends to structs containing samplers,
- // similarly to ESSL 1.00 spec.
- if((mShaderVersion < 300 || op == EOpAssign || op == EOpInitialize) &&
- left->getType().isStructureContainingSamplers())
- {
- error(loc, "undefined operation for structs containing samplers", getOperatorString(op));
- return false;
- }
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- if((left->getNominalSize() != right->getNominalSize()) ||
- (left->getSecondarySize() != right->getSecondarySize()))
- {
- return false;
- }
- break;
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpIMod:
- case EOpBitShiftLeft:
- case EOpBitShiftRight:
- case EOpBitwiseAnd:
- case EOpBitwiseXor:
- case EOpBitwiseOr:
- case EOpAddAssign:
- case EOpSubAssign:
- case EOpDivAssign:
- case EOpIModAssign:
- case EOpBitShiftLeftAssign:
- case EOpBitShiftRightAssign:
- case EOpBitwiseAndAssign:
- case EOpBitwiseXorAssign:
- case EOpBitwiseOrAssign:
- if((left->isMatrix() && right->isVector()) || (left->isVector() && right->isMatrix()))
- {
- return false;
- }
-
- // Are the sizes compatible?
- if(left->getNominalSize() != right->getNominalSize() || left->getSecondarySize() != right->getSecondarySize())
- {
- // If the nominal sizes of operands do not match:
- // One of them must be a scalar.
- if(!left->isScalar() && !right->isScalar())
- return false;
-
- // In the case of compound assignment other than multiply-assign,
- // the right side needs to be a scalar. Otherwise a vector/matrix
- // would be assigned to a scalar. A scalar can't be shifted by a
- // vector either.
- if(!right->isScalar() && (IsAssignment(op) || op == EOpBitShiftLeft || op == EOpBitShiftRight))
- return false;
- }
- break;
- default:
- break;
- }
-
- return true;
-}
-
-TIntermSwitch *TParseContext::addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &loc)
-{
- TBasicType switchType = init->getBasicType();
- if((switchType != EbtInt && switchType != EbtUInt) ||
- init->isMatrix() ||
- init->isArray() ||
- init->isVector())
- {
- error(init->getLine(), "init-expression in a switch statement must be a scalar integer", "switch");
- recover();
- return nullptr;
- }
-
- if(statementList)
- {
- if(!ValidateSwitch::validate(switchType, this, statementList, loc))
- {
- recover();
- return nullptr;
- }
- }
-
- TIntermSwitch *node = intermediate.addSwitch(init, statementList, loc);
- if(node == nullptr)
- {
- error(loc, "erroneous switch statement", "switch");
- recover();
- return nullptr;
- }
- return node;
-}
-
-TIntermCase *TParseContext::addCase(TIntermTyped *condition, const TSourceLoc &loc)
-{
- if(mSwitchNestingLevel == 0)
- {
- error(loc, "case labels need to be inside switch statements", "case");
- recover();
- return nullptr;
- }
- if(condition == nullptr)
- {
- error(loc, "case label must have a condition", "case");
- recover();
- return nullptr;
- }
- if((condition->getBasicType() != EbtInt && condition->getBasicType() != EbtUInt) ||
- condition->isMatrix() ||
- condition->isArray() ||
- condition->isVector())
- {
- error(condition->getLine(), "case label must be a scalar integer", "case");
- recover();
- }
- TIntermConstantUnion *conditionConst = condition->getAsConstantUnion();
- if(conditionConst == nullptr)
- {
- error(condition->getLine(), "case label must be constant", "case");
- recover();
- }
- TIntermCase *node = intermediate.addCase(condition, loc);
- if(node == nullptr)
- {
- error(loc, "erroneous case statement", "case");
- recover();
- return nullptr;
- }
- return node;
-}
-
-TIntermCase *TParseContext::addDefault(const TSourceLoc &loc)
-{
- if(mSwitchNestingLevel == 0)
- {
- error(loc, "default labels need to be inside switch statements", "default");
- recover();
- return nullptr;
- }
- TIntermCase *node = intermediate.addCase(nullptr, loc);
- if(node == nullptr)
- {
- error(loc, "erroneous default statement", "default");
- recover();
- return nullptr;
- }
- return node;
-}
-TIntermTyped *TParseContext::createAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc)
-{
- if(binaryOpCommonCheck(op, left, right, loc))
- {
- return intermediate.addAssign(op, left, right, loc);
- }
- return nullptr;
-}
-
-TIntermTyped *TParseContext::addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc)
-{
- TIntermTyped *node = createAssign(op, left, right, loc);
- if(node == nullptr)
- {
- assignError(loc, "assign", left->getCompleteString(), right->getCompleteString());
- recover();
- return left;
- }
- return node;
-}
-
-TIntermTyped *TParseContext::addBinaryMathInternal(TOperator op, TIntermTyped *left, TIntermTyped *right,
- const TSourceLoc &loc)
-{
- if(!binaryOpCommonCheck(op, left, right, loc))
- return nullptr;
-
- switch(op)
- {
- case EOpEqual:
- case EOpNotEqual:
- break;
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- ASSERT(!left->isArray() && !right->isArray());
- if(left->isMatrix() || left->isVector() ||
- left->getBasicType() == EbtStruct)
- {
- return nullptr;
- }
- break;
- case EOpLogicalOr:
- case EOpLogicalXor:
- case EOpLogicalAnd:
- ASSERT(!left->isArray() && !right->isArray());
- if(left->getBasicType() != EbtBool ||
- left->isMatrix() || left->isVector())
- {
- return nullptr;
- }
- break;
- case EOpAdd:
- case EOpSub:
- case EOpDiv:
- case EOpMul:
- ASSERT(!left->isArray() && !right->isArray());
- if(left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool)
- {
- return nullptr;
- }
- break;
- case EOpIMod:
- ASSERT(!left->isArray() && !right->isArray());
- // Note that this is only for the % operator, not for mod()
- if(left->getBasicType() == EbtStruct || left->getBasicType() == EbtBool || left->getBasicType() == EbtFloat)
- {
- return nullptr;
- }
- break;
- // Note that for bitwise ops, type checking is done in promote() to
- // share code between ops and compound assignment
- default:
- break;
- }
-
- return intermediate.addBinaryMath(op, left, right, loc);
-}
-
-TIntermTyped *TParseContext::addBinaryMath(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc)
-{
- TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
- if(node == 0)
- {
- binaryOpError(loc, getOperatorString(op), left->getCompleteString(), right->getCompleteString());
- recover();
- return left;
- }
- return node;
-}
-
-TIntermTyped *TParseContext::addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc)
-{
- TIntermTyped *node = addBinaryMathInternal(op, left, right, loc);
- if(node == 0)
- {
- binaryOpError(loc, getOperatorString(op), left->getCompleteString(), right->getCompleteString());
- recover();
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setBConst(false);
- return intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), loc);
- }
- return node;
-}
-
-TIntermBranch *TParseContext::addBranch(TOperator op, const TSourceLoc &loc)
-{
- switch(op)
- {
- case EOpContinue:
- if(mLoopNestingLevel <= 0)
- {
- error(loc, "continue statement only allowed in loops", "");
- recover();
- }
- break;
- case EOpBreak:
- if(mLoopNestingLevel <= 0 && mSwitchNestingLevel <= 0)
- {
- error(loc, "break statement only allowed in loops and switch statements", "");
- recover();
- }
- break;
- case EOpReturn:
- if(mCurrentFunctionType->getBasicType() != EbtVoid)
- {
- error(loc, "non-void function must return a value", "return");
- recover();
- }
- break;
- default:
- // No checks for discard
- break;
- }
- return intermediate.addBranch(op, loc);
-}
-
-TIntermBranch *TParseContext::addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc)
-{
- ASSERT(op == EOpReturn);
- mFunctionReturnsValue = true;
- if(mCurrentFunctionType->getBasicType() == EbtVoid)
- {
- error(loc, "void function cannot return a value", "return");
- recover();
- }
- else if(*mCurrentFunctionType != returnValue->getType())
- {
- error(loc, "function return is not matching type:", "return");
- recover();
- }
- return intermediate.addBranch(op, returnValue, loc);
-}
-
-TIntermTyped *TParseContext::addFunctionCallOrMethod(TFunction *fnCall, TIntermNode *paramNode, TIntermNode *thisNode, const TSourceLoc &loc, bool *fatalError)
-{
- *fatalError = false;
- TOperator op = fnCall->getBuiltInOp();
- TIntermTyped *callNode = nullptr;
-
- if(thisNode != nullptr)
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- int arraySize = 0;
- TIntermTyped *typedThis = thisNode->getAsTyped();
- if(fnCall->getName() != "length")
- {
- error(loc, "invalid method", fnCall->getName().c_str());
- recover();
- }
- else if(paramNode != nullptr)
- {
- error(loc, "method takes no parameters", "length");
- recover();
- }
- else if(typedThis == nullptr || !typedThis->isArray())
- {
- error(loc, "length can only be called on arrays", "length");
- recover();
- }
- else
- {
- arraySize = typedThis->getArraySize();
- }
- unionArray->setIConst(arraySize);
- callNode = intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), loc);
- }
- else if(op != EOpNull)
- {
- //
- // Then this should be a constructor.
- // Don't go through the symbol table for constructors.
- // Their parameters will be verified algorithmically.
- //
- TType type(EbtVoid, EbpUndefined); // use this to get the type back
- if(!constructorErrorCheck(loc, paramNode, *fnCall, op, &type))
- {
- //
- // It's a constructor, of type 'type'.
- //
- callNode = addConstructor(paramNode, &type, op, fnCall, loc);
- }
-
- if(callNode == nullptr)
- {
- recover();
- callNode = intermediate.setAggregateOperator(nullptr, op, loc);
- }
- }
- else
- {
- //
- // Not a constructor. Find it in the symbol table.
- //
- const TFunction *fnCandidate;
- bool builtIn;
- fnCandidate = findFunction(loc, fnCall, &builtIn);
- if(fnCandidate)
- {
- //
- // A declared function.
- //
- if(builtIn && !fnCandidate->getExtension().empty() &&
- extensionErrorCheck(loc, fnCandidate->getExtension()))
- {
- recover();
- }
- op = fnCandidate->getBuiltInOp();
- if(builtIn && op != EOpNull)
- {
- //
- // A function call mapped to a built-in operation.
- //
- if(fnCandidate->getParamCount() == 1)
- {
- //
- // Treat it like a built-in unary operator.
- //
- TIntermNode *operand = paramNode->getAsAggregate()->getSequence()[0];
- callNode = createUnaryMath(op, operand->getAsTyped(), loc, &fnCandidate->getReturnType());
-
- if(callNode == nullptr)
- {
- std::stringstream extraInfoStream;
- extraInfoStream << "built in unary operator function. Type: "
- << static_cast<TIntermTyped*>(paramNode)->getCompleteString();
- std::string extraInfo = extraInfoStream.str();
- error(paramNode->getLine(), " wrong operand type", "Internal Error", extraInfo.c_str());
- *fatalError = true;
- return nullptr;
- }
- }
- else
- {
- TIntermAggregate *aggregate = intermediate.setAggregateOperator(paramNode, op, loc);
- aggregate->setType(fnCandidate->getReturnType());
-
- // Some built-in functions have out parameters too.
- functionCallLValueErrorCheck(fnCandidate, aggregate);
-
- callNode = aggregate;
-
- if(op == EOpClamp)
- {
- // Special case for clamp -- try to fold it as min(max(t, minVal), maxVal)
- TIntermSequence &parameters = paramNode->getAsAggregate()->getSequence();
- TIntermConstantUnion *valConstant = parameters[0]->getAsTyped()->getAsConstantUnion();
- TIntermConstantUnion *minConstant = parameters[1]->getAsTyped()->getAsConstantUnion();
- TIntermConstantUnion *maxConstant = parameters[2]->getAsTyped()->getAsConstantUnion();
-
- if (valConstant && minConstant && maxConstant)
- {
- TIntermTyped *typedReturnNode = valConstant->fold(EOpMax, minConstant, infoSink());
- if (typedReturnNode && typedReturnNode->getAsConstantUnion())
- {
- typedReturnNode = maxConstant->fold(EOpMin, typedReturnNode->getAsConstantUnion(), infoSink());
- }
- if (typedReturnNode)
- {
- callNode = typedReturnNode;
- }
- }
- }
- else
- {
- if(fnCandidate->getParamCount() == 2)
- {
- TIntermSequence &parameters = paramNode->getAsAggregate()->getSequence();
- TIntermTyped *left = parameters[0]->getAsTyped();
- TIntermTyped *right = parameters[1]->getAsTyped();
-
- TIntermConstantUnion *leftTempConstant = left->getAsConstantUnion();
- TIntermConstantUnion *rightTempConstant = right->getAsConstantUnion();
- if (leftTempConstant && rightTempConstant)
- {
- TIntermTyped *typedReturnNode = leftTempConstant->fold(op, rightTempConstant, infoSink());
-
- if(typedReturnNode)
- {
- callNode = typedReturnNode;
- }
- }
- else if (op == EOpMax || op == EOpMin)
- {
- TIntermSymbol *leftSymbol = left->getAsSymbolNode();
- TIntermSymbol *rightSymbol = right->getAsSymbolNode();
-
- if (leftSymbol && rightSymbol && leftSymbol->getId() == rightSymbol->getId())
- {
- callNode = left;
- }
- }
- }
- }
- }
- }
- else
- {
- // This is a real function call
-
- TIntermAggregate *aggregate = intermediate.setAggregateOperator(paramNode, EOpFunctionCall, loc);
- aggregate->setType(fnCandidate->getReturnType());
-
- // this is how we know whether the given function is a builtIn function or a user defined function
- // if builtIn == false, it's a userDefined -> could be an overloaded builtIn function also
- // if builtIn == true, it's definitely a builtIn function with EOpNull
- if(!builtIn)
- aggregate->setUserDefined();
- aggregate->setName(fnCandidate->getMangledName());
-
- callNode = aggregate;
-
- functionCallLValueErrorCheck(fnCandidate, aggregate);
- }
- }
- else
- {
- // error message was put out by findFunction()
- // Put on a dummy node for error recovery
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setFConst(0.0f);
- callNode = intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), loc);
- recover();
- }
- }
- delete fnCall;
- return callNode;
-}
-
-TIntermTyped *TParseContext::addTernarySelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &loc)
-{
- if(boolErrorCheck(loc, cond))
- recover();
-
- if(trueBlock->getType() != falseBlock->getType())
- {
- binaryOpError(loc, ":", trueBlock->getCompleteString(), falseBlock->getCompleteString());
- recover();
- return falseBlock;
- }
- // ESSL1 sections 5.2 and 5.7:
- // ESSL3 section 5.7:
- // Ternary operator is not among the operators allowed for structures/arrays.
- if(trueBlock->isArray() || trueBlock->getBasicType() == EbtStruct)
- {
- error(loc, "ternary operator is not allowed for structures or arrays", ":");
- recover();
- return falseBlock;
- }
- return intermediate.addSelection(cond, trueBlock, falseBlock, loc);
-}
-
-//
-// Parse an array of strings using yyparse.
-//
-// Returns 0 for success.
-//
-int PaParseStrings(int count, const char* const string[], const int length[],
- TParseContext* context) {
- if ((count == 0) || !string)
- return 1;
-
- if (glslang_initialize(context))
- return 1;
-
- int error = glslang_scan(count, string, length, context);
- if (!error)
- error = glslang_parse(context);
-
- glslang_finalize(context);
-
- return (error == 0) && (context->numErrors() == 0) ? 0 : 1;
-}
-
-
-
diff --git a/src/OpenGL/compiler/ParseHelper.h b/src/OpenGL/compiler/ParseHelper.h
deleted file mode 100644
index e52822034..000000000
--- a/src/OpenGL/compiler/ParseHelper.h
+++ /dev/null
@@ -1,281 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-#ifndef _PARSER_HELPER_INCLUDED_
-#define _PARSER_HELPER_INCLUDED_
-
-#include "Diagnostics.h"
-#include "DirectiveHandler.h"
-#include "localintermediate.h"
-#include "preprocessor/Preprocessor.h"
-#include "Compiler.h"
-#include "SymbolTable.h"
-
-struct TMatrixFields {
- bool wholeRow;
- bool wholeCol;
- int row;
- int col;
-};
-
-//
-// The following are extra variables needed during parsing, grouped together so
-// they can be passed to the parser without needing a global.
-//
-class TParseContext {
-public:
- TParseContext(TSymbolTable& symt, TExtensionBehavior& ext, TIntermediate& interm, GLenum type, int options, bool checksPrecErrors, const char* sourcePath, TInfoSink& is) :
- intermediate(interm),
- symbolTable(symt),
- compileOptions(options),
- sourcePath(sourcePath),
- lexAfterType(false),
- inTypeParen(false),
- AfterEOF(false),
- mDeferredSingleDeclarationErrorCheck(false),
- mShaderType(type),
- mShaderVersion(100),
- mTreeRoot(0),
- mLoopNestingLevel(0),
- mSwitchNestingLevel(0),
- mStructNestingLevel(0),
- mCurrentFunctionType(nullptr),
- mFunctionReturnsValue(false),
- mChecksPrecisionErrors(checksPrecErrors),
- mDefaultMatrixPacking(EmpColumnMajor),
- mDefaultBlockStorage(EbsShared),
- mDiagnostics(is),
- mDirectiveHandler(ext, mDiagnostics, mShaderVersion),
- mPreprocessor(&mDiagnostics, &mDirectiveHandler, pp::PreprocessorSettings()),
- mScanner(nullptr),
- mUsesFragData(false),
- mUsesFragColor(false) { }
- TIntermediate& intermediate; // to hold and build a parse tree
- TSymbolTable& symbolTable; // symbol table that goes with the language currently being parsed
- int compileOptions;
- const char* sourcePath; // Path of source file or null.
- bool lexAfterType; // true if we've recognized a type, so can only be looking for an identifier
- bool inTypeParen; // true if in parentheses, looking only for an identifier
- bool AfterEOF;
-
- const pp::Preprocessor &getPreprocessor() const { return mPreprocessor; }
- pp::Preprocessor &getPreprocessor() { return mPreprocessor; }
- void *getScanner() const { return mScanner; }
- void setScanner(void *scanner) { mScanner = scanner; }
- int getShaderVersion() const { return mShaderVersion; }
- GLenum getShaderType() const { return mShaderType; }
- int numErrors() const { return mDiagnostics.numErrors(); }
- TInfoSink &infoSink() { return mDiagnostics.infoSink(); }
- void error(const TSourceLoc &loc, const char *reason, const char* token,
- const char* extraInfo="");
- void warning(const TSourceLoc &loc, const char* reason, const char* token,
- const char* extraInfo="");
- void info(const TSourceLoc &loc, const char* reason, const char* token,
- const char* extraInfo="");
- void trace(const char* str);
- void recover();
- TIntermNode *getTreeRoot() const { return mTreeRoot; }
- void setTreeRoot(TIntermNode *treeRoot) { mTreeRoot = treeRoot; }
-
- bool getFunctionReturnsValue() const { return mFunctionReturnsValue; }
- void setFunctionReturnsValue(bool functionReturnsValue)
- {
- mFunctionReturnsValue = functionReturnsValue;
- }
-
- void setLoopNestingLevel(int loopNestintLevel)
- {
- mLoopNestingLevel = loopNestintLevel;
- }
-
- const TType *getCurrentFunctionType() const { return mCurrentFunctionType; }
- void setCurrentFunctionType(const TType *currentFunctionType)
- {
- mCurrentFunctionType = currentFunctionType;
- }
-
- void incrLoopNestingLevel() { ++mLoopNestingLevel; }
- void decrLoopNestingLevel() { --mLoopNestingLevel; }
-
- void incrSwitchNestingLevel() { ++mSwitchNestingLevel; }
- void decrSwitchNestingLevel() { --mSwitchNestingLevel; }
-
- // This method is guaranteed to succeed, even if no variable with 'name' exists.
- const TVariable *getNamedVariable(const TSourceLoc &location, const TString *name, const TSymbol *symbol);
-
- bool parseVectorFields(const TString&, int vecSize, TVectorFields&, const TSourceLoc &line);
-
- bool reservedErrorCheck(const TSourceLoc &line, const TString& identifier);
- void assignError(const TSourceLoc &line, const char* op, TString left, TString right);
- void unaryOpError(const TSourceLoc &line, const char* op, TString operand);
- void binaryOpError(const TSourceLoc &line, const char* op, TString left, TString right);
- bool precisionErrorCheck(const TSourceLoc &line, TPrecision precision, TBasicType type);
- bool lValueErrorCheck(const TSourceLoc &line, const char* op, TIntermTyped*);
- bool constErrorCheck(TIntermTyped* node);
- bool integerErrorCheck(TIntermTyped* node, const char* token);
- bool globalErrorCheck(const TSourceLoc &line, bool global, const char* token);
- bool constructorErrorCheck(const TSourceLoc &line, TIntermNode*, TFunction&, TOperator, TType*);
- bool arraySizeErrorCheck(const TSourceLoc &line, TIntermTyped* expr, int& size);
- bool arrayQualifierErrorCheck(const TSourceLoc &line, TPublicType type);
- bool arrayTypeErrorCheck(const TSourceLoc &line, TPublicType type);
- bool voidErrorCheck(const TSourceLoc&, const TString&, const TBasicType&);
- bool boolErrorCheck(const TSourceLoc&, const TIntermTyped*);
- bool boolErrorCheck(const TSourceLoc&, const TPublicType&);
- bool samplerErrorCheck(const TSourceLoc &line, const TPublicType& pType, const char* reason);
- bool locationDeclaratorListCheck(const TSourceLoc &line, const TPublicType &pType);
- bool structQualifierErrorCheck(const TSourceLoc &line, const TPublicType& pType);
- bool parameterSamplerErrorCheck(const TSourceLoc &line, TQualifier qualifier, const TType& type);
- bool nonInitConstErrorCheck(const TSourceLoc &line, TString& identifier, TPublicType& type, bool array);
- bool nonInitErrorCheck(const TSourceLoc &line, const TString& identifier, TPublicType& type);
- bool paramErrorCheck(const TSourceLoc &line, TQualifier qualifier, TQualifier paramQualifier, TType* type);
- bool extensionErrorCheck(const TSourceLoc &line, const TString&);
- bool singleDeclarationErrorCheck(const TPublicType &publicType, const TSourceLoc &identifierLocation);
- bool layoutLocationErrorCheck(const TSourceLoc& location, const TLayoutQualifier &layoutQualifier);
- bool functionCallLValueErrorCheck(const TFunction *fnCandidate, TIntermAggregate *);
- void es3InvariantErrorCheck(const TQualifier qualifier, const TSourceLoc &invariantLocation);
- void checkInputOutputTypeIsValidES3(const TQualifier qualifier, const TPublicType &type, const TSourceLoc &qualifierLocation);
-
- const TExtensionBehavior& extensionBehavior() const { return mDirectiveHandler.extensionBehavior(); }
- bool supportsExtension(const char* extension);
- void handleExtensionDirective(const TSourceLoc &line, const char* extName, const char* behavior);
-
- const TPragma& pragma() const { return mDirectiveHandler.pragma(); }
- void handlePragmaDirective(const TSourceLoc &line, const char* name, const char* value, bool stdgl);
-
- bool containsSampler(TType& type);
- const TFunction* findFunction(const TSourceLoc &line, TFunction* pfnCall, bool *builtIn = 0);
- bool executeInitializer(const TSourceLoc &line, const TString &identifier, const TPublicType &pType,
- TIntermTyped *initializer, TIntermNode **intermNode);
-
- TPublicType addFullySpecifiedType(TQualifier qualifier, bool invariant, TLayoutQualifier layoutQualifier, const TPublicType &typeSpecifier);
- bool arraySetMaxSize(TIntermSymbol*, TType*, int, bool, const TSourceLoc&);
-
- TIntermAggregate *parseSingleDeclaration(TPublicType &publicType, const TSourceLoc &identifierOrTypeLocation, const TString &identifier);
- TIntermAggregate *parseSingleArrayDeclaration(TPublicType &publicType, const TSourceLoc &identifierLocation, const TString &identifier,
- const TSourceLoc &indexLocation, TIntermTyped *indexExpression);
- TIntermAggregate *parseSingleInitDeclaration(const TPublicType &publicType, const TSourceLoc &identifierLocation, const TString &identifier,
- const TSourceLoc &initLocation, TIntermTyped *initializer);
-
- // Parse a declaration like "type a[n] = initializer"
- // Note that this does not apply to declarations like "type[n] a = initializer"
- TIntermAggregate *parseSingleArrayInitDeclaration(TPublicType &publicType, const TSourceLoc &identifierLocation, const TString &identifier,
- const TSourceLoc &indexLocation, TIntermTyped *indexExpression,
- const TSourceLoc &initLocation, TIntermTyped *initializer);
-
- TIntermAggregate *parseInvariantDeclaration(const TSourceLoc &invariantLoc, const TSourceLoc &identifierLoc, const TString *identifier,
- const TSymbol *symbol);
-
- TIntermAggregate *parseDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, const TSourceLoc &identifierLocation,
- const TString &identifier);
- TIntermAggregate *parseArrayDeclarator(TPublicType &publicType, TIntermAggregate *aggregateDeclaration, const TSourceLoc &identifierLocation,
- const TString &identifier, const TSourceLoc &arrayLocation, TIntermTyped *indexExpression);
- TIntermAggregate *parseInitDeclarator(const TPublicType &publicType, TIntermAggregate *aggregateDeclaration, const TSourceLoc &identifierLocation,
- const TString &identifier, const TSourceLoc &initLocation, TIntermTyped *initializer);
-
- // Parse a declarator like "a[n] = initializer"
- TIntermAggregate *parseArrayInitDeclarator(const TPublicType &publicType, TIntermAggregate *aggregateDeclaration, const TSourceLoc &identifierLocation,
- const TString &identifier, const TSourceLoc &indexLocation, TIntermTyped *indexExpression,
- const TSourceLoc &initLocation, TIntermTyped *initializer);
-
- void parseGlobalLayoutQualifier(const TPublicType &typeQualifier);
- TIntermAggregate *addFunctionPrototypeDeclaration(const TFunction &function, const TSourceLoc &location);
- TIntermAggregate *addFunctionDefinition(const TFunction &function, TIntermAggregate *functionPrototype, TIntermAggregate *functionBody, const TSourceLoc &location);
- void parseFunctionPrototype(const TSourceLoc &location, TFunction *function, TIntermAggregate **aggregateOut);
- TFunction *parseFunctionDeclarator(const TSourceLoc &location, TFunction *function);
- TFunction *addConstructorFunc(const TPublicType &publicType);
- TIntermTyped* addConstructor(TIntermNode*, const TType*, TOperator, TFunction*, const TSourceLoc&);
- TIntermTyped* foldConstConstructor(TIntermAggregate* aggrNode, const TType& type);
- TIntermTyped* addConstVectorNode(TVectorFields&, TIntermTyped*, const TSourceLoc&);
- TIntermTyped* addConstMatrixNode(int, TIntermTyped*, const TSourceLoc&);
- TIntermTyped* addConstArrayNode(int index, TIntermTyped* node, const TSourceLoc &line);
- TIntermTyped* addConstStruct(const TString&, TIntermTyped*, const TSourceLoc&);
- TIntermTyped *addIndexExpression(TIntermTyped *baseExpression, const TSourceLoc& location, TIntermTyped *indexExpression);
- TIntermTyped* addFieldSelectionExpression(TIntermTyped *baseExpression, const TSourceLoc &dotLocation, const TString &fieldString, const TSourceLoc &fieldLocation);
-
- TFieldList *addStructDeclaratorList(const TPublicType &typeSpecifier, TFieldList *fieldList);
- TPublicType addStructure(const TSourceLoc &structLine, const TSourceLoc &nameLine, const TString *structName, TFieldList *fieldList);
-
- TIntermAggregate* addInterfaceBlock(const TPublicType& typeQualifier, const TSourceLoc& nameLine, const TString& blockName, TFieldList* fieldList,
- const TString* instanceName, const TSourceLoc& instanceLine, TIntermTyped* arrayIndex, const TSourceLoc& arrayIndexLine);
-
- TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine);
- TLayoutQualifier parseLayoutQualifier(const TString &qualifierType, const TSourceLoc& qualifierTypeLine, int intValue, const TSourceLoc& intValueLine);
- TLayoutQualifier joinLayoutQualifiers(TLayoutQualifier leftQualifier, TLayoutQualifier rightQualifier);
- TPublicType joinInterpolationQualifiers(const TSourceLoc &interpolationLoc, TQualifier interpolationQualifier, const TSourceLoc &storageLoc, TQualifier storageQualifier);
-
- // Performs an error check for embedded struct declarations.
- // Returns true if an error was raised due to the declaration of
- // this struct.
- bool enterStructDeclaration(const TSourceLoc &line, const TString& identifier);
- void exitStructDeclaration();
-
- bool structNestingErrorCheck(const TSourceLoc &line, const TField &field);
-
- TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &loc);
- TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &loc);
- TIntermCase *addDefault(const TSourceLoc &loc);
-
- TIntermTyped *addUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
- TIntermTyped *addUnaryMathLValue(TOperator op, TIntermTyped *child, const TSourceLoc &loc);
- TIntermTyped *addBinaryMath(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
- TIntermTyped *addBinaryMathBooleanResult(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
-
- TIntermTyped *addAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
-
- TIntermBranch *addBranch(TOperator op, const TSourceLoc &loc);
- TIntermBranch *addBranch(TOperator op, TIntermTyped *returnValue, const TSourceLoc &loc);
-
- TIntermTyped *addFunctionCallOrMethod(TFunction *fnCall, TIntermNode *paramNode, TIntermNode *thisNode, const TSourceLoc &loc, bool *fatalError);
-
- TIntermTyped *addTernarySelection(TIntermTyped *cond, TIntermTyped *trueBlock, TIntermTyped *falseBlock, const TSourceLoc &line);
-
-private:
- bool declareVariable(const TSourceLoc &line, const TString &identifier, const TType &type, TVariable **variable);
-
- TIntermTyped *addBinaryMathInternal(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
- TIntermTyped *createAssign(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
-
- // The funcReturnType parameter is expected to be non-null when the operation is a built-in function.
- // It is expected to be null for other unary operators.
- TIntermTyped *createUnaryMath(TOperator op, TIntermTyped *child, const TSourceLoc &loc, const TType *funcReturnType);
-
- // Return true if the checks pass
- bool binaryOpCommonCheck(TOperator op, TIntermTyped *left, TIntermTyped *right, const TSourceLoc &loc);
-
- // Set to true when the last/current declarator list was started with an empty declaration.
- bool mDeferredSingleDeclarationErrorCheck;
-
- GLenum mShaderType; // vertex or fragment language (future: pack or unpack)
- int mShaderVersion;
- TIntermNode *mTreeRoot; // root of parse tree being created
- int mLoopNestingLevel; // 0 if outside all loops
- int mSwitchNestingLevel; // 0 if outside all switch statements
- int mStructNestingLevel; // incremented while parsing a struct declaration
- const TType *mCurrentFunctionType; // the return type of the function that's currently being parsed
- bool mFunctionReturnsValue; // true if a non-void function has a return
- bool mChecksPrecisionErrors; // true if an error will be generated when a variable is declared without precision, explicit or implicit.
-
- TLayoutMatrixPacking mDefaultMatrixPacking;
- TLayoutBlockStorage mDefaultBlockStorage;
- TDiagnostics mDiagnostics;
- TDirectiveHandler mDirectiveHandler;
- pp::Preprocessor mPreprocessor;
- void *mScanner;
- bool mUsesFragData; // track if we are using both gl_FragData and gl_FragColor
- bool mUsesFragColor;
-};
-
-int PaParseStrings(int count, const char* const string[], const int length[],
- TParseContext* context);
-
-#endif // _PARSER_HELPER_INCLUDED_
diff --git a/src/OpenGL/compiler/PoolAlloc.cpp b/src/OpenGL/compiler/PoolAlloc.cpp
deleted file mode 100644
index 94f9cc992..000000000
--- a/src/OpenGL/compiler/PoolAlloc.cpp
+++ /dev/null
@@ -1,337 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PoolAlloc.h"
-
-#ifndef _MSC_VER
-#include <stdint.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "InitializeGlobals.h"
-#include "osinclude.h"
-
-OS_TLSIndex PoolIndex = OS_INVALID_TLS_INDEX;
-
-bool InitializePoolIndex()
-{
- assert(PoolIndex == OS_INVALID_TLS_INDEX);
-
- PoolIndex = OS_AllocTLSIndex();
- return PoolIndex != OS_INVALID_TLS_INDEX;
-}
-
-void FreePoolIndex()
-{
- assert(PoolIndex != OS_INVALID_TLS_INDEX);
-
- OS_FreeTLSIndex(PoolIndex);
- PoolIndex = OS_INVALID_TLS_INDEX;
-}
-
-TPoolAllocator* GetGlobalPoolAllocator()
-{
- assert(PoolIndex != OS_INVALID_TLS_INDEX);
- return static_cast<TPoolAllocator*>(OS_GetTLSValue(PoolIndex));
-}
-
-void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator)
-{
- assert(PoolIndex != OS_INVALID_TLS_INDEX);
- OS_SetTLSValue(PoolIndex, poolAllocator);
-}
-
-//
-// Implement the functionality of the TPoolAllocator class, which
-// is documented in PoolAlloc.h.
-//
-TPoolAllocator::TPoolAllocator(int growthIncrement, int allocationAlignment) :
- alignment(allocationAlignment)
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- , pageSize(growthIncrement),
- freeList(0),
- inUseList(0),
- numCalls(0),
- totalBytes(0)
-#endif
-{
- //
- // Adjust alignment to be at least pointer aligned and
- // power of 2.
- //
- size_t minAlign = sizeof(void*);
- alignment &= ~(minAlign - 1);
- if (alignment < minAlign)
- alignment = minAlign;
- size_t a = 1;
- while (a < alignment)
- a <<= 1;
- alignment = a;
- alignmentMask = a - 1;
-
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- //
- // Don't allow page sizes we know are smaller than all common
- // OS page sizes.
- //
- if (pageSize < 4*1024)
- pageSize = 4*1024;
-
- //
- // A large currentPageOffset indicates a new page needs to
- // be obtained to allocate memory.
- //
- currentPageOffset = pageSize;
-
- //
- // Align header skip
- //
- headerSkip = minAlign;
- if (headerSkip < sizeof(tHeader)) {
- headerSkip = (sizeof(tHeader) + alignmentMask) & ~alignmentMask;
- }
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- mStack.push_back({});
-#endif
-}
-
-TPoolAllocator::~TPoolAllocator()
-{
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- while (inUseList) {
- tHeader* next = inUseList->nextPage;
- inUseList->~tHeader();
- delete [] reinterpret_cast<char*>(inUseList);
- inUseList = next;
- }
-
- // We should not check the guard blocks
- // here, because we did it already when the block was
- // placed into the free list.
- //
- while (freeList) {
- tHeader* next = freeList->nextPage;
- delete [] reinterpret_cast<char*>(freeList);
- freeList = next;
- }
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- for (auto& allocs : mStack) {
- for (auto alloc : allocs) {
- free(alloc);
- }
- }
- mStack.clear();
-#endif
-}
-
-// Support MSVC++ 6.0
-const unsigned char TAllocation::guardBlockBeginVal = 0xfb;
-const unsigned char TAllocation::guardBlockEndVal = 0xfe;
-const unsigned char TAllocation::userDataFill = 0xcd;
-
-#ifdef GUARD_BLOCKS
- const size_t TAllocation::guardBlockSize = 16;
-#else
- const size_t TAllocation::guardBlockSize = 0;
-#endif
-
-//
-// Check a single guard block for damage
-//
-void TAllocation::checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const
-{
-#ifdef GUARD_BLOCKS
- for (size_t x = 0; x < guardBlockSize; x++) {
- if (blockMem[x] != val) {
- char assertMsg[80];
-
- // We don't print the assert message. It's here just to be helpful.
- #if defined(_MSC_VER)
- _snprintf(assertMsg, sizeof(assertMsg), "PoolAlloc: Damage %s %Iu byte allocation at 0x%p\n",
- locText, size, data());
- #else
- snprintf(assertMsg, sizeof(assertMsg), "PoolAlloc: Damage %s %zu byte allocation at 0x%p\n",
- locText, size, data());
- #endif
- assert(0 && "PoolAlloc: Damage in guard block");
- }
- }
-#endif
-}
-
-
-void TPoolAllocator::push()
-{
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- tAllocState state = { currentPageOffset, inUseList };
-
- mStack.push_back(state);
-
- //
- // Indicate there is no current page to allocate from.
- //
- currentPageOffset = pageSize;
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- mStack.push_back({});
-#endif
-}
-
-//
-// Do a mass-deallocation of all the individual allocations
-// that have occurred since the last push(), or since the
-// last pop(), or since the object's creation.
-//
-// The deallocated pages are saved for future allocations.
-//
-void TPoolAllocator::pop()
-{
- if (mStack.size() < 1)
- return;
-
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- tHeader* page = mStack.back().page;
- currentPageOffset = mStack.back().offset;
-
- while (inUseList != page) {
- // invoke destructor to free allocation list
- inUseList->~tHeader();
-
- tHeader* nextInUse = inUseList->nextPage;
- if (inUseList->pageCount > 1)
- delete [] reinterpret_cast<char*>(inUseList);
- else {
- inUseList->nextPage = freeList;
- freeList = inUseList;
- }
- inUseList = nextInUse;
- }
-
- mStack.pop_back();
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- for (auto alloc : mStack.back()) {
- free(alloc);
- }
- mStack.pop_back();
-#endif
-}
-
-//
-// Do a mass-deallocation of all the individual allocations
-// that have occurred.
-//
-void TPoolAllocator::popAll()
-{
- while (mStack.size() > 0)
- pop();
-}
-
-void* TPoolAllocator::allocate(size_t numBytes)
-{
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- //
- // Just keep some interesting statistics.
- //
- ++numCalls;
- totalBytes += numBytes;
-
- // If we are using guard blocks, all allocations are bracketed by
- // them: [guardblock][allocation][guardblock]. numBytes is how
- // much memory the caller asked for. allocationSize is the total
- // size including guard blocks. In release build,
- // guardBlockSize=0 and this all gets optimized away.
- size_t allocationSize = TAllocation::allocationSize(numBytes);
- // Detect integer overflow.
- if (allocationSize < numBytes)
- return 0;
-
- //
- // Do the allocation, most likely case first, for efficiency.
- // This step could be moved to be inline sometime.
- //
- if (allocationSize <= pageSize - currentPageOffset) {
- //
- // Safe to allocate from currentPageOffset.
- //
- unsigned char* memory = reinterpret_cast<unsigned char *>(inUseList) + currentPageOffset;
- currentPageOffset += allocationSize;
- currentPageOffset = (currentPageOffset + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, memory, numBytes);
- }
-
- if (allocationSize > pageSize - headerSkip) {
- //
- // Do a multi-page allocation. Don't mix these with the others.
- // The OS is efficient and allocating and free-ing multiple pages.
- //
- size_t numBytesToAlloc = allocationSize + headerSkip;
- // Detect integer overflow.
- if (numBytesToAlloc < allocationSize)
- return 0;
-
- tHeader* memory = reinterpret_cast<tHeader*>(::new char[numBytesToAlloc]);
- if (memory == 0)
- return 0;
-
- // Use placement-new to initialize header
- new(memory) tHeader(inUseList, (numBytesToAlloc + pageSize - 1) / pageSize);
- inUseList = memory;
-
- currentPageOffset = pageSize; // make next allocation come from a new page
-
- // No guard blocks for multi-page allocations (yet)
- return reinterpret_cast<void*>(reinterpret_cast<uintptr_t>(memory) + headerSkip);
- }
-
- //
- // Need a simple page to allocate from.
- //
- tHeader* memory;
- if (freeList) {
- memory = freeList;
- freeList = freeList->nextPage;
- } else {
- memory = reinterpret_cast<tHeader*>(::new char[pageSize]);
- if (memory == 0)
- return 0;
- }
-
- // Use placement-new to initialize header
- new(memory) tHeader(inUseList, 1);
- inUseList = memory;
-
- unsigned char* ret = reinterpret_cast<unsigned char *>(inUseList) + headerSkip;
- currentPageOffset = (headerSkip + allocationSize + alignmentMask) & ~alignmentMask;
-
- return initializeAllocation(inUseList, ret, numBytes);
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- void *alloc = malloc(numBytes + alignmentMask);
- mStack.back().push_back(alloc);
-
- intptr_t intAlloc = reinterpret_cast<intptr_t>(alloc);
- intAlloc = (intAlloc + alignmentMask) & ~alignmentMask;
- return reinterpret_cast<void *>(intAlloc);
-#endif
-}
-
-
-//
-// Check all allocations in a list for damage by calling check on each.
-//
-void TAllocation::checkAllocList() const
-{
- for (const TAllocation* alloc = this; alloc != 0; alloc = alloc->prevAlloc)
- alloc->check();
-}
diff --git a/src/OpenGL/compiler/PoolAlloc.h b/src/OpenGL/compiler/PoolAlloc.h
deleted file mode 100644
index d645a0427..000000000
--- a/src/OpenGL/compiler/PoolAlloc.h
+++ /dev/null
@@ -1,314 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _POOLALLOC_INCLUDED_
-#define _POOLALLOC_INCLUDED_
-
-#ifdef _DEBUG
-#define GUARD_BLOCKS // define to enable guard block sanity checking
-#endif
-
-//
-// This header defines an allocator that can be used to efficiently
-// allocate a large number of small requests for heap memory, with the
-// intention that they are not individually deallocated, but rather
-// collectively deallocated at one time.
-//
-// This simultaneously
-//
-// * Makes each individual allocation much more efficient; the
-// typical allocation is trivial.
-// * Completely avoids the cost of doing individual deallocation.
-// * Saves the trouble of tracking down and plugging a large class of leaks.
-//
-// Individual classes can use this allocator by supplying their own
-// new and delete methods.
-//
-// STL containers can use this allocator by using the pool_allocator
-// class as the allocator (second) template argument.
-//
-
-#include <stddef.h>
-#include <string.h>
-#include <vector>
-
-// If we are using guard blocks, we must track each indivual
-// allocation. If we aren't using guard blocks, these
-// never get instantiated, so won't have any impact.
-//
-
-class TAllocation {
-public:
- TAllocation(size_t size, unsigned char* mem, TAllocation* prev = 0) :
- size(size), mem(mem), prevAlloc(prev) {
- // Allocations are bracketed:
- // [allocationHeader][initialGuardBlock][userData][finalGuardBlock]
- // This would be cleaner with if (guardBlockSize)..., but that
- // makes the compiler print warnings about 0 length memsets,
- // even with the if() protecting them.
-#ifdef GUARD_BLOCKS
- memset(preGuard(), guardBlockBeginVal, guardBlockSize);
- memset(data(), userDataFill, size);
- memset(postGuard(), guardBlockEndVal, guardBlockSize);
-#endif
- }
-
- void check() const {
- checkGuardBlock(preGuard(), guardBlockBeginVal, "before");
- checkGuardBlock(postGuard(), guardBlockEndVal, "after");
- }
-
- void checkAllocList() const;
-
- // Return total size needed to accomodate user buffer of 'size',
- // plus our tracking data.
- inline static size_t allocationSize(size_t size) {
- return size + 2 * guardBlockSize + headerSize();
- }
-
- // Offset from surrounding buffer to get to user data buffer.
- inline static unsigned char* offsetAllocation(unsigned char* m) {
- return m + guardBlockSize + headerSize();
- }
-
-private:
- void checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const;
-
- // Find offsets to pre and post guard blocks, and user data buffer
- unsigned char* preGuard() const { return mem + headerSize(); }
- unsigned char* data() const { return preGuard() + guardBlockSize; }
- unsigned char* postGuard() const { return data() + size; }
-
- size_t size; // size of the user data area
- unsigned char* mem; // beginning of our allocation (pts to header)
- TAllocation* prevAlloc; // prior allocation in the chain
-
- // Support MSVC++ 6.0
- const static unsigned char guardBlockBeginVal;
- const static unsigned char guardBlockEndVal;
- const static unsigned char userDataFill;
-
- const static size_t guardBlockSize;
-#ifdef GUARD_BLOCKS
- inline static size_t headerSize() { return sizeof(TAllocation); }
-#else
- inline static size_t headerSize() { return 0; }
-#endif
-};
-
-//
-// There are several stacks. One is to track the pushing and popping
-// of the user, and not yet implemented. The others are simply a
-// repositories of free pages or used pages.
-//
-// Page stacks are linked together with a simple header at the beginning
-// of each allocation obtained from the underlying OS. Multi-page allocations
-// are returned to the OS. Individual page allocations are kept for future
-// re-use.
-//
-// The "page size" used is not, nor must it match, the underlying OS
-// page size. But, having it be about that size or equal to a set of
-// pages is likely most optimal.
-//
-class TPoolAllocator {
-public:
- TPoolAllocator(int growthIncrement = 8*1024, int allocationAlignment = 16);
-
- //
- // Don't call the destructor just to free up the memory, call pop()
- //
- ~TPoolAllocator();
-
- //
- // Call push() to establish a new place to pop memory too. Does not
- // have to be called to get things started.
- //
- void push();
-
- //
- // Call pop() to free all memory allocated since the last call to push(),
- // or if no last call to push, frees all memory since first allocation.
- //
- void pop();
-
- //
- // Call popAll() to free all memory allocated.
- //
- void popAll();
-
- //
- // Call allocate() to actually acquire memory. Returns 0 if no memory
- // available, otherwise a properly aligned pointer to 'numBytes' of memory.
- //
- void* allocate(size_t numBytes);
-
- //
- // There is no deallocate. The point of this class is that
- // deallocation can be skipped by the user of it, as the model
- // of use is to simultaneously deallocate everything at once
- // by calling pop(), and to not have to solve memory leak problems.
- //
-
-private:
- size_t alignment; // all returned allocations will be aligned at
- // this granularity, which will be a power of 2
- size_t alignmentMask;
-
-#if !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- friend struct tHeader;
-
- struct tHeader {
- tHeader(tHeader* nextPage, size_t pageCount) :
- nextPage(nextPage),
- pageCount(pageCount)
-#ifdef GUARD_BLOCKS
- , lastAllocation(0)
-#endif
- { }
-
- ~tHeader() {
-#ifdef GUARD_BLOCKS
- if (lastAllocation)
- lastAllocation->checkAllocList();
-#endif
- }
-
- tHeader* nextPage;
- size_t pageCount;
-#ifdef GUARD_BLOCKS
- TAllocation* lastAllocation;
-#endif
- };
-
- struct tAllocState {
- size_t offset;
- tHeader* page;
- };
- typedef std::vector<tAllocState> tAllocStack;
-
- // Track allocations if and only if we're using guard blocks
- void* initializeAllocation(tHeader* block, unsigned char* memory, size_t numBytes) {
-#ifdef GUARD_BLOCKS
- new(memory) TAllocation(numBytes, memory, block->lastAllocation);
- block->lastAllocation = reinterpret_cast<TAllocation*>(memory);
-#endif
- // This is optimized entirely away if GUARD_BLOCKS is not defined.
- return TAllocation::offsetAllocation(memory);
- }
-
- size_t pageSize; // granularity of allocation from the OS
- size_t headerSkip; // amount of memory to skip to make room for the
- // header (basically, size of header, rounded
- // up to make it aligned
- size_t currentPageOffset; // next offset in top of inUseList to allocate from
- tHeader* freeList; // list of popped memory
- tHeader* inUseList; // list of all memory currently being used
- tAllocStack mStack; // stack of where to allocate from, to partition pool
-
- int numCalls; // just an interesting statistic
- size_t totalBytes; // just an interesting statistic
-
-#else // !defined(SWIFTSHADER_TRANSLATOR_DISABLE_POOL_ALLOC)
- std::vector<std::vector<void *>> mStack;
-#endif
-
- TPoolAllocator& operator=(const TPoolAllocator&); // dont allow assignment operator
- TPoolAllocator(const TPoolAllocator&); // dont allow default copy constructor
-};
-
-
-//
-// There could potentially be many pools with pops happening at
-// different times. But a simple use is to have a global pop
-// with everyone using the same global allocator.
-//
-extern TPoolAllocator* GetGlobalPoolAllocator();
-extern void SetGlobalPoolAllocator(TPoolAllocator* poolAllocator);
-
-//
-// This STL compatible allocator is intended to be used as the allocator
-// parameter to templatized STL containers, like vector and map.
-//
-// It will use the pools for allocation, and not
-// do any deallocation, but will still do destruction.
-//
-template<class T>
-class pool_allocator {
-public:
- typedef size_t size_type;
- typedef ptrdiff_t difference_type;
- typedef T* pointer;
- typedef const T* const_pointer;
- typedef T& reference;
- typedef const T& const_reference;
- typedef T value_type;
-
- template<class Other>
- struct rebind {
- typedef pool_allocator<Other> other;
- };
- pointer address(reference x) const { return &x; }
- const_pointer address(const_reference x) const { return &x; }
-
- pool_allocator() : allocator(GetGlobalPoolAllocator()) { }
- pool_allocator(TPoolAllocator& a) : allocator(&a) { }
- pool_allocator(const pool_allocator<T>& p) : allocator(p.allocator) { }
-
- template <class Other>
- pool_allocator<T>& operator=(const pool_allocator<Other>& p) {
- allocator = p.allocator;
- return *this;
- }
-
- template<class Other>
- pool_allocator(const pool_allocator<Other>& p) : allocator(&p.getAllocator()) { }
-
-#if defined(__SUNPRO_CC) && !defined(_RWSTD_ALLOCATOR)
- // libCStd on some platforms have a different allocate/deallocate interface.
- // Caller pre-bakes sizeof(T) into 'n' which is the number of bytes to be
- // allocated, not the number of elements.
- void* allocate(size_type n) {
- return getAllocator().allocate(n);
- }
- void* allocate(size_type n, const void*) {
- return getAllocator().allocate(n);
- }
- void deallocate(void*, size_type) {}
-#else
- pointer allocate(size_type n) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
- }
- pointer allocate(size_type n, const void*) {
- return reinterpret_cast<pointer>(getAllocator().allocate(n * sizeof(T)));
- }
- void deallocate(pointer, size_type) {}
-#endif // _RWSTD_ALLOCATOR
-
- void construct(pointer p, const T& val) { new ((void *)p) T(val); }
- void destroy(pointer p) { p->T::~T(); }
-
- bool operator==(const pool_allocator& rhs) const { return &getAllocator() == &rhs.getAllocator(); }
- bool operator!=(const pool_allocator& rhs) const { return &getAllocator() != &rhs.getAllocator(); }
-
- size_type max_size() const { return static_cast<size_type>(-1) / sizeof(T); }
- size_type max_size(int size) const { return static_cast<size_type>(-1) / size; }
-
- void setAllocator(TPoolAllocator *a) { allocator = a; }
- TPoolAllocator& getAllocator() const { return *allocator; }
-
-protected:
- TPoolAllocator *allocator;
-};
-
-#endif // _POOLALLOC_INCLUDED_
diff --git a/src/OpenGL/compiler/Pragma.h b/src/OpenGL/compiler/Pragma.h
deleted file mode 100644
index 04df5b1c9..000000000
--- a/src/OpenGL/compiler/Pragma.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PRAGMA_H_
-#define COMPILER_PRAGMA_H_
-
-struct TPragma {
- // By default optimization is turned on and debug is turned off.
- TPragma() : optimize(true), debug(false) { }
- TPragma(bool o, bool d) : optimize(o), debug(d) { }
-
- bool optimize;
- bool debug;
-};
-
-#endif // COMPILER_PRAGMA_H_
diff --git a/src/OpenGL/compiler/SymbolTable.cpp b/src/OpenGL/compiler/SymbolTable.cpp
deleted file mode 100644
index 3e6cae8b8..000000000
--- a/src/OpenGL/compiler/SymbolTable.cpp
+++ /dev/null
@@ -1,284 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// Symbol table for parsing. Most functionaliy and main ideas
-// are documented in the header file.
-//
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4718)
-#endif
-
-#include "SymbolTable.h"
-
-#include <stdio.h>
-#include <limits.h>
-#include <algorithm>
-
-#if defined(_MSC_VER) && MSC_VER < 1900
-#define snprintf _snprintf
-#endif
-
-int TSymbolTableLevel::uniqueId = 0;
-
-TType::TType(const TPublicType &p) :
- type(p.type), precision(p.precision), qualifier(p.qualifier),
- primarySize(p.primarySize), secondarySize(p.secondarySize), array(p.array), arraySize(p.arraySize), maxArraySize(0),
- arrayInformationType(0), interfaceBlock(0), layoutQualifier(p.layoutQualifier), structure(0), mangled(0)
-{
- if (p.userDef)
- {
- structure = p.userDef->getStruct();
- }
-}
-
-//
-// Recursively generate mangled names.
-//
-void TType::buildMangledName(TString& mangledName)
-{
- if (isMatrix())
- mangledName += 'm';
- else if (isVector())
- mangledName += 'v';
-
- switch (type) {
- case EbtFloat: mangledName += 'f'; break;
- case EbtInt: mangledName += 'i'; break;
- case EbtUInt: mangledName += 'u'; break;
- case EbtBool: mangledName += 'b'; break;
- case EbtSampler2D: mangledName += "s2"; break;
- case EbtSampler3D: mangledName += "s3"; break;
- case EbtSamplerCube: mangledName += "sC"; break;
- case EbtSampler2DArray: mangledName += "s2a"; break;
- case EbtSampler2DRect: mangledName += "s2r"; break;
- case EbtSamplerExternalOES: mangledName += "sext"; break;
- case EbtISampler2D: mangledName += "is2"; break;
- case EbtISampler3D: mangledName += "is3"; break;
- case EbtISamplerCube: mangledName += "isC"; break;
- case EbtISampler2DArray: mangledName += "is2a"; break;
- case EbtUSampler2D: mangledName += "us2"; break;
- case EbtUSampler3D: mangledName += "us3"; break;
- case EbtUSamplerCube: mangledName += "usC"; break;
- case EbtUSampler2DArray: mangledName += "us2a"; break;
- case EbtSampler2DShadow: mangledName += "s2s"; break;
- case EbtSamplerCubeShadow: mangledName += "sCs"; break;
- case EbtSampler2DArrayShadow: mangledName += "s2as"; break;
- case EbtStruct: mangledName += structure->mangledName(); break;
- case EbtInterfaceBlock: mangledName += interfaceBlock->mangledName(); break;
- default:
- break;
- }
-
- mangledName += static_cast<char>('0' + getNominalSize());
- if(isMatrix()) {
- mangledName += static_cast<char>('0' + getSecondarySize());
- }
- if (isArray()) {
- char buf[20];
- snprintf(buf, sizeof(buf), "%d", arraySize);
- mangledName += '[';
- mangledName += buf;
- mangledName += ']';
- }
-}
-
-size_t TType::getStructSize() const
-{
- if (!getStruct()) {
- assert(false && "Not a struct");
- return 0;
- }
-
- return getStruct()->objectSize();
-}
-
-bool TStructure::containsArrays() const
-{
- for(const auto& field : *mFields)
- {
- const TType *fieldType = field->type();
- if(fieldType->isArray() || fieldType->isStructureContainingArrays())
- return true;
- }
- return false;
-}
-
-bool TStructure::containsType(TBasicType type) const
-{
- for(const auto& field : *mFields)
- {
- const TType *fieldType = field->type();
- if(fieldType->getBasicType() == type || fieldType->isStructureContainingType(type))
- return true;
- }
- return false;
-}
-
-bool TStructure::containsSamplers() const
-{
- for(const auto& field : *mFields)
- {
- const TType *fieldType = field->type();
- if(IsSampler(fieldType->getBasicType()) || fieldType->isStructureContainingSamplers())
- return true;
- }
- return false;
-}
-
-void TStructure::setMatrixPackingIfUnspecified(TLayoutMatrixPacking matrixPacking)
-{
- for(auto& field : *mFields)
- {
- field->type()->setMatrixPackingIfUnspecified(matrixPacking);
- }
-}
-
-TString TFieldListCollection::buildMangledName() const
-{
- TString mangledName(mangledNamePrefix());
- mangledName += *mName;
- for(const auto& field : *mFields)
- {
- mangledName += '-';
- mangledName += field->type()->getMangledName();
- }
- return mangledName;
-}
-
-size_t TFieldListCollection::calculateObjectSize() const
-{
- size_t size = 0;
- for(const auto& field : *mFields)
- {
- size_t fieldSize = field->type()->getObjectSize();
- if(fieldSize > INT_MAX - size)
- size = INT_MAX;
- else
- size += fieldSize;
- }
- return size;
-}
-
-int TStructure::calculateDeepestNesting() const
-{
- int maxNesting = 0;
- for(const auto& field : *mFields)
- maxNesting = std::max(maxNesting, field->type()->getDeepestStructNesting());
- return 1 + maxNesting;
-}
-
-//
-// Functions have buried pointers to delete.
-//
-TFunction::~TFunction()
-{
- for (TParamList::iterator i = parameters.begin(); i != parameters.end(); ++i)
- delete (*i).type;
-}
-
-//
-// Symbol table levels are a map of pointers to symbols that have to be deleted.
-//
-TSymbolTableLevel::~TSymbolTableLevel()
-{
- for (tLevel::iterator it = level.begin(); it != level.end(); ++it)
- delete (*it).second;
-}
-
-bool TSymbolTableLevel::insert(TSymbol *symbol)
-{
- symbol->setUniqueId(nextUniqueId());
-
- // returning true means symbol was added to the table
- tInsertResult result = level.insert(tLevelPair(symbol->getMangledName(), symbol));
-
- return result.second;
-}
-
-bool TSymbolTableLevel::insertUnmangled(TFunction *function)
-{
- function->setUniqueId(nextUniqueId());
-
- // returning true means symbol was added to the table
- tInsertResult result = level.insert(tLevelPair(function->getName(), function));
-
- return result.second;
-}
-
-TSymbol *TSymbolTableLevel::find(const TString &name) const
-{
- tLevel::const_iterator it = level.find(name);
- if (it == level.end())
- return 0;
- else
- return (*it).second;
-}
-
-TSymbol *TSymbolTable::find(const TString &name, int shaderVersion, bool *builtIn, bool *sameScope) const
-{
- int level = currentLevel();
- TSymbol *symbol = nullptr;
-
- do
- {
- while((level == ESSL3_BUILTINS && shaderVersion != 300) ||
- (level == ESSL1_BUILTINS && shaderVersion != 100)) // Skip version specific levels
- {
- --level;
- }
-
- symbol = table[level]->find(name);
- }
- while(!symbol && --level >= 0); // Doesn't decrement level when a symbol was found
-
- if(builtIn)
- {
- *builtIn = (level <= LAST_BUILTIN_LEVEL);
- }
-
- if(sameScope)
- {
- *sameScope = (level == currentLevel());
- }
-
- return symbol;
-}
-
-TSymbol *TSymbolTable::findBuiltIn(const TString &name, int shaderVersion) const
-{
- for(int level = LAST_BUILTIN_LEVEL; level >= 0; --level)
- {
- while((level == ESSL3_BUILTINS && shaderVersion != 300) ||
- (level == ESSL1_BUILTINS && shaderVersion != 100)) // Skip version specific levels
- {
- --level;
- }
-
- TSymbol *symbol = table[level]->find(name);
-
- if(symbol)
- {
- return symbol;
- }
- }
-
- return 0;
-}
-
-TSymbol::TSymbol(const TSymbol& copyOf)
-{
- name = NewPoolTString(copyOf.name->c_str());
-}
diff --git a/src/OpenGL/compiler/SymbolTable.h b/src/OpenGL/compiler/SymbolTable.h
deleted file mode 100644
index 7cf41bea3..000000000
--- a/src/OpenGL/compiler/SymbolTable.h
+++ /dev/null
@@ -1,534 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _SYMBOL_TABLE_INCLUDED_
-#define _SYMBOL_TABLE_INCLUDED_
-
-//
-// Symbol table for parsing. Has these design characteristics:
-//
-// * Same symbol table can be used to compile many shaders, to preserve
-// effort of creating and loading with the large numbers of built-in
-// symbols.
-//
-// * Name mangling will be used to give each function a unique name
-// so that symbol table lookups are never ambiguous. This allows
-// a simpler symbol table structure.
-//
-// * Pushing and popping of scope, so symbol table will really be a stack
-// of symbol tables. Searched from the top, with new inserts going into
-// the top.
-//
-// * Constants: Compile time constant symbols will keep their values
-// in the symbol table. The parser can substitute constants at parse
-// time, including doing constant folding and constant propagation.
-//
-// * No temporaries: Temporaries made from operations (+, --, .xy, etc.)
-// are tracked in the intermediate representation, not the symbol table.
-//
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "../../Common/DebugAndroid.hpp"
-#else
-#include <assert.h>
-#endif
-
-#include "InfoSink.h"
-#include "intermediate.h"
-#include <set>
-
-//
-// Symbol base class. (Can build functions or variables out of these...)
-//
-class TSymbol
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- TSymbol(const TString *n) : name(n) { }
- virtual ~TSymbol() { /* don't delete name, it's from the pool */ }
-
- const TString& getName() const { return *name; }
- virtual const TString& getMangledName() const { return getName(); }
- virtual bool isFunction() const { return false; }
- virtual bool isVariable() const { return false; }
- void setUniqueId(int id) { uniqueId = id; }
- int getUniqueId() const { return uniqueId; }
- TSymbol(const TSymbol&);
-
-protected:
- const TString *name;
- unsigned int uniqueId; // For real comparing during code generation
-};
-
-//
-// Variable class, meaning a symbol that's not a function.
-//
-// There could be a separate class heirarchy for Constant variables;
-// Only one of int, bool, or float, (or none) is correct for
-// any particular use, but it's easy to do this way, and doesn't
-// seem worth having separate classes, and "getConst" can't simply return
-// different values for different types polymorphically, so this is
-// just simple and pragmatic.
-//
-class TVariable : public TSymbol
-{
-public:
- TVariable(const TString *name, const TType& t, bool uT = false ) : TSymbol(name), type(t), userType(uT), unionArray(0), arrayInformationType(0) { }
- virtual ~TVariable() { }
- virtual bool isVariable() const { return true; }
- TType& getType() { return type; }
- const TType& getType() const { return type; }
- bool isUserType() const { return userType; }
- void setQualifier(TQualifier qualifier) { type.setQualifier(qualifier); }
- void updateArrayInformationType(TType *t) { arrayInformationType = t; }
- TType* getArrayInformationType() { return arrayInformationType; }
-
- ConstantUnion* getConstPointer()
- {
- if (!unionArray)
- unionArray = new ConstantUnion[type.getObjectSize()];
-
- return unionArray;
- }
-
- ConstantUnion* getConstPointer() const { return unionArray; }
- bool isConstant() const { return unionArray != nullptr; }
-
- void shareConstPointer( ConstantUnion *constArray)
- {
- if (unionArray == constArray)
- return;
-
- delete[] unionArray;
- unionArray = constArray;
- }
-
-protected:
- TType type;
- bool userType;
- // we are assuming that Pool Allocator will free the memory allocated to unionArray
- // when this object is destroyed
- ConstantUnion *unionArray;
- TType *arrayInformationType; // this is used for updating maxArraySize in all the references to a given symbol
-};
-
-//
-// The function sub-class of symbols and the parser will need to
-// share this definition of a function parameter.
-//
-struct TParameter
-{
- TString *name;
- TType *type;
-};
-
-//
-// The function sub-class of a symbol.
-//
-class TFunction : public TSymbol
-{
-public:
- TFunction(TOperator o) :
- TSymbol(0),
- returnType(TType(EbtVoid, EbpUndefined)),
- op(o),
- defined(false),
- prototypeDeclaration(false) { }
- TFunction(const TString *name, const TType& retType, TOperator tOp = EOpNull, const char *ext = "") :
- TSymbol(name),
- returnType(retType),
- mangledName(TFunction::mangleName(*name)),
- op(tOp),
- extension(ext),
- defined(false),
- prototypeDeclaration(false) { }
- virtual ~TFunction();
- virtual bool isFunction() const { return true; }
-
- static TString mangleName(const TString& name) { return name + '('; }
- static TString unmangleName(const TString& mangledName)
- {
- return TString(mangledName.c_str(), mangledName.find_first_of('('));
- }
-
- void addParameter(TParameter& p)
- {
- parameters.push_back(p);
- mangledName = mangledName + p.type->getMangledName();
- }
-
- const TString& getMangledName() const { return mangledName; }
- const TType& getReturnType() const { return returnType; }
-
- TOperator getBuiltInOp() const { return op; }
- const TString& getExtension() const { return extension; }
-
- void setDefined() { defined = true; }
- bool isDefined() { return defined; }
- void setHasPrototypeDeclaration() { prototypeDeclaration = true; }
- bool hasPrototypeDeclaration() const { return prototypeDeclaration; }
-
- size_t getParamCount() const { return parameters.size(); }
- const TParameter& getParam(int i) const { return parameters[i]; }
-
-protected:
- typedef TVector<TParameter> TParamList;
- TParamList parameters;
- TType returnType;
- TString mangledName;
- TOperator op;
- TString extension;
- bool defined;
- bool prototypeDeclaration;
-};
-
-
-class TSymbolTableLevel
-{
-public:
- typedef TMap<TString, TSymbol*> tLevel;
- typedef tLevel::const_iterator const_iterator;
- typedef const tLevel::value_type tLevelPair;
- typedef std::pair<tLevel::iterator, bool> tInsertResult;
-
- POOL_ALLOCATOR_NEW_DELETE()
- TSymbolTableLevel() { }
- ~TSymbolTableLevel();
-
- bool insert(TSymbol *symbol);
-
- // Insert a function using its unmangled name as the key.
- bool insertUnmangled(TFunction *function);
-
- TSymbol *find(const TString &name) const;
-
- static int nextUniqueId()
- {
- return ++uniqueId;
- }
-
-protected:
- tLevel level;
- static int uniqueId; // for unique identification in code generation
-};
-
-enum ESymbolLevel
-{
- COMMON_BUILTINS,
- ESSL1_BUILTINS,
- ESSL3_BUILTINS,
- LAST_BUILTIN_LEVEL = ESSL3_BUILTINS,
- GLOBAL_LEVEL
-};
-
-inline bool IsGenType(const TType *type)
-{
- if(type)
- {
- TBasicType basicType = type->getBasicType();
- return basicType == EbtGenType || basicType == EbtGenIType || basicType == EbtGenUType || basicType == EbtGenBType;
- }
-
- return false;
-}
-
-inline bool IsVecType(const TType *type)
-{
- if(type)
- {
- TBasicType basicType = type->getBasicType();
- return basicType == EbtVec || basicType == EbtIVec || basicType == EbtUVec || basicType == EbtBVec;
- }
-
- return false;
-}
-
-inline TType *GenType(TType *type, int size)
-{
- ASSERT(size >= 1 && size <= 4);
-
- if(!type)
- {
- return nullptr;
- }
-
- ASSERT(!IsVecType(type));
-
- switch(type->getBasicType())
- {
- case EbtGenType: return new TType(EbtFloat, size);
- case EbtGenIType: return new TType(EbtInt, size);
- case EbtGenUType: return new TType(EbtUInt, size);
- case EbtGenBType: return new TType(EbtBool, size);
- default: return type;
- }
-}
-
-inline TType *VecType(TType *type, int size)
-{
- ASSERT(size >= 2 && size <= 4);
-
- if(!type)
- {
- return nullptr;
- }
-
- ASSERT(!IsGenType(type));
-
- switch(type->getBasicType())
- {
- case EbtVec: return new TType(EbtFloat, size);
- case EbtIVec: return new TType(EbtInt, size);
- case EbtUVec: return new TType(EbtUInt, size);
- case EbtBVec: return new TType(EbtBool, size);
- default: return type;
- }
-}
-
-class TSymbolTable
-{
-public:
- TSymbolTable()
- : mGlobalInvariant(false)
- {
- //
- // The symbol table cannot be used until push() is called, but
- // the lack of an initial call to push() can be used to detect
- // that the symbol table has not been preloaded with built-ins.
- //
- }
-
- ~TSymbolTable()
- {
- while(currentLevel() > LAST_BUILTIN_LEVEL)
- {
- pop();
- }
- }
-
- bool isEmpty() { return table.empty(); }
- bool atBuiltInLevel() { return currentLevel() <= LAST_BUILTIN_LEVEL; }
- bool atGlobalLevel() { return currentLevel() <= GLOBAL_LEVEL; }
- void push()
- {
- table.push_back(new TSymbolTableLevel);
- precisionStack.push_back( PrecisionStackLevel() );
- }
-
- void pop()
- {
- delete table[currentLevel()];
- table.pop_back();
- precisionStack.pop_back();
- }
-
- bool declare(TSymbol *symbol)
- {
- return insert(currentLevel(), symbol);
- }
-
- bool insert(ESymbolLevel level, TSymbol *symbol)
- {
- return table[level]->insert(symbol);
- }
-
- bool insertConstInt(ESymbolLevel level, const char *name, int value)
- {
- TVariable *constant = new TVariable(NewPoolTString(name), TType(EbtInt, EbpUndefined, EvqConstExpr, 1));
- constant->getConstPointer()->setIConst(value);
- return insert(level, constant);
- }
-
- void insertBuiltIn(ESymbolLevel level, TOperator op, const char *ext, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
- {
- if(ptype1->getBasicType() == EbtGSampler2D)
- {
- insertUnmangledBuiltIn(name);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2D), ptype2, ptype3, ptype4, ptype5);
- }
- else if(ptype1->getBasicType() == EbtGSampler3D)
- {
- insertUnmangledBuiltIn(name);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler3D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler3D), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler3D), ptype2, ptype3, ptype4, ptype5);
- }
- else if(ptype1->getBasicType() == EbtGSamplerCube)
- {
- insertUnmangledBuiltIn(name);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSamplerCube), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISamplerCube), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSamplerCube), ptype2, ptype3, ptype4, ptype5);
- }
- else if(ptype1->getBasicType() == EbtGSampler2DArray)
- {
- insertUnmangledBuiltIn(name);
- bool gvec4 = (rvalue->getBasicType() == EbtGVec4);
- insertBuiltIn(level, gvec4 ? new TType(EbtFloat, 4) : rvalue, name, new TType(EbtSampler2DArray), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtInt, 4) : rvalue, name, new TType(EbtISampler2DArray), ptype2, ptype3, ptype4, ptype5);
- insertBuiltIn(level, gvec4 ? new TType(EbtUInt, 4) : rvalue, name, new TType(EbtUSampler2DArray), ptype2, ptype3, ptype4, ptype5);
- }
- else if(IsGenType(rvalue) || IsGenType(ptype1) || IsGenType(ptype2) || IsGenType(ptype3))
- {
- ASSERT(!ptype4);
- insertUnmangledBuiltIn(name);
- insertBuiltIn(level, op, ext, GenType(rvalue, 1), name, GenType(ptype1, 1), GenType(ptype2, 1), GenType(ptype3, 1));
- insertBuiltIn(level, op, ext, GenType(rvalue, 2), name, GenType(ptype1, 2), GenType(ptype2, 2), GenType(ptype3, 2));
- insertBuiltIn(level, op, ext, GenType(rvalue, 3), name, GenType(ptype1, 3), GenType(ptype2, 3), GenType(ptype3, 3));
- insertBuiltIn(level, op, ext, GenType(rvalue, 4), name, GenType(ptype1, 4), GenType(ptype2, 4), GenType(ptype3, 4));
- }
- else if(IsVecType(rvalue) || IsVecType(ptype1) || IsVecType(ptype2) || IsVecType(ptype3))
- {
- ASSERT(!ptype4);
- insertUnmangledBuiltIn(name);
- insertBuiltIn(level, op, ext, VecType(rvalue, 2), name, VecType(ptype1, 2), VecType(ptype2, 2), VecType(ptype3, 2));
- insertBuiltIn(level, op, ext, VecType(rvalue, 3), name, VecType(ptype1, 3), VecType(ptype2, 3), VecType(ptype3, 3));
- insertBuiltIn(level, op, ext, VecType(rvalue, 4), name, VecType(ptype1, 4), VecType(ptype2, 4), VecType(ptype3, 4));
- }
- else
- {
- TFunction *function = new TFunction(NewPoolTString(name), *rvalue, op, ext);
-
- TParameter param1 = {0, ptype1};
- function->addParameter(param1);
-
- if(ptype2)
- {
- TParameter param2 = {0, ptype2};
- function->addParameter(param2);
- }
-
- if(ptype3)
- {
- TParameter param3 = {0, ptype3};
- function->addParameter(param3);
- }
-
- if(ptype4)
- {
- TParameter param4 = {0, ptype4};
- function->addParameter(param4);
- }
-
- if(ptype5)
- {
- TParameter param5 = {0, ptype5};
- function->addParameter(param5);
- }
-
- ASSERT(hasUnmangledBuiltIn(name));
- insert(level, function);
- }
- }
-
- void insertBuiltIn(ESymbolLevel level, TOperator op, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
- {
- insertUnmangledBuiltIn(name);
- insertBuiltIn(level, op, "", rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
- }
-
- void insertBuiltIn(ESymbolLevel level, TType *rvalue, const char *name, TType *ptype1, TType *ptype2 = 0, TType *ptype3 = 0, TType *ptype4 = 0, TType *ptype5 = 0)
- {
- insertUnmangledBuiltIn(name);
- insertBuiltIn(level, EOpNull, rvalue, name, ptype1, ptype2, ptype3, ptype4, ptype5);
- }
-
- TSymbol *find(const TString &name, int shaderVersion, bool *builtIn = nullptr, bool *sameScope = nullptr) const;
- TSymbol *findBuiltIn(const TString &name, int shaderVersion) const;
-
- TSymbolTableLevel *getOuterLevel() const
- {
- assert(currentLevel() >= 1);
- return table[currentLevel() - 1];
- }
-
- bool setDefaultPrecision(const TPublicType &type, TPrecision prec)
- {
- if (IsSampler(type.type))
- return true; // Skip sampler types for the time being
- if (type.type != EbtFloat && type.type != EbtInt)
- return false; // Only set default precision for int/float
- if (type.primarySize > 1 || type.secondarySize > 1 || type.array)
- return false; // Not allowed to set for aggregate types
- int indexOfLastElement = static_cast<int>(precisionStack.size()) - 1;
- precisionStack[indexOfLastElement][type.type] = prec; // Uses map operator [], overwrites the current value
- return true;
- }
-
- // Searches down the precisionStack for a precision qualifier for the specified TBasicType
- TPrecision getDefaultPrecision( TBasicType type)
- {
- // unsigned integers use the same precision as signed
- if (type == EbtUInt) type = EbtInt;
-
- if( type != EbtFloat && type != EbtInt ) return EbpUndefined;
- int level = static_cast<int>(precisionStack.size()) - 1;
- assert( level >= 0); // Just to be safe. Should not happen.
- PrecisionStackLevel::iterator it;
- TPrecision prec = EbpUndefined; // If we dont find anything we return this. Should we error check this?
- while( level >= 0 ){
- it = precisionStack[level].find( type );
- if( it != precisionStack[level].end() ){
- prec = (*it).second;
- break;
- }
- level--;
- }
- return prec;
- }
-
- // This records invariant varyings declared through
- // "invariant varying_name;".
- void addInvariantVarying(const std::string &originalName)
- {
- mInvariantVaryings.insert(originalName);
- }
- // If this returns false, the varying could still be invariant
- // if it is set as invariant during the varying variable
- // declaration - this piece of information is stored in the
- // variable's type, not here.
- bool isVaryingInvariant(const std::string &originalName) const
- {
- return (mGlobalInvariant ||
- mInvariantVaryings.count(originalName) > 0);
- }
-
- void setGlobalInvariant() { mGlobalInvariant = true; }
- bool getGlobalInvariant() const { return mGlobalInvariant; }
-
- bool hasUnmangledBuiltIn(const char *name) { return mUnmangledBuiltinNames.count(std::string(name)) > 0; }
-
-private:
- // Used to insert unmangled functions to check redeclaration of built-ins in ESSL 3.00.
- void insertUnmangledBuiltIn(const char *name) { mUnmangledBuiltinNames.insert(std::string(name)); }
-
-protected:
- ESymbolLevel currentLevel() const { return static_cast<ESymbolLevel>(table.size() - 1); }
-
- std::vector<TSymbolTableLevel*> table;
- typedef std::map< TBasicType, TPrecision > PrecisionStackLevel;
- std::vector< PrecisionStackLevel > precisionStack;
-
- std::set<std::string> mUnmangledBuiltinNames;
-
- std::set<std::string> mInvariantVaryings;
- bool mGlobalInvariant;
-};
-
-#endif // _SYMBOL_TABLE_INCLUDED_
diff --git a/src/OpenGL/compiler/TranslatorASM.cpp b/src/OpenGL/compiler/TranslatorASM.cpp
deleted file mode 100644
index 05ea246be..000000000
--- a/src/OpenGL/compiler/TranslatorASM.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "TranslatorASM.h"
-
-#include "InitializeParseContext.h"
-
-TranslatorASM::TranslatorASM(glsl::Shader *shaderObject, GLenum shaderType) : TCompiler(shaderType), shaderObject(shaderObject)
-{
-}
-
-bool TranslatorASM::translate(TIntermNode* root)
-{
- TParseContext& parseContext = *GetGlobalParseContext();
- glsl::OutputASM outputASM(parseContext, shaderObject);
-
- outputASM.output();
-
- return parseContext.numErrors() == 0;
-}
diff --git a/src/OpenGL/compiler/TranslatorASM.h b/src/OpenGL/compiler/TranslatorASM.h
deleted file mode 100644
index c31df96a0..000000000
--- a/src/OpenGL/compiler/TranslatorASM.h
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_TRANSLATORASM_H_
-#define COMPILER_TRANSLATORASM_H_
-
-#include "Compiler.h"
-#include "OutputASM.h"
-
-namespace glsl
-{
- class Shader;
-}
-
-class TranslatorASM : public TCompiler
-{
-public:
- TranslatorASM(glsl::Shader *shaderObject, GLenum type);
-
-protected:
- virtual bool translate(TIntermNode* root);
-
-private:
- glsl::Shader *const shaderObject;
-};
-
-#endif // COMPILER_TRANSLATORASM_H_
diff --git a/src/OpenGL/compiler/Types.h b/src/OpenGL/compiler/Types.h
deleted file mode 100644
index 846b240dc..000000000
--- a/src/OpenGL/compiler/Types.h
+++ /dev/null
@@ -1,673 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _TYPES_INCLUDED
-#define _TYPES_INCLUDED
-
-#include "BaseTypes.h"
-#include "Common.h"
-#include "debug.h"
-
-#include <algorithm>
-
-class TType;
-struct TPublicType;
-
-class TField
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- TField(TType *type, TString *name, const TSourceLoc &line)
- : mType(type),
- mName(name),
- mLine(line)
- {
- }
-
- // TODO(alokp): We should only return const type.
- // Fix it by tweaking grammar.
- TType *type()
- {
- return mType;
- }
- const TType *type() const
- {
- return mType;
- }
-
- const TString &name() const
- {
- return *mName;
- }
- const TSourceLoc &line() const
- {
- return mLine;
- }
-
-private:
- TType *mType;
- TString *mName;
- TSourceLoc mLine;
-};
-
-typedef TVector<TField *> TFieldList;
-inline TFieldList *NewPoolTFieldList()
-{
- void *memory = GetGlobalPoolAllocator()->allocate(sizeof(TFieldList));
- return new(memory)TFieldList;
-}
-
-class TFieldListCollection
-{
-public:
- virtual ~TFieldListCollection() { }
- const TString &name() const
- {
- return *mName;
- }
- const TFieldList &fields() const
- {
- return *mFields;
- }
-
- const TString &mangledName() const
- {
- if(mMangledName.empty())
- mMangledName = buildMangledName();
- return mMangledName;
- }
- size_t objectSize() const
- {
- if(mObjectSize == 0)
- mObjectSize = calculateObjectSize();
- return mObjectSize;
- }
-
-protected:
- TFieldListCollection(const TString *name, TFieldList *fields)
- : mName(name),
- mFields(fields),
- mObjectSize(0)
- {
- }
- TString buildMangledName() const;
- size_t calculateObjectSize() const;
- virtual TString mangledNamePrefix() const = 0;
-
- const TString *mName;
- TFieldList *mFields;
-
- mutable TString mMangledName;
- mutable size_t mObjectSize;
-};
-
-// May also represent interface blocks
-class TStructure : public TFieldListCollection
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- TStructure(const TString *name, TFieldList *fields)
- : TFieldListCollection(name, fields),
- mDeepestNesting(0),
- mUniqueId(0),
- mAtGlobalScope(false)
- {
- }
-
- int deepestNesting() const
- {
- if(mDeepestNesting == 0)
- mDeepestNesting = calculateDeepestNesting();
- return mDeepestNesting;
- }
- bool containsArrays() const;
- bool containsType(TBasicType type) const;
- bool containsSamplers() const;
-
- bool equals(const TStructure &other) const;
-
- void setMatrixPackingIfUnspecified(TLayoutMatrixPacking matrixPacking);
-
- void setUniqueId(int uniqueId)
- {
- mUniqueId = uniqueId;
- }
-
- int uniqueId() const
- {
- ASSERT(mUniqueId != 0);
- return mUniqueId;
- }
-
- void setAtGlobalScope(bool atGlobalScope)
- {
- mAtGlobalScope = atGlobalScope;
- }
-
- bool atGlobalScope() const
- {
- return mAtGlobalScope;
- }
-
-private:
- // TODO(zmo): Find a way to get rid of the const_cast in function
- // setName(). At the moment keep this function private so only
- // friend class RegenerateStructNames may call it.
- friend class RegenerateStructNames;
- void setName(const TString &name)
- {
- TString *mutableName = const_cast<TString *>(mName);
- *mutableName = name;
- }
-
- virtual TString mangledNamePrefix() const
- {
- return "struct-";
- }
- int calculateDeepestNesting() const;
-
- mutable int mDeepestNesting;
- int mUniqueId;
- bool mAtGlobalScope;
-};
-
-class TInterfaceBlock : public TFieldListCollection
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- TInterfaceBlock(const TString *name, TFieldList *fields, const TString *instanceName,
- int arraySize, const TLayoutQualifier &layoutQualifier)
- : TFieldListCollection(name, fields),
- mInstanceName(instanceName),
- mArraySize(arraySize),
- mBlockStorage(layoutQualifier.blockStorage),
- mMatrixPacking(layoutQualifier.matrixPacking)
- {
- }
-
- const TString &instanceName() const
- {
- return *mInstanceName;
- }
- bool hasInstanceName() const
- {
- return mInstanceName != nullptr;
- }
- bool isArray() const
- {
- return mArraySize > 0;
- }
- int arraySize() const
- {
- return mArraySize;
- }
- TLayoutBlockStorage blockStorage() const
- {
- return mBlockStorage;
- }
- TLayoutMatrixPacking matrixPacking() const
- {
- return mMatrixPacking;
- }
-
-private:
- virtual TString mangledNamePrefix() const
- {
- return "iblock-";
- }
-
- const TString *mInstanceName; // for interface block instance names
- int mArraySize; // 0 if not an array
- TLayoutBlockStorage mBlockStorage;
- TLayoutMatrixPacking mMatrixPacking;
-};
-
-//
-// Base class for things that have a type.
-//
-class TType
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
-
- TType(TBasicType t, int s0 = 1, int s1 = 1) :
- type(t), precision(EbpUndefined), qualifier(EvqGlobal),
- primarySize(s0), secondarySize(s1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), layoutQualifier(TLayoutQualifier::create()),
- structure(0), mangled(0)
- {
- }
-
- TType(TBasicType t, TPrecision p, TQualifier q = EvqTemporary, int s0 = 1, int s1 = 1, bool a = false) :
- type(t), precision(p), qualifier(q),
- primarySize(s0), secondarySize(s1), array(a), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), layoutQualifier(TLayoutQualifier::create()),
- structure(0), mangled(0)
- {
- }
-
- TType(TStructure* userDef, TPrecision p = EbpUndefined) :
- type(EbtStruct), precision(p), qualifier(EvqTemporary),
- primarySize(1), secondarySize(1), array(false), arraySize(0), maxArraySize(0), arrayInformationType(0), interfaceBlock(0), layoutQualifier(TLayoutQualifier::create()),
- structure(userDef), mangled(0)
- {
- }
-
- TType(TInterfaceBlock *interfaceBlockIn, TQualifier qualifierIn,
- TLayoutQualifier layoutQualifierIn, int arraySizeIn)
- : type(EbtInterfaceBlock), precision(EbpUndefined), qualifier(qualifierIn),
- primarySize(1), secondarySize(1), array(arraySizeIn > 0), arraySize(arraySizeIn), maxArraySize(0), arrayInformationType(0),
- interfaceBlock(interfaceBlockIn), layoutQualifier(layoutQualifierIn), structure(0), mangled(0)
- {
- }
-
- explicit TType(const TPublicType &p);
-
- TBasicType getBasicType() const { return type; }
- void setBasicType(TBasicType t) { type = t; }
-
- TPrecision getPrecision() const { return precision; }
- void setPrecision(TPrecision p) { precision = p; }
-
- TQualifier getQualifier() const { return qualifier; }
- void setQualifier(TQualifier q) { qualifier = q; }
-
- TLayoutQualifier getLayoutQualifier() const { return layoutQualifier; }
- void setLayoutQualifier(TLayoutQualifier lq) { layoutQualifier = lq; }
-
- void setMatrixPackingIfUnspecified(TLayoutMatrixPacking matrixPacking)
- {
- if(isStruct())
- {
- // If the structure's matrix packing is specified, it overrules the block's matrix packing
- structure->setMatrixPackingIfUnspecified((layoutQualifier.matrixPacking == EmpUnspecified) ?
- matrixPacking : layoutQualifier.matrixPacking);
- }
- // If the member's matrix packing is specified, it overrules any higher level matrix packing
- if(layoutQualifier.matrixPacking == EmpUnspecified)
- {
- layoutQualifier.matrixPacking = matrixPacking;
- }
- }
-
- // One-dimensional size of single instance type
- int getNominalSize() const { return primarySize; }
- void setNominalSize(int s) { primarySize = s; }
- // Full size of single instance of type
- size_t getObjectSize() const
- {
- if(isArray())
- {
- return getElementSize() * std::max(getArraySize(), getMaxArraySize());
- }
- else
- {
- return getElementSize();
- }
- }
-
- size_t getElementSize() const
- {
- if(getBasicType() == EbtStruct)
- {
- return getStructSize();
- }
- else if(isInterfaceBlock())
- {
- return interfaceBlock->objectSize();
- }
- else if(isMatrix())
- {
- return primarySize * secondarySize;
- }
- else // Vector or scalar
- {
- return primarySize;
- }
- }
-
- int samplerRegisterCount() const
- {
- if(structure)
- {
- int registerCount = 0;
-
- const TFieldList& fields = isInterfaceBlock() ? interfaceBlock->fields() : structure->fields();
- for(size_t i = 0; i < fields.size(); i++)
- {
- registerCount += fields[i]->type()->totalSamplerRegisterCount();
- }
-
- return registerCount;
- }
-
- return IsSampler(getBasicType()) ? 1 : 0;
- }
-
- int elementRegisterCount() const
- {
- if(structure || isInterfaceBlock())
- {
- int registerCount = 0;
-
- const TFieldList& fields = isInterfaceBlock() ? interfaceBlock->fields() : structure->fields();
- for(size_t i = 0; i < fields.size(); i++)
- {
- registerCount += fields[i]->type()->totalRegisterCount();
- }
-
- return registerCount;
- }
- else if(isMatrix())
- {
- return getNominalSize();
- }
- else
- {
- return 1;
- }
- }
-
- int blockRegisterCount() const
- {
- // If this TType object is a block member, return the register count of the parent block
- // Otherwise, return the register count of the current TType object
- if(interfaceBlock && !isInterfaceBlock())
- {
- int registerCount = 0;
- const TFieldList& fieldList = interfaceBlock->fields();
- for(size_t i = 0; i < fieldList.size(); i++)
- {
- const TType &fieldType = *(fieldList[i]->type());
- registerCount += fieldType.totalRegisterCount();
- }
- return registerCount;
- }
- return totalRegisterCount();
- }
-
- int totalSamplerRegisterCount() const
- {
- if(array)
- {
- return arraySize * samplerRegisterCount();
- }
- else
- {
- return samplerRegisterCount();
- }
- }
-
- int totalRegisterCount() const
- {
- if(array)
- {
- return arraySize * elementRegisterCount();
- }
- else
- {
- return elementRegisterCount();
- }
- }
-
- int registerSize() const
- {
- return isMatrix() ? secondarySize : primarySize;
- }
-
- bool isMatrix() const { return secondarySize > 1; }
- void setSecondarySize(int s1) { secondarySize = s1; }
- int getSecondarySize() const { return secondarySize; }
-
- bool isArray() const { return array ? true : false; }
- bool isUnsizedArray() const { return array && arraySize == 0; }
- int getArraySize() const { return arraySize; }
- void setArraySize(int s) { array = true; arraySize = s; }
- int getMaxArraySize () const { return maxArraySize; }
- void setMaxArraySize (int s) { maxArraySize = s; }
- void clearArrayness() { array = false; arraySize = 0; maxArraySize = 0; }
- void setArrayInformationType(TType* t) { arrayInformationType = t; }
- TType* getArrayInformationType() const { return arrayInformationType; }
-
- TInterfaceBlock *getInterfaceBlock() const { return interfaceBlock; }
- void setInterfaceBlock(TInterfaceBlock *interfaceBlockIn) { interfaceBlock = interfaceBlockIn; }
- bool isInterfaceBlock() const { return type == EbtInterfaceBlock; }
- TInterfaceBlock *getAsInterfaceBlock() const { return isInterfaceBlock() ? getInterfaceBlock() : nullptr; }
-
- bool isVector() const { return primarySize > 1 && !isMatrix(); }
- bool isScalar() const { return primarySize == 1 && !isMatrix() && !structure && !isInterfaceBlock() && !IsSampler(getBasicType()); }
- bool isRegister() const { return !isMatrix() && !structure && !array && !isInterfaceBlock(); } // Fits in a 4-element register
- bool isStruct() const { return structure != 0; }
- bool isScalarInt() const { return isScalar() && IsInteger(type); }
-
- TStructure* getStruct() const { return structure; }
- void setStruct(TStructure* s) { structure = s; }
-
- TString& getMangledName() {
- if (!mangled) {
- mangled = NewPoolTString("");
- buildMangledName(*mangled);
- *mangled += ';' ;
- }
-
- return *mangled;
- }
-
- bool sameElementType(const TType& right) const {
- return type == right.type &&
- primarySize == right.primarySize &&
- secondarySize == right.secondarySize &&
- structure == right.structure;
- }
- bool operator==(const TType& right) const {
- return type == right.type &&
- primarySize == right.primarySize &&
- secondarySize == right.secondarySize &&
- array == right.array && (!array || arraySize == right.arraySize) &&
- structure == right.structure;
- // don't check the qualifier, it's not ever what's being sought after
- }
- bool operator!=(const TType& right) const {
- return !operator==(right);
- }
- bool operator<(const TType& right) const {
- if (type != right.type) return type < right.type;
- if(primarySize != right.primarySize) return (primarySize * secondarySize) < (right.primarySize * right.secondarySize);
- if(secondarySize != right.secondarySize) return secondarySize < right.secondarySize;
- if (array != right.array) return array < right.array;
- if (arraySize != right.arraySize) return arraySize < right.arraySize;
- if (structure != right.structure) return structure < right.structure;
-
- return false;
- }
-
- const char* getBasicString() const { return ::getBasicString(type); }
- const char* getPrecisionString() const { return ::getPrecisionString(precision); }
- const char* getQualifierString() const { return ::getQualifierString(qualifier); }
- TString getCompleteString() const;
-
- // If this type is a struct, returns the deepest struct nesting of
- // any field in the struct. For example:
- // struct nesting1 {
- // vec4 position;
- // };
- // struct nesting2 {
- // nesting1 field1;
- // vec4 field2;
- // };
- // For type "nesting2", this method would return 2 -- the number
- // of structures through which indirection must occur to reach the
- // deepest field (nesting2.field1.position).
- int getDeepestStructNesting() const
- {
- return structure ? structure->deepestNesting() : 0;
- }
-
- bool isStructureContainingArrays() const
- {
- return structure ? structure->containsArrays() : false;
- }
-
- bool isStructureContainingType(TBasicType t) const
- {
- return structure ? structure->containsType(t) : false;
- }
-
- bool isStructureContainingSamplers() const
- {
- return structure ? structure->containsSamplers() : false;
- }
-
-protected:
- void buildMangledName(TString&);
- size_t getStructSize() const;
-
- TBasicType type = EbtVoid;
- TPrecision precision = EbpUndefined;
- TQualifier qualifier = EvqTemporary;
- unsigned char primarySize = 0; // size of vector or matrix, not size of array
- unsigned char secondarySize = 0; // 1 for vectors, > 1 for matrices
- bool array = false;
- int arraySize = 0;
- int maxArraySize = 0;
- TType *arrayInformationType = nullptr;
-
- // null unless this is an interface block, or interface block member variable
- TInterfaceBlock *interfaceBlock = nullptr;
- TLayoutQualifier layoutQualifier;
-
- TStructure *structure = nullptr; // null unless this is a struct
-
- TString *mangled = nullptr;
-};
-
-//
-// This is a workaround for a problem with the yacc stack, It can't have
-// types that it thinks have non-trivial constructors. It should
-// just be used while recognizing the grammar, not anything else. Pointers
-// could be used, but also trying to avoid lots of memory management overhead.
-//
-// Not as bad as it looks, there is no actual assumption that the fields
-// match up or are name the same or anything like that.
-//
-struct TPublicType
-{
- TBasicType type;
- TLayoutQualifier layoutQualifier;
- TQualifier qualifier;
- bool invariant;
- TPrecision precision;
- int primarySize; // size of vector or matrix, not size of array
- int secondarySize; // 1 for scalars/vectors, >1 for matrices
- bool array;
- int arraySize;
- TType* userDef;
- TSourceLoc line;
-
- void setBasic(TBasicType bt, TQualifier q, const TSourceLoc &ln)
- {
- type = bt;
- layoutQualifier = TLayoutQualifier::create();
- qualifier = q;
- invariant = false;
- precision = EbpUndefined;
- primarySize = 1;
- secondarySize = 1;
- array = false;
- arraySize = 0;
- userDef = 0;
- line = ln;
- }
-
- void setAggregate(int s)
- {
- primarySize = s;
- secondarySize = 1;
- }
-
- void setMatrix(int s0, int s1)
- {
- primarySize = s0;
- secondarySize = s1;
- }
-
- bool isUnsizedArray() const
- {
- return array && arraySize == 0;
- }
-
- void setArray(bool a, int s = 0)
- {
- array = a;
- arraySize = s;
- }
-
- void clearArrayness()
- {
- array = false;
- arraySize = 0;
- }
-
- bool isStructureContainingArrays() const
- {
- if (!userDef)
- {
- return false;
- }
-
- return userDef->isStructureContainingArrays();
- }
-
- bool isStructureContainingType(TBasicType t) const
- {
- if(!userDef)
- {
- return false;
- }
-
- return userDef->isStructureContainingType(t);
- }
-
- bool isMatrix() const
- {
- return primarySize > 1 && secondarySize > 1;
- }
-
- bool isVector() const
- {
- return primarySize > 1 && secondarySize == 1;
- }
-
- int getCols() const
- {
- ASSERT(isMatrix());
- return primarySize;
- }
-
- int getRows() const
- {
- ASSERT(isMatrix());
- return secondarySize;
- }
-
- int getNominalSize() const
- {
- return primarySize;
- }
-
- bool isAggregate() const
- {
- return array || isMatrix() || isVector();
- }
-};
-
-#endif // _TYPES_INCLUDED_
diff --git a/src/OpenGL/compiler/ValidateLimitations.cpp b/src/OpenGL/compiler/ValidateLimitations.cpp
deleted file mode 100644
index a685d5b56..000000000
--- a/src/OpenGL/compiler/ValidateLimitations.cpp
+++ /dev/null
@@ -1,505 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ValidateLimitations.h"
-#include "InfoSink.h"
-#include "InitializeParseContext.h"
-#include "ParseHelper.h"
-
-namespace {
-bool IsLoopIndex(const TIntermSymbol* symbol, const TLoopStack& stack) {
- for (TLoopStack::const_iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId())
- return true;
- }
- return false;
-}
-
-void MarkLoopForUnroll(const TIntermSymbol* symbol, TLoopStack& stack) {
- for (TLoopStack::iterator i = stack.begin(); i != stack.end(); ++i) {
- if (i->index.id == symbol->getId()) {
- ASSERT(i->loop);
- i->loop->setUnrollFlag(true);
- return;
- }
- }
- UNREACHABLE(0);
-}
-
-// Traverses a node to check if it represents a constant index expression.
-// Definition:
-// constant-index-expressions are a superset of constant-expressions.
-// Constant-index-expressions can include loop indices as defined in
-// GLSL ES 1.0 spec, Appendix A, section 4.
-// The following are constant-index-expressions:
-// - Constant expressions
-// - Loop indices as defined in section 4
-// - Expressions composed of both of the above
-class ValidateConstIndexExpr : public TIntermTraverser {
-public:
- ValidateConstIndexExpr(const TLoopStack& stack)
- : mValid(true), mLoopStack(stack) {}
-
- // Returns true if the parsed node represents a constant index expression.
- bool isValid() const { return mValid; }
-
- virtual void visitSymbol(TIntermSymbol* symbol) {
- // Only constants and loop indices are allowed in a
- // constant index expression.
- if (mValid) {
- mValid = (symbol->getQualifier() == EvqConstExpr) ||
- IsLoopIndex(symbol, mLoopStack);
- }
- }
-
-private:
- bool mValid;
- const TLoopStack& mLoopStack;
-};
-
-// Traverses a node to check if it uses a loop index.
-// If an int loop index is used in its body as a sampler array index,
-// mark the loop for unroll.
-class ValidateLoopIndexExpr : public TIntermTraverser {
-public:
- ValidateLoopIndexExpr(TLoopStack& stack)
- : mUsesFloatLoopIndex(false),
- mUsesIntLoopIndex(false),
- mLoopStack(stack) {}
-
- bool usesFloatLoopIndex() const { return mUsesFloatLoopIndex; }
- bool usesIntLoopIndex() const { return mUsesIntLoopIndex; }
-
- virtual void visitSymbol(TIntermSymbol* symbol) {
- if (IsLoopIndex(symbol, mLoopStack)) {
- switch (symbol->getBasicType()) {
- case EbtFloat:
- mUsesFloatLoopIndex = true;
- break;
- case EbtUInt:
- mUsesIntLoopIndex = true;
- MarkLoopForUnroll(symbol, mLoopStack);
- break;
- case EbtInt:
- mUsesIntLoopIndex = true;
- MarkLoopForUnroll(symbol, mLoopStack);
- break;
- default:
- UNREACHABLE(symbol->getBasicType());
- }
- }
- }
-
-private:
- bool mUsesFloatLoopIndex;
- bool mUsesIntLoopIndex;
- TLoopStack& mLoopStack;
-};
-} // namespace
-
-ValidateLimitations::ValidateLimitations(GLenum shaderType,
- TInfoSinkBase& sink)
- : mShaderType(shaderType),
- mSink(sink),
- mNumErrors(0)
-{
-}
-
-bool ValidateLimitations::visitBinary(Visit, TIntermBinary* node)
-{
- // Check if loop index is modified in the loop body.
- validateOperation(node, node->getLeft());
-
- // Check indexing.
- switch (node->getOp()) {
- case EOpIndexDirect:
- validateIndexing(node);
- break;
- case EOpIndexIndirect:
- validateIndexing(node);
- break;
- default: break;
- }
- return true;
-}
-
-bool ValidateLimitations::visitUnary(Visit, TIntermUnary* node)
-{
- // Check if loop index is modified in the loop body.
- validateOperation(node, node->getOperand());
-
- return true;
-}
-
-bool ValidateLimitations::visitAggregate(Visit, TIntermAggregate* node)
-{
- switch (node->getOp()) {
- case EOpFunctionCall:
- validateFunctionCall(node);
- break;
- default:
- break;
- }
- return true;
-}
-
-bool ValidateLimitations::visitLoop(Visit, TIntermLoop* node)
-{
- if (!validateLoopType(node))
- return false;
-
- TLoopInfo info;
- memset(&info, 0, sizeof(TLoopInfo));
- info.loop = node;
- if (!validateForLoopHeader(node, &info))
- return false;
-
- TIntermNode* body = node->getBody();
- if (body) {
- mLoopStack.push_back(info);
- body->traverse(this);
- mLoopStack.pop_back();
- }
-
- // The loop is fully processed - no need to visit children.
- return false;
-}
-
-void ValidateLimitations::error(TSourceLoc loc,
- const char *reason, const char* token)
-{
- mSink.prefix(EPrefixError);
- mSink.location(loc);
- mSink << "'" << token << "' : " << reason << "\n";
- ++mNumErrors;
-}
-
-bool ValidateLimitations::withinLoopBody() const
-{
- return !mLoopStack.empty();
-}
-
-bool ValidateLimitations::isLoopIndex(const TIntermSymbol* symbol) const
-{
- return IsLoopIndex(symbol, mLoopStack);
-}
-
-bool ValidateLimitations::validateLoopType(TIntermLoop* node) {
- TLoopType type = node->getType();
- if (type == ELoopFor)
- return true;
-
- // Reject while and do-while loops.
- error(node->getLine(),
- "This type of loop is not allowed",
- type == ELoopWhile ? "while" : "do");
- return false;
-}
-
-bool ValidateLimitations::validateForLoopHeader(TIntermLoop* node,
- TLoopInfo* info)
-{
- ASSERT(node->getType() == ELoopFor);
-
- //
- // The for statement has the form:
- // for ( init-declaration ; condition ; expression ) statement
- //
- if (!validateForLoopInit(node, info))
- return false;
- if (!validateForLoopCond(node, info))
- return false;
- if (!validateForLoopExpr(node, info))
- return false;
-
- return true;
-}
-
-bool ValidateLimitations::validateForLoopInit(TIntermLoop* node,
- TLoopInfo* info)
-{
- TIntermNode* init = node->getInit();
- if (!init) {
- error(node->getLine(), "Missing init declaration", "for");
- return false;
- }
-
- //
- // init-declaration has the form:
- // type-specifier identifier = constant-expression
- //
- TIntermAggregate* decl = init->getAsAggregate();
- if (!decl || (decl->getOp() != EOpDeclaration)) {
- error(init->getLine(), "Invalid init declaration", "for");
- return false;
- }
- // To keep things simple do not allow declaration list.
- TIntermSequence& declSeq = decl->getSequence();
- if (declSeq.size() != 1) {
- error(decl->getLine(), "Invalid init declaration", "for");
- return false;
- }
- TIntermBinary* declInit = declSeq[0]->getAsBinaryNode();
- if (!declInit || (declInit->getOp() != EOpInitialize)) {
- error(decl->getLine(), "Invalid init declaration", "for");
- return false;
- }
- TIntermSymbol* symbol = declInit->getLeft()->getAsSymbolNode();
- if (!symbol) {
- error(declInit->getLine(), "Invalid init declaration", "for");
- return false;
- }
- // The loop index has type int or float.
- TBasicType type = symbol->getBasicType();
- if (!IsInteger(type) && (type != EbtFloat)) {
- error(symbol->getLine(),
- "Invalid type for loop index", getBasicString(type));
- return false;
- }
- // The loop index is initialized with constant expression.
- if (!isConstExpr(declInit->getRight())) {
- error(declInit->getLine(),
- "Loop index cannot be initialized with non-constant expression",
- symbol->getSymbol().c_str());
- return false;
- }
-
- info->index.id = symbol->getId();
- return true;
-}
-
-bool ValidateLimitations::validateForLoopCond(TIntermLoop* node,
- TLoopInfo* info)
-{
- TIntermNode* cond = node->getCondition();
- if (!cond) {
- error(node->getLine(), "Missing condition", "for");
- return false;
- }
- //
- // condition has the form:
- // loop_index relational_operator constant_expression
- //
- TIntermBinary* binOp = cond->getAsBinaryNode();
- if (!binOp) {
- error(node->getLine(), "Invalid condition", "for");
- return false;
- }
- // Loop index should be to the left of relational operator.
- TIntermSymbol* symbol = binOp->getLeft()->getAsSymbolNode();
- if (!symbol) {
- error(binOp->getLine(), "Invalid condition", "for");
- return false;
- }
- if (symbol->getId() != info->index.id) {
- error(symbol->getLine(),
- "Expected loop index", symbol->getSymbol().c_str());
- return false;
- }
- // Relational operator is one of: > >= < <= == or !=.
- switch (binOp->getOp()) {
- case EOpEqual:
- case EOpNotEqual:
- case EOpLessThan:
- case EOpGreaterThan:
- case EOpLessThanEqual:
- case EOpGreaterThanEqual:
- break;
- default:
- error(binOp->getLine(),
- "Invalid relational operator",
- getOperatorString(binOp->getOp()));
- break;
- }
- // Loop index must be compared with a constant.
- if (!isConstExpr(binOp->getRight())) {
- error(binOp->getLine(),
- "Loop index cannot be compared with non-constant expression",
- symbol->getSymbol().c_str());
- return false;
- }
-
- return true;
-}
-
-bool ValidateLimitations::validateForLoopExpr(TIntermLoop* node,
- TLoopInfo* info)
-{
- TIntermNode* expr = node->getExpression();
- if (!expr) {
- error(node->getLine(), "Missing expression", "for");
- return false;
- }
-
- // for expression has one of the following forms:
- // loop_index++
- // loop_index--
- // loop_index += constant_expression
- // loop_index -= constant_expression
- // ++loop_index
- // --loop_index
- // The last two forms are not specified in the spec, but I am assuming
- // its an oversight.
- TIntermUnary* unOp = expr->getAsUnaryNode();
- TIntermBinary* binOp = unOp ? nullptr : expr->getAsBinaryNode();
-
- TOperator op = EOpNull;
- TIntermSymbol* symbol = nullptr;
- if (unOp) {
- op = unOp->getOp();
- symbol = unOp->getOperand()->getAsSymbolNode();
- } else if (binOp) {
- op = binOp->getOp();
- symbol = binOp->getLeft()->getAsSymbolNode();
- }
-
- // The operand must be loop index.
- if (!symbol) {
- error(expr->getLine(), "Invalid expression", "for");
- return false;
- }
- if (symbol->getId() != info->index.id) {
- error(symbol->getLine(),
- "Expected loop index", symbol->getSymbol().c_str());
- return false;
- }
-
- // The operator is one of: ++ -- += -=.
- switch (op) {
- case EOpPostIncrement:
- case EOpPostDecrement:
- case EOpPreIncrement:
- case EOpPreDecrement:
- ASSERT((unOp != NULL) && (binOp == NULL));
- break;
- case EOpAddAssign:
- case EOpSubAssign:
- ASSERT((unOp == NULL) && (binOp != NULL));
- break;
- default:
- error(expr->getLine(), "Invalid operator", getOperatorString(op));
- return false;
- }
-
- // Loop index must be incremented/decremented with a constant.
- if (binOp != NULL) {
- if (!isConstExpr(binOp->getRight())) {
- error(binOp->getLine(),
- "Loop index cannot be modified by non-constant expression",
- symbol->getSymbol().c_str());
- return false;
- }
- }
-
- return true;
-}
-
-bool ValidateLimitations::validateFunctionCall(TIntermAggregate* node)
-{
- ASSERT(node->getOp() == EOpFunctionCall);
-
- // If not within loop body, there is nothing to check.
- if (!withinLoopBody())
- return true;
-
- // List of param indices for which loop indices are used as argument.
- typedef std::vector<int> ParamIndex;
- ParamIndex pIndex;
- TIntermSequence& params = node->getSequence();
- for (TIntermSequence::size_type i = 0; i < params.size(); ++i) {
- TIntermSymbol* symbol = params[i]->getAsSymbolNode();
- if (symbol && isLoopIndex(symbol))
- pIndex.push_back(i);
- }
- // If none of the loop indices are used as arguments,
- // there is nothing to check.
- if (pIndex.empty())
- return true;
-
- bool valid = true;
- TSymbolTable& symbolTable = GetGlobalParseContext()->symbolTable;
- TSymbol* symbol = symbolTable.find(node->getName(), GetGlobalParseContext()->getShaderVersion());
- ASSERT(symbol && symbol->isFunction());
- TFunction* function = static_cast<TFunction*>(symbol);
- for (ParamIndex::const_iterator i = pIndex.begin();
- i != pIndex.end(); ++i) {
- const TParameter& param = function->getParam(*i);
- TQualifier qual = param.type->getQualifier();
- if ((qual == EvqOut) || (qual == EvqInOut)) {
- error(params[*i]->getLine(),
- "Loop index cannot be used as argument to a function out or inout parameter",
- params[*i]->getAsSymbolNode()->getSymbol().c_str());
- valid = false;
- }
- }
-
- return valid;
-}
-
-bool ValidateLimitations::validateOperation(TIntermOperator* node,
- TIntermNode* operand) {
- // Check if loop index is modified in the loop body.
- if (!withinLoopBody() || !node->modifiesState())
- return true;
-
- const TIntermSymbol* symbol = operand->getAsSymbolNode();
- if (symbol && isLoopIndex(symbol)) {
- error(node->getLine(),
- "Loop index cannot be statically assigned to within the body of the loop",
- symbol->getSymbol().c_str());
- }
- return true;
-}
-
-bool ValidateLimitations::isConstExpr(TIntermNode* node)
-{
- ASSERT(node);
- return node->getAsConstantUnion() != nullptr;
-}
-
-bool ValidateLimitations::isConstIndexExpr(TIntermNode* node)
-{
- ASSERT(node);
-
- ValidateConstIndexExpr validate(mLoopStack);
- node->traverse(&validate);
- return validate.isValid();
-}
-
-bool ValidateLimitations::validateIndexing(TIntermBinary* node)
-{
- ASSERT((node->getOp() == EOpIndexDirect) ||
- (node->getOp() == EOpIndexIndirect));
-
- bool valid = true;
- TIntermTyped* index = node->getRight();
- // The index expression must have integral type.
- if (!index->isScalarInt()) {
- error(index->getLine(),
- "Index expression must have integral type",
- index->getCompleteString().c_str());
- valid = false;
- }
- // The index expession must be a constant-index-expression unless
- // the operand is a uniform in a vertex shader.
- TIntermTyped* operand = node->getLeft();
- bool skip = (mShaderType == GL_VERTEX_SHADER) &&
- (operand->getQualifier() == EvqUniform);
- if (!skip && !isConstIndexExpr(index)) {
- error(index->getLine(), "Index expression must be constant", "[]");
- valid = false;
- }
- return valid;
-}
-
diff --git a/src/OpenGL/compiler/ValidateLimitations.h b/src/OpenGL/compiler/ValidateLimitations.h
deleted file mode 100644
index 6e43e0c8f..000000000
--- a/src/OpenGL/compiler/ValidateLimitations.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Compiler.h"
-#include "intermediate.h"
-
-class TInfoSinkBase;
-
-struct TLoopInfo {
- struct TIndex {
- int id; // symbol id.
- } index;
- TIntermLoop* loop;
-};
-typedef TVector<TLoopInfo> TLoopStack;
-
-// Traverses intermediate tree to ensure that the shader does not exceed the
-// minimum functionality mandated in GLSL 1.0 spec, Appendix A.
-class ValidateLimitations : public TIntermTraverser {
-public:
- ValidateLimitations(GLenum shaderType, TInfoSinkBase& sink);
-
- int numErrors() const { return mNumErrors; }
-
- virtual bool visitBinary(Visit, TIntermBinary*);
- virtual bool visitUnary(Visit, TIntermUnary*);
- virtual bool visitAggregate(Visit, TIntermAggregate*);
- virtual bool visitLoop(Visit, TIntermLoop*);
-
-private:
- void error(TSourceLoc loc, const char *reason, const char* token);
-
- bool withinLoopBody() const;
- bool isLoopIndex(const TIntermSymbol* symbol) const;
- bool validateLoopType(TIntermLoop* node);
- bool validateForLoopHeader(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopInit(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopCond(TIntermLoop* node, TLoopInfo* info);
- bool validateForLoopExpr(TIntermLoop* node, TLoopInfo* info);
- // Returns true if none of the loop indices is used as the argument to
- // the given function out or inout parameter.
- bool validateFunctionCall(TIntermAggregate* node);
- bool validateOperation(TIntermOperator* node, TIntermNode* operand);
-
- // Returns true if indexing does not exceed the minimum functionality
- // mandated in GLSL 1.0 spec, Appendix A, Section 5.
- bool isConstExpr(TIntermNode* node);
- bool isConstIndexExpr(TIntermNode* node);
- bool validateIndexing(TIntermBinary* node);
-
- GLenum mShaderType;
- TInfoSinkBase& mSink;
- int mNumErrors;
- TLoopStack mLoopStack;
-};
-
diff --git a/src/OpenGL/compiler/ValidateSwitch.cpp b/src/OpenGL/compiler/ValidateSwitch.cpp
deleted file mode 100644
index edef69b03..000000000
--- a/src/OpenGL/compiler/ValidateSwitch.cpp
+++ /dev/null
@@ -1,208 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ValidateSwitch.h"
-
-#include "ParseHelper.h"
-
-bool ValidateSwitch::validate(TBasicType switchType, TParseContext *context,
- TIntermAggregate *statementList, const TSourceLoc &loc)
-{
- ValidateSwitch validate(switchType, context);
- ASSERT(statementList);
- statementList->traverse(&validate);
- return validate.validateInternal(loc);
-}
-
-ValidateSwitch::ValidateSwitch(TBasicType switchType, TParseContext *context)
- : TIntermTraverser(true, false, true),
- mSwitchType(switchType),
- mContext(context),
- mCaseTypeMismatch(false),
- mFirstCaseFound(false),
- mStatementBeforeCase(false),
- mLastStatementWasCase(false),
- mControlFlowDepth(0),
- mCaseInsideControlFlow(false),
- mDefaultCount(0),
- mDuplicateCases(false)
-{}
-
-void ValidateSwitch::visitSymbol(TIntermSymbol *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
-}
-
-void ValidateSwitch::visitConstantUnion(TIntermConstantUnion *)
-{
- // Conditions of case labels are not traversed, so this is some other constant
- // Could be just a statement like "0;"
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
-}
-
-bool ValidateSwitch::visitBinary(Visit, TIntermBinary *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::visitUnary(Visit, TIntermUnary *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::visitSelection(Visit visit, TIntermSelection *)
-{
- if (visit == PreVisit)
- ++mControlFlowDepth;
- if (visit == PostVisit)
- --mControlFlowDepth;
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::visitSwitch(Visit, TIntermSwitch *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- // Don't go into nested switch statements
- return false;
-}
-
-bool ValidateSwitch::visitCase(Visit, TIntermCase *node)
-{
- const char *nodeStr = node->hasCondition() ? "case" : "default";
- if (mControlFlowDepth > 0)
- {
- mContext->error(node->getLine(), "label statement nested inside control flow", nodeStr);
- mCaseInsideControlFlow = true;
- }
- mFirstCaseFound = true;
- mLastStatementWasCase = true;
- if (!node->hasCondition())
- {
- ++mDefaultCount;
- if (mDefaultCount > 1)
- {
- mContext->error(node->getLine(), "duplicate default label", nodeStr);
- }
- }
- else
- {
- TIntermConstantUnion *condition = node->getCondition()->getAsConstantUnion();
- if (condition == nullptr)
- {
- // This can happen in error cases.
- return false;
- }
- TBasicType conditionType = condition->getBasicType();
- if (conditionType != mSwitchType)
- {
- mContext->error(condition->getLine(),
- "case label type does not match switch init-expression type", nodeStr);
- mCaseTypeMismatch = true;
- }
-
- if (conditionType == EbtInt)
- {
- int iConst = condition->getIConst(0);
- if (mCasesSigned.find(iConst) != mCasesSigned.end())
- {
- mContext->error(condition->getLine(), "duplicate case label", nodeStr);
- mDuplicateCases = true;
- }
- else
- {
- mCasesSigned.insert(iConst);
- }
- }
- else if (conditionType == EbtUInt)
- {
- unsigned int uConst = condition->getUConst(0);
- if (mCasesUnsigned.find(uConst) != mCasesUnsigned.end())
- {
- mContext->error(condition->getLine(), "duplicate case label", nodeStr);
- mDuplicateCases = true;
- }
- else
- {
- mCasesUnsigned.insert(uConst);
- }
- }
- // Other types are possible only in error cases, where the error has already been generated
- // when parsing the case statement.
- }
- // Don't traverse the condition of the case statement
- return false;
-}
-
-bool ValidateSwitch::visitAggregate(Visit visit, TIntermAggregate *)
-{
- if (getParentNode() != nullptr)
- {
- // This is not the statementList node, but some other node.
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- }
- return true;
-}
-
-bool ValidateSwitch::visitLoop(Visit visit, TIntermLoop *)
-{
- if (visit == PreVisit)
- ++mControlFlowDepth;
- if (visit == PostVisit)
- --mControlFlowDepth;
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::visitBranch(Visit, TIntermBranch *)
-{
- if (!mFirstCaseFound)
- mStatementBeforeCase = true;
- mLastStatementWasCase = false;
- return true;
-}
-
-bool ValidateSwitch::validateInternal(const TSourceLoc &loc)
-{
- if (mStatementBeforeCase)
- {
- mContext->error(loc,
- "statement before the first label", "switch");
- }
- if (mLastStatementWasCase)
- {
- mContext->error(loc,
- "no statement between the last label and the end of the switch statement", "switch");
- }
- return !mStatementBeforeCase && !mLastStatementWasCase && !mCaseInsideControlFlow &&
- !mCaseTypeMismatch && mDefaultCount <= 1 && !mDuplicateCases;
-}
diff --git a/src/OpenGL/compiler/ValidateSwitch.h b/src/OpenGL/compiler/ValidateSwitch.h
deleted file mode 100644
index 1c36e3307..000000000
--- a/src/OpenGL/compiler/ValidateSwitch.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_TRANSLATOR_VALIDATESWITCH_H_
-#define COMPILER_TRANSLATOR_VALIDATESWITCH_H_
-
-#include "intermediate.h"
-#include <set>
-
-class TParseContext;
-
-class ValidateSwitch : public TIntermTraverser
-{
-public:
- // Check for errors and output messages any remaining errors on the context.
- // Returns true if there are no errors.
- static bool validate(TBasicType switchType, TParseContext *context,
- TIntermAggregate *statementList, const TSourceLoc &loc);
-
- void visitSymbol(TIntermSymbol *) override;
- void visitConstantUnion(TIntermConstantUnion *) override;
- bool visitBinary(Visit, TIntermBinary *) override;
- bool visitUnary(Visit, TIntermUnary *) override;
- bool visitSelection(Visit visit, TIntermSelection *) override;
- bool visitSwitch(Visit, TIntermSwitch *) override;
- bool visitCase(Visit, TIntermCase *) override;
- bool visitAggregate(Visit, TIntermAggregate *) override;
- bool visitLoop(Visit visit, TIntermLoop *) override;
- bool visitBranch(Visit, TIntermBranch *) override;
-
-private:
- ValidateSwitch(TBasicType switchType, TParseContext *context);
-
- bool validateInternal(const TSourceLoc &loc);
-
- TBasicType mSwitchType;
- TParseContext *mContext;
- bool mCaseTypeMismatch;
- bool mFirstCaseFound;
- bool mStatementBeforeCase;
- bool mLastStatementWasCase;
- int mControlFlowDepth;
- bool mCaseInsideControlFlow;
- int mDefaultCount;
- std::set<int> mCasesSigned;
- std::set<unsigned int> mCasesUnsigned;
- bool mDuplicateCases;
-};
-
-#endif // COMPILER_TRANSLATOR_VALIDATESWITCH_H_
diff --git a/src/OpenGL/compiler/debug.cpp b/src/OpenGL/compiler/debug.cpp
deleted file mode 100644
index 651734661..000000000
--- a/src/OpenGL/compiler/debug.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// debug.cpp: Debugging utilities.
-
-#include "debug.h"
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "InitializeParseContext.h"
-#include "ParseHelper.h"
-
-#ifdef TRACE_ENABLED
-namespace sh {
-void Trace(const char *format, ...) {
- if (!format) return;
-
- TParseContext* parseContext = GetGlobalParseContext();
- if (parseContext) {
- const int kTraceBufferLen = 1024;
- char buf[kTraceBufferLen];
- va_list args;
- va_start(args, format);
- vsnprintf(buf, kTraceBufferLen, format, args);
- va_end(args);
-
- parseContext->trace(buf);
- }
-}
-} // namespace sh
-#endif // TRACE_ENABLED
-
diff --git a/src/OpenGL/compiler/debug.h b/src/OpenGL/compiler/debug.h
deleted file mode 100644
index 1bf999c07..000000000
--- a/src/OpenGL/compiler/debug.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// debug.h: Debugging utilities.
-
-#ifndef COMPILER_DEBUG_H_
-#define COMPILER_DEBUG_H_
-
-#if defined(__ANDROID__) && !defined(ANDROID_HOST_BUILD) && !defined(ANDROID_NDK_BUILD)
-#include "../../Common/DebugAndroid.hpp"
-
-#define Trace(...) ((void)0)
-#else
-
-#include <assert.h>
-
-#ifdef _DEBUG
-#define TRACE_ENABLED // define to enable debug message tracing
-#endif // _DEBUG
-
-// Outputs text to the debug log
-namespace sh {
-#ifdef TRACE_ENABLED
-void Trace(const char* format, ...);
-#else
-inline void Trace(const char* format, ...) {}
-#endif
-inline void Trace() {}
-}
-
-// A macro asserting a condition and outputting failures to the debug log
-#undef ASSERT
-#define ASSERT(expression) do { \
- if(!(expression)) \
- sh::Trace("Assert failed: %s(%d): "#expression"\n", __FUNCTION__, __LINE__); \
- assert(expression); \
-} while(0)
-
-#undef UNIMPLEMENTED
-#define UNIMPLEMENTED(...) do { \
- sh::Trace("Unimplemented invoked: %s(%d): ", __FUNCTION__, __LINE__); \
- sh::Trace(__VA_ARGS__); \
- sh::Trace("\n"); \
- assert(false); \
-} while(0)
-
-#undef UNREACHABLE
-#define UNREACHABLE(value) do { \
- sh::Trace("Unreachable reached: %s(%d). %s: %d\n", __FUNCTION__, __LINE__, #value, value); \
- assert(false); \
-} while(0)
-
-#endif // !__ANDROID__
-#endif // COMPILER_DEBUG_H_
-
diff --git a/src/OpenGL/compiler/generate_parser.sh b/src/OpenGL/compiler/generate_parser.sh
deleted file mode 100644
index 428b79b4d..000000000
--- a/src/OpenGL/compiler/generate_parser.sh
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/bash
-# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Generates GLSL ES parser - glslang_lex.cpp, glslang_tab.h, and glslang_tab.cpp
-
-run_flex()
-{
-input_file=$script_dir/$1.l
-output_source=$script_dir/$1_lex.cpp
-flex --noline --nounistd --outfile=$output_source $input_file
-}
-
-run_bison()
-{
-input_file=$script_dir/$1.y
-output_header=$script_dir/$1_tab.h
-output_source=$script_dir/$1_tab.cpp
-bison --no-lines --skeleton=yacc.c --defines=$output_header --output=$output_source $input_file
-}
-
-script_dir=$(dirname $0)
-
-# Generate Parser
-run_flex glslang
-run_bison glslang
diff --git a/src/OpenGL/compiler/glslang.h b/src/OpenGL/compiler/glslang.h
deleted file mode 100644
index 656ba18d1..000000000
--- a/src/OpenGL/compiler/glslang.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-class TParseContext;
-extern int glslang_initialize(TParseContext* context);
-extern int glslang_finalize(TParseContext* context);
-
-extern int glslang_scan(size_t count,
- const char* const string[],
- const int length[],
- TParseContext* context);
-extern int glslang_parse(TParseContext* context);
-
diff --git a/src/OpenGL/compiler/glslang.l b/src/OpenGL/compiler/glslang.l
deleted file mode 100644
index 846afb5eb..000000000
--- a/src/OpenGL/compiler/glslang.l
+++ /dev/null
@@ -1,589 +0,0 @@
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Lex specification for GLSL ES.
-Based on ANSI C grammar, Lex specification:
-http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
-*/
-
-%top{
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-// Ignore errors in auto-generated code.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4189)
-#pragma warning(disable: 4505)
-#pragma warning(disable: 4701)
-#endif
-}
-
-%{
-#include "glslang.h"
-#include "ParseHelper.h"
-#include "preprocessor/Token.h"
-#include "util.h"
-#include "glslang_tab.h"
-
-/* windows only pragma */
-#ifdef _MSC_VER
-#pragma warning(disable : 4102)
-#endif
-
-#define YY_USER_ACTION \
- yylloc->first_file = yylloc->last_file = yycolumn; \
- yylloc->first_line = yylloc->last_line = yylineno;
-
-#define YY_INPUT(buf, result, max_size) \
- result = string_input(buf, max_size, yyscanner);
-
-static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
-static int check_type(yyscan_t yyscanner);
-static int reserved_word(yyscan_t yyscanner);
-static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
-static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
-static int ES2_identifier_ES3_keyword(TParseContext *context, int token);
-static int uint_constant(TParseContext *context);
-static int int_constant(yyscan_t yyscanner);
-static int float_constant(yyscan_t yyscanner);
-static int floatsuffix_check(TParseContext* context);
-%}
-
-%option noyywrap nounput never-interactive
-%option yylineno reentrant bison-bridge bison-locations
-%option extra-type="TParseContext*"
-%x COMMENT FIELDS
-
-D [0-9]
-L [a-zA-Z_]
-H [a-fA-F0-9]
-E [Ee][+-]?{D}+
-O [0-7]
-
-%%
-
-%{
- TParseContext* context = yyextra;
-%}
-
-"invariant" { return(INVARIANT); }
-"highp" { return(HIGH_PRECISION); }
-"mediump" { return(MEDIUM_PRECISION); }
-"lowp" { return(LOW_PRECISION); }
-"precision" { return(PRECISION); }
-
-"attribute" { return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
-"const" { return(CONST_QUAL); }
-"uniform" { return(UNIFORM); }
-"varying" { return ES2_keyword_ES3_reserved(context, VARYING); }
-
-"break" { return(BREAK); }
-"continue" { return(CONTINUE); }
-"do" { return(DO); }
-"for" { return(FOR); }
-"while" { return(WHILE); }
-
-"if" { return(IF); }
-"else" { return(ELSE); }
-"switch" { return ES2_reserved_ES3_keyword(context, SWITCH); }
-"case" { return ES2_reserved_ES3_keyword(context, CASE); }
-"default" { return ES2_reserved_ES3_keyword(context, DEFAULT); }
-
-"centroid" { return ES2_reserved_ES3_keyword(context, CENTROID); }
-"flat" { return ES2_reserved_ES3_keyword(context, FLAT); }
-"smooth" { return ES2_reserved_ES3_keyword(context, SMOOTH); }
-
-"in" { return(IN_QUAL); }
-"out" { return(OUT_QUAL); }
-"inout" { return(INOUT_QUAL); }
-
-"float" { context->lexAfterType = true; return(FLOAT_TYPE); }
-"int" { context->lexAfterType = true; return(INT_TYPE); }
-"uint" { return ES2_identifier_ES3_keyword(context, UINT_TYPE); }
-"void" { context->lexAfterType = true; return(VOID_TYPE); }
-"bool" { context->lexAfterType = true; return(BOOL_TYPE); }
-"true" { yylval->lex.b = true; return(BOOLCONSTANT); }
-"false" { yylval->lex.b = false; return(BOOLCONSTANT); }
-
-"discard" { return(DISCARD); }
-"return" { return(RETURN); }
-
-"mat2" { context->lexAfterType = true; return(MATRIX2); }
-"mat3" { context->lexAfterType = true; return(MATRIX3); }
-"mat4" { context->lexAfterType = true; return(MATRIX4); }
-
-"mat2x2" { return ES2_identifier_ES3_keyword(context, MATRIX2); }
-"mat3x3" { return ES2_identifier_ES3_keyword(context, MATRIX3); }
-"mat4x4" { return ES2_identifier_ES3_keyword(context, MATRIX4); }
-
-"mat2x3" { return ES2_identifier_ES3_keyword(context, MATRIX2x3); }
-"mat3x2" { return ES2_identifier_ES3_keyword(context, MATRIX3x2); }
-"mat2x4" { return ES2_identifier_ES3_keyword(context, MATRIX2x4); }
-"mat4x2" { return ES2_identifier_ES3_keyword(context, MATRIX4x2); }
-"mat3x4" { return ES2_identifier_ES3_keyword(context, MATRIX3x4); }
-"mat4x3" { return ES2_identifier_ES3_keyword(context, MATRIX4x3); }
-
-"vec2" { context->lexAfterType = true; return (VEC2); }
-"vec3" { context->lexAfterType = true; return (VEC3); }
-"vec4" { context->lexAfterType = true; return (VEC4); }
-"ivec2" { context->lexAfterType = true; return (IVEC2); }
-"ivec3" { context->lexAfterType = true; return (IVEC3); }
-"ivec4" { context->lexAfterType = true; return (IVEC4); }
-"uvec2" { return ES2_identifier_ES3_keyword(context, UVEC2); }
-"uvec3" { return ES2_identifier_ES3_keyword(context, UVEC3); }
-"uvec4" { return ES2_identifier_ES3_keyword(context, UVEC4); }
-"bvec2" { context->lexAfterType = true; return (BVEC2); }
-"bvec3" { context->lexAfterType = true; return (BVEC3); }
-"bvec4" { context->lexAfterType = true; return (BVEC4); }
-
-"sampler2D" { context->lexAfterType = true; return SAMPLER2D; }
-"samplerCube" { context->lexAfterType = true; return SAMPLERCUBE; }
-"sampler2DRect" { context->lexAfterType = true; return SAMPLER2DRECT; }
-"samplerExternalOES" { context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; }
-"sampler3D" { context->lexAfterType = true; return SAMPLER3D; }
-"sampler3DRect" { return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
-"sampler2DArray" { return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAY); }
-"isampler2D" { return ES2_identifier_ES3_keyword(context, ISAMPLER2D); }
-"isampler3D" { return ES2_identifier_ES3_keyword(context, ISAMPLER3D); }
-"isamplerCube" { return ES2_identifier_ES3_keyword(context, ISAMPLERCUBE); }
-"isampler2DArray" { return ES2_identifier_ES3_keyword(context, ISAMPLER2DARRAY); }
-"usampler2D" { return ES2_identifier_ES3_keyword(context, USAMPLER2D); }
-"usampler3D" { return ES2_identifier_ES3_keyword(context, USAMPLER3D); }
-"usamplerCube" { return ES2_identifier_ES3_keyword(context, USAMPLERCUBE); }
-"usampler2DArray" { return ES2_identifier_ES3_keyword(context, USAMPLER2DARRAY); }
-"sampler2DShadow" { return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
-"samplerCubeShadow" { return ES2_identifier_ES3_keyword(context, SAMPLERCUBESHADOW); }
-"sampler2DArrayShadow" { return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
-
-"struct" { context->lexAfterType = true; return(STRUCT); }
-
-"layout" { return ES2_identifier_ES3_keyword(context, LAYOUT); }
-
- /* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
-"coherent" |
-"restrict" |
-"readonly" |
-"writeonly" |
-"resource" |
-"atomic_uint" |
-"noperspective" |
-"patch" |
-"sample" |
-"subroutine" |
-"common" |
-"partition" |
-"active" |
-
-"filter" |
-"image1D" |
-"image2D" |
-"image3D" |
-"imageCube" |
-"iimage1D" |
-"iimage2D" |
-"iimage3D" |
-"iimageCube" |
-"uimage1D" |
-"uimage2D" |
-"uimage3D" |
-"uimageCube" |
-"image1DArray" |
-"image2DArray" |
-"iimage1DArray" |
-"iimage2DArray" |
-"uimage1DArray" |
-"uimage2DArray" |
-"image1DShadow" |
-"image2DShadow" |
-"image1DArrayShadow" |
-"image2DArrayShadow" |
-"imageBuffer" |
-"iimageBuffer" |
-"uimageBuffer" |
-
-"sampler1DArray" |
-"sampler1DArrayShadow" |
-"isampler1D" |
-"isampler1DArray" |
-"usampler1D" |
-"usampler1DArray" |
-"isampler2DRect" |
-"usampler2DRect" |
-"samplerBuffer" |
-"isamplerBuffer" |
-"usamplerBuffer" |
-"sampler2DMS" |
-"isampler2DMS" |
-"usampler2DMS" |
-"sampler2DMSArray" |
-"isampler2DMSArray" |
-"usampler2DMSArray" {
- if (context->getShaderVersion() < 300) {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
- return reserved_word(yyscanner);
-}
-
- /* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
-"packed" {
- if (context->getShaderVersion() >= 300)
- {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return reserved_word(yyscanner);
-}
-
- /* Reserved keywords */
-"asm" |
-
-"class" |
-"union" |
-"enum" |
-"typedef" |
-"template" |
-"this" |
-
-"goto" |
-
-"inline" |
-"noinline" |
-"volatile" |
-"public" |
-"static" |
-"extern" |
-"external" |
-"interface" |
-
-"long" |
-"short" |
-"double" |
-"half" |
-"fixed" |
-"unsigned" |
-"superp" |
-
-"input" |
-"output" |
-
-"hvec2" |
-"hvec3" |
-"hvec4" |
-"dvec2" |
-"dvec3" |
-"dvec4" |
-"fvec2" |
-"fvec3" |
-"fvec4" |
-
-"sampler1D" |
-"sampler1DShadow" |
-"sampler2DRectShadow" |
-
-"sizeof" |
-"cast" |
-
-"namespace" |
-"using" { return reserved_word(yyscanner); }
-
-{L}({L}|{D})* {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
-}
-
-0[xX]{H}+ { return int_constant(yyscanner); }
-0{O}+ { return int_constant(yyscanner); }
-{D}+ { return int_constant(yyscanner); }
-
-0[xX]{H}+[uU] { return uint_constant(context); }
-0{O}+[uU] { return uint_constant(context); }
-{D}+[uU] { return uint_constant(context); }
-
-{D}+{E} { return float_constant(yyscanner); }
-{D}+"."{D}*({E})? { return float_constant(yyscanner); }
-"."{D}+({E})? { return float_constant(yyscanner); }
-
-{D}+{E}[fF] { return floatsuffix_check(context); }
-{D}+"."{D}*({E})?[fF] { return floatsuffix_check(context); }
-"."{D}+({E})?[fF] { return floatsuffix_check(context); }
-
-"+=" { return(ADD_ASSIGN); }
-"-=" { return(SUB_ASSIGN); }
-"*=" { return(MUL_ASSIGN); }
-"/=" { return(DIV_ASSIGN); }
-"%=" { return(MOD_ASSIGN); }
-"<<=" { return(LEFT_ASSIGN); }
-">>=" { return(RIGHT_ASSIGN); }
-"&=" { return(AND_ASSIGN); }
-"^=" { return(XOR_ASSIGN); }
-"|=" { return(OR_ASSIGN); }
-
-"++" { return(INC_OP); }
-"--" { return(DEC_OP); }
-"&&" { return(AND_OP); }
-"||" { return(OR_OP); }
-"^^" { return(XOR_OP); }
-"<=" { return(LE_OP); }
-">=" { return(GE_OP); }
-"==" { return(EQ_OP); }
-"!=" { return(NE_OP); }
-"<<" { return(LEFT_OP); }
-">>" { return(RIGHT_OP); }
-";" { context->lexAfterType = false; return(SEMICOLON); }
-("{"|"<%") { context->lexAfterType = false; return(LEFT_BRACE); }
-("}"|"%>") { return(RIGHT_BRACE); }
-"," { if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
-":" { return(COLON); }
-"=" { context->lexAfterType = false; return(EQUAL); }
-"(" { context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
-")" { context->inTypeParen = false; return(RIGHT_PAREN); }
-("["|"<:") { return(LEFT_BRACKET); }
-("]"|":>") { return(RIGHT_BRACKET); }
-"." { BEGIN(FIELDS); return(DOT); }
-"!" { return(BANG); }
-"-" { return(DASH); }
-"~" { return(TILDE); }
-"+" { return(PLUS); }
-"*" { return(STAR); }
-"/" { return(SLASH); }
-"%" { return(PERCENT); }
-"<" { return(LEFT_ANGLE); }
-">" { return(RIGHT_ANGLE); }
-"|" { return(VERTICAL_BAR); }
-"^" { return(CARET); }
-"&" { return(AMPERSAND); }
-"?" { return(QUESTION); }
-
-<FIELDS>{L}({L}|{D})* {
- BEGIN(INITIAL);
- yylval->lex.string = NewPoolTString(yytext);
- return FIELD_SELECTION;
-}
-<FIELDS>[ \t\v\f\r] {}
-
-[ \t\v\n\f\r] { }
-<*><<EOF>> { context->AfterEOF = true; yyterminate(); }
-<*>. { context->warning(*yylloc, "Unknown char", yytext, ""); return 0; }
-
-%%
-
-yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
- pp::Token token;
- yyget_extra(yyscanner)->getPreprocessor().lex(&token);
- yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
- if (len < max_size)
- memcpy(buf, token.text.c_str(), len);
- yyset_column(token.location.file, yyscanner);
- yyset_lineno(token.location.line, yyscanner);
-
- if (len >= max_size)
- YY_FATAL_ERROR("Input buffer overflow");
- else if (len > 0)
- buf[len++] = ' ';
- return len;
-}
-
-int check_type(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- int token = IDENTIFIER;
- TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->getShaderVersion());
- if (yyextra->lexAfterType == false && symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType()) {
- yyextra->lexAfterType = true;
- token = TYPE_NAME;
- }
- }
- yylval->lex.symbol = symbol;
- return token;
-}
-
-int reserved_word(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
- yyextra->recover();
- return 0;
-}
-
-int ES2_reserved_ES3_keyword(TParseContext *context, int token)
-{
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- return reserved_word(yyscanner);
- }
-
- return token;
-}
-
-int ES2_keyword_ES3_reserved(TParseContext *context, int token)
-{
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- if (context->getShaderVersion() >= 300)
- {
- return reserved_word(yyscanner);
- }
-
- return token;
-}
-
-int ES2_identifier_ES3_keyword(TParseContext *context, int token)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
- if (context->getShaderVersion() < 300)
- {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return token;
-}
-
-int uint_constant(TParseContext *context)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
- context->recover();
- return 0;
- }
-
- if (!atou_clamp(yytext, &(yylval->lex.u)))
- yyextra->warning(*yylloc, "Integer overflow", yytext, "");
-
- return UINTCONSTANT;
-}
-
-int floatsuffix_check(TParseContext* context)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
- context->recover();
- return 0;
- }
-
- std::string text = yytext;
- text.resize(text.size() - 1); // Drop the suffix
- if(!atof_clamp(text.c_str(), &(yylval->lex.f)))
- yyextra->warning(*yylloc, "Float overflow", yytext, "");
-
- return(FLOATCONSTANT);
-}
-
-int int_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atoi_clamp(yytext, &(yylval->lex.i)))
- yyextra->warning(*yylloc, "Integer overflow", yytext, "");
- return INTCONSTANT;
-}
-
-int float_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atof_clamp(yytext, &(yylval->lex.f)))
- yyextra->warning(*yylloc, "Float overflow", yytext, "");
- return FLOATCONSTANT;
-}
-
-void yyerror(YYLTYPE* lloc, TParseContext* context, void* scanner, const char* reason) {
- struct yyguts_t* yyg = (struct yyguts_t*) scanner;
-
- if (context->AfterEOF) {
- context->error(*lloc, reason, "unexpected EOF");
- } else {
- context->error(*lloc, reason, yytext);
- }
- context->recover();
-}
-
-int glslang_initialize(TParseContext* context) {
- yyscan_t scanner = NULL;
- if (yylex_init_extra(context, &scanner))
- return 1;
-
- context->setScanner(scanner);
- return 0;
-}
-
-int glslang_finalize(TParseContext* context) {
- yyscan_t scanner = context->getScanner();
- if (scanner == NULL) return 0;
-
- context->setScanner(NULL);
- yylex_destroy(scanner);
-
- return 0;
-}
-
-int glslang_scan(size_t count, const char* const string[], const int length[],
- TParseContext* context) {
- yyrestart(NULL, context->getScanner());
- yyset_column(0, context->getScanner());
- yyset_lineno(1, context->getScanner());
- context->AfterEOF = false;
-
- // Initialize preprocessor.
- if (!context->getPreprocessor().init(count, string, length))
- return 1;
-
- // Define extension macros.
- const TExtensionBehavior& extBehavior = context->extensionBehavior();
- for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
- iter != extBehavior.end(); ++iter)
- {
- context->getPreprocessor().predefineMacro(iter->first.c_str(), 1);
- }
-
- context->getPreprocessor().predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
-
- return 0;
-}
-
diff --git a/src/OpenGL/compiler/glslang.y b/src/OpenGL/compiler/glslang.y
deleted file mode 100644
index 11000e177..000000000
--- a/src/OpenGL/compiler/glslang.y
+++ /dev/null
@@ -1,1630 +0,0 @@
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Yacc grammar for GLSL ES.
-Based on ANSI C Yacc grammar:
-http://www.lysator.liu.se/c/ANSI-C-grammar-y.html
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES PARSER (glslang_tab.cpp AND glslang_tab.h).
-*/
-
-%{
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-// Ignore errors in auto-generated code.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4189)
-#pragma warning(disable: 4505)
-#pragma warning(disable: 4701)
-#endif
-
-#include "SymbolTable.h"
-#include "ParseHelper.h"
-
-#define YYENABLE_NLS 0
-%}
-
-%expect 1 /* One shift reduce conflict because of if | else */
-%pure-parser
-%parse-param {TParseContext* context}
-%param {void* yyscanner}
-
-%code requires {
-#define YYLTYPE TSourceLoc
-#define YYLTYPE_IS_DECLARED 1
-}
-
-%union {
- struct {
- union {
- TString *string;
- float f;
- int i;
- unsigned int u;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- TIntermSwitch* intermSwitch;
- TIntermCase* intermCase;
- };
- union {
- TPublicType type;
- TPrecision precision;
- TLayoutQualifier layoutQualifier;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TField* field;
- TFieldList* fieldList;
- };
- } interm;
-}
-
-%{
-extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
-extern void yyerror(YYLTYPE* lloc, TParseContext* context, void* scanner, const char* reason);
-
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- do { \
- if (N) { \
- (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
- (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
- (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
- (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
- } \
- else { \
- (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
- (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
- (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
- (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
- } \
- } while (0)
-
-#define FRAG_VERT_ONLY(S, L) { \
- if (context->getShaderType() != GL_FRAGMENT_SHADER && \
- context->getShaderType() != GL_VERTEX_SHADER) { \
- context->error(L, " supported in vertex/fragment shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define VERTEX_ONLY(S, L) { \
- if (context->getShaderType() != GL_VERTEX_SHADER) { \
- context->error(L, " supported in vertex shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define FRAG_ONLY(S, L) { \
- if (context->getShaderType() != GL_FRAGMENT_SHADER) { \
- context->error(L, " supported in fragment shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define ES2_ONLY(S, L) { \
- if (context->getShaderVersion() != 100) { \
- context->error(L, " supported in GLSL ES 1.00 only ", S); \
- context->recover(); \
- } \
-}
-
-#define ES3_ONLY(TOKEN, LINE, REASON) { \
- if (context->getShaderVersion() != 300) { \
- context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
- context->recover(); \
- } \
-}
-%}
-
-%token <lex> INVARIANT HIGH_PRECISION MEDIUM_PRECISION LOW_PRECISION PRECISION
-%token <lex> ATTRIBUTE CONST_QUAL BOOL_TYPE FLOAT_TYPE INT_TYPE UINT_TYPE
-%token <lex> BREAK CONTINUE DO ELSE FOR IF DISCARD RETURN SWITCH CASE DEFAULT
-%token <lex> BVEC2 BVEC3 BVEC4 IVEC2 IVEC3 IVEC4 VEC2 VEC3 VEC4 UVEC2 UVEC3 UVEC4
-%token <lex> MATRIX2 MATRIX3 MATRIX4 IN_QUAL OUT_QUAL INOUT_QUAL UNIFORM VARYING
-%token <lex> MATRIX2x3 MATRIX3x2 MATRIX2x4 MATRIX4x2 MATRIX3x4 MATRIX4x3
-%token <lex> CENTROID FLAT SMOOTH
-%token <lex> STRUCT VOID_TYPE WHILE
-%token <lex> SAMPLER2D SAMPLERCUBE SAMPLER_EXTERNAL_OES SAMPLER2DRECT SAMPLER2DARRAY
-%token <lex> ISAMPLER2D ISAMPLER3D ISAMPLERCUBE ISAMPLER2DARRAY
-%token <lex> USAMPLER2D USAMPLER3D USAMPLERCUBE USAMPLER2DARRAY
-%token <lex> SAMPLER3D SAMPLER3DRECT SAMPLER2DSHADOW SAMPLERCUBESHADOW SAMPLER2DARRAYSHADOW
-%token <lex> LAYOUT
-
-%token <lex> IDENTIFIER TYPE_NAME FLOATCONSTANT INTCONSTANT UINTCONSTANT BOOLCONSTANT
-%token <lex> FIELD_SELECTION
-%token <lex> LEFT_OP RIGHT_OP
-%token <lex> INC_OP DEC_OP LE_OP GE_OP EQ_OP NE_OP
-%token <lex> AND_OP OR_OP XOR_OP MUL_ASSIGN DIV_ASSIGN ADD_ASSIGN
-%token <lex> MOD_ASSIGN LEFT_ASSIGN RIGHT_ASSIGN AND_ASSIGN XOR_ASSIGN OR_ASSIGN
-%token <lex> SUB_ASSIGN
-
-%token <lex> LEFT_PAREN RIGHT_PAREN LEFT_BRACKET RIGHT_BRACKET LEFT_BRACE RIGHT_BRACE DOT
-%token <lex> COMMA COLON EQUAL SEMICOLON BANG DASH TILDE PLUS STAR SLASH PERCENT
-%token <lex> LEFT_ANGLE RIGHT_ANGLE VERTICAL_BAR CARET AMPERSAND QUESTION
-
-%type <interm> assignment_operator unary_operator
-%type <interm.intermTypedNode> variable_identifier primary_expression postfix_expression
-%type <interm.intermTypedNode> expression integer_expression assignment_expression
-%type <interm.intermTypedNode> unary_expression multiplicative_expression additive_expression
-%type <interm.intermTypedNode> relational_expression equality_expression
-%type <interm.intermTypedNode> conditional_expression constant_expression
-%type <interm.intermTypedNode> logical_or_expression logical_xor_expression logical_and_expression
-%type <interm.intermTypedNode> shift_expression and_expression exclusive_or_expression inclusive_or_expression
-%type <interm.intermTypedNode> function_call initializer condition conditionopt
-
-%type <interm.intermNode> translation_unit function_definition
-%type <interm.intermNode> statement simple_statement
-%type <interm.intermAggregate> statement_list compound_statement compound_statement_no_new_scope
-%type <interm.intermNode> declaration_statement selection_statement expression_statement
-%type <interm.intermNode> declaration external_declaration
-%type <interm.intermNode> for_init_statement
-%type <interm.nodePair> selection_rest_statement for_rest_statement
-%type <interm.intermSwitch> switch_statement
-%type <interm.intermCase> case_label
-%type <interm.intermNode> iteration_statement jump_statement statement_no_new_scope statement_with_scope
-%type <interm> single_declaration init_declarator_list
-
-%type <interm> parameter_declaration parameter_declarator parameter_type_specifier
-%type <interm.qualifier> parameter_qualifier parameter_type_qualifier
-%type <interm.layoutQualifier> layout_qualifier layout_qualifier_id_list layout_qualifier_id
-
-%type <interm.precision> precision_qualifier
-%type <interm.type> type_qualifier fully_specified_type type_specifier storage_qualifier interpolation_qualifier
-%type <interm.type> type_specifier_no_prec type_specifier_nonarray
-%type <interm.type> struct_specifier
-%type <interm.field> struct_declarator
-%type <interm.fieldList> struct_declarator_list struct_declaration struct_declaration_list
-%type <interm.function> function_header function_declarator function_identifier
-%type <interm.function> function_header_with_parameters function_call_header
-%type <interm> function_call_header_with_parameters function_call_header_no_parameters function_call_generic function_prototype
-%type <interm> function_call_or_method
-
-%type <lex> enter_struct
-
-%start translation_unit
-%%
-
-variable_identifier
- : IDENTIFIER {
- // The symbol table search was done in the lexical phase
- const TVariable *variable = context->getNamedVariable(@1, $1.string, $1.symbol);
-
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
-
- // Constants which aren't indexable arrays can be propagated by value.
- ConstantUnion *constArray = variable->getConstPointer();
- if (constArray && variable->getType().getArraySize() <= 1) {
- TType t(variable->getType());
- $$ = context->intermediate.addConstantUnion(constArray, t, @1);
- } else
- $$ = context->intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), @1);
- }
- ;
-
-primary_expression
- : variable_identifier {
- $$ = $1;
- }
- | INTCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst($1.i);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), @1);
- }
- | UINTCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setUConst($1.u);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConstExpr), @1);
- }
- | FLOATCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setFConst($1.f);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), @1);
- }
- | BOOLCONSTANT {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setBConst($1.b);
- $$ = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), @1);
- }
- | LEFT_PAREN expression RIGHT_PAREN {
- $$ = $2;
- }
- ;
-
-postfix_expression
- : primary_expression {
- $$ = $1;
- }
- | postfix_expression LEFT_BRACKET integer_expression RIGHT_BRACKET {
- $$ = context->addIndexExpression($1, @2, $3);
- }
- | function_call {
- $$ = $1;
- }
- | postfix_expression DOT FIELD_SELECTION {
- $$ = context->addFieldSelectionExpression($1, @2, *$3.string, @3);
- }
- | postfix_expression INC_OP {
- $$ = context->addUnaryMathLValue(EOpPostIncrement, $1, @2);
- }
- | postfix_expression DEC_OP {
- $$ = context->addUnaryMathLValue(EOpPostDecrement, $1, @2);
- }
- ;
-
-integer_expression
- : expression {
- if (context->integerErrorCheck($1, "[]"))
- context->recover();
- $$ = $1;
- }
- ;
-
-function_call
- : function_call_or_method {
- bool fatalError = false;
- $$ = context->addFunctionCallOrMethod($1.function, $1.nodePair.node1, $1.nodePair.node2, @1, &fatalError);
- if (fatalError)
- {
- YYERROR;
- }
- }
- ;
-
-function_call_or_method
- : function_call_generic {
- $$ = $1;
- $$.nodePair.node2 = nullptr;
- }
- | postfix_expression DOT function_call_generic {
- ES3_ONLY("", @3, "methods");
- $$ = $3;
- $$.nodePair.node2 = $1;
- }
- ;
-
-function_call_generic
- : function_call_header_with_parameters RIGHT_PAREN {
- $$ = $1;
- }
- | function_call_header_no_parameters RIGHT_PAREN {
- $$ = $1;
- }
- ;
-
-function_call_header_no_parameters
- : function_call_header VOID_TYPE {
- $$.function = $1;
- $$.nodePair.node1 = nullptr;
- }
- | function_call_header {
- $$.function = $1;
- $$.nodePair.node1 = nullptr;
- }
- ;
-
-function_call_header_with_parameters
- : function_call_header assignment_expression {
- TParameter param = { 0, new TType($2->getType()) };
- $1->addParameter(param);
- $$.function = $1;
- $$.nodePair.node1 = context->intermediate.makeAggregate($2, @2);
- }
- | function_call_header_with_parameters COMMA assignment_expression {
- TParameter param = { 0, new TType($3->getType()) };
- $1.function->addParameter(param);
- $$.function = $1.function;
- $$.nodePair.node1 = context->intermediate.growAggregate($1.intermNode, $3, @2);
- }
- ;
-
-function_call_header
- : function_identifier LEFT_PAREN {
- $$ = $1;
- }
- ;
-
-// Grammar Note: Constructors look like functions, but are recognized as types.
-
-function_identifier
- : type_specifier_no_prec {
- if ($1.array) {
- ES3_ONLY("[]", @1, "array constructor");
- }
- $$ = context->addConstructorFunc($1);
- }
- | IDENTIFIER {
- if (context->reservedErrorCheck(@1, *$1.string))
- context->recover();
- TType type(EbtVoid, EbpUndefined);
- TFunction *function = new TFunction($1.string, type);
- $$ = function;
- }
- | FIELD_SELECTION {
- if (context->reservedErrorCheck(@1, *$1.string))
- context->recover();
- TType type(EbtVoid, EbpUndefined);
- TFunction *function = new TFunction($1.string, type);
- $$ = function;
- }
- ;
-
-unary_expression
- : postfix_expression {
- $$ = $1;
- }
- | INC_OP unary_expression {
- $$ = context->addUnaryMathLValue(EOpPreIncrement, $2, @1);
- }
- | DEC_OP unary_expression {
- $$ = context->addUnaryMathLValue(EOpPreDecrement, $2, @1);
- }
- | unary_operator unary_expression {
- if ($1.op != EOpNull) {
- $$ = context->addUnaryMath($1.op, $2, @1);
- } else
- $$ = $2;
- }
- ;
-// Grammar Note: No traditional style type casts.
-
-unary_operator
- : PLUS { $$.op = EOpNull; }
- | DASH { $$.op = EOpNegative; }
- | BANG { $$.op = EOpLogicalNot; }
- | TILDE {
- ES3_ONLY("~", @1, "bit-wise operator");
- $$.op = EOpBitwiseNot;
- }
- ;
-// Grammar Note: No '*' or '&' unary ops. Pointers are not supported.
-
-multiplicative_expression
- : unary_expression { $$ = $1; }
- | multiplicative_expression STAR unary_expression {
- FRAG_VERT_ONLY("*", @2);
- $$ = context->addBinaryMath(EOpMul, $1, $3, @2);
- }
- | multiplicative_expression SLASH unary_expression {
- FRAG_VERT_ONLY("/", @2);
- $$ = context->addBinaryMath(EOpDiv, $1, $3, @2);
- }
- | multiplicative_expression PERCENT unary_expression {
- FRAG_VERT_ONLY("%", @2);
- ES3_ONLY("%", @2, "integer modulus operator");
- $$ = context->addBinaryMath(EOpIMod, $1, $3, @2);
- }
- ;
-
-additive_expression
- : multiplicative_expression { $$ = $1; }
- | additive_expression PLUS multiplicative_expression {
- $$ = context->addBinaryMath(EOpAdd, $1, $3, @2);
- }
- | additive_expression DASH multiplicative_expression {
- $$ = context->addBinaryMath(EOpSub, $1, $3, @2);
- }
- ;
-
-shift_expression
- : additive_expression { $$ = $1; }
- | shift_expression LEFT_OP additive_expression {
- ES3_ONLY("<<", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitShiftLeft, $1, $3, @2);
- }
- | shift_expression RIGHT_OP additive_expression {
- ES3_ONLY(">>", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitShiftRight, $1, $3, @2);
- }
- ;
-
-relational_expression
- : shift_expression { $$ = $1; }
- | relational_expression LEFT_ANGLE shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLessThan, $1, $3, @2);
- }
- | relational_expression RIGHT_ANGLE shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpGreaterThan, $1, $3, @2);
- }
- | relational_expression LE_OP shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLessThanEqual, $1, $3, @2);
- }
- | relational_expression GE_OP shift_expression {
- $$ = context->addBinaryMathBooleanResult(EOpGreaterThanEqual, $1, $3, @2);
- }
- ;
-
-equality_expression
- : relational_expression { $$ = $1; }
- | equality_expression EQ_OP relational_expression {
- $$ = context->addBinaryMathBooleanResult(EOpEqual, $1, $3, @2);
- }
- | equality_expression NE_OP relational_expression {
- $$ = context->addBinaryMathBooleanResult(EOpNotEqual, $1, $3, @2);
- }
- ;
-
-and_expression
- : equality_expression { $$ = $1; }
- | and_expression AMPERSAND equality_expression {
- ES3_ONLY("&", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseAnd, $1, $3, @2);
- }
- ;
-
-exclusive_or_expression
- : and_expression { $$ = $1; }
- | exclusive_or_expression CARET and_expression {
- ES3_ONLY("^", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseXor, $1, $3, @2);
- }
- ;
-
-inclusive_or_expression
- : exclusive_or_expression { $$ = $1; }
- | inclusive_or_expression VERTICAL_BAR exclusive_or_expression {
- ES3_ONLY("|", @2, "bit-wise operator");
- $$ = context->addBinaryMath(EOpBitwiseOr, $1, $3, @2);
- }
- ;
-
-logical_and_expression
- : inclusive_or_expression { $$ = $1; }
- | logical_and_expression AND_OP inclusive_or_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalAnd, $1, $3, @2);
- }
- ;
-
-logical_xor_expression
- : logical_and_expression { $$ = $1; }
- | logical_xor_expression XOR_OP logical_and_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalXor, $1, $3, @2);
- }
- ;
-
-logical_or_expression
- : logical_xor_expression { $$ = $1; }
- | logical_or_expression OR_OP logical_xor_expression {
- $$ = context->addBinaryMathBooleanResult(EOpLogicalOr, $1, $3, @2);
- }
- ;
-
-conditional_expression
- : logical_or_expression { $$ = $1; }
- | logical_or_expression QUESTION expression COLON assignment_expression {
- $$ = context->addTernarySelection($1, $3, $5, @2);
- }
- ;
-
-assignment_expression
- : conditional_expression { $$ = $1; }
- | unary_expression assignment_operator assignment_expression {
- if (context->lValueErrorCheck(@2, "assign", $1))
- context->recover();
- $$ = context->addAssign($2.op, $1, $3, @2);
- }
- ;
-
-assignment_operator
- : EQUAL { $$.op = EOpAssign; }
- | MUL_ASSIGN { FRAG_VERT_ONLY("*=", @1); $$.op = EOpMulAssign; }
- | DIV_ASSIGN { FRAG_VERT_ONLY("/=", @1); $$.op = EOpDivAssign; }
- | MOD_ASSIGN { ES3_ONLY("%=", @1, "integer modulus operator");
- FRAG_VERT_ONLY("%=", @1); $$.op = EOpIModAssign; }
- | ADD_ASSIGN { $$.op = EOpAddAssign; }
- | SUB_ASSIGN { $$.op = EOpSubAssign; }
- | LEFT_ASSIGN { ES3_ONLY("<<=", @1, "bit-wise operator");
- FRAG_VERT_ONLY("<<=", @1);
- $$.op = EOpBitShiftLeftAssign; }
- | RIGHT_ASSIGN { ES3_ONLY(">>=", @1, "bit-wise operator");
- FRAG_VERT_ONLY(">>=", @1);
- $$.op = EOpBitShiftRightAssign; }
- | AND_ASSIGN { ES3_ONLY("&=", @1, "bit-wise operator");
- FRAG_VERT_ONLY("&=", @1);
- $$.op = EOpBitwiseAndAssign; }
- | XOR_ASSIGN { ES3_ONLY("^=", @1, "bit-wise operator");
- FRAG_VERT_ONLY("^=", @1);
- $$.op = EOpBitwiseXorAssign; }
- | OR_ASSIGN { ES3_ONLY("|=", @1, "bit-wise operator");
- FRAG_VERT_ONLY("|=", @1);
- $$.op = EOpBitwiseOrAssign; }
- ;
-
-expression
- : assignment_expression {
- $$ = $1;
- }
- | expression COMMA assignment_expression {
- $$ = context->intermediate.addComma($1, $3, @2);
- if ($$ == 0) {
- context->binaryOpError(@2, ",", $1->getCompleteString(), $3->getCompleteString());
- context->recover();
- $$ = $3;
- }
- }
- ;
-
-constant_expression
- : conditional_expression {
- if (context->constErrorCheck($1))
- context->recover();
- $$ = $1;
- }
- ;
-
-enter_struct
- : IDENTIFIER LEFT_BRACE {
- if (context->enterStructDeclaration(@1, *$1.string))
- context->recover();
- $$ = $1;
- }
- ;
-
-declaration
- : function_prototype SEMICOLON {
- $$ = context->addFunctionPrototypeDeclaration(*($1.function), @1);
- }
- | init_declarator_list SEMICOLON {
- TIntermAggregate *aggNode = $1.intermAggregate;
- if (aggNode && aggNode->getOp() == EOpNull)
- aggNode->setOp(EOpDeclaration);
- $$ = aggNode;
- }
- | PRECISION precision_qualifier type_specifier_no_prec SEMICOLON {
- if (!context->symbolTable.setDefaultPrecision( $3, $2 )) {
- context->error(@1, "illegal type argument for default precision qualifier", getBasicString($3.type));
- context->recover();
- }
- $$ = 0;
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
- $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, NULL, @1, NULL, @1);
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
- $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, NULL, @1);
- }
- | type_qualifier enter_struct struct_declaration_list RIGHT_BRACE IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET SEMICOLON {
- ES3_ONLY(getQualifierString($1.qualifier), @1, "interface blocks");
- $$ = context->addInterfaceBlock($1, @2, *$2.string, $3, $5.string, @5, $7, @6);
- }
- | type_qualifier SEMICOLON {
- context->parseGlobalLayoutQualifier($1);
- $$ = 0;
- }
- ;
-
-function_prototype
- : function_declarator RIGHT_PAREN {
- $$.function = context->parseFunctionDeclarator(@2, $1);
- }
- ;
-
-function_declarator
- : function_header {
- $$ = $1;
- }
- | function_header_with_parameters {
- $$ = $1;
- }
- ;
-
-
-function_header_with_parameters
- : function_header parameter_declaration {
- // Add the parameter
- $$ = $1;
- if ($2.param.type->getBasicType() != EbtVoid)
- $1->addParameter($2.param);
- else
- delete $2.param.type;
- }
- | function_header_with_parameters COMMA parameter_declaration {
- //
- // Only first parameter of one-parameter functions can be void
- // The check for named parameters not being void is done in parameter_declarator
- //
- if ($3.param.type->getBasicType() == EbtVoid) {
- //
- // This parameter > first is void
- //
- context->error(@2, "cannot be an argument type except for '(void)'", "void");
- context->recover();
- delete $3.param.type;
- } else {
- // Add the parameter
- $$ = $1;
- $1->addParameter($3.param);
- }
- }
- ;
-
-function_header
- : fully_specified_type IDENTIFIER LEFT_PAREN {
- if ($1.qualifier != EvqGlobal && $1.qualifier != EvqTemporary) {
- context->error(@2, "no qualifiers allowed for function return", getQualifierString($1.qualifier));
- context->recover();
- }
- if (!$1.layoutQualifier.isEmpty())
- {
- context->error(@2, "no qualifiers allowed for function return", "layout");
- context->recover();
- }
- // make sure a sampler is not involved as well...
- if (context->samplerErrorCheck(@2, $1, "samplers can't be function return values"))
- context->recover();
-
- // Add the function as a prototype after parsing it (we do not support recursion)
- TFunction *function;
- TType type($1);
- function = new TFunction($2.string, type);
- $$ = function;
-
- context->symbolTable.push();
- }
- ;
-
-parameter_declarator
- // Type + name
- : type_specifier IDENTIFIER {
- if ($1.type == EbtVoid) {
- context->error(@2, "illegal use of type 'void'", $2.string->c_str());
- context->recover();
- }
- if (context->reservedErrorCheck(@2, *$2.string))
- context->recover();
- TParameter param = {$2.string, new TType($1)};
- $$.param = param;
- }
- | type_specifier IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- // Check that we can make an array out of this type
- if (context->arrayTypeErrorCheck(@3, $1))
- context->recover();
-
- if (context->reservedErrorCheck(@2, *$2.string))
- context->recover();
-
- int size = 0;
- if (context->arraySizeErrorCheck(@3, $4, size))
- context->recover();
- $1.setArray(true, size);
-
- TType* type = new TType($1);
- TParameter param = { $2.string, type };
- $$.param = param;
- }
- ;
-
-parameter_declaration
- //
- // The only parameter qualifier a parameter can have are
- // IN_QUAL, OUT_QUAL, INOUT_QUAL, or CONST.
- //
-
- //
- // Type + name
- //
- : parameter_type_qualifier parameter_qualifier parameter_declarator {
- $$ = $3;
- if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
- context->recover();
- }
- | parameter_qualifier parameter_declarator {
- $$ = $2;
- if (context->parameterSamplerErrorCheck(@2, $1, *$2.param.type))
- context->recover();
- if (context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type))
- context->recover();
- }
- //
- // Only type
- //
- | parameter_type_qualifier parameter_qualifier parameter_type_specifier {
- $$ = $3;
- if (context->paramErrorCheck(@3, $1, $2, $$.param.type))
- context->recover();
- }
- | parameter_qualifier parameter_type_specifier {
- $$ = $2;
- if (context->parameterSamplerErrorCheck(@2, $1, *$2.param.type))
- context->recover();
- if (context->paramErrorCheck(@2, EvqTemporary, $1, $$.param.type))
- context->recover();
- }
- ;
-
-parameter_qualifier
- : /* empty */ {
- $$ = EvqIn;
- }
- | IN_QUAL {
- $$ = EvqIn;
- }
- | OUT_QUAL {
- $$ = EvqOut;
- }
- | INOUT_QUAL {
- $$ = EvqInOut;
- }
- ;
-
-parameter_type_specifier
- : type_specifier {
- TParameter param = { 0, new TType($1) };
- $$.param = param;
- }
- ;
-
-init_declarator_list
- : single_declaration {
- $$ = $1;
- }
- | init_declarator_list COMMA IDENTIFIER {
- $$ = $1;
- $$.intermAggregate = context->parseDeclarator($$.type, $1.intermAggregate, @3, *$3.string);
- }
- | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$ = $1;
- $$.intermAggregate = context->parseArrayDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
- }
- | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
- ES3_ONLY("[]", @3, "implicitly sized array");
- $$ = $1;
- $$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, nullptr, @6, $7);
- }
- | init_declarator_list COMMA IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
- ES3_ONLY("=", @7, "first-class arrays (array initializer)");
- $$ = $1;
- $$.intermAggregate = context->parseArrayInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5, @7, $8);
- }
- | init_declarator_list COMMA IDENTIFIER EQUAL initializer {
- $$ = $1;
- $$.intermAggregate = context->parseInitDeclarator($$.type, $1.intermAggregate, @3, *$3.string, @4, $5);
- }
- ;
-
-single_declaration
- : fully_specified_type {
- $$.type = $1;
- $$.intermAggregate = context->parseSingleDeclaration($$.type, @1, "");
- }
- | fully_specified_type IDENTIFIER {
- $$.type = $1;
- $$.intermAggregate = context->parseSingleDeclaration($$.type, @2, *$2.string);
- }
- | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$.type = $1;
- $$.intermAggregate = context->parseSingleArrayDeclaration($$.type, @2, *$2.string, @3, $4);
- }
- | fully_specified_type IDENTIFIER LEFT_BRACKET RIGHT_BRACKET EQUAL initializer {
- ES3_ONLY("[]", @3, "implicitly sized array");
- $$.type = $1;
- $$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, nullptr, @5, $6);
- }
- | fully_specified_type IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET EQUAL initializer {
- ES3_ONLY("=", @6, "first-class arrays (array initializer)");
- $$.type = $1;
- $$.intermAggregate = context->parseSingleArrayInitDeclaration($$.type, @2, *$2.string, @3, $4, @6, $7);
- }
- | fully_specified_type IDENTIFIER EQUAL initializer {
- $$.type = $1;
- $$.intermAggregate = context->parseSingleInitDeclaration($$.type, @2, *$2.string, @3, $4);
- }
- | INVARIANT IDENTIFIER {
- // $$.type is not used in invariant declarations.
- $$.intermAggregate = context->parseInvariantDeclaration(@1, @2, $2.string, $2.symbol);
- }
- ;
-
-fully_specified_type
- : type_specifier {
- $$ = $1;
-
- if ($1.array) {
- ES3_ONLY("[]", @1, "first-class-array");
- if (context->getShaderVersion() != 300) {
- $1.clearArrayness();
- }
- }
- }
- | type_qualifier type_specifier {
- $$ = context->addFullySpecifiedType($1.qualifier, $1.invariant, $1.layoutQualifier, $2);
- }
- ;
-
-interpolation_qualifier
- : SMOOTH {
- $$.qualifier = EvqSmooth;
- }
- | FLAT {
- $$.qualifier = EvqFlat;
- }
- ;
-
-parameter_type_qualifier
- : CONST_QUAL {
- $$ = EvqConstReadOnly;
- }
- ;
-
-type_qualifier
- : ATTRIBUTE {
- VERTEX_ONLY("attribute", @1);
- ES2_ONLY("attribute", @1);
- if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "attribute"))
- context->recover();
- $$.setBasic(EbtVoid, EvqAttribute, @1);
- }
- | VARYING {
- ES2_ONLY("varying", @1);
- if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "varying"))
- context->recover();
- if (context->getShaderType() == GL_VERTEX_SHADER)
- $$.setBasic(EbtVoid, EvqVaryingOut, @1);
- else
- $$.setBasic(EbtVoid, EvqVaryingIn, @1);
- }
- | INVARIANT VARYING {
- ES2_ONLY("varying", @1);
- if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "invariant varying"))
- context->recover();
- if (context->getShaderType() == GL_VERTEX_SHADER)
- $$.setBasic(EbtVoid, EvqInvariantVaryingOut, @1);
- else
- $$.setBasic(EbtVoid, EvqInvariantVaryingIn, @1);
- }
- | storage_qualifier {
- if ($1.qualifier != EvqConstExpr && !context->symbolTable.atGlobalLevel())
- {
- context->error(@1, "Local variables can only use the const storage qualifier.", getQualifierString($1.qualifier));
- context->recover();
- }
- $$.setBasic(EbtVoid, $1.qualifier, @1);
- }
- | interpolation_qualifier storage_qualifier {
- $$ = context->joinInterpolationQualifiers(@1, $1.qualifier, @2, $2.qualifier);
- }
- | interpolation_qualifier {
- context->error(@1, "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString($1.qualifier));
- context->recover();
-
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtVoid, qual, @1);
- }
- | layout_qualifier {
- $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.layoutQualifier = $1;
- }
- | layout_qualifier storage_qualifier {
- $$.setBasic(EbtVoid, $2.qualifier, @2);
- $$.layoutQualifier = $1;
- }
- | INVARIANT storage_qualifier {
- context->es3InvariantErrorCheck($2.qualifier, @1);
- $$.setBasic(EbtVoid, $2.qualifier, @2);
- $$.invariant = true;
- }
- | INVARIANT interpolation_qualifier storage_qualifier {
- context->es3InvariantErrorCheck($3.qualifier, @1);
- $$ = context->joinInterpolationQualifiers(@2, $2.qualifier, @3, $3.qualifier);
- $$.invariant = true;
- }
- ;
-
-storage_qualifier
- : CONST_QUAL {
- $$.qualifier = EvqConstExpr;
- }
- | IN_QUAL {
- ES3_ONLY("in", @1, "storage qualifier");
- $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
- }
- | OUT_QUAL {
- ES3_ONLY("out", @1, "storage qualifier");
- $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
- }
- | CENTROID IN_QUAL {
- ES3_ONLY("centroid in", @1, "storage qualifier");
- if (context->getShaderType() == GL_VERTEX_SHADER)
- {
- context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
- context->recover();
- }
- $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
- }
- | CENTROID OUT_QUAL {
- ES3_ONLY("centroid out", @1, "storage qualifier");
- if (context->getShaderType() == GL_FRAGMENT_SHADER)
- {
- context->error(@1, "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
- context->recover();
- }
- $$.qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
- }
- | UNIFORM {
- if (context->globalErrorCheck(@1, context->symbolTable.atGlobalLevel(), "uniform"))
- context->recover();
- $$.qualifier = EvqUniform;
- }
- ;
-
-type_specifier
- : type_specifier_no_prec {
- $$ = $1;
-
- if ($$.precision == EbpUndefined) {
- $$.precision = context->symbolTable.getDefaultPrecision($1.type);
- if (context->precisionErrorCheck(@1, $$.precision, $1.type)) {
- context->recover();
- }
- }
- }
- | precision_qualifier type_specifier_no_prec {
- $$ = $2;
- $$.precision = $1;
-
- if (!SupportsPrecision($2.type)) {
- context->error(@1, "illegal type for precision qualifier", getBasicString($2.type));
- context->recover();
- }
- }
- ;
-
-precision_qualifier
- : HIGH_PRECISION {
- $$ = EbpHigh;
- }
- | MEDIUM_PRECISION {
- $$ = EbpMedium;
- }
- | LOW_PRECISION {
- $$ = EbpLow;
- }
- ;
-
-layout_qualifier
- : LAYOUT LEFT_PAREN layout_qualifier_id_list RIGHT_PAREN {
- ES3_ONLY("layout", @1, "qualifier");
- $$ = $3;
- }
- ;
-
-layout_qualifier_id_list
- : layout_qualifier_id {
- $$ = $1;
- }
- | layout_qualifier_id_list COMMA layout_qualifier_id {
- $$ = context->joinLayoutQualifiers($1, $3);
- }
- ;
-
-layout_qualifier_id
- : IDENTIFIER {
- $$ = context->parseLayoutQualifier(*$1.string, @1);
- }
- | IDENTIFIER EQUAL INTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, @1, $3.i, @3);
- }
- | IDENTIFIER EQUAL UINTCONSTANT {
- $$ = context->parseLayoutQualifier(*$1.string, @1, $3.i, @3);
- }
- ;
-
-type_specifier_no_prec
- : type_specifier_nonarray {
- $$ = $1;
- }
- | type_specifier_nonarray LEFT_BRACKET RIGHT_BRACKET {
- ES3_ONLY("[]", @2, "implicitly sized array");
- $$ = $1;
- $$.setArray(true, 0);
- }
- | type_specifier_nonarray LEFT_BRACKET constant_expression RIGHT_BRACKET {
- $$ = $1;
-
- if (context->arrayTypeErrorCheck(@2, $1))
- context->recover();
- else {
- int size = 0;
- if (context->arraySizeErrorCheck(@2, $3, size))
- context->recover();
- $$.setArray(true, size);
- }
- }
- ;
-
-type_specifier_nonarray
- : VOID_TYPE {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtVoid, qual, @1);
- }
- | FLOAT_TYPE {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- }
- | INT_TYPE {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, @1);
- }
- | UINT_TYPE {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, @1);
- }
- | BOOL_TYPE {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, @1);
- }
- | VEC2 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(2);
- }
- | VEC3 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(3);
- }
- | VEC4 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setAggregate(4);
- }
- | BVEC2 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, @1);
- $$.setAggregate(2);
- }
- | BVEC3 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, @1);
- $$.setAggregate(3);
- }
- | BVEC4 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtBool, qual, @1);
- $$.setAggregate(4);
- }
- | IVEC2 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, @1);
- $$.setAggregate(2);
- }
- | IVEC3 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, @1);
- $$.setAggregate(3);
- }
- | IVEC4 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtInt, qual, @1);
- $$.setAggregate(4);
- }
- | UVEC2 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, @1);
- $$.setAggregate(2);
- }
- | UVEC3 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, @1);
- $$.setAggregate(3);
- }
- | UVEC4 {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUInt, qual, @1);
- $$.setAggregate(4);
- }
- | MATRIX2 {
- FRAG_VERT_ONLY("mat2", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(2, 2);
- }
- | MATRIX3 {
- FRAG_VERT_ONLY("mat3", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(3, 3);
- }
- | MATRIX4 {
- FRAG_VERT_ONLY("mat4", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(4, 4);
- }
- | MATRIX2x3 {
- FRAG_VERT_ONLY("mat2x3", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(2, 3);
- }
- | MATRIX3x2 {
- FRAG_VERT_ONLY("mat3x2", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(3, 2);
- }
- | MATRIX2x4 {
- FRAG_VERT_ONLY("mat2x4", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(2, 4);
- }
- | MATRIX4x2 {
- FRAG_VERT_ONLY("mat4x2", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(4, 2);
- }
- | MATRIX3x4 {
- FRAG_VERT_ONLY("mat3x4", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(3, 4);
- }
- | MATRIX4x3 {
- FRAG_VERT_ONLY("mat4x3", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtFloat, qual, @1);
- $$.setMatrix(4, 3);
- }
- | SAMPLER2D {
- FRAG_VERT_ONLY("sampler2D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2D, qual, @1);
- }
- | SAMPLERCUBE {
- FRAG_VERT_ONLY("samplerCube", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSamplerCube, qual, @1);
- }
- | SAMPLER_EXTERNAL_OES {
- if (!context->supportsExtension("GL_OES_EGL_image_external")) {
- context->error(@1, "unsupported type", "samplerExternalOES", "");
- context->recover();
- }
- FRAG_VERT_ONLY("samplerExternalOES", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSamplerExternalOES, qual, @1);
- }
- | SAMPLER2DRECT {
- if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
- context->error(@1, "unsupported type", "sampler2DRect", "");
- context->recover();
- }
- FRAG_VERT_ONLY("sampler2DRect", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DRect, qual, @1);
- }
- | SAMPLER3D {
- FRAG_VERT_ONLY("sampler3D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler3D, qual, @1);
- }
- | SAMPLER2DARRAY {
- FRAG_VERT_ONLY("sampler2DArray", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DArray, qual, @1);
- }
- | ISAMPLER2D {
- FRAG_VERT_ONLY("isampler2D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler2D, qual, @1);
- }
- | ISAMPLER3D {
- FRAG_VERT_ONLY("isampler3D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler3D, qual, @1);
- }
- | ISAMPLERCUBE {
- FRAG_VERT_ONLY("isamplerCube", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISamplerCube, qual, @1);
- }
- | ISAMPLER2DARRAY {
- FRAG_VERT_ONLY("isampler2DArray", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtISampler2DArray, qual, @1);
- }
- | USAMPLER2D {
- FRAG_VERT_ONLY("usampler2D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler2D, qual, @1);
- }
- | USAMPLER3D {
- FRAG_VERT_ONLY("usampler3D", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler3D, qual, @1);
- }
- | USAMPLERCUBE {
- FRAG_VERT_ONLY("usamplerCube", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSamplerCube, qual, @1);
- }
- | USAMPLER2DARRAY {
- FRAG_VERT_ONLY("usampler2DArray", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtUSampler2DArray, qual, @1);
- }
- | SAMPLER2DSHADOW {
- FRAG_VERT_ONLY("sampler2DShadow", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DShadow, qual, @1);
- }
- | SAMPLERCUBESHADOW {
- FRAG_VERT_ONLY("samplerCubeShadow", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSamplerCubeShadow, qual, @1);
- }
- | SAMPLER2DARRAYSHADOW {
- FRAG_VERT_ONLY("sampler2DArrayShadow", @1);
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtSampler2DArrayShadow, qual, @1);
- }
- | struct_specifier {
- FRAG_VERT_ONLY("struct", @1);
- $$ = $1;
- $$.qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- }
- | TYPE_NAME {
- //
- // This is for user defined type names. The lexical phase looked up the
- // type.
- //
- TType& structure = static_cast<TVariable*>($1.symbol)->getType();
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- $$.setBasic(EbtStruct, qual, @1);
- $$.userDef = &structure;
- }
- ;
-
-struct_specifier
- : STRUCT IDENTIFIER LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure(@1, @2, $2.string, $5);
- }
- | STRUCT LEFT_BRACE { if (context->enterStructDeclaration(@2, *$2.string)) context->recover(); } struct_declaration_list RIGHT_BRACE {
- $$ = context->addStructure(@1, @1, NewPoolTString(""), $4);
- }
- ;
-
-struct_declaration_list
- : struct_declaration {
- $$ = $1;
- }
- | struct_declaration_list struct_declaration {
- $$ = $1;
- for (unsigned int i = 0; i < $2->size(); ++i) {
- TField* field = (*$2)[i];
- for (unsigned int j = 0; j < $$->size(); ++j) {
- if ((*$$)[j]->name() == field->name()) {
- context->error((*$2)[i]->line(), "duplicate field name in structure:", "struct", field->name().c_str());
- context->recover();
- }
- }
- $$->push_back((*$2)[i]);
- }
- }
- ;
-
-struct_declaration
- : type_specifier struct_declarator_list SEMICOLON {
- $$ = context->addStructDeclaratorList($1, $2);
- }
- | type_qualifier type_specifier struct_declarator_list SEMICOLON {
- // ES3 Only, but errors should be handled elsewhere
- $2.qualifier = $1.qualifier;
- $2.layoutQualifier = $1.layoutQualifier;
- $$ = context->addStructDeclaratorList($2, $3);
- }
- ;
-
-struct_declarator_list
- : struct_declarator {
- $$ = NewPoolTFieldList();
- $$->push_back($1);
- }
- | struct_declarator_list COMMA struct_declarator {
- $$->push_back($3);
- }
- ;
-
-struct_declarator
- : IDENTIFIER {
- if (context->reservedErrorCheck(@1, *$1.string))
- context->recover();
-
- TType* type = new TType(EbtVoid, EbpUndefined);
- $$ = new TField(type, $1.string, @1);
- }
- | IDENTIFIER LEFT_BRACKET constant_expression RIGHT_BRACKET {
- if (context->reservedErrorCheck(@1, *$1.string))
- context->recover();
-
- TType* type = new TType(EbtVoid, EbpUndefined);
- int size = 0;
- if (context->arraySizeErrorCheck($3->getLine(), $3, size))
- context->recover();
- type->setArraySize(size);
-
- $$ = new TField(type, $1.string, @1);
- }
- ;
-
-initializer
- : assignment_expression { $$ = $1; }
- ;
-
-declaration_statement
- : declaration { $$ = $1; }
- ;
-
-statement
- : compound_statement { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-// Grammar Note: Labeled statements for SWITCH only; 'goto' is not supported.
-
-simple_statement
- : declaration_statement { $$ = $1; }
- | expression_statement { $$ = $1; }
- | selection_statement { $$ = $1; }
- | switch_statement { $$ = $1; }
- | case_label { $$ = $1; }
- | iteration_statement { $$ = $1; }
- | jump_statement { $$ = $1; }
- ;
-
-compound_statement
- : LEFT_BRACE RIGHT_BRACE { $$ = 0; }
- | LEFT_BRACE { context->symbolTable.push(); } statement_list { context->symbolTable.pop(); } RIGHT_BRACE {
- if ($3 != 0) {
- $3->setOp(EOpSequence);
- $3->setEndLine(@5);
- }
- $$ = $3;
- }
- ;
-
-statement_no_new_scope
- : compound_statement_no_new_scope { $$ = $1; }
- | simple_statement { $$ = $1; }
- ;
-
-statement_with_scope
- : { context->symbolTable.push(); } compound_statement_no_new_scope { context->symbolTable.pop(); $$ = $2; }
- | { context->symbolTable.push(); } simple_statement { context->symbolTable.pop(); $$ = $2; }
- ;
-
-compound_statement_no_new_scope
- // Statement that doesn't create a new scope, for selection_statement, iteration_statement
- : LEFT_BRACE RIGHT_BRACE {
- $$ = 0;
- }
- | LEFT_BRACE statement_list RIGHT_BRACE {
- if ($2) {
- $2->setOp(EOpSequence);
- $2->setEndLine(@3);
- }
- $$ = $2;
- }
- ;
-
-statement_list
- : statement {
- $$ = context->intermediate.makeAggregate($1, @$);
- }
- | statement_list statement {
- $$ = context->intermediate.growAggregate($1, $2, @$);
- }
- ;
-
-expression_statement
- : SEMICOLON { $$ = 0; }
- | expression SEMICOLON { $$ = static_cast<TIntermNode*>($1); }
- ;
-
-selection_statement
- : IF LEFT_PAREN expression RIGHT_PAREN selection_rest_statement {
- if (context->boolErrorCheck(@1, $3))
- context->recover();
- $$ = context->intermediate.addSelection($3, $5, @1);
- }
- ;
-
-selection_rest_statement
- : statement_with_scope ELSE statement_with_scope {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- | statement_with_scope {
- $$.node1 = $1;
- $$.node2 = 0;
- }
- ;
-
-switch_statement
- : SWITCH LEFT_PAREN expression RIGHT_PAREN { context->incrSwitchNestingLevel(); } compound_statement {
- $$ = context->addSwitch($3, $6, @1);
- context->decrSwitchNestingLevel();
- }
- ;
-
-case_label
- : CASE constant_expression COLON {
- $$ = context->addCase($2, @1);
- }
- | DEFAULT COLON {
- $$ = context->addDefault(@1);
- }
- ;
-
-condition
- // In 1996 c++ draft, conditions can include single declarations
- : expression {
- $$ = $1;
- if (context->boolErrorCheck($1->getLine(), $1))
- context->recover();
- }
- | fully_specified_type IDENTIFIER EQUAL initializer {
- TIntermNode *intermNode;
- if (context->boolErrorCheck(@2, $1))
- context->recover();
-
- if (!context->executeInitializer(@2, *$2.string, $1, $4, &intermNode))
- $$ = $4;
- else {
- context->recover();
- $$ = 0;
- }
- }
- ;
-
-iteration_statement
- : WHILE LEFT_PAREN { context->symbolTable.push(); context->incrLoopNestingLevel(); } condition RIGHT_PAREN statement_no_new_scope {
- context->symbolTable.pop();
- $$ = context->intermediate.addLoop(ELoopWhile, 0, $4, 0, $6, @1);
- context->decrLoopNestingLevel();
- }
- | DO { context->incrLoopNestingLevel(); } statement_with_scope WHILE LEFT_PAREN expression RIGHT_PAREN SEMICOLON {
- if (context->boolErrorCheck(@8, $6))
- context->recover();
-
- $$ = context->intermediate.addLoop(ELoopDoWhile, 0, $6, 0, $3, @4);
- context->decrLoopNestingLevel();
- }
- | FOR LEFT_PAREN { context->symbolTable.push(); context->incrLoopNestingLevel(); } for_init_statement for_rest_statement RIGHT_PAREN statement_no_new_scope {
- context->symbolTable.pop();
- $$ = context->intermediate.addLoop(ELoopFor, $4, reinterpret_cast<TIntermTyped*>($5.node1), reinterpret_cast<TIntermTyped*>($5.node2), $7, @1);
- context->decrLoopNestingLevel();
- }
- ;
-
-for_init_statement
- : expression_statement {
- $$ = $1;
- }
- | declaration_statement {
- $$ = $1;
- }
- ;
-
-conditionopt
- : condition {
- $$ = $1;
- }
- | /* May be null */ {
- $$ = 0;
- }
- ;
-
-for_rest_statement
- : conditionopt SEMICOLON {
- $$.node1 = $1;
- $$.node2 = 0;
- }
- | conditionopt SEMICOLON expression {
- $$.node1 = $1;
- $$.node2 = $3;
- }
- ;
-
-jump_statement
- : CONTINUE SEMICOLON {
- $$ = context->addBranch(EOpContinue, @1);
- }
- | BREAK SEMICOLON {
- $$ = context->addBranch(EOpBreak, @1);
- }
- | RETURN SEMICOLON {
- $$ = context->addBranch(EOpReturn, @1);
- }
- | RETURN expression SEMICOLON {
- $$ = context->addBranch(EOpReturn, $2, @1);
- }
- | DISCARD SEMICOLON {
- FRAG_ONLY("discard", @1);
- $$ = context->addBranch(EOpKill, @1);
- }
- ;
-
-// Grammar Note: No 'goto'. Gotos are not supported.
-
-translation_unit
- : external_declaration {
- $$ = $1;
- context->setTreeRoot($$);
- }
- | translation_unit external_declaration {
- $$ = context->intermediate.growAggregate($1, $2, @$);
- context->setTreeRoot($$);
- }
- ;
-
-external_declaration
- : function_definition {
- $$ = $1;
- }
- | declaration {
- $$ = $1;
- }
- ;
-
-function_definition
- : function_prototype {
- context->parseFunctionPrototype(@1, $1.function, &$1.intermAggregate);
- }
- compound_statement_no_new_scope {
- $$ = context->addFunctionDefinition(*($1.function), $1.intermAggregate, $3, @1);
- }
- ;
-
-%%
-
-int glslang_parse(TParseContext* context) {
- return yyparse(context, context->getScanner());
-}
diff --git a/src/OpenGL/compiler/glslang_lex.cpp b/src/OpenGL/compiler/glslang_lex.cpp
deleted file mode 100644
index 82365acbc..000000000
--- a/src/OpenGL/compiler/glslang_lex.cpp
+++ /dev/null
@@ -1,3822 +0,0 @@
-#line 25 "./glslang.l"
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-// Ignore errors in auto-generated code.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4189)
-#pragma warning(disable: 4505)
-#pragma warning(disable: 4701)
-#endif
-
-
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-
-
-
-
-
-
-
-
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 4
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#ifdef yyget_lval
-#define yyget_lval_ALREADY_DEFINED
-#else
-#define yyget_lval yyget_lval
-#endif
-
-
-#ifdef yyset_lval
-#define yyset_lval_ALREADY_DEFINED
-#else
-#define yyset_lval yyset_lval
-#endif
-
-
-
-
-
-#ifdef yyget_lloc
-#define yyget_lloc_ALREADY_DEFINED
-#else
-#define yyget_lloc yyget_lloc
-#endif
-
-
-#ifdef yyset_lloc
-#define yyset_lloc_ALREADY_DEFINED
-#else
-#define yyset_lloc yyset_lloc
-#endif
-
-
-
-
-
-
-
-
-
-
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-
-/* begin standard C++ headers. */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-
-/* Promotes a possibly negative, possibly signed char to an
- * integer in range [0..255] for use as an array index.
- */
-#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
-
-
-
-
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin , yyscanner )
-#define YY_END_OF_BUFFER_CHAR 0
-
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-
-
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- /* Note: We specifically omit the test for yy_rule_can_match_eol because it requires
- * access to the local variable yy_act. Since yyless() is a macro, it would break
- * existing scanners that call yyless() from OUTSIDE yylex.
- * One obvious solution it to make yy_act a global. I tried that, and saw
- * a 5% performance hit in a non-yylineno scanner, because yy_act is
- * normally declared as a register variable-- so it is not worth it.
- */
- #define YY_LESS_LINENO(n) \
- do { \
- int yyl;\
- for ( yyl = n; yyl < yyleng; ++yyl )\
- if ( yytext[yyl] == '\n' )\
- --yylineno;\
- }while(0)
- #define YY_LINENO_REWIND_TO(dst) \
- do {\
- const char *p;\
- for ( p = yy_cp-1; p >= (dst); --p)\
- if ( *p == '\n' )\
- --yylineno;\
- }while(0)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
-
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-
-
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-
-
-
-
-void yyrestart ( FILE *input_file , yyscan_t yyscanner );
-void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
-void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-void yypop_buffer_state ( yyscan_t yyscanner );
-
-
-static void yyensure_buffer_stack ( yyscan_t yyscanner );
-static void yy_load_buffer_state ( yyscan_t yyscanner );
-static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
-
-
-YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
-
-
-void *yyalloc ( yy_size_t , yyscan_t yyscanner );
-void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
-void yyfree ( void * , yyscan_t yyscanner );
-
-
-#define yy_new_buffer yy_create_buffer
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-
-/* Begin user sect3 */
-
-#define yywrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-typedef flex_uint8_t YY_CHAR;
-
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-
-
-
-
-
-static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
-static int yy_get_next_buffer ( yyscan_t yyscanner );
-static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
-
-
-
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 239
-#define YY_END_OF_BUFFER 240
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static const flex_int16_t yy_accept[821] =
- { 0,
- 0, 0, 0, 0, 0, 0, 240, 238, 237, 237,
- 222, 228, 233, 217, 218, 226, 225, 214, 223, 221,
- 227, 180, 180, 215, 211, 229, 216, 230, 234, 177,
- 219, 220, 232, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 212, 231, 213, 224, 239, 236, 235,
- 208, 194, 213, 202, 197, 192, 200, 190, 201, 191,
- 186, 193, 185, 179, 180, 0, 183, 0, 220, 212,
- 219, 209, 205, 207, 206, 210, 177, 198, 204, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
-
- 177, 12, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 15, 177, 177, 23, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 199, 203, 235, 0, 189, 185, 0, 188,
- 182, 0, 184, 178, 195, 196, 177, 136, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 13, 177, 177, 177, 177, 177, 177, 177, 177,
-
- 177, 177, 27, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 24, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 0,
- 186, 0, 185, 187, 181, 177, 177, 177, 30, 177,
- 177, 18, 174, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 16, 139, 177, 177, 177, 177, 21,
- 177, 177, 143, 155, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 152, 4, 35, 36,
-
- 37, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 142, 31, 177, 177, 28,
- 177, 177, 177, 177, 177, 177, 177, 47, 48, 49,
- 29, 177, 177, 177, 177, 177, 177, 10, 56, 57,
- 58, 177, 137, 177, 177, 7, 177, 177, 177, 177,
- 164, 165, 166, 177, 32, 177, 156, 26, 167, 168,
- 169, 2, 161, 162, 163, 177, 177, 177, 25, 159,
- 177, 177, 177, 50, 51, 52, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 86, 177, 177,
-
- 177, 177, 177, 177, 177, 153, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 138, 177, 177,
- 176, 53, 54, 55, 177, 177, 14, 177, 91, 177,
- 177, 177, 177, 89, 177, 177, 177, 154, 149, 92,
- 177, 177, 177, 177, 177, 177, 144, 177, 177, 177,
- 78, 38, 41, 43, 42, 39, 45, 44, 46, 40,
- 177, 177, 177, 177, 160, 135, 177, 177, 147, 177,
- 177, 177, 34, 87, 173, 22, 148, 77, 177, 158,
- 17, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 19, 33, 177, 177, 177,
-
- 177, 177, 177, 93, 94, 95, 177, 177, 177, 177,
- 177, 3, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 140, 177, 177, 177, 177, 177, 8,
- 177, 177, 9, 177, 177, 177, 177, 20, 79, 11,
- 150, 97, 98, 99, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 145, 177, 177, 177,
- 81, 83, 80, 177, 177, 177, 177, 177, 177, 177,
- 141, 101, 102, 103, 177, 177, 157, 177, 146, 177,
- 177, 6, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 96, 151, 1, 177, 177, 177, 177, 177, 175,
-
- 177, 90, 5, 170, 59, 63, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 177, 82,
- 177, 177, 177, 177, 100, 177, 177, 177, 177, 177,
- 120, 66, 67, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 88, 177, 177, 177,
- 104, 122, 70, 71, 177, 177, 84, 177, 177, 177,
- 177, 177, 177, 177, 115, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 129, 177, 177, 177, 177,
- 60, 177, 177, 177, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 116, 105, 177, 106, 177, 177, 177,
-
- 130, 177, 177, 68, 177, 177, 177, 177, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 117, 177, 177,
- 131, 177, 177, 72, 107, 108, 177, 111, 177, 112,
- 177, 177, 177, 177, 177, 85, 177, 177, 177, 177,
- 61, 177, 64, 126, 177, 177, 109, 110, 177, 177,
- 177, 177, 177, 177, 177, 177, 177, 177, 124, 127,
- 118, 177, 65, 177, 177, 177, 177, 177, 177, 177,
- 177, 125, 128, 177, 177, 121, 69, 177, 177, 171,
- 177, 177, 177, 74, 177, 177, 123, 73, 177, 177,
- 177, 177, 177, 177, 132, 177, 177, 177, 177, 177,
-
- 177, 133, 177, 177, 177, 75, 177, 134, 113, 114,
- 177, 177, 177, 62, 177, 177, 172, 119, 76, 0
- } ;
-
-static const YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 2, 2, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 4, 1, 1, 1, 5, 6, 1, 7,
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 20, 20, 21, 21, 22, 23, 24,
- 25, 26, 27, 1, 28, 29, 30, 31, 32, 33,
- 34, 34, 34, 34, 34, 34, 35, 34, 36, 34,
- 34, 37, 38, 34, 39, 34, 34, 40, 34, 34,
- 41, 1, 42, 43, 44, 1, 45, 46, 47, 48,
-
- 49, 50, 51, 52, 53, 34, 54, 55, 56, 57,
- 58, 59, 34, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, 71, 72, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static const YY_CHAR yy_meta[73] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 2, 2, 2, 2, 2, 2,
- 2, 1, 1, 1, 1, 1, 1, 3, 3, 3,
- 3, 2, 2, 4, 4, 4, 4, 4, 4, 4,
- 1, 1, 1, 4, 3, 3, 3, 3, 2, 2,
- 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
- 4, 4, 4, 4, 4, 4, 4, 4, 1, 1,
- 1, 1
- } ;
-
-static const flex_int16_t yy_base[827] =
- { 0,
- 0, 0, 1019, 1018, 72, 0, 1020, 1023, 1023, 1023,
- 994, 120, 141, 1023, 1023, 993, 138, 1023, 137, 135,
- 992, 154, 208, 990, 1023, 154, 990, 132, 1023, 0,
- 1023, 1023, 139, 130, 123, 140, 147, 133, 177, 956,
- 186, 151, 139, 116, 161, 950, 173, 963, 193, 199,
- 208, 215, 108, 1023, 184, 1023, 1023, 1023, 1023, 0,
- 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023, 1023,
- 230, 1023, 235, 235, 0, 271, 1023, 0, 1023, 1023,
- 1023, 986, 1023, 1023, 1023, 985, 0, 1023, 1023, 947,
- 952, 152, 949, 957, 956, 943, 946, 957, 243, 951,
-
- 939, 936, 949, 936, 933, 933, 939, 147, 248, 933,
- 943, 929, 935, 938, 939, 0, 931, 941, 249, 940,
- 935, 916, 177, 920, 933, 924, 184, 917, 250, 929,
- 931, 257, 920, 917, 906, 915, 249, 257, 919, 915,
- 917, 906, 909, 196, 217, 269, 918, 906, 918, 262,
- 911, 910, 1023, 1023, 0, 311, 1023, 292, 328, 1023,
- 1023, 335, 342, 257, 1023, 1023, 909, 0, 905, 900,
- 904, 913, 910, 315, 894, 894, 905, 897, 215, 907,
- 904, 904, 902, 899, 891, 897, 884, 882, 894, 880,
- 896, 0, 893, 881, 888, 885, 889, 890, 883, 880,
-
- 869, 868, 881, 884, 872, 880, 868, 874, 865, 316,
- 870, 873, 864, 871, 860, 864, 855, 869, 868, 859,
- 865, 307, 849, 852, 850, 860, 850, 845, 843, 845,
- 855, 841, 843, 840, 851, 850, 853, 835, 316, 843,
- 839, 837, 846, 825, 353, 843, 845, 834, 826, 363,
- 370, 378, 389, 1023, 1023, 823, 833, 832, 0, 830,
- 383, 0, 0, 823, 821, 821, 822, 817, 825, 814,
- 831, 820, 394, 0, 0, 814, 824, 823, 823, 0,
- 808, 397, 0, 0, 810, 400, 817, 818, 809, 803,
- 802, 803, 802, 802, 406, 797, 0, 0, 793, 792,
-
- 791, 793, 794, 799, 793, 789, 802, 797, 797, 795,
- 794, 788, 782, 784, 783, 787, 779, 782, 777, 785,
- 790, 778, 775, 787, 778, 0, 0, 784, 780, 0,
- 772, 772, 777, 768, 775, 409, 772, 0, 0, 0,
- 0, 762, 774, 773, 772, 773, 773, 0, 0, 0,
- 0, 760, 0, 768, 759, 0, 758, 759, 753, 763,
- 0, 0, 0, 754, 0, 750, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 760, 413, 759, 0, 0,
- 757, 753, 750, 0, 0, 0, 742, 415, 418, 427,
- 747, 743, 748, 739, 737, 750, 735, 0, 735, 748,
-
- 737, 733, 739, 734, 741, 0, 739, 736, 740, 724,
- 722, 725, 731, 737, 732, 731, 719, 0, 721, 722,
- 0, 0, 0, 0, 719, 722, 0, 716, 0, 729,
- 709, 718, 713, 0, 706, 706, 719, 0, 721, 0,
- 431, 734, 733, 732, 699, 698, 0, 715, 714, 709,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 698, 711, 698, 695, 0, 0, 700, 699, 0, 696,
- 703, 702, 0, 688, 0, 0, 0, 0, 685, 0,
- 0, 684, 695, 434, 688, 694, 693, 690, 685, 682,
- 675, 675, 688, 673, 685, 0, 0, 678, 701, 700,
-
- 699, 666, 665, 427, 428, 0, 677, 680, 678, 667,
- 663, 0, 675, 672, 671, 661, 660, 650, 667, 653,
- 441, 661, 664, 0, 681, 680, 679, 646, 645, 0,
- 659, 646, 0, 656, 649, 650, 653, 0, 0, 0,
- 0, 673, 672, 0, 649, 652, 637, 644, 635, 642,
- 643, 643, 642, 628, 451, 640, 0, 641, 630, 629,
- 0, 0, 0, 654, 653, 652, 619, 618, 614, 622,
- 0, 650, 649, 0, 626, 629, 0, 458, 0, 607,
- 616, 0, 612, 611, 620, 620, 608, 622, 606, 620,
- 615, 0, 0, 0, 632, 631, 630, 597, 596, 0,
-
- 596, 0, 0, 434, 454, 620, 606, 609, 592, 604,
- 592, 591, 600, 600, 617, 616, 615, 582, 581, 0,
- 581, 582, 581, 591, 0, 594, 590, 592, 588, 575,
- 606, 449, 0, 583, 586, 578, 570, 577, 568, 589,
- 577, 573, 575, 573, 573, 572, 0, 560, 559, 569,
- 0, 589, 462, 0, 566, 569, 0, 569, 568, 552,
- 544, 552, 542, 550, 0, 547, 546, 567, 555, 553,
- 553, 537, 540, 554, 538, 569, 549, 550, 547, 544,
- 554, 531, 545, 544, 528, 527, 526, 547, 535, 533,
- 533, 514, 513, 0, 541, 513, 539, 511, 515, 514,
-
- 545, 525, 522, 0, 521, 524, 520, 522, 506, 503,
- 516, 501, 502, 509, 503, 492, 491, 0, 497, 496,
- 527, 507, 504, 0, 0, 0, 500, 0, 499, 0,
- 505, 504, 488, 485, 486, 0, 478, 486, 476, 482,
- 503, 482, 0, 0, 494, 493, 0, 0, 492, 491,
- 475, 472, 473, 487, 486, 463, 462, 468, 0, 0,
- 489, 461, 487, 479, 128, 151, 196, 227, 238, 269,
- 277, 0, 0, 291, 319, 0, 0, 323, 321, 0,
- 324, 354, 393, 0, 382, 405, 0, 0, 408, 396,
- 420, 412, 438, 440, 0, 445, 429, 463, 429, 433,
-
- 435, 0, 453, 454, 445, 0, 466, 0, 0, 0,
- 447, 448, 442, 0, 443, 444, 0, 0, 0, 1023,
- 509, 512, 515, 518, 519, 520
- } ;
-
-static const flex_int16_t yy_def[827] =
- { 0,
- 820, 1, 821, 821, 820, 5, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 822,
- 820, 820, 820, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 820, 820, 820, 820, 820, 820, 823,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 824, 820, 825, 22, 23, 820, 820, 826, 820, 820,
- 820, 820, 820, 820, 820, 820, 822, 820, 820, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 820, 820, 823, 820, 820, 825, 820, 820,
- 820, 820, 820, 826, 820, 820, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 820,
- 820, 820, 820, 820, 820, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
-
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 822,
- 822, 822, 822, 822, 822, 822, 822, 822, 822, 0,
- 820, 820, 820, 820, 820, 820
- } ;
-
-static const flex_int16_t yy_nxt[1096] =
- { 0,
- 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 23, 23, 23, 23,
- 23, 24, 25, 26, 27, 28, 29, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 31, 32, 33, 30, 34, 35, 36, 37, 38, 39,
- 40, 41, 42, 30, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 30, 30, 30, 54, 55,
- 56, 57, 8, 59, 58, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
- 8, 8, 8, 8, 8, 8, 8, 8, 8, 60,
-
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 8, 8, 8, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
- 8, 8, 8, 8, 62, 63, 64, 67, 69, 71,
- 71, 71, 71, 71, 71, 71, 85, 86, 80, 151,
- 124, 70, 68, 88, 125, 65, 73, 152, 74, 74,
- 74, 74, 74, 74, 75, 81, 90, 82, 83, 783,
- 93, 89, 94, 122, 96, 76, 95, 104, 97, 105,
- 91, 92, 77, 78, 98, 100, 123, 99, 106, 101,
-
- 116, 188, 76, 117, 102, 126, 118, 119, 153, 169,
- 103, 120, 189, 170, 121, 784, 77, 129, 127, 78,
- 73, 107, 75, 75, 75, 75, 75, 75, 75, 108,
- 113, 109, 130, 208, 110, 131, 213, 133, 114, 76,
- 111, 209, 214, 785, 134, 135, 77, 140, 136, 115,
- 141, 237, 238, 154, 137, 138, 76, 139, 142, 148,
- 144, 156, 157, 149, 145, 143, 159, 160, 146, 239,
- 77, 147, 150, 161, 820, 268, 269, 240, 156, 157,
- 162, 786, 162, 159, 160, 163, 163, 163, 163, 163,
- 163, 163, 190, 228, 177, 255, 216, 161, 178, 179,
-
- 820, 221, 230, 200, 787, 191, 201, 202, 229, 217,
- 203, 218, 204, 241, 246, 231, 247, 222, 223, 255,
- 250, 242, 250, 159, 160, 251, 251, 251, 251, 251,
- 251, 251, 299, 300, 301, 788, 789, 252, 790, 252,
- 159, 160, 253, 253, 253, 253, 253, 253, 253, 163,
- 163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
- 163, 163, 163, 262, 313, 331, 791, 792, 314, 338,
- 339, 340, 793, 332, 254, 794, 263, 251, 251, 251,
- 251, 251, 251, 251, 251, 251, 251, 251, 251, 251,
- 251, 254, 253, 253, 253, 253, 253, 253, 253, 349,
-
- 350, 351, 157, 253, 253, 253, 253, 253, 253, 253,
- 361, 362, 363, 369, 370, 371, 373, 374, 375, 157,
- 795, 160, 384, 385, 386, 422, 423, 424, 442, 443,
- 444, 452, 453, 454, 455, 456, 457, 796, 160, 797,
- 798, 445, 446, 458, 459, 460, 499, 500, 501, 525,
- 526, 527, 799, 800, 547, 549, 564, 565, 566, 502,
- 503, 637, 528, 529, 548, 550, 595, 596, 597, 567,
- 568, 638, 569, 615, 616, 617, 667, 801, 802, 598,
- 599, 639, 803, 668, 804, 669, 618, 619, 640, 687,
- 641, 642, 805, 806, 807, 808, 688, 809, 689, 810,
-
- 811, 812, 813, 814, 815, 816, 817, 818, 819, 8,
- 8, 8, 8, 87, 87, 87, 155, 155, 155, 71,
- 158, 164, 164, 782, 781, 780, 779, 778, 777, 776,
- 775, 774, 773, 772, 771, 770, 769, 768, 767, 766,
- 765, 764, 763, 762, 761, 760, 759, 758, 757, 756,
- 755, 754, 753, 752, 751, 750, 749, 748, 747, 746,
- 745, 744, 743, 742, 741, 740, 739, 738, 737, 736,
- 735, 734, 733, 732, 731, 730, 729, 728, 727, 726,
- 725, 724, 723, 722, 721, 720, 719, 718, 717, 716,
- 715, 714, 713, 712, 711, 710, 709, 708, 707, 706,
-
- 705, 704, 703, 702, 701, 700, 699, 698, 697, 696,
- 695, 694, 693, 692, 691, 690, 686, 685, 684, 683,
- 682, 681, 680, 679, 678, 677, 676, 675, 674, 673,
- 672, 671, 670, 666, 665, 664, 663, 662, 661, 660,
- 659, 658, 657, 656, 655, 654, 653, 652, 651, 650,
- 649, 648, 647, 646, 645, 644, 643, 636, 635, 634,
- 633, 632, 631, 630, 629, 628, 627, 626, 625, 624,
- 623, 622, 621, 620, 614, 613, 612, 611, 610, 609,
- 608, 607, 606, 605, 604, 603, 602, 601, 600, 594,
- 593, 592, 591, 590, 589, 588, 587, 586, 585, 584,
-
- 583, 582, 581, 580, 579, 578, 577, 576, 575, 574,
- 573, 572, 571, 570, 563, 562, 561, 560, 559, 558,
- 557, 556, 555, 554, 553, 552, 551, 546, 545, 544,
- 543, 542, 541, 540, 539, 538, 537, 536, 535, 534,
- 533, 532, 531, 530, 524, 523, 522, 521, 520, 519,
- 518, 517, 516, 515, 514, 513, 512, 511, 510, 509,
- 508, 507, 506, 505, 504, 498, 497, 496, 495, 494,
- 493, 492, 491, 490, 489, 488, 487, 486, 485, 484,
- 483, 482, 481, 480, 479, 478, 477, 476, 475, 474,
- 473, 472, 471, 470, 469, 468, 467, 466, 465, 464,
-
- 463, 462, 461, 451, 450, 449, 448, 447, 441, 440,
- 439, 438, 437, 436, 435, 434, 433, 432, 431, 430,
- 429, 428, 427, 426, 425, 421, 420, 419, 418, 417,
- 416, 415, 414, 413, 412, 411, 410, 409, 408, 407,
- 406, 405, 404, 403, 402, 401, 400, 399, 398, 397,
- 396, 395, 394, 393, 392, 391, 390, 389, 388, 387,
- 383, 382, 381, 380, 379, 378, 377, 376, 372, 368,
- 367, 366, 365, 364, 360, 359, 358, 357, 356, 355,
- 354, 353, 352, 348, 347, 346, 345, 344, 343, 342,
- 341, 337, 336, 335, 334, 333, 330, 329, 328, 327,
-
- 326, 325, 324, 323, 322, 321, 320, 319, 318, 317,
- 316, 315, 312, 311, 310, 309, 308, 307, 306, 305,
- 304, 303, 302, 298, 297, 296, 295, 294, 293, 292,
- 291, 290, 289, 288, 287, 286, 285, 284, 283, 282,
- 281, 280, 279, 278, 277, 276, 275, 274, 273, 272,
- 271, 270, 267, 266, 265, 264, 261, 260, 259, 258,
- 257, 256, 249, 248, 245, 244, 243, 236, 235, 234,
- 233, 232, 227, 226, 225, 224, 220, 219, 215, 212,
- 211, 210, 207, 206, 205, 199, 198, 197, 196, 195,
- 194, 193, 192, 187, 186, 185, 184, 183, 182, 181,
-
- 180, 176, 175, 174, 173, 172, 171, 168, 167, 166,
- 165, 132, 128, 112, 84, 79, 72, 66, 61, 820,
- 58, 58, 7, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820
-
- } ;
-
-static const flex_int16_t yy_chk[1096] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
-
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
- 5, 5, 5, 5, 12, 12, 13, 17, 19, 20,
- 20, 20, 20, 20, 20, 20, 28, 28, 26, 53,
- 44, 19, 17, 33, 44, 13, 22, 53, 22, 22,
- 22, 22, 22, 22, 22, 26, 34, 26, 26, 765,
- 35, 33, 35, 43, 36, 22, 35, 38, 36, 38,
- 34, 34, 22, 22, 36, 37, 43, 36, 38, 37,
-
- 42, 108, 22, 42, 37, 45, 42, 42, 55, 92,
- 37, 42, 108, 92, 42, 766, 22, 47, 45, 22,
- 23, 39, 23, 23, 23, 23, 23, 23, 23, 39,
- 41, 39, 47, 123, 39, 47, 127, 49, 41, 23,
- 39, 123, 127, 767, 49, 49, 23, 50, 49, 41,
- 50, 144, 144, 55, 49, 49, 23, 49, 50, 52,
- 51, 71, 71, 52, 51, 50, 73, 73, 51, 145,
- 23, 51, 52, 74, 74, 179, 179, 145, 71, 71,
- 76, 768, 76, 73, 73, 76, 76, 76, 76, 76,
- 76, 76, 109, 137, 99, 164, 129, 74, 99, 99,
-
- 74, 132, 138, 119, 769, 109, 119, 119, 137, 129,
- 119, 129, 119, 146, 150, 138, 150, 132, 132, 164,
- 156, 146, 156, 158, 158, 156, 156, 156, 156, 156,
- 156, 156, 210, 210, 210, 770, 771, 159, 774, 159,
- 158, 158, 159, 159, 159, 159, 159, 159, 159, 162,
- 162, 162, 162, 162, 162, 162, 163, 163, 163, 163,
- 163, 163, 163, 174, 222, 239, 775, 778, 222, 245,
- 245, 245, 779, 239, 163, 781, 174, 250, 250, 250,
- 250, 250, 250, 250, 251, 251, 251, 251, 251, 251,
- 251, 163, 252, 252, 252, 252, 252, 252, 252, 261,
-
- 261, 261, 251, 253, 253, 253, 253, 253, 253, 253,
- 273, 273, 273, 282, 282, 282, 286, 286, 286, 251,
- 782, 253, 295, 295, 295, 336, 336, 336, 377, 377,
- 377, 388, 388, 388, 389, 389, 389, 783, 253, 785,
- 786, 377, 377, 390, 390, 390, 441, 441, 441, 484,
- 484, 484, 789, 790, 504, 505, 521, 521, 521, 441,
- 441, 604, 484, 484, 504, 505, 555, 555, 555, 521,
- 521, 604, 521, 578, 578, 578, 632, 791, 792, 555,
- 555, 605, 793, 632, 794, 632, 578, 578, 605, 653,
- 605, 605, 796, 797, 798, 799, 653, 800, 653, 801,
-
- 803, 804, 805, 807, 811, 812, 813, 815, 816, 821,
- 821, 821, 821, 822, 822, 822, 823, 823, 823, 824,
- 825, 826, 826, 764, 763, 762, 761, 758, 757, 756,
- 755, 754, 753, 752, 751, 750, 749, 746, 745, 742,
- 741, 740, 739, 738, 737, 735, 734, 733, 732, 731,
- 729, 727, 723, 722, 721, 720, 719, 717, 716, 715,
- 714, 713, 712, 711, 710, 709, 708, 707, 706, 705,
- 703, 702, 701, 700, 699, 698, 697, 696, 695, 693,
- 692, 691, 690, 689, 688, 687, 686, 685, 684, 683,
- 682, 681, 680, 679, 678, 677, 676, 675, 674, 673,
-
- 672, 671, 670, 669, 668, 667, 666, 664, 663, 662,
- 661, 660, 659, 658, 656, 655, 652, 650, 649, 648,
- 646, 645, 644, 643, 642, 641, 640, 639, 638, 637,
- 636, 635, 634, 631, 630, 629, 628, 627, 626, 624,
- 623, 622, 621, 619, 618, 617, 616, 615, 614, 613,
- 612, 611, 610, 609, 608, 607, 606, 601, 599, 598,
- 597, 596, 595, 591, 590, 589, 588, 587, 586, 585,
- 584, 583, 581, 580, 576, 575, 573, 572, 570, 569,
- 568, 567, 566, 565, 564, 560, 559, 558, 556, 554,
- 553, 552, 551, 550, 549, 548, 547, 546, 545, 543,
-
- 542, 537, 536, 535, 534, 532, 531, 529, 528, 527,
- 526, 525, 523, 522, 520, 519, 518, 517, 516, 515,
- 514, 513, 511, 510, 509, 508, 507, 503, 502, 501,
- 500, 499, 498, 495, 494, 493, 492, 491, 490, 489,
- 488, 487, 486, 485, 483, 482, 479, 474, 472, 471,
- 470, 468, 467, 464, 463, 462, 461, 450, 449, 448,
- 446, 445, 444, 443, 442, 439, 437, 436, 435, 433,
- 432, 431, 430, 428, 426, 425, 420, 419, 417, 416,
- 415, 414, 413, 412, 411, 410, 409, 408, 407, 405,
- 404, 403, 402, 401, 400, 399, 397, 396, 395, 394,
-
- 393, 392, 391, 387, 383, 382, 381, 378, 376, 366,
- 364, 360, 359, 358, 357, 355, 354, 352, 347, 346,
- 345, 344, 343, 342, 337, 335, 334, 333, 332, 331,
- 329, 328, 325, 324, 323, 322, 321, 320, 319, 318,
- 317, 316, 315, 314, 313, 312, 311, 310, 309, 308,
- 307, 306, 305, 304, 303, 302, 301, 300, 299, 296,
- 294, 293, 292, 291, 290, 289, 288, 287, 285, 281,
- 279, 278, 277, 276, 272, 271, 270, 269, 268, 267,
- 266, 265, 264, 260, 258, 257, 256, 249, 248, 247,
- 246, 244, 243, 242, 241, 240, 238, 237, 236, 235,
-
- 234, 233, 232, 231, 230, 229, 228, 227, 226, 225,
- 224, 223, 221, 220, 219, 218, 217, 216, 215, 214,
- 213, 212, 211, 209, 208, 207, 206, 205, 204, 203,
- 202, 201, 200, 199, 198, 197, 196, 195, 194, 193,
- 191, 190, 189, 188, 187, 186, 185, 184, 183, 182,
- 181, 180, 178, 177, 176, 175, 173, 172, 171, 170,
- 169, 167, 152, 151, 149, 148, 147, 143, 142, 141,
- 140, 139, 136, 135, 134, 133, 131, 130, 128, 126,
- 125, 124, 122, 121, 120, 118, 117, 115, 114, 113,
- 112, 111, 110, 107, 106, 105, 104, 103, 102, 101,
-
- 100, 98, 97, 96, 95, 94, 93, 91, 90, 86,
- 82, 48, 46, 40, 27, 24, 21, 16, 11, 7,
- 4, 3, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820, 820, 820, 820, 820, 820,
- 820, 820, 820, 820, 820
-
- } ;
-
-
-/* Table of booleans, true if rule could match eol. */
-static const flex_int32_t yy_rule_can_match_eol[240] =
- { 0,
-0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0,
- };
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Lex specification for GLSL ES.
-Based on ANSI C grammar, Lex specification:
-http://www.lysator.liu.se/c/ANSI-C-grammar-l.html
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES LEXER (glslang_lex.cpp).
-*/
-
-#include "glslang.h"
-#include "ParseHelper.h"
-#include "preprocessor/Token.h"
-#include "util.h"
-#include "glslang_tab.h"
-
-/* windows only pragma */
-#ifdef _MSC_VER
-#pragma warning(disable : 4102)
-#endif
-
-#define YY_USER_ACTION \
- yylloc->first_file = yylloc->last_file = yycolumn; \
- yylloc->first_line = yylloc->last_line = yylineno;
-
-#define YY_INPUT(buf, result, max_size) \
- result = string_input(buf, max_size, yyscanner);
-
-static yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner);
-static int check_type(yyscan_t yyscanner);
-static int reserved_word(yyscan_t yyscanner);
-static int ES2_reserved_ES3_keyword(TParseContext *context, int token);
-static int ES2_keyword_ES3_reserved(TParseContext *context, int token);
-static int ES2_identifier_ES3_keyword(TParseContext *context, int token);
-static int uint_constant(TParseContext *context);
-static int int_constant(yyscan_t yyscanner);
-static int float_constant(yyscan_t yyscanner);
-static int floatsuffix_check(TParseContext* context);
-
-
-
-
-#define INITIAL 0
-#define COMMENT 1
-#define FIELDS 2
-
-
-
-
-
-
-#define YY_EXTRA_TYPE TParseContext*
-
-
-
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
- {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- int yy_n_chars;
- int yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
-
-
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
-
-
- YYSTYPE * yylval_r;
-
-
-
- YYLTYPE * yylloc_r;
-
-
- }; /* end struct yyguts_t */
-
-
-
-
-static int yy_init_globals ( yyscan_t yyscanner );
-
-
-
-
-
- /* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
- # define yylval yyg->yylval_r
-
-
-
- # define yylloc yyg->yylloc_r
-
-
-
-int yylex_init (yyscan_t* scanner);
-
-int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
-
-
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-
-int yylex_destroy ( yyscan_t yyscanner );
-
-
-
-int yyget_debug ( yyscan_t yyscanner );
-
-
-
-void yyset_debug ( int debug_flag , yyscan_t yyscanner );
-
-
-
-YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
-
-
-
-void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
-
-
-
-FILE *yyget_in ( yyscan_t yyscanner );
-
-
-
-void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
-
-
-
-FILE *yyget_out ( yyscan_t yyscanner );
-
-
-
-void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
-
-
-
- int yyget_leng ( yyscan_t yyscanner );
-
-
-
-char *yyget_text ( yyscan_t yyscanner );
-
-
-
-int yyget_lineno ( yyscan_t yyscanner );
-
-
-
-void yyset_lineno ( int _line_number , yyscan_t yyscanner );
-
-
-
-
-int yyget_column ( yyscan_t yyscanner );
-
-
-
-
-
-void yyset_column ( int _column_no , yyscan_t yyscanner );
-
-
-
-
-YYSTYPE * yyget_lval ( yyscan_t yyscanner );
-
-
-void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
-
-
-
- YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
-
-
-
- void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
-
-
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap ( yyscan_t yyscanner );
-#else
-extern int yywrap ( yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput ( yyscan_t yyscanner );
-#else
-static int input ( yyscan_t yyscanner );
-#endif
-
-#endif
-
-
-
-
-
-
-
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
-#endif
-
-
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- int n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-
-#endif
-
-
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-
-
-/* end tables serialization structures and prototypes */
-
-
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-extern int yylex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
-
-#define YY_DECL int yylex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
-
-
- yylval = yylval_param;
-
-
-
- yylloc = yylloc_param;
-
-
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
-
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_load_buffer_state( yyscanner );
- }
-
- {
-
-
-
- TParseContext* context = yyextra;
-
-
-
- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yyg->yy_start;
-yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 821 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 820 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-
- if ( yy_act != YY_END_OF_BUFFER && yy_rule_can_match_eol[yy_act] )
- {
- int yyl;
- for ( yyl = 0; yyl < yyleng; ++yyl )
- if ( yytext[yyl] == '\n' )
-
- do{ yylineno++;
- yycolumn=0;
- }while(0)
-;
- }
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-{ return(INVARIANT); }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-{ return(HIGH_PRECISION); }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-{ return(MEDIUM_PRECISION); }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-{ return(LOW_PRECISION); }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-{ return(PRECISION); }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-{ return ES2_keyword_ES3_reserved(context, ATTRIBUTE); }
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-{ return(CONST_QUAL); }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-{ return(UNIFORM); }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-{ return ES2_keyword_ES3_reserved(context, VARYING); }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-{ return(BREAK); }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-{ return(CONTINUE); }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-{ return(DO); }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-{ return(FOR); }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-{ return(WHILE); }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-{ return(IF); }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-{ return(ELSE); }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, SWITCH); }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, CASE); }
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, DEFAULT); }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, CENTROID); }
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, FLAT); }
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, SMOOTH); }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-{ return(IN_QUAL); }
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-{ return(OUT_QUAL); }
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-{ return(INOUT_QUAL); }
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(FLOAT_TYPE); }
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(INT_TYPE); }
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, UINT_TYPE); }
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(VOID_TYPE); }
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(BOOL_TYPE); }
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-{ yylval->lex.b = true; return(BOOLCONSTANT); }
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-{ yylval->lex.b = false; return(BOOLCONSTANT); }
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-{ return(DISCARD); }
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-{ return(RETURN); }
- YY_BREAK
-case 35:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(MATRIX2); }
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(MATRIX3); }
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(MATRIX4); }
- YY_BREAK
-case 38:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX2); }
- YY_BREAK
-case 39:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX3); }
- YY_BREAK
-case 40:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX4); }
- YY_BREAK
-case 41:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX2x3); }
- YY_BREAK
-case 42:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX3x2); }
- YY_BREAK
-case 43:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX2x4); }
- YY_BREAK
-case 44:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX4x2); }
- YY_BREAK
-case 45:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX3x4); }
- YY_BREAK
-case 46:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, MATRIX4x3); }
- YY_BREAK
-case 47:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (VEC2); }
- YY_BREAK
-case 48:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (VEC3); }
- YY_BREAK
-case 49:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (VEC4); }
- YY_BREAK
-case 50:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (IVEC2); }
- YY_BREAK
-case 51:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (IVEC3); }
- YY_BREAK
-case 52:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (IVEC4); }
- YY_BREAK
-case 53:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, UVEC2); }
- YY_BREAK
-case 54:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, UVEC3); }
- YY_BREAK
-case 55:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, UVEC4); }
- YY_BREAK
-case 56:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (BVEC2); }
- YY_BREAK
-case 57:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (BVEC3); }
- YY_BREAK
-case 58:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return (BVEC4); }
- YY_BREAK
-case 59:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return SAMPLER2D; }
- YY_BREAK
-case 60:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return SAMPLERCUBE; }
- YY_BREAK
-case 61:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return SAMPLER2DRECT; }
- YY_BREAK
-case 62:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return SAMPLER_EXTERNAL_OES; }
- YY_BREAK
-case 63:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return SAMPLER3D; }
- YY_BREAK
-case 64:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, SAMPLER3DRECT); }
- YY_BREAK
-case 65:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAY); }
- YY_BREAK
-case 66:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, ISAMPLER2D); }
- YY_BREAK
-case 67:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, ISAMPLER3D); }
- YY_BREAK
-case 68:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, ISAMPLERCUBE); }
- YY_BREAK
-case 69:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, ISAMPLER2DARRAY); }
- YY_BREAK
-case 70:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, USAMPLER2D); }
- YY_BREAK
-case 71:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, USAMPLER3D); }
- YY_BREAK
-case 72:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, USAMPLERCUBE); }
- YY_BREAK
-case 73:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, USAMPLER2DARRAY); }
- YY_BREAK
-case 74:
-YY_RULE_SETUP
-{ return ES2_reserved_ES3_keyword(context, SAMPLER2DSHADOW); }
- YY_BREAK
-case 75:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, SAMPLERCUBESHADOW); }
- YY_BREAK
-case 76:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, SAMPLER2DARRAYSHADOW); }
- YY_BREAK
-case 77:
-YY_RULE_SETUP
-{ context->lexAfterType = true; return(STRUCT); }
- YY_BREAK
-case 78:
-YY_RULE_SETUP
-{ return ES2_identifier_ES3_keyword(context, LAYOUT); }
- YY_BREAK
-/* Reserved keywords for GLSL ES 3.00 that are not reserved for GLSL ES 1.00 */
-case 79:
-case 80:
-case 81:
-case 82:
-case 83:
-case 84:
-case 85:
-case 86:
-case 87:
-case 88:
-case 89:
-case 90:
-case 91:
-case 92:
-case 93:
-case 94:
-case 95:
-case 96:
-case 97:
-case 98:
-case 99:
-case 100:
-case 101:
-case 102:
-case 103:
-case 104:
-case 105:
-case 106:
-case 107:
-case 108:
-case 109:
-case 110:
-case 111:
-case 112:
-case 113:
-case 114:
-case 115:
-case 116:
-case 117:
-case 118:
-case 119:
-case 120:
-case 121:
-case 122:
-case 123:
-case 124:
-case 125:
-case 126:
-case 127:
-case 128:
-case 129:
-case 130:
-case 131:
-case 132:
-case 133:
-case 134:
-YY_RULE_SETUP
-{
- if (context->getShaderVersion() < 300) {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
- return reserved_word(yyscanner);
-}
- YY_BREAK
-/* Reserved keywords in GLSL ES 1.00 that are not reserved in GLSL ES 3.00 */
-case 135:
-YY_RULE_SETUP
-{
- if (context->getShaderVersion() >= 300)
- {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return reserved_word(yyscanner);
-}
- YY_BREAK
-/* Reserved keywords */
-case 136:
-case 137:
-case 138:
-case 139:
-case 140:
-case 141:
-case 142:
-case 143:
-case 144:
-case 145:
-case 146:
-case 147:
-case 148:
-case 149:
-case 150:
-case 151:
-case 152:
-case 153:
-case 154:
-case 155:
-case 156:
-case 157:
-case 158:
-case 159:
-case 160:
-case 161:
-case 162:
-case 163:
-case 164:
-case 165:
-case 166:
-case 167:
-case 168:
-case 169:
-case 170:
-case 171:
-case 172:
-case 173:
-case 174:
-case 175:
-case 176:
-YY_RULE_SETUP
-{ return reserved_word(yyscanner); }
- YY_BREAK
-case 177:
-YY_RULE_SETUP
-{
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
-}
- YY_BREAK
-case 178:
-YY_RULE_SETUP
-{ return int_constant(yyscanner); }
- YY_BREAK
-case 179:
-YY_RULE_SETUP
-{ return int_constant(yyscanner); }
- YY_BREAK
-case 180:
-YY_RULE_SETUP
-{ return int_constant(yyscanner); }
- YY_BREAK
-case 181:
-YY_RULE_SETUP
-{ return uint_constant(context); }
- YY_BREAK
-case 182:
-YY_RULE_SETUP
-{ return uint_constant(context); }
- YY_BREAK
-case 183:
-YY_RULE_SETUP
-{ return uint_constant(context); }
- YY_BREAK
-case 184:
-YY_RULE_SETUP
-{ return float_constant(yyscanner); }
- YY_BREAK
-case 185:
-YY_RULE_SETUP
-{ return float_constant(yyscanner); }
- YY_BREAK
-case 186:
-YY_RULE_SETUP
-{ return float_constant(yyscanner); }
- YY_BREAK
-case 187:
-YY_RULE_SETUP
-{ return floatsuffix_check(context); }
- YY_BREAK
-case 188:
-YY_RULE_SETUP
-{ return floatsuffix_check(context); }
- YY_BREAK
-case 189:
-YY_RULE_SETUP
-{ return floatsuffix_check(context); }
- YY_BREAK
-case 190:
-YY_RULE_SETUP
-{ return(ADD_ASSIGN); }
- YY_BREAK
-case 191:
-YY_RULE_SETUP
-{ return(SUB_ASSIGN); }
- YY_BREAK
-case 192:
-YY_RULE_SETUP
-{ return(MUL_ASSIGN); }
- YY_BREAK
-case 193:
-YY_RULE_SETUP
-{ return(DIV_ASSIGN); }
- YY_BREAK
-case 194:
-YY_RULE_SETUP
-{ return(MOD_ASSIGN); }
- YY_BREAK
-case 195:
-YY_RULE_SETUP
-{ return(LEFT_ASSIGN); }
- YY_BREAK
-case 196:
-YY_RULE_SETUP
-{ return(RIGHT_ASSIGN); }
- YY_BREAK
-case 197:
-YY_RULE_SETUP
-{ return(AND_ASSIGN); }
- YY_BREAK
-case 198:
-YY_RULE_SETUP
-{ return(XOR_ASSIGN); }
- YY_BREAK
-case 199:
-YY_RULE_SETUP
-{ return(OR_ASSIGN); }
- YY_BREAK
-case 200:
-YY_RULE_SETUP
-{ return(INC_OP); }
- YY_BREAK
-case 201:
-YY_RULE_SETUP
-{ return(DEC_OP); }
- YY_BREAK
-case 202:
-YY_RULE_SETUP
-{ return(AND_OP); }
- YY_BREAK
-case 203:
-YY_RULE_SETUP
-{ return(OR_OP); }
- YY_BREAK
-case 204:
-YY_RULE_SETUP
-{ return(XOR_OP); }
- YY_BREAK
-case 205:
-YY_RULE_SETUP
-{ return(LE_OP); }
- YY_BREAK
-case 206:
-YY_RULE_SETUP
-{ return(GE_OP); }
- YY_BREAK
-case 207:
-YY_RULE_SETUP
-{ return(EQ_OP); }
- YY_BREAK
-case 208:
-YY_RULE_SETUP
-{ return(NE_OP); }
- YY_BREAK
-case 209:
-YY_RULE_SETUP
-{ return(LEFT_OP); }
- YY_BREAK
-case 210:
-YY_RULE_SETUP
-{ return(RIGHT_OP); }
- YY_BREAK
-case 211:
-YY_RULE_SETUP
-{ context->lexAfterType = false; return(SEMICOLON); }
- YY_BREAK
-case 212:
-YY_RULE_SETUP
-{ context->lexAfterType = false; return(LEFT_BRACE); }
- YY_BREAK
-case 213:
-YY_RULE_SETUP
-{ return(RIGHT_BRACE); }
- YY_BREAK
-case 214:
-YY_RULE_SETUP
-{ if (context->inTypeParen) context->lexAfterType = false; return(COMMA); }
- YY_BREAK
-case 215:
-YY_RULE_SETUP
-{ return(COLON); }
- YY_BREAK
-case 216:
-YY_RULE_SETUP
-{ context->lexAfterType = false; return(EQUAL); }
- YY_BREAK
-case 217:
-YY_RULE_SETUP
-{ context->lexAfterType = false; context->inTypeParen = true; return(LEFT_PAREN); }
- YY_BREAK
-case 218:
-YY_RULE_SETUP
-{ context->inTypeParen = false; return(RIGHT_PAREN); }
- YY_BREAK
-case 219:
-YY_RULE_SETUP
-{ return(LEFT_BRACKET); }
- YY_BREAK
-case 220:
-YY_RULE_SETUP
-{ return(RIGHT_BRACKET); }
- YY_BREAK
-case 221:
-YY_RULE_SETUP
-{ BEGIN(FIELDS); return(DOT); }
- YY_BREAK
-case 222:
-YY_RULE_SETUP
-{ return(BANG); }
- YY_BREAK
-case 223:
-YY_RULE_SETUP
-{ return(DASH); }
- YY_BREAK
-case 224:
-YY_RULE_SETUP
-{ return(TILDE); }
- YY_BREAK
-case 225:
-YY_RULE_SETUP
-{ return(PLUS); }
- YY_BREAK
-case 226:
-YY_RULE_SETUP
-{ return(STAR); }
- YY_BREAK
-case 227:
-YY_RULE_SETUP
-{ return(SLASH); }
- YY_BREAK
-case 228:
-YY_RULE_SETUP
-{ return(PERCENT); }
- YY_BREAK
-case 229:
-YY_RULE_SETUP
-{ return(LEFT_ANGLE); }
- YY_BREAK
-case 230:
-YY_RULE_SETUP
-{ return(RIGHT_ANGLE); }
- YY_BREAK
-case 231:
-YY_RULE_SETUP
-{ return(VERTICAL_BAR); }
- YY_BREAK
-case 232:
-YY_RULE_SETUP
-{ return(CARET); }
- YY_BREAK
-case 233:
-YY_RULE_SETUP
-{ return(AMPERSAND); }
- YY_BREAK
-case 234:
-YY_RULE_SETUP
-{ return(QUESTION); }
- YY_BREAK
-case 235:
-YY_RULE_SETUP
-{
- BEGIN(INITIAL);
- yylval->lex.string = NewPoolTString(yytext);
- return FIELD_SELECTION;
-}
- YY_BREAK
-case 236:
-YY_RULE_SETUP
-{}
- YY_BREAK
-case 237:
-/* rule 237 can match eol */
-YY_RULE_SETUP
-{ }
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(COMMENT):
-case YY_STATE_EOF(FIELDS):
-{ context->AfterEOF = true; yyterminate(); }
- YY_BREAK
-case 238:
-YY_RULE_SETUP
-{ context->warning(*yylloc, "Unknown char", yytext, ""); return 0; }
- YY_BREAK
-case 239:
-YY_RULE_SETUP
-ECHO;
- YY_BREAK
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap( yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of user's declarations */
-} /* end of yylex */
-
-
-
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = yyg->yytext_ptr;
- int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yyrealloc( (void *) b->yy_ch_buf,
- (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = NULL;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin , yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
- (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- /* "- 2" to take care of EOB's */
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
- yy_state_type yy_current_state;
- char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_current_state = yyg->yy_start;
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 821 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- }
-
- return yy_current_state;
-}
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
- int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- char *yy_cp = yyg->yy_c_buf_p;
-
- YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 821 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 820);
-
- (void)yyg;
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (yyscan_t yyscanner)
-#else
- static int input (yyscan_t yyscanner)
-#endif
-
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin , yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap( yyscanner ) )
- return 0;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
- if ( c == '\n' )
-
- do{ yylineno++;
- yycolumn=0;
- }while(0)
-;
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void yyrestart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
- yy_load_buffer_state( yyscanner );
-}
-
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
- */
- yyensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-
-static void yy_load_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file , yyscanner);
-
- return b;
-}
-
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * @param yyscanner The scanner object.
- */
- void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yyfree( (void *) b->yy_ch_buf , yyscanner );
-
- yyfree( (void *) b , yyscanner );
-}
-
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_flush_buffer( b , yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then yy_init_buffer was _probably_
- * called from yyrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
-
-
- b->yy_is_interactive = 0;
-
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
- void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack(yyscanner);
-
- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-void yypop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (yyscan_t yyscanner)
-{
- yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- yy_size_t grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-
-
-
-
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return NULL;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = NULL;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b , yyscanner );
-
- return b;
-}
-
-
-
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
-{
-
- return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
-}
-
-
-
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = (yy_size_t) (_yybytes_len + 2);
- buf = (char *) yyalloc( n , yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n , yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-
-
-
-
-
-
-
-
-
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-
-
-/* Accessor methods (get/set functions) to struct members. */
-
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int yyget_lineno (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-
-
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int yyget_column (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-
-
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_out (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-int yyget_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *yyget_text (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-
-
-/** Set the current line number.
- * @param _line_number line number
- * @param yyscanner The scanner object.
- */
-void yyset_lineno (int _line_number , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
-
- yylineno = _line_number;
-}
-
-
-
-
-/** Set the current column.
- * @param _column_no column number
- * @param yyscanner The scanner object.
- */
-void yyset_column (int _column_no , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_column called with no buffer" );
-
- yycolumn = _column_no;
-}
-
-
-
-
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param _in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE * _in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = _in_str ;
-}
-
-
-
-void yyset_out (FILE * _out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = _out_str ;
-}
-
-
-
-
-int yyget_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-
-
-void yyset_debug (int _bdebug , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = _bdebug ;
-}
-
-
-/* Accessor methods for yylval and yylloc */
-
-
-YYSTYPE * yyget_lval (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-
-
-void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-
-
-
-YYLTYPE *yyget_lloc (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylloc;
-}
-
-
-
-void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylloc = yylloc_param;
-}
-
-
-
-
-
-/* User-visible API */
-
-/* yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-int yylex_init(yyscan_t* ptr_yy_globals)
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-
-/* yylex_init_extra has the same functionality as yylex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to yyalloc in
- * the yyextra field.
- */
-int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
-{
- struct yyguts_t dummy_yyguts;
-
- yyset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- yyset_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from yylex_destroy(), so don't allocate here.
- */
-
-
-
-
- yyg->yy_buffer_stack = NULL;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = NULL;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
-
-
-
-
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = NULL;
- yyout = NULL;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * yylex_init()
- */
- return 0;
-}
-
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- yyfree(yyg->yy_buffer_stack , yyscanner);
- yyg->yy_buffer_stack = NULL;
-
-
- /* Destroy the start condition stack. */
- yyfree( yyg->yy_start_stack , yyscanner );
- yyg->yy_start_stack = NULL;
-
-
-
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * yylex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- yyfree ( yyscanner , yyscanner );
- yyscanner = NULL;
- return 0;
-}
-
-
-
-/*
- * Internal utility routines.
- */
-
-
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
-{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-
-
-void *yyalloc (yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- return malloc(size);
-}
-
-
-
-void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return realloc(ptr, size);
-}
-
-
-
-void yyfree (void * ptr , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
-}
-
-
-#define YYTABLES_NAME "yytables"
-
-
-
-
-
-
-
-
-yy_size_t string_input(char* buf, yy_size_t max_size, yyscan_t yyscanner) {
- pp::Token token;
- yyget_extra(yyscanner)->getPreprocessor().lex(&token);
- yy_size_t len = token.type == pp::Token::LAST ? 0 : token.text.size();
- if (len < max_size)
- memcpy(buf, token.text.c_str(), len);
- yyset_column(token.location.file, yyscanner);
- yyset_lineno(token.location.line, yyscanner);
-
- if (len >= max_size)
- YY_FATAL_ERROR("Input buffer overflow");
- else if (len > 0)
- buf[len++] = ' ';
- return len;
-}
-
-int check_type(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- int token = IDENTIFIER;
- TSymbol* symbol = yyextra->symbolTable.find(yytext, yyextra->getShaderVersion());
- if (yyextra->lexAfterType == false && symbol && symbol->isVariable()) {
- TVariable* variable = static_cast<TVariable*>(symbol);
- if (variable->isUserType()) {
- yyextra->lexAfterType = true;
- token = TYPE_NAME;
- }
- }
- yylval->lex.symbol = symbol;
- return token;
-}
-
-int reserved_word(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- yyextra->error(*yylloc, "Illegal use of reserved word", yytext, "");
- yyextra->recover();
- return 0;
-}
-
-int ES2_reserved_ES3_keyword(TParseContext *context, int token)
-{
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- return reserved_word(yyscanner);
- }
-
- return token;
-}
-
-int ES2_keyword_ES3_reserved(TParseContext *context, int token)
-{
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- if (context->getShaderVersion() >= 300)
- {
- return reserved_word(yyscanner);
- }
-
- return token;
-}
-
-int ES2_identifier_ES3_keyword(TParseContext *context, int token)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
- yyscan_t yyscanner = (yyscan_t) context->getScanner();
-
- // not a reserved word in GLSL ES 1.00, so could be used as an identifier/type name
- if (context->getShaderVersion() < 300)
- {
- yylval->lex.string = NewPoolTString(yytext);
- return check_type(yyscanner);
- }
-
- return token;
-}
-
-int uint_constant(TParseContext *context)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- context->error(*yylloc, "Unsigned integers are unsupported prior to GLSL ES 3.00", yytext, "");
- context->recover();
- return 0;
- }
-
- if (!atou_clamp(yytext, &(yylval->lex.u)))
- yyextra->warning(*yylloc, "Integer overflow", yytext, "");
-
- return UINTCONSTANT;
-}
-
-int floatsuffix_check(TParseContext* context)
-{
- struct yyguts_t* yyg = (struct yyguts_t*) context->getScanner();
-
- if (context->getShaderVersion() < 300)
- {
- context->error(*yylloc, "Floating-point suffix unsupported prior to GLSL ES 3.00", yytext);
- context->recover();
- return 0;
- }
-
- std::string text = yytext;
- text.resize(text.size() - 1); // Drop the suffix
- if(!atof_clamp(text.c_str(), &(yylval->lex.f)))
- yyextra->warning(*yylloc, "Float overflow", yytext, "");
-
- return(FLOATCONSTANT);
-}
-
-int int_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atoi_clamp(yytext, &(yylval->lex.i)))
- yyextra->warning(*yylloc, "Integer overflow", yytext, "");
- return INTCONSTANT;
-}
-
-int float_constant(yyscan_t yyscanner) {
- struct yyguts_t* yyg = (struct yyguts_t*) yyscanner;
-
- if (!atof_clamp(yytext, &(yylval->lex.f)))
- yyextra->warning(*yylloc, "Float overflow", yytext, "");
- return FLOATCONSTANT;
-}
-
-void yyerror(YYLTYPE* lloc, TParseContext* context, void* scanner, const char* reason) {
- struct yyguts_t* yyg = (struct yyguts_t*) scanner;
-
- if (context->AfterEOF) {
- context->error(*lloc, reason, "unexpected EOF");
- } else {
- context->error(*lloc, reason, yytext);
- }
- context->recover();
-}
-
-int glslang_initialize(TParseContext* context) {
- yyscan_t scanner = NULL;
- if (yylex_init_extra(context, &scanner))
- return 1;
-
- context->setScanner(scanner);
- return 0;
-}
-
-int glslang_finalize(TParseContext* context) {
- yyscan_t scanner = context->getScanner();
- if (scanner == NULL) return 0;
-
- context->setScanner(NULL);
- yylex_destroy(scanner);
-
- return 0;
-}
-
-int glslang_scan(size_t count, const char* const string[], const int length[],
- TParseContext* context) {
- yyrestart(NULL, context->getScanner());
- yyset_column(0, context->getScanner());
- yyset_lineno(1, context->getScanner());
- context->AfterEOF = false;
-
- // Initialize preprocessor.
- if (!context->getPreprocessor().init(count, string, length))
- return 1;
-
- // Define extension macros.
- const TExtensionBehavior& extBehavior = context->extensionBehavior();
- for (TExtensionBehavior::const_iterator iter = extBehavior.begin();
- iter != extBehavior.end(); ++iter)
- {
- context->getPreprocessor().predefineMacro(iter->first.c_str(), 1);
- }
-
- context->getPreprocessor().predefineMacro("GL_FRAGMENT_PRECISION_HIGH", 1);
-
- return 0;
-}
-
-
diff --git a/src/OpenGL/compiler/glslang_tab.cpp b/src/OpenGL/compiler/glslang_tab.cpp
deleted file mode 100644
index f18ef9f0a..000000000
--- a/src/OpenGL/compiler/glslang_tab.cpp
+++ /dev/null
@@ -1,5112 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-
-
-
-/* Copy the first part of user declarations. */
-
-
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-// Ignore errors in auto-generated code.
-#if defined(__GNUC__)
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wswitch-enum"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065)
-#pragma warning(disable: 4189)
-#pragma warning(disable: 4505)
-#pragma warning(disable: 4701)
-#endif
-
-#include "SymbolTable.h"
-#include "ParseHelper.h"
-
-#define YYENABLE_NLS 0
-
-
-
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* In a future release of Bison, this section will be replaced
- by #include "glslang_tab.h". */
-#ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
-# define YY_YY_GLSLANG_TAB_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-/* "%code requires" blocks. */
-
-
-#define YYLTYPE TSourceLoc
-#define YYLTYPE_IS_DECLARED 1
-
-
-
-/* Token type. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- INVARIANT = 258,
- HIGH_PRECISION = 259,
- MEDIUM_PRECISION = 260,
- LOW_PRECISION = 261,
- PRECISION = 262,
- ATTRIBUTE = 263,
- CONST_QUAL = 264,
- BOOL_TYPE = 265,
- FLOAT_TYPE = 266,
- INT_TYPE = 267,
- UINT_TYPE = 268,
- BREAK = 269,
- CONTINUE = 270,
- DO = 271,
- ELSE = 272,
- FOR = 273,
- IF = 274,
- DISCARD = 275,
- RETURN = 276,
- SWITCH = 277,
- CASE = 278,
- DEFAULT = 279,
- BVEC2 = 280,
- BVEC3 = 281,
- BVEC4 = 282,
- IVEC2 = 283,
- IVEC3 = 284,
- IVEC4 = 285,
- VEC2 = 286,
- VEC3 = 287,
- VEC4 = 288,
- UVEC2 = 289,
- UVEC3 = 290,
- UVEC4 = 291,
- MATRIX2 = 292,
- MATRIX3 = 293,
- MATRIX4 = 294,
- IN_QUAL = 295,
- OUT_QUAL = 296,
- INOUT_QUAL = 297,
- UNIFORM = 298,
- VARYING = 299,
- MATRIX2x3 = 300,
- MATRIX3x2 = 301,
- MATRIX2x4 = 302,
- MATRIX4x2 = 303,
- MATRIX3x4 = 304,
- MATRIX4x3 = 305,
- CENTROID = 306,
- FLAT = 307,
- SMOOTH = 308,
- STRUCT = 309,
- VOID_TYPE = 310,
- WHILE = 311,
- SAMPLER2D = 312,
- SAMPLERCUBE = 313,
- SAMPLER_EXTERNAL_OES = 314,
- SAMPLER2DRECT = 315,
- SAMPLER2DARRAY = 316,
- ISAMPLER2D = 317,
- ISAMPLER3D = 318,
- ISAMPLERCUBE = 319,
- ISAMPLER2DARRAY = 320,
- USAMPLER2D = 321,
- USAMPLER3D = 322,
- USAMPLERCUBE = 323,
- USAMPLER2DARRAY = 324,
- SAMPLER3D = 325,
- SAMPLER3DRECT = 326,
- SAMPLER2DSHADOW = 327,
- SAMPLERCUBESHADOW = 328,
- SAMPLER2DARRAYSHADOW = 329,
- LAYOUT = 330,
- IDENTIFIER = 331,
- TYPE_NAME = 332,
- FLOATCONSTANT = 333,
- INTCONSTANT = 334,
- UINTCONSTANT = 335,
- BOOLCONSTANT = 336,
- FIELD_SELECTION = 337,
- LEFT_OP = 338,
- RIGHT_OP = 339,
- INC_OP = 340,
- DEC_OP = 341,
- LE_OP = 342,
- GE_OP = 343,
- EQ_OP = 344,
- NE_OP = 345,
- AND_OP = 346,
- OR_OP = 347,
- XOR_OP = 348,
- MUL_ASSIGN = 349,
- DIV_ASSIGN = 350,
- ADD_ASSIGN = 351,
- MOD_ASSIGN = 352,
- LEFT_ASSIGN = 353,
- RIGHT_ASSIGN = 354,
- AND_ASSIGN = 355,
- XOR_ASSIGN = 356,
- OR_ASSIGN = 357,
- SUB_ASSIGN = 358,
- LEFT_PAREN = 359,
- RIGHT_PAREN = 360,
- LEFT_BRACKET = 361,
- RIGHT_BRACKET = 362,
- LEFT_BRACE = 363,
- RIGHT_BRACE = 364,
- DOT = 365,
- COMMA = 366,
- COLON = 367,
- EQUAL = 368,
- SEMICOLON = 369,
- BANG = 370,
- DASH = 371,
- TILDE = 372,
- PLUS = 373,
- STAR = 374,
- SLASH = 375,
- PERCENT = 376,
- LEFT_ANGLE = 377,
- RIGHT_ANGLE = 378,
- VERTICAL_BAR = 379,
- CARET = 380,
- AMPERSAND = 381,
- QUESTION = 382
- };
-#endif
-
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-union YYSTYPE
-{
-
-
- struct {
- union {
- TString *string;
- float f;
- int i;
- unsigned int u;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- TIntermSwitch* intermSwitch;
- TIntermCase* intermCase;
- };
- union {
- TPublicType type;
- TPrecision precision;
- TLayoutQualifier layoutQualifier;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TField* field;
- TFieldList* fieldList;
- };
- } interm;
-
-
-};
-
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type. */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-int yyparse (TParseContext* context, void* yyscanner);
-
-#endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */
-
-/* Copy the second part of user declarations. */
-
-
-extern int yylex(YYSTYPE* yylval, YYLTYPE* yylloc, void* yyscanner);
-extern void yyerror(YYLTYPE* lloc, TParseContext* context, void* scanner, const char* reason);
-
-#define YYLLOC_DEFAULT(Current, Rhs, N) \
- do { \
- if (N) { \
- (Current).first_file = YYRHSLOC(Rhs, 1).first_file; \
- (Current).first_line = YYRHSLOC(Rhs, 1).first_line; \
- (Current).last_file = YYRHSLOC(Rhs, N).last_file; \
- (Current).last_line = YYRHSLOC(Rhs, N).last_line; \
- } \
- else { \
- (Current).first_file = YYRHSLOC(Rhs, 0).last_file; \
- (Current).first_line = YYRHSLOC(Rhs, 0).last_line; \
- (Current).last_file = YYRHSLOC(Rhs, 0).last_file; \
- (Current).last_line = YYRHSLOC(Rhs, 0).last_line; \
- } \
- } while (0)
-
-#define FRAG_VERT_ONLY(S, L) { \
- if (context->getShaderType() != GL_FRAGMENT_SHADER && \
- context->getShaderType() != GL_VERTEX_SHADER) { \
- context->error(L, " supported in vertex/fragment shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define VERTEX_ONLY(S, L) { \
- if (context->getShaderType() != GL_VERTEX_SHADER) { \
- context->error(L, " supported in vertex shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define FRAG_ONLY(S, L) { \
- if (context->getShaderType() != GL_FRAGMENT_SHADER) { \
- context->error(L, " supported in fragment shaders only ", S); \
- context->recover(); \
- } \
-}
-
-#define ES2_ONLY(S, L) { \
- if (context->getShaderVersion() != 100) { \
- context->error(L, " supported in GLSL ES 1.00 only ", S); \
- context->recover(); \
- } \
-}
-
-#define ES3_ONLY(TOKEN, LINE, REASON) { \
- if (context->getShaderVersion() != 300) { \
- context->error(LINE, REASON " supported in GLSL ES 3.00 only ", TOKEN); \
- context->recover(); \
- } \
-}
-
-
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL \
- && defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
- YYLTYPE yyls_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
- + 2 * YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 113
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 2530
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 128
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 93
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 273
-/* YYNSTATES -- Number of states. */
-#define YYNSTATES 414
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 382
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 42, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 71, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
- 85, 86, 87, 88, 89, 90, 91, 92, 93, 94,
- 95, 96, 97, 98, 99, 100, 101, 102, 103, 104,
- 105, 106, 107, 108, 109, 110, 111, 112, 113, 114,
- 115, 116, 117, 118, 119, 120, 121, 122, 123, 124,
- 125, 126, 127
-};
-
-#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 229, 229, 249, 252, 257, 262, 267, 272, 278,
- 281, 284, 287, 290, 293, 299, 307, 318, 322, 330,
- 333, 339, 343, 350, 356, 365, 373, 379, 386, 396,
- 399, 402, 405, 415, 416, 417, 418, 426, 427, 431,
- 435, 443, 444, 447, 453, 454, 458, 465, 466, 469,
- 472, 475, 481, 482, 485, 491, 492, 499, 500, 507,
- 508, 515, 516, 522, 523, 529, 530, 536, 537, 543,
- 544, 552, 553, 554, 555, 557, 558, 559, 562, 565,
- 568, 571, 577, 580, 591, 599, 607, 610, 616, 623,
- 627, 631, 635, 642, 648, 651, 658, 666, 687, 713,
- 723, 751, 756, 766, 771, 781, 784, 787, 790, 796,
- 803, 806, 810, 814, 819, 824, 831, 835, 839, 843,
- 848, 853, 857, 864, 874, 880, 883, 889, 895, 902,
- 911, 920, 928, 931, 938, 942, 946, 951, 959, 962,
- 966, 970, 979, 988, 996, 1006, 1018, 1021, 1024, 1030,
- 1037, 1040, 1046, 1049, 1052, 1058, 1061, 1066, 1081, 1085,
- 1089, 1093, 1097, 1101, 1106, 1111, 1116, 1121, 1126, 1131,
- 1136, 1141, 1146, 1151, 1156, 1161, 1167, 1173, 1179, 1185,
- 1191, 1197, 1203, 1209, 1215, 1220, 1225, 1234, 1243, 1248,
- 1253, 1258, 1263, 1268, 1273, 1278, 1283, 1288, 1293, 1298,
- 1303, 1308, 1313, 1326, 1326, 1329, 1329, 1335, 1338, 1354,
- 1357, 1366, 1370, 1376, 1383, 1398, 1402, 1406, 1407, 1413,
- 1414, 1415, 1416, 1417, 1418, 1419, 1423, 1424, 1424, 1424,
- 1434, 1435, 1439, 1439, 1440, 1440, 1445, 1448, 1458, 1461,
- 1467, 1468, 1472, 1480, 1484, 1491, 1491, 1498, 1501, 1508,
- 1513, 1528, 1528, 1533, 1533, 1540, 1540, 1548, 1551, 1557,
- 1560, 1566, 1570, 1577, 1580, 1583, 1586, 1589, 1598, 1602,
- 1609, 1612, 1618, 1618
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "INVARIANT", "HIGH_PRECISION",
- "MEDIUM_PRECISION", "LOW_PRECISION", "PRECISION", "ATTRIBUTE",
- "CONST_QUAL", "BOOL_TYPE", "FLOAT_TYPE", "INT_TYPE", "UINT_TYPE",
- "BREAK", "CONTINUE", "DO", "ELSE", "FOR", "IF", "DISCARD", "RETURN",
- "SWITCH", "CASE", "DEFAULT", "BVEC2", "BVEC3", "BVEC4", "IVEC2", "IVEC3",
- "IVEC4", "VEC2", "VEC3", "VEC4", "UVEC2", "UVEC3", "UVEC4", "MATRIX2",
- "MATRIX3", "MATRIX4", "IN_QUAL", "OUT_QUAL", "INOUT_QUAL", "UNIFORM",
- "VARYING", "MATRIX2x3", "MATRIX3x2", "MATRIX2x4", "MATRIX4x2",
- "MATRIX3x4", "MATRIX4x3", "CENTROID", "FLAT", "SMOOTH", "STRUCT",
- "VOID_TYPE", "WHILE", "SAMPLER2D", "SAMPLERCUBE", "SAMPLER_EXTERNAL_OES",
- "SAMPLER2DRECT", "SAMPLER2DARRAY", "ISAMPLER2D", "ISAMPLER3D",
- "ISAMPLERCUBE", "ISAMPLER2DARRAY", "USAMPLER2D", "USAMPLER3D",
- "USAMPLERCUBE", "USAMPLER2DARRAY", "SAMPLER3D", "SAMPLER3DRECT",
- "SAMPLER2DSHADOW", "SAMPLERCUBESHADOW", "SAMPLER2DARRAYSHADOW", "LAYOUT",
- "IDENTIFIER", "TYPE_NAME", "FLOATCONSTANT", "INTCONSTANT",
- "UINTCONSTANT", "BOOLCONSTANT", "FIELD_SELECTION", "LEFT_OP", "RIGHT_OP",
- "INC_OP", "DEC_OP", "LE_OP", "GE_OP", "EQ_OP", "NE_OP", "AND_OP",
- "OR_OP", "XOR_OP", "MUL_ASSIGN", "DIV_ASSIGN", "ADD_ASSIGN",
- "MOD_ASSIGN", "LEFT_ASSIGN", "RIGHT_ASSIGN", "AND_ASSIGN", "XOR_ASSIGN",
- "OR_ASSIGN", "SUB_ASSIGN", "LEFT_PAREN", "RIGHT_PAREN", "LEFT_BRACKET",
- "RIGHT_BRACKET", "LEFT_BRACE", "RIGHT_BRACE", "DOT", "COMMA", "COLON",
- "EQUAL", "SEMICOLON", "BANG", "DASH", "TILDE", "PLUS", "STAR", "SLASH",
- "PERCENT", "LEFT_ANGLE", "RIGHT_ANGLE", "VERTICAL_BAR", "CARET",
- "AMPERSAND", "QUESTION", "$accept", "variable_identifier",
- "primary_expression", "postfix_expression", "integer_expression",
- "function_call", "function_call_or_method", "function_call_generic",
- "function_call_header_no_parameters",
- "function_call_header_with_parameters", "function_call_header",
- "function_identifier", "unary_expression", "unary_operator",
- "multiplicative_expression", "additive_expression", "shift_expression",
- "relational_expression", "equality_expression", "and_expression",
- "exclusive_or_expression", "inclusive_or_expression",
- "logical_and_expression", "logical_xor_expression",
- "logical_or_expression", "conditional_expression",
- "assignment_expression", "assignment_operator", "expression",
- "constant_expression", "enter_struct", "declaration",
- "function_prototype", "function_declarator",
- "function_header_with_parameters", "function_header",
- "parameter_declarator", "parameter_declaration", "parameter_qualifier",
- "parameter_type_specifier", "init_declarator_list", "single_declaration",
- "fully_specified_type", "interpolation_qualifier",
- "parameter_type_qualifier", "type_qualifier", "storage_qualifier",
- "type_specifier", "precision_qualifier", "layout_qualifier",
- "layout_qualifier_id_list", "layout_qualifier_id",
- "type_specifier_no_prec", "type_specifier_nonarray", "struct_specifier",
- "$@1", "$@2", "struct_declaration_list", "struct_declaration",
- "struct_declarator_list", "struct_declarator", "initializer",
- "declaration_statement", "statement", "simple_statement",
- "compound_statement", "$@3", "$@4", "statement_no_new_scope",
- "statement_with_scope", "$@5", "$@6", "compound_statement_no_new_scope",
- "statement_list", "expression_statement", "selection_statement",
- "selection_rest_statement", "switch_statement", "$@7", "case_label",
- "condition", "iteration_statement", "$@8", "$@9", "$@10",
- "for_init_statement", "conditionopt", "for_rest_statement",
- "jump_statement", "translation_unit", "external_declaration",
- "function_definition", "$@11", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 279, 280, 281, 282, 283, 284,
- 285, 286, 287, 288, 289, 290, 291, 292, 293, 294,
- 295, 296, 297, 298, 299, 300, 301, 302, 303, 304,
- 305, 306, 307, 308, 309, 310, 311, 312, 313, 314,
- 315, 316, 317, 318, 319, 320, 321, 322, 323, 324,
- 325, 326, 327, 328, 329, 330, 331, 332, 333, 334,
- 335, 336, 337, 338, 339, 340, 341, 342, 343, 344,
- 345, 346, 347, 348, 349, 350, 351, 352, 353, 354,
- 355, 356, 357, 358, 359, 360, 361, 362, 363, 364,
- 365, 366, 367, 368, 369, 370, 371, 372, 373, 374,
- 375, 376, 377, 378, 379, 380, 381, 382
-};
-# endif
-
-#define YYPACT_NINF -344
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-344)))
-
-#define YYTABLE_NINF -233
-
-#define yytable_value_is_error(Yytable_value) \
- 0
-
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
-{
- 2168, 120, -344, -344, -344, 146, -344, -344, -344, -344,
- -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,
- -344, -344, -344, -344, -344, -344, -344, -344, -344, -344,
- -344, -344, -344, -344, -344, -344, -344, 127, -344, -344,
- -41, -344, -344, -344, -344, -344, -344, -344, -344, -344,
- -344, -344, -344, -344, -344, -344, -344, -344, -344, -84,
- -344, -344, -68, -57, -39, 1, -89, -344, 41, 14,
- 1187, -344, -344, 2453, 14, -344, 15, -344, 2093, -344,
- -344, -344, -344, 14, -344, 2453, -344, -344, 18, -344,
- 47, -344, 26, -344, 10, -344, -344, -344, -344, -344,
- 2317, 113, 60, -344, -66, -344, 31, -344, 2243, -344,
- -344, -344, 1257, -344, -344, -344, -45, -344, 2243, 46,
- -21, -344, 415, -344, -344, -344, -344, 68, 2317, -42,
- -344, 1355, 1646, -344, 188, 2317, 89, 1838, -344, 85,
- -344, -344, -344, -344, -344, 1646, 1646, 1646, -344, -344,
- -344, -344, -344, -344, -344, 39, -344, -344, -344, 74,
- -17, 1741, 96, -344, 1646, 37, -37, 91, -61, 87,
- 65, 81, 71, 116, 115, -64, -344, 102, -344, -344,
- 2243, 1923, 105, -344, 47, 97, 99, -344, 110, 131,
- 124, 1453, 138, 1646, 132, 142, 140, -344, -344, 123,
- -344, -344, -77, -344, -68, 143, -344, -344, -344, -344,
- 531, -344, -344, -344, -344, -344, -344, 144, -344, -344,
- 1548, 1646, 141, 148, -344, -344, 89, 145, -9, -344,
- -58, -344, -344, -344, -13, -344, -344, 1646, 2385, -344,
- -344, 1646, 152, -344, -344, -344, 1646, 1646, 1646, 1646,
- 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646, 1646,
- 1646, 1646, 1646, 1646, 1646, 1646, -344, 2008, -344, -344,
- -344, -344, -344, -344, 150, -344, 1646, -344, -344, -7,
- 1646, 147, -344, -344, -344, 647, -344, -344, -344, -344,
- -344, -344, -344, -344, -344, -344, -344, 1646, 1646, -344,
- -344, -344, 1646, 149, 153, -344, 1646, 151, 5, 1646,
- 89, -344, -70, -344, -344, 158, 157, -344, 165, -344,
- -344, -344, -344, -344, 37, 37, -37, -37, 91, 91,
- 91, 91, -61, -61, 87, 65, 81, 71, 116, 115,
- 75, -344, 214, 26, 879, 995, -8, -344, 4, -344,
- 1092, 647, -344, -344, 164, 1646, 159, -344, 1646, -344,
- 166, -344, 1646, -344, -344, 1646, 170, -344, -344, -344,
- -344, 1092, 150, -344, 157, 200, 2317, 172, 169, -344,
- -344, 1646, -344, -344, 173, -344, 1646, -344, 167, 174,
- 265, -344, 175, 171, 763, -344, -344, 177, 9, 1646,
- 763, 150, -344, 1646, -344, -344, -344, -344, 178, 157,
- -344, -344, -344, -344
-};
-
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint16 yydefact[] =
-{
- 0, 0, 146, 147, 148, 0, 128, 138, 162, 159,
- 160, 161, 166, 167, 168, 169, 170, 171, 163, 164,
- 165, 172, 173, 174, 175, 176, 177, 139, 140, 143,
- 129, 178, 179, 180, 181, 182, 183, 0, 126, 125,
- 0, 158, 184, 185, 186, 187, 189, 190, 191, 192,
- 193, 194, 195, 196, 197, 188, 198, 199, 200, 0,
- 202, 271, 272, 0, 95, 105, 0, 110, 116, 133,
- 0, 131, 123, 0, 134, 144, 155, 201, 0, 268,
- 270, 130, 122, 0, 136, 0, 141, 142, 0, 205,
- 0, 86, 0, 93, 105, 127, 106, 107, 108, 96,
- 0, 105, 0, 87, 117, 132, 0, 92, 0, 124,
- 145, 135, 0, 1, 269, 137, 0, 203, 0, 152,
- 0, 150, 0, 273, 97, 102, 104, 109, 0, 111,
- 98, 0, 0, 85, 0, 0, 0, 0, 207, 2,
- 6, 4, 5, 7, 28, 0, 0, 0, 156, 35,
- 34, 36, 33, 3, 9, 29, 11, 16, 17, 0,
- 0, 22, 0, 37, 0, 41, 44, 47, 52, 55,
- 57, 59, 61, 63, 65, 67, 84, 0, 26, 88,
- 0, 0, 0, 149, 0, 0, 0, 253, 0, 0,
- 0, 0, 0, 0, 0, 0, 227, 236, 240, 37,
- 69, 82, 0, 216, 0, 144, 219, 238, 218, 217,
- 0, 220, 221, 222, 223, 224, 225, 99, 101, 103,
- 0, 0, 0, 0, 215, 121, 0, 213, 0, 211,
- 0, 208, 30, 31, 0, 13, 14, 0, 0, 20,
- 19, 0, 158, 23, 25, 32, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 157, 0, 206, 153,
- 154, 151, 264, 263, 234, 255, 0, 267, 265, 0,
- 0, 0, 248, 251, 226, 0, 72, 73, 75, 74,
- 77, 78, 79, 80, 81, 76, 71, 0, 0, 241,
- 237, 239, 0, 0, 0, 115, 0, 118, 0, 0,
- 0, 209, 0, 89, 8, 0, 15, 27, 12, 18,
- 24, 38, 39, 40, 43, 42, 45, 46, 50, 51,
- 48, 49, 53, 54, 56, 58, 60, 62, 64, 66,
- 0, 204, 0, 0, 0, 0, 0, 266, 0, 247,
- 0, 228, 70, 83, 0, 0, 112, 119, 0, 210,
- 0, 212, 0, 90, 10, 0, 0, 233, 235, 258,
- 257, 260, 234, 245, 249, 0, 0, 0, 0, 100,
- 113, 0, 120, 214, 0, 68, 0, 259, 0, 0,
- 244, 242, 0, 0, 0, 229, 114, 0, 0, 261,
- 0, 234, 246, 0, 231, 252, 230, 91, 0, 262,
- 256, 243, 250, 254
-};
-
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int16 yypgoto[] =
-{
- -344, -344, -344, -344, -344, -344, -344, 48, -344, -344,
- -344, -344, 70, -344, -56, -49, -123, -53, 28, 29,
- 27, 32, 30, 33, -344, -110, -128, -344, -138, -119,
- -344, 11, 17, -344, -344, -344, 168, 201, 197, 176,
- -344, -344, -326, 7, -344, -105, 13, -69, 294, -344,
- -344, 117, 0, -344, -344, -344, -344, -103, -121, 76,
- -10, -215, -40, -203, -314, -86, -344, -344, -97, -343,
- -344, -344, -87, 23, -36, -344, -344, -344, -344, -344,
- -60, -344, -344, -344, -344, -344, -344, -344, -344, -344,
- 232, -344, -344
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int16 yydefgoto[] =
-{
- -1, 153, 154, 155, 315, 156, 157, 158, 159, 160,
- 161, 162, 199, 164, 165, 166, 167, 168, 169, 170,
- 171, 172, 173, 174, 175, 200, 201, 297, 202, 177,
- 108, 203, 204, 63, 64, 65, 125, 99, 100, 126,
- 66, 67, 68, 69, 101, 70, 71, 72, 73, 74,
- 120, 121, 178, 76, 77, 180, 118, 137, 138, 228,
- 229, 225, 206, 207, 208, 209, 285, 378, 405, 342,
- 343, 344, 406, 210, 211, 212, 391, 213, 392, 214,
- 377, 215, 350, 274, 345, 371, 388, 389, 216, 78,
- 79, 80, 92
-};
-
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
-static const yytype_int16 yytable[] =
-{
- 75, 109, 176, 135, 224, 123, 305, 301, 83, 234,
- 95, 61, 223, 135, 84, 181, 231, 62, 312, 95,
- 90, 176, 102, 7, 375, 103, 253, 254, 264, 390,
- 368, 127, 135, 243, 298, 88, 362, 299, 130, 136,
- 131, 96, 97, 98, 363, 375, 91, 132, 93, 136,
- 96, 97, 98, 279, 27, 28, 313, 29, 411, 127,
- 231, 255, 256, 265, 220, 37, 226, 89, 136, 179,
- 75, 221, 94, 110, 281, 135, 135, 267, 75, 249,
- 404, 250, 105, 176, 183, 116, 404, 111, 240, 61,
- 184, 357, 314, 224, 241, 62, 115, 372, 298, 316,
- 75, 304, 310, 298, 298, 311, -94, 347, 75, 373,
- 176, 136, 136, 320, 408, 298, 310, 104, 75, 359,
- 298, 112, 205, 119, 235, 236, 117, 340, 75, 7,
- 328, 329, 330, 331, 122, 75, 129, 75, 346, 133,
- 380, 83, 348, 382, 217, 237, 231, 84, 301, 238,
- 2, 3, 4, 96, 97, 98, 246, 247, 248, 182,
- 27, 28, 135, 29, 81, 227, 396, 86, 87, 352,
- 353, 37, 38, 39, 251, 252, 257, 258, 224, 239,
- 75, 75, 163, 354, 269, 270, 298, 365, 412, -27,
- 360, 259, 176, 324, 325, 261, 82, 7, 136, 176,
- 244, 163, 326, 327, 332, 333, 260, 262, 263, 266,
- 205, 272, 374, 273, 275, 232, 233, 286, 287, 288,
- 289, 290, 291, 292, 293, 294, 295, 224, 27, 28,
- 224, 29, 81, 374, 245, 276, 296, 385, 277, 37,
- 38, 39, 280, 384, 282, 376, 283, -26, 398, 284,
- 302, 309, 176, 224, 306, 307, 367, -21, -232, 349,
- 356, 409, 355, 163, 358, 364, 376, 75, 298, -28,
- 366, 379, 381, 383, 386, 224, 393, 394, 395, 400,
- 397, 399, 401, 196, 403, 205, 319, 334, 336, 335,
- 163, 407, 413, 338, 337, 124, 218, 339, 128, 85,
- 361, 271, 308, 410, 219, 369, 402, 109, 351, 370,
- 114, 387, 0, 0, 0, 0, 321, 322, 323, 163,
- 163, 163, 163, 163, 163, 163, 163, 163, 163, 163,
- 163, 163, 163, 163, 163, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 205, 205, 0, 0, 0, 0,
- 205, 205, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 205, 163, 0, 0, 0, 75, 0, 0, 163,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 205, 0, 0, 0, 0, 0,
- 205, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 185,
- 186, 187, 163, 188, 189, 190, 191, 192, 193, 194,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 195, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 0, 56, 57, 58,
- 59, 139, 60, 140, 141, 142, 143, 144, 0, 0,
- 145, 146, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 147,
- 0, 0, 0, 196, 197, 0, 0, 0, 0, 198,
- 149, 150, 151, 152, 1, 2, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 185, 186, 187, 0, 188,
- 189, 190, 191, 192, 193, 194, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 27, 28, 0, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, 195, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 0, 56, 57, 58, 59, 139, 60, 140,
- 141, 142, 143, 144, 0, 0, 145, 146, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 147, 0, 0, 0, 196,
- 300, 0, 0, 0, 0, 198, 149, 150, 151, 152,
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 185, 186, 187, 0, 188, 189, 190, 191, 192,
- 193, 194, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 27, 28, 0,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, 195, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 0, 56,
- 57, 58, 59, 139, 60, 140, 141, 142, 143, 144,
- 0, 0, 145, 146, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 147, 0, 0, 0, 196, 0, 0, 0, 0,
- 0, 198, 149, 150, 151, 152, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 185, 186, 187,
- 0, 188, 189, 190, 191, 192, 193, 194, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 195,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 59, 139,
- 60, 140, 141, 142, 143, 144, 0, 0, 145, 146,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 147, 0, 0,
- 0, 122, 0, 0, 0, 0, 0, 198, 149, 150,
- 151, 152, 1, 2, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 185, 186, 187, 0, 188, 189, 190,
- 191, 192, 193, 194, 12, 13, 14, 15, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 0, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, 195, 42, 43, 44, 45,
- 46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 0, 56, 57, 58, 59, 139, 60, 140, 141, 142,
- 143, 144, 0, 0, 145, 146, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 147, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 198, 149, 150, 151, 152, 1, 2,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 0, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, 0, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 0, 56, 57, 58,
- 59, 139, 60, 140, 141, 142, 143, 144, 0, 0,
- 145, 146, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 134, 2, 3, 4, 147,
- 6, 7, 8, 9, 10, 11, 0, 0, 0, 198,
- 149, 150, 151, 152, 0, 0, 0, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 0, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, 40, 41, 0, 42,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 0, 56, 57, 58, 59, 139, 60,
- 140, 141, 142, 143, 144, 0, 0, 145, 146, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 2, 3, 4, 0, 0, 147, 8, 9, 10,
- 11, 0, 0, 0, 0, 0, 0, 149, 150, 151,
- 152, 0, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
- 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
- 0, 40, 41, 0, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 0, 56,
- 57, 58, 0, 106, 60, 0, 0, 8, 9, 10,
- 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
- 0, 107, 31, 32, 33, 34, 35, 36, 0, 0,
- 0, 40, 41, 0, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 0, 56,
- 57, 58, 0, 139, 60, 140, 141, 142, 143, 144,
- 0, 0, 145, 146, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 147, 0, 0, 148, 8, 9, 10, 11, 0,
- 0, 0, 149, 150, 151, 152, 0, 0, 0, 0,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
- 31, 32, 33, 34, 35, 36, 0, 0, 0, 40,
- 41, 0, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 0, 56, 57, 58,
- 0, 139, 60, 140, 141, 142, 143, 144, 0, 0,
- 145, 146, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 147,
- 0, 0, 222, 8, 9, 10, 11, 0, 0, 0,
- 149, 150, 151, 152, 0, 0, 0, 0, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
- 33, 34, 35, 36, 0, 0, 0, 40, 41, 0,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 0, 139,
- 60, 140, 141, 142, 143, 144, 0, 0, 145, 146,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 147, 8, 9,
- 10, 11, 0, 0, 0, 0, 0, 278, 149, 150,
- 151, 152, 0, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 0, 0,
- 0, 0, 0, 31, 32, 33, 34, 35, 36, 0,
- 0, 0, 40, 41, 0, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
- 56, 57, 58, 0, 139, 60, 140, 141, 142, 143,
- 144, 0, 0, 145, 146, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 147, 0, 0, 303, 8, 9, 10, 11,
- 0, 0, 0, 149, 150, 151, 152, 0, 0, 0,
- 0, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 0, 0, 0, 0,
- 0, 31, 32, 33, 34, 35, 36, 0, 0, 0,
- 40, 41, 0, 42, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 0, 56, 57,
- 58, 0, 139, 60, 140, 141, 142, 143, 144, 0,
- 0, 145, 146, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 147, 8, 9, 10, 11, 0, 0, 0, 0, 0,
- 0, 149, 150, 151, 152, 0, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 23, 24, 25,
- 26, 0, 0, 0, 0, 0, 31, 32, 33, 34,
- 35, 36, 0, 0, 0, 40, 242, 0, 42, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 0, 56, 57, 58, 0, 139, 60, 140,
- 141, 142, 143, 144, 0, 0, 145, 146, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 134, 2, 3, 4, 147, 6, 7, 8, 9,
- 10, 11, 0, 0, 0, 0, 149, 150, 151, 152,
- 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
- 56, 57, 58, 59, 0, 60, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 134, 2, 3, 4,
- 0, 6, 7, 8, 9, 10, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 230, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
- 60, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 134, 2, 3, 4, 0, 6, 7, 8, 9,
- 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 268, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
- 56, 57, 58, 59, 0, 60, 0, 0, 0, 0,
- 0, 0, 0, 113, 0, 0, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 341, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
- 60, 1, 2, 3, 4, 5, 6, 7, 8, 9,
- 10, 11, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 0, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, 0, 42, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 0,
- 56, 57, 58, 59, 0, 60, 134, 2, 3, 4,
- 0, 6, 7, 8, 9, 10, 11, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 27, 28, 0, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 0,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 59, 0,
- 60, 2, 3, 4, 0, 0, 0, 8, 9, 10,
- 11, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 12, 13, 14, 15, 16, 17, 18, 19,
- 20, 21, 22, 23, 24, 25, 26, 0, 0, 0,
- 0, 0, 31, 32, 33, 34, 35, 36, 0, 0,
- 0, 40, 41, 0, 42, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 0, 56,
- 57, 58, 0, 0, 60, 8, 9, 10, 11, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 0, 0, 0, 0, 0,
- 31, 32, 33, 34, 35, 36, 0, 0, 0, 40,
- 41, 0, 42, 43, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 0, 56, 57, 58,
- 0, 317, 60, 8, 9, 10, 11, 318, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
- 24, 25, 26, 0, 0, 0, 0, 0, 31, 32,
- 33, 34, 35, 36, 0, 0, 0, 40, 41, 0,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 0, 56, 57, 58, 0, 0,
- 60
-};
-
-static const yytype_int16 yycheck[] =
-{
- 0, 70, 112, 108, 132, 92, 221, 210, 1, 147,
- 9, 0, 131, 118, 1, 118, 137, 0, 76, 9,
- 104, 131, 111, 9, 350, 114, 87, 88, 92, 372,
- 344, 100, 137, 161, 111, 76, 106, 114, 104, 108,
- 106, 40, 41, 42, 114, 371, 114, 113, 105, 118,
- 40, 41, 42, 191, 40, 41, 114, 43, 401, 128,
- 181, 122, 123, 127, 106, 51, 135, 108, 137, 114,
- 70, 113, 111, 73, 193, 180, 181, 180, 78, 116,
- 394, 118, 69, 193, 105, 85, 400, 74, 105, 78,
- 111, 306, 105, 221, 111, 78, 83, 105, 111, 237,
- 100, 220, 111, 111, 111, 114, 105, 114, 108, 105,
- 220, 180, 181, 241, 105, 111, 111, 76, 118, 114,
- 111, 106, 122, 76, 85, 86, 108, 265, 128, 9,
- 253, 254, 255, 256, 108, 135, 76, 137, 276, 108,
- 355, 134, 280, 358, 76, 106, 267, 134, 351, 110,
- 4, 5, 6, 40, 41, 42, 119, 120, 121, 113,
- 40, 41, 267, 43, 44, 76, 381, 40, 41, 297,
- 298, 51, 52, 53, 83, 84, 89, 90, 306, 105,
- 180, 181, 112, 302, 79, 80, 111, 112, 403, 104,
- 309, 126, 302, 249, 250, 124, 76, 9, 267, 309,
- 104, 131, 251, 252, 257, 258, 125, 91, 93, 107,
- 210, 114, 350, 114, 104, 145, 146, 94, 95, 96,
- 97, 98, 99, 100, 101, 102, 103, 355, 40, 41,
- 358, 43, 44, 371, 164, 104, 113, 365, 114, 51,
- 52, 53, 104, 362, 112, 350, 104, 104, 386, 109,
- 106, 106, 362, 381, 113, 107, 343, 105, 108, 112,
- 107, 399, 113, 193, 113, 107, 371, 267, 111, 104,
- 56, 107, 113, 107, 104, 403, 76, 105, 109, 105,
- 107, 114, 17, 108, 113, 285, 238, 259, 261, 260,
- 220, 114, 114, 263, 262, 94, 128, 264, 101, 5,
- 310, 184, 226, 400, 128, 345, 392, 376, 285, 345,
- 78, 371, -1, -1, -1, -1, 246, 247, 248, 249,
- 250, 251, 252, 253, 254, 255, 256, 257, 258, 259,
- 260, 261, 262, 263, 264, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 344, 345, -1, -1, -1, -1,
- 350, 351, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 371, 302, -1, -1, -1, 376, -1, -1, 309,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 394, -1, -1, -1, -1, -1,
- 400, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 362, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, -1, -1,
- 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
- -1, -1, -1, 108, 109, -1, -1, -1, -1, 114,
- 115, 116, 117, 118, 3, 4, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, -1, 18,
- 19, 20, 21, 22, 23, 24, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, 40, 41, -1, 43, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, -1, 72, 73, 74, 75, 76, 77, 78,
- 79, 80, 81, 82, -1, -1, 85, 86, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 104, -1, -1, -1, 108,
- 109, -1, -1, -1, -1, 114, 115, 116, 117, 118,
- 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, -1, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, -1,
- 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
- 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
- -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 104, -1, -1, -1, 108, -1, -1, -1, -1,
- -1, 114, 115, 116, 117, 118, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- -1, 18, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, 75, 76,
- 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 104, -1, -1,
- -1, 108, -1, -1, -1, -1, -1, 114, 115, 116,
- 117, 118, 3, 4, 5, 6, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, -1, 18, 19, 20,
- 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
- 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
- 41, -1, 43, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 59, 60,
- 61, 62, 63, 64, 65, 66, 67, 68, 69, 70,
- -1, 72, 73, 74, 75, 76, 77, 78, 79, 80,
- 81, 82, -1, -1, 85, 86, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 104, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 114, 115, 116, 117, 118, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, 40, 41, -1, 43, 44,
- 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, -1, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
- 75, 76, 77, 78, 79, 80, 81, 82, -1, -1,
- 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, 3, 4, 5, 6, 104,
- 8, 9, 10, 11, 12, 13, -1, -1, -1, 114,
- 115, 116, 117, 118, -1, -1, -1, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 37,
- 38, 39, 40, 41, -1, 43, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, -1, 57,
- 58, 59, 60, 61, 62, 63, 64, 65, 66, 67,
- 68, 69, 70, -1, 72, 73, 74, 75, 76, 77,
- 78, 79, 80, 81, 82, -1, -1, 85, 86, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 4, 5, 6, -1, -1, 104, 10, 11, 12,
- 13, -1, -1, -1, -1, -1, -1, 115, 116, 117,
- 118, -1, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
- -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
- -1, 54, 55, -1, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
- 73, 74, -1, 76, 77, -1, -1, 10, 11, 12,
- 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
- -1, 114, 45, 46, 47, 48, 49, 50, -1, -1,
- -1, 54, 55, -1, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
- 73, 74, -1, 76, 77, 78, 79, 80, 81, 82,
- -1, -1, 85, 86, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 104, -1, -1, 107, 10, 11, 12, 13, -1,
- -1, -1, 115, 116, 117, 118, -1, -1, -1, -1,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
- 45, 46, 47, 48, 49, 50, -1, -1, -1, 54,
- 55, -1, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
- -1, 76, 77, 78, 79, 80, 81, 82, -1, -1,
- 85, 86, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, 104,
- -1, -1, 107, 10, 11, 12, 13, -1, -1, -1,
- 115, 116, 117, 118, -1, -1, -1, -1, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
- 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, -1, 76,
- 77, 78, 79, 80, 81, 82, -1, -1, 85, 86,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 104, 10, 11,
- 12, 13, -1, -1, -1, -1, -1, 114, 115, 116,
- 117, 118, -1, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, -1, -1,
- -1, -1, -1, 45, 46, 47, 48, 49, 50, -1,
- -1, -1, 54, 55, -1, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
- 72, 73, 74, -1, 76, 77, 78, 79, 80, 81,
- 82, -1, -1, 85, 86, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 104, -1, -1, 107, 10, 11, 12, 13,
- -1, -1, -1, 115, 116, 117, 118, -1, -1, -1,
- -1, 25, 26, 27, 28, 29, 30, 31, 32, 33,
- 34, 35, 36, 37, 38, 39, -1, -1, -1, -1,
- -1, 45, 46, 47, 48, 49, 50, -1, -1, -1,
- 54, 55, -1, 57, 58, 59, 60, 61, 62, 63,
- 64, 65, 66, 67, 68, 69, 70, -1, 72, 73,
- 74, -1, 76, 77, 78, 79, 80, 81, 82, -1,
- -1, 85, 86, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 104, 10, 11, 12, 13, -1, -1, -1, -1, -1,
- -1, 115, 116, 117, 118, -1, 25, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
- 39, -1, -1, -1, -1, -1, 45, 46, 47, 48,
- 49, 50, -1, -1, -1, 54, 55, -1, 57, 58,
- 59, 60, 61, 62, 63, 64, 65, 66, 67, 68,
- 69, 70, -1, 72, 73, 74, -1, 76, 77, 78,
- 79, 80, 81, 82, -1, -1, 85, 86, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 3, 4, 5, 6, 104, 8, 9, 10, 11,
- 12, 13, -1, -1, -1, -1, 115, 116, 117, 118,
- -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
- 72, 73, 74, 75, -1, 77, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, 3, 4, 5, 6,
- -1, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 109, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
- 77, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, 3, 4, 5, 6, -1, 8, 9, 10, 11,
- 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 109, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
- 72, 73, 74, 75, -1, 77, -1, -1, -1, -1,
- -1, -1, -1, 0, -1, -1, 3, 4, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 109, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
- 77, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 34, 35, 36, 37, 38, 39, 40, 41,
- -1, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, -1, 57, 58, 59, 60, 61,
- 62, 63, 64, 65, 66, 67, 68, 69, 70, -1,
- 72, 73, 74, 75, -1, 77, 3, 4, 5, 6,
- -1, 8, 9, 10, 11, 12, 13, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, 40, 41, -1, 43, 44, 45, 46,
- 47, 48, 49, 50, 51, 52, 53, 54, 55, -1,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, 75, -1,
- 77, 4, 5, 6, -1, -1, -1, 10, 11, 12,
- 13, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, -1, -1, -1,
- -1, -1, 45, 46, 47, 48, 49, 50, -1, -1,
- -1, 54, 55, -1, 57, 58, 59, 60, 61, 62,
- 63, 64, 65, 66, 67, 68, 69, 70, -1, 72,
- 73, 74, -1, -1, 77, 10, 11, 12, 13, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
- 35, 36, 37, 38, 39, -1, -1, -1, -1, -1,
- 45, 46, 47, 48, 49, 50, -1, -1, -1, 54,
- 55, -1, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, -1, 72, 73, 74,
- -1, 76, 77, 10, 11, 12, 13, 82, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- 37, 38, 39, -1, -1, -1, -1, -1, 45, 46,
- 47, 48, 49, 50, -1, -1, -1, 54, 55, -1,
- 57, 58, 59, 60, 61, 62, 63, 64, 65, 66,
- 67, 68, 69, 70, -1, 72, 73, 74, -1, -1,
- 77
-};
-
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- 12, 13, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, 37, 38, 39, 40, 41, 43,
- 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 57, 58, 59, 60, 61, 62, 63, 64,
- 65, 66, 67, 68, 69, 70, 72, 73, 74, 75,
- 77, 159, 160, 161, 162, 163, 168, 169, 170, 171,
- 173, 174, 175, 176, 177, 180, 181, 182, 217, 218,
- 219, 44, 76, 171, 174, 176, 40, 41, 76, 108,
- 104, 114, 220, 105, 111, 9, 40, 41, 42, 165,
- 166, 172, 111, 114, 76, 174, 76, 114, 158, 175,
- 180, 174, 106, 0, 218, 174, 180, 108, 184, 76,
- 178, 179, 108, 200, 165, 164, 167, 175, 166, 76,
- 104, 106, 113, 108, 3, 173, 175, 185, 186, 76,
- 78, 79, 80, 81, 82, 85, 86, 104, 107, 115,
- 116, 117, 118, 129, 130, 131, 133, 134, 135, 136,
- 137, 138, 139, 140, 141, 142, 143, 144, 145, 146,
- 147, 148, 149, 150, 151, 152, 153, 157, 180, 114,
- 183, 185, 113, 105, 111, 14, 15, 16, 18, 19,
- 20, 21, 22, 23, 24, 56, 108, 109, 114, 140,
- 153, 154, 156, 159, 160, 180, 190, 191, 192, 193,
- 201, 202, 203, 205, 207, 209, 216, 76, 164, 167,
- 106, 113, 107, 157, 154, 189, 175, 76, 187, 188,
- 109, 186, 140, 140, 156, 85, 86, 106, 110, 105,
- 105, 111, 55, 154, 104, 140, 119, 120, 121, 116,
- 118, 83, 84, 87, 88, 122, 123, 89, 90, 126,
- 125, 124, 91, 93, 92, 127, 107, 185, 109, 79,
- 80, 179, 114, 114, 211, 104, 104, 114, 114, 156,
- 104, 157, 112, 104, 109, 194, 94, 95, 96, 97,
- 98, 99, 100, 101, 102, 103, 113, 155, 111, 114,
- 109, 191, 106, 107, 157, 189, 113, 107, 187, 106,
- 111, 114, 76, 114, 105, 132, 156, 76, 82, 135,
- 154, 140, 140, 140, 142, 142, 143, 143, 144, 144,
- 144, 144, 145, 145, 146, 147, 148, 149, 150, 151,
- 156, 109, 197, 198, 199, 212, 156, 114, 156, 112,
- 210, 201, 154, 154, 157, 113, 107, 189, 113, 114,
- 157, 188, 106, 114, 107, 112, 56, 200, 192, 190,
- 202, 213, 105, 105, 156, 170, 173, 208, 195, 107,
- 189, 113, 189, 107, 157, 154, 104, 208, 214, 215,
- 197, 204, 206, 76, 105, 109, 189, 107, 156, 114,
- 105, 17, 193, 113, 192, 196, 200, 114, 105, 156,
- 196, 197, 189, 114
-};
-
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 128, 129, 130, 130, 130, 130, 130, 130, 131,
- 131, 131, 131, 131, 131, 132, 133, 134, 134, 135,
- 135, 136, 136, 137, 137, 138, 139, 139, 139, 140,
- 140, 140, 140, 141, 141, 141, 141, 142, 142, 142,
- 142, 143, 143, 143, 144, 144, 144, 145, 145, 145,
- 145, 145, 146, 146, 146, 147, 147, 148, 148, 149,
- 149, 150, 150, 151, 151, 152, 152, 153, 153, 154,
- 154, 155, 155, 155, 155, 155, 155, 155, 155, 155,
- 155, 155, 156, 156, 157, 158, 159, 159, 159, 159,
- 159, 159, 159, 160, 161, 161, 162, 162, 163, 164,
- 164, 165, 165, 165, 165, 166, 166, 166, 166, 167,
- 168, 168, 168, 168, 168, 168, 169, 169, 169, 169,
- 169, 169, 169, 170, 170, 171, 171, 172, 173, 173,
- 173, 173, 173, 173, 173, 173, 173, 173, 174, 174,
- 174, 174, 174, 174, 175, 175, 176, 176, 176, 177,
- 178, 178, 179, 179, 179, 180, 180, 180, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 181, 181, 181, 181, 181, 181, 181,
- 181, 181, 181, 183, 182, 184, 182, 185, 185, 186,
- 186, 187, 187, 188, 188, 189, 190, 191, 191, 192,
- 192, 192, 192, 192, 192, 192, 193, 194, 195, 193,
- 196, 196, 198, 197, 199, 197, 200, 200, 201, 201,
- 202, 202, 203, 204, 204, 206, 205, 207, 207, 208,
- 208, 210, 209, 211, 209, 212, 209, 213, 213, 214,
- 214, 215, 215, 216, 216, 216, 216, 216, 217, 217,
- 218, 218, 220, 219
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 1, 1, 1, 1, 1, 3, 1,
- 4, 1, 3, 2, 2, 1, 1, 1, 3, 2,
- 2, 2, 1, 2, 3, 2, 1, 1, 1, 1,
- 2, 2, 2, 1, 1, 1, 1, 1, 3, 3,
- 3, 1, 3, 3, 1, 3, 3, 1, 3, 3,
- 3, 3, 1, 3, 3, 1, 3, 1, 3, 1,
- 3, 1, 3, 1, 3, 1, 3, 1, 5, 1,
- 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 3, 1, 2, 2, 2, 4, 5,
- 6, 9, 2, 2, 1, 1, 2, 3, 3, 2,
- 5, 3, 2, 3, 2, 0, 1, 1, 1, 1,
- 1, 3, 6, 7, 8, 5, 1, 2, 5, 6,
- 7, 4, 2, 1, 2, 1, 1, 1, 1, 1,
- 2, 1, 2, 1, 1, 2, 2, 3, 1, 1,
- 1, 2, 2, 1, 1, 2, 1, 1, 1, 4,
- 1, 3, 1, 3, 3, 1, 3, 4, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 6, 0, 5, 1, 2, 3,
- 4, 1, 3, 1, 4, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 2, 0, 0, 5,
- 1, 1, 0, 2, 0, 2, 2, 3, 1, 2,
- 1, 2, 5, 3, 1, 0, 6, 3, 2, 1,
- 4, 0, 6, 0, 8, 0, 7, 1, 1, 1,
- 0, 2, 3, 2, 2, 2, 3, 2, 1, 2,
- 1, 1, 0, 3
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (&yylloc, context, yyscanner, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
-
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
- If N is 0, then set CURRENT to the empty location which ends
- the previous symbol: RHS[0] (always defined). */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- do \
- if (N) \
- { \
- (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
- (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
- (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
- (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
- } \
- else \
- { \
- (Current).first_line = (Current).last_line = \
- YYRHSLOC (Rhs, 0).last_line; \
- (Current).first_column = (Current).last_column = \
- YYRHSLOC (Rhs, 0).last_column; \
- } \
- while (0)
-#endif
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
- This macro was not mandated originally: define only if we know
- we won't break user code: when these are the locations we know. */
-
-#ifndef YY_LOCATION_PRINT
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
-
-/* Print *YYLOCP on YYO. Private, do not rely on its existence. */
-
-YY_ATTRIBUTE_UNUSED
-static unsigned
-yy_location_print_ (FILE *yyo, YYLTYPE const * const yylocp)
-{
- unsigned res = 0;
- int end_col = 0 != yylocp->last_column ? yylocp->last_column - 1 : 0;
- if (0 <= yylocp->first_line)
- {
- res += YYFPRINTF (yyo, "%d", yylocp->first_line);
- if (0 <= yylocp->first_column)
- res += YYFPRINTF (yyo, ".%d", yylocp->first_column);
- }
- if (0 <= yylocp->last_line)
- {
- if (yylocp->first_line < yylocp->last_line)
- {
- res += YYFPRINTF (yyo, "-%d", yylocp->last_line);
- if (0 <= end_col)
- res += YYFPRINTF (yyo, ".%d", end_col);
- }
- else if (0 <= end_col && yylocp->first_column < end_col)
- res += YYFPRINTF (yyo, "-%d", end_col);
- }
- return res;
- }
-
-# define YY_LOCATION_PRINT(File, Loc) \
- yy_location_print_ (File, &(Loc))
-
-# else
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, Location, context, yyscanner); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void* yyscanner)
-{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- YYUSE (yylocationp);
- YYUSE (context);
- YYUSE (yyscanner);
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, YYLTYPE const * const yylocationp, TParseContext* context, void* yyscanner)
-{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
- YY_LOCATION_PRINT (yyoutput, *yylocationp);
- YYFPRINTF (yyoutput, ": ");
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, yylocationp, context, yyscanner);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, YYLTYPE *yylsp, int yyrule, TParseContext* context, void* yyscanner)
-{
- unsigned long int yylno = yyrline[yyrule];
- int yynrhs = yyr2[yyrule];
- int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , &(yylsp[(yyi + 1) - (yynrhs)]) , context, yyscanner);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, yylsp, Rule, context, yyscanner); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, YYLTYPE *yylocationp, TParseContext* context, void* yyscanner)
-{
- YYUSE (yyvaluep);
- YYUSE (yylocationp);
- YYUSE (context);
- YYUSE (yyscanner);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-int
-yyparse (TParseContext* context, void* yyscanner)
-{
-/* The lookahead symbol. */
-int yychar;
-
-
-/* The semantic value of the lookahead symbol. */
-/* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
-
-/* Location data for the lookahead symbol. */
-static YYLTYPE yyloc_default
-# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
- = { 1, 1, 1, 1 }
-# endif
-;
-YYLTYPE yylloc = yyloc_default;
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
- 'yyls': related to locations.
-
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls;
- YYLTYPE *yylsp;
-
- /* The locations where the error started and ended. */
- YYLTYPE yyerror_range[3];
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
- YYLTYPE yyloc;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N), yylsp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yylsp = yyls = yylsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- yylsp[0] = yylloc;
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
- YYLTYPE *yyls1 = yyls;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &yystacksize);
-
- yyls = yyls1;
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
- YYSTACK_RELOCATE (yyls_alloc, yyls);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
- yylsp = yyls + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex (&yylval, &yylloc, yyscanner);
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
- *++yylsp = yylloc;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
- /* Default location. */
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-
- {
- // The symbol table search was done in the lexical phase
- const TVariable *variable = context->getNamedVariable((yylsp[0]), (yyvsp[0].lex).string, (yyvsp[0].lex).symbol);
-
- // don't delete $1.string, it's used by error recovery, and the pool
- // pop will reclaim the memory
-
- // Constants which aren't indexable arrays can be propagated by value.
- ConstantUnion *constArray = variable->getConstPointer();
- if (constArray && variable->getType().getArraySize() <= 1) {
- TType t(variable->getType());
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(constArray, t, (yylsp[0]));
- } else
- (yyval.interm.intermTypedNode) = context->intermediate.addSymbol(variable->getUniqueId(),
- variable->getName(),
- variable->getType(), (yylsp[0]));
- }
-
- break;
-
- case 3:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 4:
-
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setIConst((yyvsp[0].lex).i);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtInt, EbpUndefined, EvqConstExpr), (yylsp[0]));
- }
-
- break;
-
- case 5:
-
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setUConst((yyvsp[0].lex).u);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtUInt, EbpUndefined, EvqConstExpr), (yylsp[0]));
- }
-
- break;
-
- case 6:
-
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setFConst((yyvsp[0].lex).f);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtFloat, EbpUndefined, EvqConstExpr), (yylsp[0]));
- }
-
- break;
-
- case 7:
-
- {
- ConstantUnion *unionArray = new ConstantUnion[1];
- unionArray->setBConst((yyvsp[0].lex).b);
- (yyval.interm.intermTypedNode) = context->intermediate.addConstantUnion(unionArray, TType(EbtBool, EbpUndefined, EvqConstExpr), (yylsp[0]));
- }
-
- break;
-
- case 8:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[-1].interm.intermTypedNode);
- }
-
- break;
-
- case 9:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 10:
-
- {
- (yyval.interm.intermTypedNode) = context->addIndexExpression((yyvsp[-3].interm.intermTypedNode), (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
- }
-
- break;
-
- case 11:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 12:
-
- {
- (yyval.interm.intermTypedNode) = context->addFieldSelectionExpression((yyvsp[-2].interm.intermTypedNode), (yylsp[-1]), *(yyvsp[0].lex).string, (yylsp[0]));
- }
-
- break;
-
- case 13:
-
- {
- (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPostIncrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
- }
-
- break;
-
- case 14:
-
- {
- (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPostDecrement, (yyvsp[-1].interm.intermTypedNode), (yylsp[0]));
- }
-
- break;
-
- case 15:
-
- {
- if (context->integerErrorCheck((yyvsp[0].interm.intermTypedNode), "[]"))
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 16:
-
- {
- bool fatalError = false;
- (yyval.interm.intermTypedNode) = context->addFunctionCallOrMethod((yyvsp[0].interm).function, (yyvsp[0].interm).nodePair.node1, (yyvsp[0].interm).nodePair.node2, (yylsp[0]), &fatalError);
- if (fatalError)
- {
- YYERROR;
- }
- }
-
- break;
-
- case 17:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- (yyval.interm).nodePair.node2 = nullptr;
- }
-
- break;
-
- case 18:
-
- {
- ES3_ONLY("", (yylsp[0]), "methods");
- (yyval.interm) = (yyvsp[0].interm);
- (yyval.interm).nodePair.node2 = (yyvsp[-2].interm.intermTypedNode);
- }
-
- break;
-
- case 19:
-
- {
- (yyval.interm) = (yyvsp[-1].interm);
- }
-
- break;
-
- case 20:
-
- {
- (yyval.interm) = (yyvsp[-1].interm);
- }
-
- break;
-
- case 21:
-
- {
- (yyval.interm).function = (yyvsp[-1].interm.function);
- (yyval.interm).nodePair.node1 = nullptr;
- }
-
- break;
-
- case 22:
-
- {
- (yyval.interm).function = (yyvsp[0].interm.function);
- (yyval.interm).nodePair.node1 = nullptr;
- }
-
- break;
-
- case 23:
-
- {
- TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)->getType()) };
- (yyvsp[-1].interm.function)->addParameter(param);
- (yyval.interm).function = (yyvsp[-1].interm.function);
- (yyval.interm).nodePair.node1 = context->intermediate.makeAggregate((yyvsp[0].interm.intermTypedNode), (yylsp[0]));
- }
-
- break;
-
- case 24:
-
- {
- TParameter param = { 0, new TType((yyvsp[0].interm.intermTypedNode)->getType()) };
- (yyvsp[-2].interm).function->addParameter(param);
- (yyval.interm).function = (yyvsp[-2].interm).function;
- (yyval.interm).nodePair.node1 = context->intermediate.growAggregate((yyvsp[-2].interm).intermNode, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 25:
-
- {
- (yyval.interm.function) = (yyvsp[-1].interm.function);
- }
-
- break;
-
- case 26:
-
- {
- if ((yyvsp[0].interm.type).array) {
- ES3_ONLY("[]", (yylsp[0]), "array constructor");
- }
- (yyval.interm.function) = context->addConstructorFunc((yyvsp[0].interm.type));
- }
-
- break;
-
- case 27:
-
- {
- if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
- context->recover();
- TType type(EbtVoid, EbpUndefined);
- TFunction *function = new TFunction((yyvsp[0].lex).string, type);
- (yyval.interm.function) = function;
- }
-
- break;
-
- case 28:
-
- {
- if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
- context->recover();
- TType type(EbtVoid, EbpUndefined);
- TFunction *function = new TFunction((yyvsp[0].lex).string, type);
- (yyval.interm.function) = function;
- }
-
- break;
-
- case 29:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 30:
-
- {
- (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPreIncrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 31:
-
- {
- (yyval.interm.intermTypedNode) = context->addUnaryMathLValue(EOpPreDecrement, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 32:
-
- {
- if ((yyvsp[-1].interm).op != EOpNull) {
- (yyval.interm.intermTypedNode) = context->addUnaryMath((yyvsp[-1].interm).op, (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- } else
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 33:
-
- { (yyval.interm).op = EOpNull; }
-
- break;
-
- case 34:
-
- { (yyval.interm).op = EOpNegative; }
-
- break;
-
- case 35:
-
- { (yyval.interm).op = EOpLogicalNot; }
-
- break;
-
- case 36:
-
- {
- ES3_ONLY("~", (yylsp[0]), "bit-wise operator");
- (yyval.interm).op = EOpBitwiseNot;
- }
-
- break;
-
- case 37:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 38:
-
- {
- FRAG_VERT_ONLY("*", (yylsp[-1]));
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpMul, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 39:
-
- {
- FRAG_VERT_ONLY("/", (yylsp[-1]));
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpDiv, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 40:
-
- {
- FRAG_VERT_ONLY("%", (yylsp[-1]));
- ES3_ONLY("%", (yylsp[-1]), "integer modulus operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpIMod, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 41:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 42:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpAdd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 43:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpSub, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 44:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 45:
-
- {
- ES3_ONLY("<<", (yylsp[-1]), "bit-wise operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftLeft, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 46:
-
- {
- ES3_ONLY(">>", (yylsp[-1]), "bit-wise operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitShiftRight, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 47:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 48:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLessThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 49:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpGreaterThan, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 50:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLessThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 51:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpGreaterThanEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 52:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 53:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 54:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpNotEqual, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 55:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 56:
-
- {
- ES3_ONLY("&", (yylsp[-1]), "bit-wise operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 57:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 58:
-
- {
- ES3_ONLY("^", (yylsp[-1]), "bit-wise operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 59:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 60:
-
- {
- ES3_ONLY("|", (yylsp[-1]), "bit-wise operator");
- (yyval.interm.intermTypedNode) = context->addBinaryMath(EOpBitwiseOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 61:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 62:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalAnd, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 63:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 64:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalXor, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 65:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 66:
-
- {
- (yyval.interm.intermTypedNode) = context->addBinaryMathBooleanResult(EOpLogicalOr, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 67:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 68:
-
- {
- (yyval.interm.intermTypedNode) = context->addTernarySelection((yyvsp[-4].interm.intermTypedNode), (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-3]));
- }
-
- break;
-
- case 69:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 70:
-
- {
- if (context->lValueErrorCheck((yylsp[-1]), "assign", (yyvsp[-2].interm.intermTypedNode)))
- context->recover();
- (yyval.interm.intermTypedNode) = context->addAssign((yyvsp[-1].interm).op, (yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- }
-
- break;
-
- case 71:
-
- { (yyval.interm).op = EOpAssign; }
-
- break;
-
- case 72:
-
- { FRAG_VERT_ONLY("*=", (yylsp[0])); (yyval.interm).op = EOpMulAssign; }
-
- break;
-
- case 73:
-
- { FRAG_VERT_ONLY("/=", (yylsp[0])); (yyval.interm).op = EOpDivAssign; }
-
- break;
-
- case 74:
-
- { ES3_ONLY("%=", (yylsp[0]), "integer modulus operator");
- FRAG_VERT_ONLY("%=", (yylsp[0])); (yyval.interm).op = EOpIModAssign; }
-
- break;
-
- case 75:
-
- { (yyval.interm).op = EOpAddAssign; }
-
- break;
-
- case 76:
-
- { (yyval.interm).op = EOpSubAssign; }
-
- break;
-
- case 77:
-
- { ES3_ONLY("<<=", (yylsp[0]), "bit-wise operator");
- FRAG_VERT_ONLY("<<=", (yylsp[0]));
- (yyval.interm).op = EOpBitShiftLeftAssign; }
-
- break;
-
- case 78:
-
- { ES3_ONLY(">>=", (yylsp[0]), "bit-wise operator");
- FRAG_VERT_ONLY(">>=", (yylsp[0]));
- (yyval.interm).op = EOpBitShiftRightAssign; }
-
- break;
-
- case 79:
-
- { ES3_ONLY("&=", (yylsp[0]), "bit-wise operator");
- FRAG_VERT_ONLY("&=", (yylsp[0]));
- (yyval.interm).op = EOpBitwiseAndAssign; }
-
- break;
-
- case 80:
-
- { ES3_ONLY("^=", (yylsp[0]), "bit-wise operator");
- FRAG_VERT_ONLY("^=", (yylsp[0]));
- (yyval.interm).op = EOpBitwiseXorAssign; }
-
- break;
-
- case 81:
-
- { ES3_ONLY("|=", (yylsp[0]), "bit-wise operator");
- FRAG_VERT_ONLY("|=", (yylsp[0]));
- (yyval.interm).op = EOpBitwiseOrAssign; }
-
- break;
-
- case 82:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 83:
-
- {
- (yyval.interm.intermTypedNode) = context->intermediate.addComma((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.intermTypedNode), (yylsp[-1]));
- if ((yyval.interm.intermTypedNode) == 0) {
- context->binaryOpError((yylsp[-1]), ",", (yyvsp[-2].interm.intermTypedNode)->getCompleteString(), (yyvsp[0].interm.intermTypedNode)->getCompleteString());
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
- }
-
- break;
-
- case 84:
-
- {
- if (context->constErrorCheck((yyvsp[0].interm.intermTypedNode)))
- context->recover();
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 85:
-
- {
- if (context->enterStructDeclaration((yylsp[-1]), *(yyvsp[-1].lex).string))
- context->recover();
- (yyval.lex) = (yyvsp[-1].lex);
- }
-
- break;
-
- case 86:
-
- {
- (yyval.interm.intermNode) = context->addFunctionPrototypeDeclaration(*((yyvsp[-1].interm).function), (yylsp[-1]));
- }
-
- break;
-
- case 87:
-
- {
- TIntermAggregate *aggNode = (yyvsp[-1].interm).intermAggregate;
- if (aggNode && aggNode->getOp() == EOpNull)
- aggNode->setOp(EOpDeclaration);
- (yyval.interm.intermNode) = aggNode;
- }
-
- break;
-
- case 88:
-
- {
- if (!context->symbolTable.setDefaultPrecision( (yyvsp[-1].interm.type), (yyvsp[-2].interm.precision) )) {
- context->error((yylsp[-3]), "illegal type argument for default precision qualifier", getBasicString((yyvsp[-1].interm.type).type));
- context->recover();
- }
- (yyval.interm.intermNode) = 0;
- }
-
- break;
-
- case 89:
-
- {
- ES3_ONLY(getQualifierString((yyvsp[-4].interm.type).qualifier), (yylsp[-4]), "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[-4].interm.type), (yylsp[-3]), *(yyvsp[-3].lex).string, (yyvsp[-2].interm.fieldList), NULL, (yylsp[-4]), NULL, (yylsp[-4]));
- }
-
- break;
-
- case 90:
-
- {
- ES3_ONLY(getQualifierString((yyvsp[-5].interm.type).qualifier), (yylsp[-5]), "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[-5].interm.type), (yylsp[-4]), *(yyvsp[-4].lex).string, (yyvsp[-3].interm.fieldList), (yyvsp[-1].lex).string, (yylsp[-1]), NULL, (yylsp[-5]));
- }
-
- break;
-
- case 91:
-
- {
- ES3_ONLY(getQualifierString((yyvsp[-8].interm.type).qualifier), (yylsp[-8]), "interface blocks");
- (yyval.interm.intermNode) = context->addInterfaceBlock((yyvsp[-8].interm.type), (yylsp[-7]), *(yyvsp[-7].lex).string, (yyvsp[-6].interm.fieldList), (yyvsp[-4].lex).string, (yylsp[-4]), (yyvsp[-2].interm.intermTypedNode), (yylsp[-3]));
- }
-
- break;
-
- case 92:
-
- {
- context->parseGlobalLayoutQualifier((yyvsp[-1].interm.type));
- (yyval.interm.intermNode) = 0;
- }
-
- break;
-
- case 93:
-
- {
- (yyval.interm).function = context->parseFunctionDeclarator((yylsp[0]), (yyvsp[-1].interm.function));
- }
-
- break;
-
- case 94:
-
- {
- (yyval.interm.function) = (yyvsp[0].interm.function);
- }
-
- break;
-
- case 95:
-
- {
- (yyval.interm.function) = (yyvsp[0].interm.function);
- }
-
- break;
-
- case 96:
-
- {
- // Add the parameter
- (yyval.interm.function) = (yyvsp[-1].interm.function);
- if ((yyvsp[0].interm).param.type->getBasicType() != EbtVoid)
- (yyvsp[-1].interm.function)->addParameter((yyvsp[0].interm).param);
- else
- delete (yyvsp[0].interm).param.type;
- }
-
- break;
-
- case 97:
-
- {
- //
- // Only first parameter of one-parameter functions can be void
- // The check for named parameters not being void is done in parameter_declarator
- //
- if ((yyvsp[0].interm).param.type->getBasicType() == EbtVoid) {
- //
- // This parameter > first is void
- //
- context->error((yylsp[-1]), "cannot be an argument type except for '(void)'", "void");
- context->recover();
- delete (yyvsp[0].interm).param.type;
- } else {
- // Add the parameter
- (yyval.interm.function) = (yyvsp[-2].interm.function);
- (yyvsp[-2].interm.function)->addParameter((yyvsp[0].interm).param);
- }
- }
-
- break;
-
- case 98:
-
- {
- if ((yyvsp[-2].interm.type).qualifier != EvqGlobal && (yyvsp[-2].interm.type).qualifier != EvqTemporary) {
- context->error((yylsp[-1]), "no qualifiers allowed for function return", getQualifierString((yyvsp[-2].interm.type).qualifier));
- context->recover();
- }
- if (!(yyvsp[-2].interm.type).layoutQualifier.isEmpty())
- {
- context->error((yylsp[-1]), "no qualifiers allowed for function return", "layout");
- context->recover();
- }
- // make sure a sampler is not involved as well...
- if (context->samplerErrorCheck((yylsp[-1]), (yyvsp[-2].interm.type), "samplers can't be function return values"))
- context->recover();
-
- // Add the function as a prototype after parsing it (we do not support recursion)
- TFunction *function;
- TType type((yyvsp[-2].interm.type));
- function = new TFunction((yyvsp[-1].lex).string, type);
- (yyval.interm.function) = function;
-
- context->symbolTable.push();
- }
-
- break;
-
- case 99:
-
- {
- if ((yyvsp[-1].interm.type).type == EbtVoid) {
- context->error((yylsp[0]), "illegal use of type 'void'", (yyvsp[0].lex).string->c_str());
- context->recover();
- }
- if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
- context->recover();
- TParameter param = {(yyvsp[0].lex).string, new TType((yyvsp[-1].interm.type))};
- (yyval.interm).param = param;
- }
-
- break;
-
- case 100:
-
- {
- // Check that we can make an array out of this type
- if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-4].interm.type)))
- context->recover();
-
- if (context->reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
- context->recover();
-
- int size = 0;
- if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
- context->recover();
- (yyvsp[-4].interm.type).setArray(true, size);
-
- TType* type = new TType((yyvsp[-4].interm.type));
- TParameter param = { (yyvsp[-3].lex).string, type };
- (yyval.interm).param = param;
- }
-
- break;
-
- case 101:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- if (context->paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.qualifier), (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
- context->recover();
- }
-
- break;
-
- case 102:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- if (context->parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
- context->recover();
- if (context->paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
- context->recover();
- }
-
- break;
-
- case 103:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- if (context->paramErrorCheck((yylsp[0]), (yyvsp[-2].interm.qualifier), (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
- context->recover();
- }
-
- break;
-
- case 104:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- if (context->parameterSamplerErrorCheck((yylsp[0]), (yyvsp[-1].interm.qualifier), *(yyvsp[0].interm).param.type))
- context->recover();
- if (context->paramErrorCheck((yylsp[0]), EvqTemporary, (yyvsp[-1].interm.qualifier), (yyval.interm).param.type))
- context->recover();
- }
-
- break;
-
- case 105:
-
- {
- (yyval.interm.qualifier) = EvqIn;
- }
-
- break;
-
- case 106:
-
- {
- (yyval.interm.qualifier) = EvqIn;
- }
-
- break;
-
- case 107:
-
- {
- (yyval.interm.qualifier) = EvqOut;
- }
-
- break;
-
- case 108:
-
- {
- (yyval.interm.qualifier) = EvqInOut;
- }
-
- break;
-
- case 109:
-
- {
- TParameter param = { 0, new TType((yyvsp[0].interm.type)) };
- (yyval.interm).param = param;
- }
-
- break;
-
- case 110:
-
- {
- (yyval.interm) = (yyvsp[0].interm);
- }
-
- break;
-
- case 111:
-
- {
- (yyval.interm) = (yyvsp[-2].interm);
- (yyval.interm).intermAggregate = context->parseDeclarator((yyval.interm).type, (yyvsp[-2].interm).intermAggregate, (yylsp[0]), *(yyvsp[0].lex).string);
- }
-
- break;
-
- case 112:
-
- {
- (yyval.interm) = (yyvsp[-5].interm);
- (yyval.interm).intermAggregate = context->parseArrayDeclarator((yyval.interm).type, (yyvsp[-5].interm).intermAggregate, (yylsp[-3]), *(yyvsp[-3].lex).string, (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
- }
-
- break;
-
- case 113:
-
- {
- ES3_ONLY("[]", (yylsp[-4]), "implicitly sized array");
- (yyval.interm) = (yyvsp[-6].interm);
- (yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[-6].interm).intermAggregate, (yylsp[-4]), *(yyvsp[-4].lex).string, (yylsp[-3]), nullptr, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 114:
-
- {
- ES3_ONLY("=", (yylsp[-1]), "first-class arrays (array initializer)");
- (yyval.interm) = (yyvsp[-7].interm);
- (yyval.interm).intermAggregate = context->parseArrayInitDeclarator((yyval.interm).type, (yyvsp[-7].interm).intermAggregate, (yylsp[-5]), *(yyvsp[-5].lex).string, (yylsp[-4]), (yyvsp[-3].interm.intermTypedNode), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 115:
-
- {
- (yyval.interm) = (yyvsp[-4].interm);
- (yyval.interm).intermAggregate = context->parseInitDeclarator((yyval.interm).type, (yyvsp[-4].interm).intermAggregate, (yylsp[-2]), *(yyvsp[-2].lex).string, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 116:
-
- {
- (yyval.interm).type = (yyvsp[0].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), "");
- }
-
- break;
-
- case 117:
-
- {
- (yyval.interm).type = (yyvsp[-1].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleDeclaration((yyval.interm).type, (yylsp[0]), *(yyvsp[0].lex).string);
- }
-
- break;
-
- case 118:
-
- {
- (yyval.interm).type = (yyvsp[-4].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleArrayDeclaration((yyval.interm).type, (yylsp[-3]), *(yyvsp[-3].lex).string, (yylsp[-2]), (yyvsp[-1].interm.intermTypedNode));
- }
-
- break;
-
- case 119:
-
- {
- ES3_ONLY("[]", (yylsp[-3]), "implicitly sized array");
- (yyval.interm).type = (yyvsp[-5].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[-4]), *(yyvsp[-4].lex).string, (yylsp[-3]), nullptr, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 120:
-
- {
- ES3_ONLY("=", (yylsp[-1]), "first-class arrays (array initializer)");
- (yyval.interm).type = (yyvsp[-6].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleArrayInitDeclaration((yyval.interm).type, (yylsp[-5]), *(yyvsp[-5].lex).string, (yylsp[-4]), (yyvsp[-3].interm.intermTypedNode), (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 121:
-
- {
- (yyval.interm).type = (yyvsp[-3].interm.type);
- (yyval.interm).intermAggregate = context->parseSingleInitDeclaration((yyval.interm).type, (yylsp[-2]), *(yyvsp[-2].lex).string, (yylsp[-1]), (yyvsp[0].interm.intermTypedNode));
- }
-
- break;
-
- case 122:
-
- {
- // $$.type is not used in invariant declarations.
- (yyval.interm).intermAggregate = context->parseInvariantDeclaration((yylsp[-1]), (yylsp[0]), (yyvsp[0].lex).string, (yyvsp[0].lex).symbol);
- }
-
- break;
-
- case 123:
-
- {
- (yyval.interm.type) = (yyvsp[0].interm.type);
-
- if ((yyvsp[0].interm.type).array) {
- ES3_ONLY("[]", (yylsp[0]), "first-class-array");
- if (context->getShaderVersion() != 300) {
- (yyvsp[0].interm.type).clearArrayness();
- }
- }
- }
-
- break;
-
- case 124:
-
- {
- (yyval.interm.type) = context->addFullySpecifiedType((yyvsp[-1].interm.type).qualifier, (yyvsp[-1].interm.type).invariant, (yyvsp[-1].interm.type).layoutQualifier, (yyvsp[0].interm.type));
- }
-
- break;
-
- case 125:
-
- {
- (yyval.interm.type).qualifier = EvqSmooth;
- }
-
- break;
-
- case 126:
-
- {
- (yyval.interm.type).qualifier = EvqFlat;
- }
-
- break;
-
- case 127:
-
- {
- (yyval.interm.qualifier) = EvqConstReadOnly;
- }
-
- break;
-
- case 128:
-
- {
- VERTEX_ONLY("attribute", (yylsp[0]));
- ES2_ONLY("attribute", (yylsp[0]));
- if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "attribute"))
- context->recover();
- (yyval.interm.type).setBasic(EbtVoid, EvqAttribute, (yylsp[0]));
- }
-
- break;
-
- case 129:
-
- {
- ES2_ONLY("varying", (yylsp[0]));
- if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "varying"))
- context->recover();
- if (context->getShaderType() == GL_VERTEX_SHADER)
- (yyval.interm.type).setBasic(EbtVoid, EvqVaryingOut, (yylsp[0]));
- else
- (yyval.interm.type).setBasic(EbtVoid, EvqVaryingIn, (yylsp[0]));
- }
-
- break;
-
- case 130:
-
- {
- ES2_ONLY("varying", (yylsp[-1]));
- if (context->globalErrorCheck((yylsp[-1]), context->symbolTable.atGlobalLevel(), "invariant varying"))
- context->recover();
- if (context->getShaderType() == GL_VERTEX_SHADER)
- (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingOut, (yylsp[-1]));
- else
- (yyval.interm.type).setBasic(EbtVoid, EvqInvariantVaryingIn, (yylsp[-1]));
- }
-
- break;
-
- case 131:
-
- {
- if ((yyvsp[0].interm.type).qualifier != EvqConstExpr && !context->symbolTable.atGlobalLevel())
- {
- context->error((yylsp[0]), "Local variables can only use the const storage qualifier.", getQualifierString((yyvsp[0].interm.type).qualifier));
- context->recover();
- }
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[0].interm.type).qualifier, (yylsp[0]));
- }
-
- break;
-
- case 132:
-
- {
- (yyval.interm.type) = context->joinInterpolationQualifiers((yylsp[-1]), (yyvsp[-1].interm.type).qualifier, (yylsp[0]), (yyvsp[0].interm.type).qualifier);
- }
-
- break;
-
- case 133:
-
- {
- context->error((yylsp[0]), "interpolation qualifier requires a fragment 'in' or vertex 'out' storage qualifier", getQualifierString((yyvsp[0].interm.type).qualifier));
- context->recover();
-
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
- }
-
- break;
-
- case 134:
-
- {
- (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).layoutQualifier = (yyvsp[0].interm.layoutQualifier);
- }
-
- break;
-
- case 135:
-
- {
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[0].interm.type).qualifier, (yylsp[0]));
- (yyval.interm.type).layoutQualifier = (yyvsp[-1].interm.layoutQualifier);
- }
-
- break;
-
- case 136:
-
- {
- context->es3InvariantErrorCheck((yyvsp[0].interm.type).qualifier, (yylsp[-1]));
- (yyval.interm.type).setBasic(EbtVoid, (yyvsp[0].interm.type).qualifier, (yylsp[0]));
- (yyval.interm.type).invariant = true;
- }
-
- break;
-
- case 137:
-
- {
- context->es3InvariantErrorCheck((yyvsp[0].interm.type).qualifier, (yylsp[-2]));
- (yyval.interm.type) = context->joinInterpolationQualifiers((yylsp[-1]), (yyvsp[-1].interm.type).qualifier, (yylsp[0]), (yyvsp[0].interm.type).qualifier);
- (yyval.interm.type).invariant = true;
- }
-
- break;
-
- case 138:
-
- {
- (yyval.interm.type).qualifier = EvqConstExpr;
- }
-
- break;
-
- case 139:
-
- {
- ES3_ONLY("in", (yylsp[0]), "storage qualifier");
- (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentIn : EvqVertexIn;
- }
-
- break;
-
- case 140:
-
- {
- ES3_ONLY("out", (yylsp[0]), "storage qualifier");
- (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqVertexOut;
- }
-
- break;
-
- case 141:
-
- {
- ES3_ONLY("centroid in", (yylsp[-1]), "storage qualifier");
- if (context->getShaderType() == GL_VERTEX_SHADER)
- {
- context->error((yylsp[-1]), "invalid storage qualifier", "it is an error to use 'centroid in' in the vertex shader");
- context->recover();
- }
- (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqCentroidIn : EvqVertexIn;
- }
-
- break;
-
- case 142:
-
- {
- ES3_ONLY("centroid out", (yylsp[-1]), "storage qualifier");
- if (context->getShaderType() == GL_FRAGMENT_SHADER)
- {
- context->error((yylsp[-1]), "invalid storage qualifier", "it is an error to use 'centroid out' in the fragment shader");
- context->recover();
- }
- (yyval.interm.type).qualifier = (context->getShaderType() == GL_FRAGMENT_SHADER) ? EvqFragmentOut : EvqCentroidOut;
- }
-
- break;
-
- case 143:
-
- {
- if (context->globalErrorCheck((yylsp[0]), context->symbolTable.atGlobalLevel(), "uniform"))
- context->recover();
- (yyval.interm.type).qualifier = EvqUniform;
- }
-
- break;
-
- case 144:
-
- {
- (yyval.interm.type) = (yyvsp[0].interm.type);
-
- if ((yyval.interm.type).precision == EbpUndefined) {
- (yyval.interm.type).precision = context->symbolTable.getDefaultPrecision((yyvsp[0].interm.type).type);
- if (context->precisionErrorCheck((yylsp[0]), (yyval.interm.type).precision, (yyvsp[0].interm.type).type)) {
- context->recover();
- }
- }
- }
-
- break;
-
- case 145:
-
- {
- (yyval.interm.type) = (yyvsp[0].interm.type);
- (yyval.interm.type).precision = (yyvsp[-1].interm.precision);
-
- if (!SupportsPrecision((yyvsp[0].interm.type).type)) {
- context->error((yylsp[-1]), "illegal type for precision qualifier", getBasicString((yyvsp[0].interm.type).type));
- context->recover();
- }
- }
-
- break;
-
- case 146:
-
- {
- (yyval.interm.precision) = EbpHigh;
- }
-
- break;
-
- case 147:
-
- {
- (yyval.interm.precision) = EbpMedium;
- }
-
- break;
-
- case 148:
-
- {
- (yyval.interm.precision) = EbpLow;
- }
-
- break;
-
- case 149:
-
- {
- ES3_ONLY("layout", (yylsp[-3]), "qualifier");
- (yyval.interm.layoutQualifier) = (yyvsp[-1].interm.layoutQualifier);
- }
-
- break;
-
- case 150:
-
- {
- (yyval.interm.layoutQualifier) = (yyvsp[0].interm.layoutQualifier);
- }
-
- break;
-
- case 151:
-
- {
- (yyval.interm.layoutQualifier) = context->joinLayoutQualifiers((yyvsp[-2].interm.layoutQualifier), (yyvsp[0].interm.layoutQualifier));
- }
-
- break;
-
- case 152:
-
- {
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[0].lex).string, (yylsp[0]));
- }
-
- break;
-
- case 153:
-
- {
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[-2].lex).string, (yylsp[-2]), (yyvsp[0].lex).i, (yylsp[0]));
- }
-
- break;
-
- case 154:
-
- {
- (yyval.interm.layoutQualifier) = context->parseLayoutQualifier(*(yyvsp[-2].lex).string, (yylsp[-2]), (yyvsp[0].lex).i, (yylsp[0]));
- }
-
- break;
-
- case 155:
-
- {
- (yyval.interm.type) = (yyvsp[0].interm.type);
- }
-
- break;
-
- case 156:
-
- {
- ES3_ONLY("[]", (yylsp[-1]), "implicitly sized array");
- (yyval.interm.type) = (yyvsp[-2].interm.type);
- (yyval.interm.type).setArray(true, 0);
- }
-
- break;
-
- case 157:
-
- {
- (yyval.interm.type) = (yyvsp[-3].interm.type);
-
- if (context->arrayTypeErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
- context->recover();
- else {
- int size = 0;
- if (context->arraySizeErrorCheck((yylsp[-2]), (yyvsp[-1].interm.intermTypedNode), size))
- context->recover();
- (yyval.interm.type).setArray(true, size);
- }
- }
-
- break;
-
- case 158:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtVoid, qual, (yylsp[0]));
- }
-
- break;
-
- case 159:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- }
-
- break;
-
- case 160:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
- }
-
- break;
-
- case 161:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
- }
-
- break;
-
- case 162:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
- }
-
- break;
-
- case 163:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(2);
- }
-
- break;
-
- case 164:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(3);
- }
-
- break;
-
- case 165:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(4);
- }
-
- break;
-
- case 166:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(2);
- }
-
- break;
-
- case 167:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(3);
- }
-
- break;
-
- case 168:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtBool, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(4);
- }
-
- break;
-
- case 169:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(2);
- }
-
- break;
-
- case 170:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(3);
- }
-
- break;
-
- case 171:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(4);
- }
-
- break;
-
- case 172:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(2);
- }
-
- break;
-
- case 173:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(3);
- }
-
- break;
-
- case 174:
-
- {
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUInt, qual, (yylsp[0]));
- (yyval.interm.type).setAggregate(4);
- }
-
- break;
-
- case 175:
-
- {
- FRAG_VERT_ONLY("mat2", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(2, 2);
- }
-
- break;
-
- case 176:
-
- {
- FRAG_VERT_ONLY("mat3", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(3, 3);
- }
-
- break;
-
- case 177:
-
- {
- FRAG_VERT_ONLY("mat4", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(4, 4);
- }
-
- break;
-
- case 178:
-
- {
- FRAG_VERT_ONLY("mat2x3", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(2, 3);
- }
-
- break;
-
- case 179:
-
- {
- FRAG_VERT_ONLY("mat3x2", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(3, 2);
- }
-
- break;
-
- case 180:
-
- {
- FRAG_VERT_ONLY("mat2x4", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(2, 4);
- }
-
- break;
-
- case 181:
-
- {
- FRAG_VERT_ONLY("mat4x2", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(4, 2);
- }
-
- break;
-
- case 182:
-
- {
- FRAG_VERT_ONLY("mat3x4", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(3, 4);
- }
-
- break;
-
- case 183:
-
- {
- FRAG_VERT_ONLY("mat4x3", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtFloat, qual, (yylsp[0]));
- (yyval.interm.type).setMatrix(4, 3);
- }
-
- break;
-
- case 184:
-
- {
- FRAG_VERT_ONLY("sampler2D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2D, qual, (yylsp[0]));
- }
-
- break;
-
- case 185:
-
- {
- FRAG_VERT_ONLY("samplerCube", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSamplerCube, qual, (yylsp[0]));
- }
-
- break;
-
- case 186:
-
- {
- if (!context->supportsExtension("GL_OES_EGL_image_external")) {
- context->error((yylsp[0]), "unsupported type", "samplerExternalOES", "");
- context->recover();
- }
- FRAG_VERT_ONLY("samplerExternalOES", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSamplerExternalOES, qual, (yylsp[0]));
- }
-
- break;
-
- case 187:
-
- {
- if (!context->supportsExtension("GL_ARB_texture_rectangle")) {
- context->error((yylsp[0]), "unsupported type", "sampler2DRect", "");
- context->recover();
- }
- FRAG_VERT_ONLY("sampler2DRect", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DRect, qual, (yylsp[0]));
- }
-
- break;
-
- case 188:
-
- {
- FRAG_VERT_ONLY("sampler3D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler3D, qual, (yylsp[0]));
- }
-
- break;
-
- case 189:
-
- {
- FRAG_VERT_ONLY("sampler2DArray", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DArray, qual, (yylsp[0]));
- }
-
- break;
-
- case 190:
-
- {
- FRAG_VERT_ONLY("isampler2D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler2D, qual, (yylsp[0]));
- }
-
- break;
-
- case 191:
-
- {
- FRAG_VERT_ONLY("isampler3D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler3D, qual, (yylsp[0]));
- }
-
- break;
-
- case 192:
-
- {
- FRAG_VERT_ONLY("isamplerCube", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISamplerCube, qual, (yylsp[0]));
- }
-
- break;
-
- case 193:
-
- {
- FRAG_VERT_ONLY("isampler2DArray", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtISampler2DArray, qual, (yylsp[0]));
- }
-
- break;
-
- case 194:
-
- {
- FRAG_VERT_ONLY("usampler2D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler2D, qual, (yylsp[0]));
- }
-
- break;
-
- case 195:
-
- {
- FRAG_VERT_ONLY("usampler3D", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler3D, qual, (yylsp[0]));
- }
-
- break;
-
- case 196:
-
- {
- FRAG_VERT_ONLY("usamplerCube", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSamplerCube, qual, (yylsp[0]));
- }
-
- break;
-
- case 197:
-
- {
- FRAG_VERT_ONLY("usampler2DArray", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtUSampler2DArray, qual, (yylsp[0]));
- }
-
- break;
-
- case 198:
-
- {
- FRAG_VERT_ONLY("sampler2DShadow", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DShadow, qual, (yylsp[0]));
- }
-
- break;
-
- case 199:
-
- {
- FRAG_VERT_ONLY("samplerCubeShadow", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSamplerCubeShadow, qual, (yylsp[0]));
- }
-
- break;
-
- case 200:
-
- {
- FRAG_VERT_ONLY("sampler2DArrayShadow", (yylsp[0]));
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtSampler2DArrayShadow, qual, (yylsp[0]));
- }
-
- break;
-
- case 201:
-
- {
- FRAG_VERT_ONLY("struct", (yylsp[0]));
- (yyval.interm.type) = (yyvsp[0].interm.type);
- (yyval.interm.type).qualifier = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- }
-
- break;
-
- case 202:
-
- {
- //
- // This is for user defined type names. The lexical phase looked up the
- // type.
- //
- TType& structure = static_cast<TVariable*>((yyvsp[0].lex).symbol)->getType();
- TQualifier qual = context->symbolTable.atGlobalLevel() ? EvqGlobal : EvqTemporary;
- (yyval.interm.type).setBasic(EbtStruct, qual, (yylsp[0]));
- (yyval.interm.type).userDef = &structure;
- }
-
- break;
-
- case 203:
-
- { if (context->enterStructDeclaration((yylsp[-1]), *(yyvsp[-1].lex).string)) context->recover(); }
-
- break;
-
- case 204:
-
- {
- (yyval.interm.type) = context->addStructure((yylsp[-5]), (yylsp[-4]), (yyvsp[-4].lex).string, (yyvsp[-1].interm.fieldList));
- }
-
- break;
-
- case 205:
-
- { if (context->enterStructDeclaration((yylsp[0]), *(yyvsp[0].lex).string)) context->recover(); }
-
- break;
-
- case 206:
-
- {
- (yyval.interm.type) = context->addStructure((yylsp[-4]), (yylsp[-4]), NewPoolTString(""), (yyvsp[-1].interm.fieldList));
- }
-
- break;
-
- case 207:
-
- {
- (yyval.interm.fieldList) = (yyvsp[0].interm.fieldList);
- }
-
- break;
-
- case 208:
-
- {
- (yyval.interm.fieldList) = (yyvsp[-1].interm.fieldList);
- for (unsigned int i = 0; i < (yyvsp[0].interm.fieldList)->size(); ++i) {
- TField* field = (*(yyvsp[0].interm.fieldList))[i];
- for (unsigned int j = 0; j < (yyval.interm.fieldList)->size(); ++j) {
- if ((*(yyval.interm.fieldList))[j]->name() == field->name()) {
- context->error((*(yyvsp[0].interm.fieldList))[i]->line(), "duplicate field name in structure:", "struct", field->name().c_str());
- context->recover();
- }
- }
- (yyval.interm.fieldList)->push_back((*(yyvsp[0].interm.fieldList))[i]);
- }
- }
-
- break;
-
- case 209:
-
- {
- (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[-2].interm.type), (yyvsp[-1].interm.fieldList));
- }
-
- break;
-
- case 210:
-
- {
- // ES3 Only, but errors should be handled elsewhere
- (yyvsp[-2].interm.type).qualifier = (yyvsp[-3].interm.type).qualifier;
- (yyvsp[-2].interm.type).layoutQualifier = (yyvsp[-3].interm.type).layoutQualifier;
- (yyval.interm.fieldList) = context->addStructDeclaratorList((yyvsp[-2].interm.type), (yyvsp[-1].interm.fieldList));
- }
-
- break;
-
- case 211:
-
- {
- (yyval.interm.fieldList) = NewPoolTFieldList();
- (yyval.interm.fieldList)->push_back((yyvsp[0].interm.field));
- }
-
- break;
-
- case 212:
-
- {
- (yyval.interm.fieldList)->push_back((yyvsp[0].interm.field));
- }
-
- break;
-
- case 213:
-
- {
- if (context->reservedErrorCheck((yylsp[0]), *(yyvsp[0].lex).string))
- context->recover();
-
- TType* type = new TType(EbtVoid, EbpUndefined);
- (yyval.interm.field) = new TField(type, (yyvsp[0].lex).string, (yylsp[0]));
- }
-
- break;
-
- case 214:
-
- {
- if (context->reservedErrorCheck((yylsp[-3]), *(yyvsp[-3].lex).string))
- context->recover();
-
- TType* type = new TType(EbtVoid, EbpUndefined);
- int size = 0;
- if (context->arraySizeErrorCheck((yyvsp[-1].interm.intermTypedNode)->getLine(), (yyvsp[-1].interm.intermTypedNode), size))
- context->recover();
- type->setArraySize(size);
-
- (yyval.interm.field) = new TField(type, (yyvsp[-3].lex).string, (yylsp[-3]));
- }
-
- break;
-
- case 215:
-
- { (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode); }
-
- break;
-
- case 216:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 217:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermAggregate); }
-
- break;
-
- case 218:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 219:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 220:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 221:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 222:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermSwitch); }
-
- break;
-
- case 223:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermCase); }
-
- break;
-
- case 224:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 225:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 226:
-
- { (yyval.interm.intermAggregate) = 0; }
-
- break;
-
- case 227:
-
- { context->symbolTable.push(); }
-
- break;
-
- case 228:
-
- { context->symbolTable.pop(); }
-
- break;
-
- case 229:
-
- {
- if ((yyvsp[-2].interm.intermAggregate) != 0) {
- (yyvsp[-2].interm.intermAggregate)->setOp(EOpSequence);
- (yyvsp[-2].interm.intermAggregate)->setEndLine((yylsp[0]));
- }
- (yyval.interm.intermAggregate) = (yyvsp[-2].interm.intermAggregate);
- }
-
- break;
-
- case 230:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermAggregate); }
-
- break;
-
- case 231:
-
- { (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 232:
-
- { context->symbolTable.push(); }
-
- break;
-
- case 233:
-
- { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermAggregate); }
-
- break;
-
- case 234:
-
- { context->symbolTable.push(); }
-
- break;
-
- case 235:
-
- { context->symbolTable.pop(); (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode); }
-
- break;
-
- case 236:
-
- {
- (yyval.interm.intermAggregate) = 0;
- }
-
- break;
-
- case 237:
-
- {
- if ((yyvsp[-1].interm.intermAggregate)) {
- (yyvsp[-1].interm.intermAggregate)->setOp(EOpSequence);
- (yyvsp[-1].interm.intermAggregate)->setEndLine((yylsp[0]));
- }
- (yyval.interm.intermAggregate) = (yyvsp[-1].interm.intermAggregate);
- }
-
- break;
-
- case 238:
-
- {
- (yyval.interm.intermAggregate) = context->intermediate.makeAggregate((yyvsp[0].interm.intermNode), (yyloc));
- }
-
- break;
-
- case 239:
-
- {
- (yyval.interm.intermAggregate) = context->intermediate.growAggregate((yyvsp[-1].interm.intermAggregate), (yyvsp[0].interm.intermNode), (yyloc));
- }
-
- break;
-
- case 240:
-
- { (yyval.interm.intermNode) = 0; }
-
- break;
-
- case 241:
-
- { (yyval.interm.intermNode) = static_cast<TIntermNode*>((yyvsp[-1].interm.intermTypedNode)); }
-
- break;
-
- case 242:
-
- {
- if (context->boolErrorCheck((yylsp[-4]), (yyvsp[-2].interm.intermTypedNode)))
- context->recover();
- (yyval.interm.intermNode) = context->intermediate.addSelection((yyvsp[-2].interm.intermTypedNode), (yyvsp[0].interm.nodePair), (yylsp[-4]));
- }
-
- break;
-
- case 243:
-
- {
- (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermNode);
- (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermNode);
- }
-
- break;
-
- case 244:
-
- {
- (yyval.interm.nodePair).node1 = (yyvsp[0].interm.intermNode);
- (yyval.interm.nodePair).node2 = 0;
- }
-
- break;
-
- case 245:
-
- { context->incrSwitchNestingLevel(); }
-
- break;
-
- case 246:
-
- {
- (yyval.interm.intermSwitch) = context->addSwitch((yyvsp[-3].interm.intermTypedNode), (yyvsp[0].interm.intermAggregate), (yylsp[-5]));
- context->decrSwitchNestingLevel();
- }
-
- break;
-
- case 247:
-
- {
- (yyval.interm.intermCase) = context->addCase((yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
- }
-
- break;
-
- case 248:
-
- {
- (yyval.interm.intermCase) = context->addDefault((yylsp[-1]));
- }
-
- break;
-
- case 249:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- if (context->boolErrorCheck((yyvsp[0].interm.intermTypedNode)->getLine(), (yyvsp[0].interm.intermTypedNode)))
- context->recover();
- }
-
- break;
-
- case 250:
-
- {
- TIntermNode *intermNode;
- if (context->boolErrorCheck((yylsp[-2]), (yyvsp[-3].interm.type)))
- context->recover();
-
- if (!context->executeInitializer((yylsp[-2]), *(yyvsp[-2].lex).string, (yyvsp[-3].interm.type), (yyvsp[0].interm.intermTypedNode), &intermNode))
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- else {
- context->recover();
- (yyval.interm.intermTypedNode) = 0;
- }
- }
-
- break;
-
- case 251:
-
- { context->symbolTable.push(); context->incrLoopNestingLevel(); }
-
- break;
-
- case 252:
-
- {
- context->symbolTable.pop();
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[0].interm.intermNode), (yylsp[-5]));
- context->decrLoopNestingLevel();
- }
-
- break;
-
- case 253:
-
- { context->incrLoopNestingLevel(); }
-
- break;
-
- case 254:
-
- {
- if (context->boolErrorCheck((yylsp[0]), (yyvsp[-2].interm.intermTypedNode)))
- context->recover();
-
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopDoWhile, 0, (yyvsp[-2].interm.intermTypedNode), 0, (yyvsp[-5].interm.intermNode), (yylsp[-4]));
- context->decrLoopNestingLevel();
- }
-
- break;
-
- case 255:
-
- { context->symbolTable.push(); context->incrLoopNestingLevel(); }
-
- break;
-
- case 256:
-
- {
- context->symbolTable.pop();
- (yyval.interm.intermNode) = context->intermediate.addLoop(ELoopFor, (yyvsp[-3].interm.intermNode), reinterpret_cast<TIntermTyped*>((yyvsp[-2].interm.nodePair).node1), reinterpret_cast<TIntermTyped*>((yyvsp[-2].interm.nodePair).node2), (yyvsp[0].interm.intermNode), (yylsp[-6]));
- context->decrLoopNestingLevel();
- }
-
- break;
-
- case 257:
-
- {
- (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
- }
-
- break;
-
- case 258:
-
- {
- (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
- }
-
- break;
-
- case 259:
-
- {
- (yyval.interm.intermTypedNode) = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 260:
-
- {
- (yyval.interm.intermTypedNode) = 0;
- }
-
- break;
-
- case 261:
-
- {
- (yyval.interm.nodePair).node1 = (yyvsp[-1].interm.intermTypedNode);
- (yyval.interm.nodePair).node2 = 0;
- }
-
- break;
-
- case 262:
-
- {
- (yyval.interm.nodePair).node1 = (yyvsp[-2].interm.intermTypedNode);
- (yyval.interm.nodePair).node2 = (yyvsp[0].interm.intermTypedNode);
- }
-
- break;
-
- case 263:
-
- {
- (yyval.interm.intermNode) = context->addBranch(EOpContinue, (yylsp[-1]));
- }
-
- break;
-
- case 264:
-
- {
- (yyval.interm.intermNode) = context->addBranch(EOpBreak, (yylsp[-1]));
- }
-
- break;
-
- case 265:
-
- {
- (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yylsp[-1]));
- }
-
- break;
-
- case 266:
-
- {
- (yyval.interm.intermNode) = context->addBranch(EOpReturn, (yyvsp[-1].interm.intermTypedNode), (yylsp[-2]));
- }
-
- break;
-
- case 267:
-
- {
- FRAG_ONLY("discard", (yylsp[-1]));
- (yyval.interm.intermNode) = context->addBranch(EOpKill, (yylsp[-1]));
- }
-
- break;
-
- case 268:
-
- {
- (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
- context->setTreeRoot((yyval.interm.intermNode));
- }
-
- break;
-
- case 269:
-
- {
- (yyval.interm.intermNode) = context->intermediate.growAggregate((yyvsp[-1].interm.intermNode), (yyvsp[0].interm.intermNode), (yyloc));
- context->setTreeRoot((yyval.interm.intermNode));
- }
-
- break;
-
- case 270:
-
- {
- (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
- }
-
- break;
-
- case 271:
-
- {
- (yyval.interm.intermNode) = (yyvsp[0].interm.intermNode);
- }
-
- break;
-
- case 272:
-
- {
- context->parseFunctionPrototype((yylsp[0]), (yyvsp[0].interm).function, &(yyvsp[0].interm).intermAggregate);
- }
-
- break;
-
- case 273:
-
- {
- (yyval.interm.intermNode) = context->addFunctionDefinition(*((yyvsp[-2].interm).function), (yyvsp[-2].interm).intermAggregate, (yyvsp[0].interm.intermAggregate), (yylsp[-2]));
- }
-
- break;
-
-
-
- default: break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
- *++yylsp = yyloc;
-
- /* Now 'shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (&yylloc, context, yyscanner, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (&yylloc, context, yyscanner, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
-
- yyerror_range[1] = yylloc;
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, &yylloc, context, yyscanner);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- yyerror_range[1] = yylsp[1-yylen];
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
- yyerror_range[1] = *yylsp;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, yylsp, context, yyscanner);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- yyerror_range[2] = yylloc;
- /* Using YYLLOC is tempting, but would change the location of
- the lookahead. YYLOC is available though. */
- YYLLOC_DEFAULT (yyloc, yyerror_range, 2);
- *++yylsp = yyloc;
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (&yylloc, context, yyscanner, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, &yylloc, context, yyscanner);
- }
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, yylsp, context, yyscanner);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- return yyresult;
-}
-
-
-
-int glslang_parse(TParseContext* context) {
- return yyparse(context, context->getScanner());
-}
diff --git a/src/OpenGL/compiler/glslang_tab.h b/src/OpenGL/compiler/glslang_tab.h
deleted file mode 100644
index 77bf4f4cb..000000000
--- a/src/OpenGL/compiler/glslang_tab.h
+++ /dev/null
@@ -1,248 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-#ifndef YY_YY_GLSLANG_TAB_H_INCLUDED
-# define YY_YY_GLSLANG_TAB_H_INCLUDED
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-/* "%code requires" blocks. */
-
-
-#define YYLTYPE TSourceLoc
-#define YYLTYPE_IS_DECLARED 1
-
-
-
-/* Token type. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- INVARIANT = 258,
- HIGH_PRECISION = 259,
- MEDIUM_PRECISION = 260,
- LOW_PRECISION = 261,
- PRECISION = 262,
- ATTRIBUTE = 263,
- CONST_QUAL = 264,
- BOOL_TYPE = 265,
- FLOAT_TYPE = 266,
- INT_TYPE = 267,
- UINT_TYPE = 268,
- BREAK = 269,
- CONTINUE = 270,
- DO = 271,
- ELSE = 272,
- FOR = 273,
- IF = 274,
- DISCARD = 275,
- RETURN = 276,
- SWITCH = 277,
- CASE = 278,
- DEFAULT = 279,
- BVEC2 = 280,
- BVEC3 = 281,
- BVEC4 = 282,
- IVEC2 = 283,
- IVEC3 = 284,
- IVEC4 = 285,
- VEC2 = 286,
- VEC3 = 287,
- VEC4 = 288,
- UVEC2 = 289,
- UVEC3 = 290,
- UVEC4 = 291,
- MATRIX2 = 292,
- MATRIX3 = 293,
- MATRIX4 = 294,
- IN_QUAL = 295,
- OUT_QUAL = 296,
- INOUT_QUAL = 297,
- UNIFORM = 298,
- VARYING = 299,
- MATRIX2x3 = 300,
- MATRIX3x2 = 301,
- MATRIX2x4 = 302,
- MATRIX4x2 = 303,
- MATRIX3x4 = 304,
- MATRIX4x3 = 305,
- CENTROID = 306,
- FLAT = 307,
- SMOOTH = 308,
- STRUCT = 309,
- VOID_TYPE = 310,
- WHILE = 311,
- SAMPLER2D = 312,
- SAMPLERCUBE = 313,
- SAMPLER_EXTERNAL_OES = 314,
- SAMPLER2DRECT = 315,
- SAMPLER2DARRAY = 316,
- ISAMPLER2D = 317,
- ISAMPLER3D = 318,
- ISAMPLERCUBE = 319,
- ISAMPLER2DARRAY = 320,
- USAMPLER2D = 321,
- USAMPLER3D = 322,
- USAMPLERCUBE = 323,
- USAMPLER2DARRAY = 324,
- SAMPLER3D = 325,
- SAMPLER3DRECT = 326,
- SAMPLER2DSHADOW = 327,
- SAMPLERCUBESHADOW = 328,
- SAMPLER2DARRAYSHADOW = 329,
- LAYOUT = 330,
- IDENTIFIER = 331,
- TYPE_NAME = 332,
- FLOATCONSTANT = 333,
- INTCONSTANT = 334,
- UINTCONSTANT = 335,
- BOOLCONSTANT = 336,
- FIELD_SELECTION = 337,
- LEFT_OP = 338,
- RIGHT_OP = 339,
- INC_OP = 340,
- DEC_OP = 341,
- LE_OP = 342,
- GE_OP = 343,
- EQ_OP = 344,
- NE_OP = 345,
- AND_OP = 346,
- OR_OP = 347,
- XOR_OP = 348,
- MUL_ASSIGN = 349,
- DIV_ASSIGN = 350,
- ADD_ASSIGN = 351,
- MOD_ASSIGN = 352,
- LEFT_ASSIGN = 353,
- RIGHT_ASSIGN = 354,
- AND_ASSIGN = 355,
- XOR_ASSIGN = 356,
- OR_ASSIGN = 357,
- SUB_ASSIGN = 358,
- LEFT_PAREN = 359,
- RIGHT_PAREN = 360,
- LEFT_BRACKET = 361,
- RIGHT_BRACKET = 362,
- LEFT_BRACE = 363,
- RIGHT_BRACE = 364,
- DOT = 365,
- COMMA = 366,
- COLON = 367,
- EQUAL = 368,
- SEMICOLON = 369,
- BANG = 370,
- DASH = 371,
- TILDE = 372,
- PLUS = 373,
- STAR = 374,
- SLASH = 375,
- PERCENT = 376,
- LEFT_ANGLE = 377,
- RIGHT_ANGLE = 378,
- VERTICAL_BAR = 379,
- CARET = 380,
- AMPERSAND = 381,
- QUESTION = 382
- };
-#endif
-
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-
-union YYSTYPE
-{
-
-
- struct {
- union {
- TString *string;
- float f;
- int i;
- unsigned int u;
- bool b;
- };
- TSymbol* symbol;
- } lex;
- struct {
- TOperator op;
- union {
- TIntermNode* intermNode;
- TIntermNodePair nodePair;
- TIntermTyped* intermTypedNode;
- TIntermAggregate* intermAggregate;
- TIntermSwitch* intermSwitch;
- TIntermCase* intermCase;
- };
- union {
- TPublicType type;
- TPrecision precision;
- TLayoutQualifier layoutQualifier;
- TQualifier qualifier;
- TFunction* function;
- TParameter param;
- TField* field;
- TFieldList* fieldList;
- };
- } interm;
-
-
-};
-
-typedef union YYSTYPE YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-/* Location type. */
-#if ! defined YYLTYPE && ! defined YYLTYPE_IS_DECLARED
-typedef struct YYLTYPE YYLTYPE;
-struct YYLTYPE
-{
- int first_line;
- int first_column;
- int last_line;
- int last_column;
-};
-# define YYLTYPE_IS_DECLARED 1
-# define YYLTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-int yyparse (TParseContext* context, void* yyscanner);
-
-#endif /* !YY_YY_GLSLANG_TAB_H_INCLUDED */
diff --git a/src/OpenGL/compiler/intermOut.cpp b/src/OpenGL/compiler/intermOut.cpp
deleted file mode 100644
index 5a8ebc5c3..000000000
--- a/src/OpenGL/compiler/intermOut.cpp
+++ /dev/null
@@ -1,483 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "localintermediate.h"
-#include "SymbolTable.h"
-
-//
-// Two purposes:
-// 1. Show an example of how to iterate tree. Functions can
-// also directly call Traverse() on children themselves to
-// have finer grained control over the process than shown here.
-// See the last function for how to get started.
-// 2. Print out a text based description of the tree.
-//
-
-//
-// Use this class to carry along data from node to node in
-// the traversal
-//
-class TOutputTraverser : public TIntermTraverser {
-public:
- TOutputTraverser(TInfoSinkBase& i) : sink(i) { }
- TInfoSinkBase& sink;
-
-protected:
- void visitSymbol(TIntermSymbol*);
- void visitConstantUnion(TIntermConstantUnion*);
- bool visitBinary(Visit visit, TIntermBinary*);
- bool visitUnary(Visit visit, TIntermUnary*);
- bool visitSelection(Visit visit, TIntermSelection*);
- bool visitAggregate(Visit visit, TIntermAggregate*);
- bool visitLoop(Visit visit, TIntermLoop*);
- bool visitBranch(Visit visit, TIntermBranch*);
-};
-
-TString TType::getCompleteString() const
-{
- TStringStream stream;
-
- if (qualifier != EvqTemporary && qualifier != EvqGlobal)
- stream << getQualifierString() << " " << getPrecisionString() << " ";
- if (array)
- stream << "array of ";
- if (isMatrix())
- stream << static_cast<int>(primarySize) << "X" << static_cast<int>(secondarySize) << " matrix of ";
- else if(primarySize > 1)
- stream << static_cast<int>(primarySize) << "-component vector of ";
-
- stream << getBasicString();
- return stream.str();
-}
-
-//
-// Helper functions for printing, not part of traversing.
-//
-
-void OutputTreeText(TInfoSinkBase& sink, TIntermNode* node, const int depth)
-{
- int i;
-
- sink.location(node->getLine());
-
- for (i = 0; i < depth; ++i)
- sink << " ";
-}
-
-//
-// The rest of the file are the traversal functions. The last one
-// is the one that starts the traversal.
-//
-// Return true from interior nodes to have the external traversal
-// continue on to children. If you process children yourself,
-// return false.
-//
-
-void TOutputTraverser::visitSymbol(TIntermSymbol* node)
-{
- OutputTreeText(sink, node, mDepth);
-
- sink << "'" << node->getSymbol() << "' ";
- sink << "(" << node->getCompleteString() << ")\n";
-}
-
-bool TOutputTraverser::visitBinary(Visit visit, TIntermBinary* node)
-{
- TInfoSinkBase& out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- switch (node->getOp()) {
- case EOpAssign: out << "move second child to first child"; break;
- case EOpInitialize: out << "initialize first child with second child"; break;
- case EOpAddAssign: out << "add second child into first child"; break;
- case EOpSubAssign: out << "subtract second child into first child"; break;
- case EOpMulAssign: out << "multiply second child into first child"; break;
- case EOpVectorTimesMatrixAssign: out << "matrix mult second child into first child"; break;
- case EOpVectorTimesScalarAssign: out << "vector scale second child into first child"; break;
- case EOpMatrixTimesScalarAssign: out << "matrix scale second child into first child"; break;
- case EOpMatrixTimesMatrixAssign: out << "matrix mult second child into first child"; break;
- case EOpDivAssign: out << "divide second child into first child"; break;
- case EOpIModAssign: out << "modulo second child into first child"; break;
- case EOpBitShiftLeftAssign: out << "bit-wise shift first child left by second child"; break;
- case EOpBitShiftRightAssign: out << "bit-wise shift first child right by second child"; break;
- case EOpBitwiseAndAssign: out << "bit-wise and second child into first child"; break;
- case EOpBitwiseXorAssign: out << "bit-wise xor second child into first child"; break;
- case EOpBitwiseOrAssign: out << "bit-wise or second child into first child"; break;
- case EOpIndexDirect: out << "direct index"; break;
- case EOpIndexIndirect: out << "indirect index"; break;
- case EOpIndexDirectStruct: out << "direct index for structure"; break;
- case EOpVectorSwizzle: out << "vector swizzle"; break;
-
- case EOpAdd: out << "add"; break;
- case EOpSub: out << "subtract"; break;
- case EOpMul: out << "component-wise multiply"; break;
- case EOpDiv: out << "divide"; break;
- case EOpIMod: out << "modulo"; break;
- case EOpBitShiftLeft: out << "bit-wise shift left"; break;
- case EOpBitShiftRight: out << "bit-wise shift right"; break;
- case EOpBitwiseAnd: out << "bit-wise and"; break;
- case EOpBitwiseXor: out << "bit-wise xor"; break;
- case EOpBitwiseOr: out << "bit-wise or"; break;
- case EOpEqual: out << "Compare Equal"; break;
- case EOpNotEqual: out << "Compare Not Equal"; break;
- case EOpLessThan: out << "Compare Less Than"; break;
- case EOpGreaterThan: out << "Compare Greater Than"; break;
- case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
- case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
-
- case EOpVectorTimesScalar: out << "vector-scale"; break;
- case EOpVectorTimesMatrix: out << "vector-times-matrix"; break;
- case EOpMatrixTimesVector: out << "matrix-times-vector"; break;
- case EOpMatrixTimesScalar: out << "matrix-scale"; break;
- case EOpMatrixTimesMatrix: out << "matrix-multiply"; break;
-
- case EOpLogicalOr: out << "logical-or"; break;
- case EOpLogicalXor: out << "logical-xor"; break;
- case EOpLogicalAnd: out << "logical-and"; break;
- default: out << "<unknown op>";
- }
-
- out << " (" << node->getCompleteString() << ")";
-
- out << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitUnary(Visit visit, TIntermUnary* node)
-{
- TInfoSinkBase& out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- switch (node->getOp()) {
- case EOpNegative: out << "Negate value"; break;
- case EOpVectorLogicalNot:
- case EOpLogicalNot: out << "Negate conditional"; break;
- case EOpBitwiseNot: out << "bit-wise not"; break;
-
- case EOpPostIncrement: out << "Post-Increment"; break;
- case EOpPostDecrement: out << "Post-Decrement"; break;
- case EOpPreIncrement: out << "Pre-Increment"; break;
- case EOpPreDecrement: out << "Pre-Decrement"; break;
-
- case EOpRadians: out << "radians"; break;
- case EOpDegrees: out << "degrees"; break;
- case EOpSin: out << "sine"; break;
- case EOpCos: out << "cosine"; break;
- case EOpTan: out << "tangent"; break;
- case EOpAsin: out << "arc sine"; break;
- case EOpAcos: out << "arc cosine"; break;
- case EOpAtan: out << "arc tangent"; break;
- case EOpSinh: out << "hyperbolic sine"; break;
- case EOpCosh: out << "hyperbolic cosine"; break;
- case EOpTanh: out << "hyperbolic tangent"; break;
- case EOpAsinh: out << "arc hyperbolic sine"; break;
- case EOpAcosh: out << "arc hyperbolic cosine"; break;
- case EOpAtanh: out << "arc hyperbolic tangent"; break;
-
- case EOpExp: out << "exp"; break;
- case EOpLog: out << "log"; break;
- case EOpExp2: out << "exp2"; break;
- case EOpLog2: out << "log2"; break;
- case EOpSqrt: out << "sqrt"; break;
- case EOpInverseSqrt: out << "inverse sqrt"; break;
-
- case EOpAbs: out << "Absolute value"; break;
- case EOpSign: out << "Sign"; break;
- case EOpFloor: out << "Floor"; break;
- case EOpTrunc: out << "Trunc"; break;
- case EOpRound: out << "Round"; break;
- case EOpRoundEven: out << "RoundEven"; break;
- case EOpCeil: out << "Ceiling"; break;
- case EOpFract: out << "Fraction"; break;
- case EOpIsNan: out << "Is not a number"; break;
- case EOpIsInf: out << "Is infinity"; break;
-
- case EOpFloatBitsToInt: out << "float bits to int"; break;
- case EOpFloatBitsToUint: out << "float bits to uint"; break;
- case EOpIntBitsToFloat: out << "int bits to float"; break;
- case EOpUintBitsToFloat: out << "uint bits to float"; break;
-
- case EOpPackSnorm2x16: out << "pack Snorm 2x16"; break;
- case EOpPackUnorm2x16: out << "pack Unorm 2x16"; break;
- case EOpPackHalf2x16: out << "pack half 2x16"; break;
-
- case EOpUnpackSnorm2x16: out << "unpack Snorm 2x16"; break;
- case EOpUnpackUnorm2x16: out << "unpack Unorm 2x16"; break;
- case EOpUnpackHalf2x16: out << "unpack half 2x16"; break;
-
- case EOpLength: out << "length"; break;
- case EOpNormalize: out << "normalize"; break;
- // case EOpDPdx: out << "dPdx"; break;
- // case EOpDPdy: out << "dPdy"; break;
- // case EOpFwidth: out << "fwidth"; break;
-
- case EOpDeterminant: out << "determinant"; break;
- case EOpTranspose: out << "transpose"; break;
- case EOpInverse: out << "inverse"; break;
-
- case EOpAny: out << "any"; break;
- case EOpAll: out << "all"; break;
-
- default: out.message(EPrefixError, "Bad unary op");
- }
-
- out << " (" << node->getCompleteString() << ")";
-
- out << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- TInfoSinkBase& out = sink;
-
- if (node->getOp() == EOpNull) {
- out.message(EPrefixError, "node is still EOpNull!");
- return true;
- }
-
- OutputTreeText(out, node, mDepth);
-
- switch (node->getOp()) {
- case EOpSequence: out << "Sequence\n"; return true;
- case EOpComma: out << "Comma\n"; return true;
- case EOpFunction: out << "Function Definition: " << node->getName(); break;
- case EOpFunctionCall: out << "Function Call: " << node->getName(); break;
- case EOpParameters: out << "Function Parameters: "; break;
-
- case EOpConstructFloat: out << "Construct float"; break;
- case EOpConstructVec2: out << "Construct vec2"; break;
- case EOpConstructVec3: out << "Construct vec3"; break;
- case EOpConstructVec4: out << "Construct vec4"; break;
- case EOpConstructBool: out << "Construct bool"; break;
- case EOpConstructBVec2: out << "Construct bvec2"; break;
- case EOpConstructBVec3: out << "Construct bvec3"; break;
- case EOpConstructBVec4: out << "Construct bvec4"; break;
- case EOpConstructInt: out << "Construct int"; break;
- case EOpConstructIVec2: out << "Construct ivec2"; break;
- case EOpConstructIVec3: out << "Construct ivec3"; break;
- case EOpConstructIVec4: out << "Construct ivec4"; break;
- case EOpConstructUInt: out << "Construct uint"; break;
- case EOpConstructUVec2: out << "Construct uvec2"; break;
- case EOpConstructUVec3: out << "Construct uvec3"; break;
- case EOpConstructUVec4: out << "Construct uvec4"; break;
- case EOpConstructMat2: out << "Construct mat2"; break;
- case EOpConstructMat2x3: out << "Construct mat2x3"; break;
- case EOpConstructMat2x4: out << "Construct mat2x4"; break;
- case EOpConstructMat3x2: out << "Construct mat3x2"; break;
- case EOpConstructMat3: out << "Construct mat3"; break;
- case EOpConstructMat3x4: out << "Construct mat3x4"; break;
- case EOpConstructMat4x2: out << "Construct mat4x2"; break;
- case EOpConstructMat4x3: out << "Construct mat4x3"; break;
- case EOpConstructMat4: out << "Construct mat4"; break;
- case EOpConstructStruct: out << "Construct structure"; break;
-
- case EOpLessThan: out << "Compare Less Than"; break;
- case EOpGreaterThan: out << "Compare Greater Than"; break;
- case EOpLessThanEqual: out << "Compare Less Than or Equal"; break;
- case EOpGreaterThanEqual: out << "Compare Greater Than or Equal"; break;
- case EOpVectorEqual: out << "Equal"; break;
- case EOpVectorNotEqual: out << "NotEqual"; break;
-
- case EOpMod: out << "mod"; break;
- case EOpModf: out << "modf"; break;
- case EOpPow: out << "pow"; break;
-
- case EOpAtan: out << "arc tangent"; break;
-
- case EOpMin: out << "min"; break;
- case EOpMax: out << "max"; break;
- case EOpClamp: out << "clamp"; break;
- case EOpMix: out << "mix"; break;
- case EOpStep: out << "step"; break;
- case EOpSmoothStep: out << "smoothstep"; break;
-
- case EOpFloatBitsToInt: out << "floatBitsToInt"; break;
- case EOpFloatBitsToUint: out << "floatBitsToUint"; break;
- case EOpIntBitsToFloat: out << "intBitsToFloat"; break;
- case EOpUintBitsToFloat: out << "uintBitsToFloat"; break;
-
- case EOpDistance: out << "distance"; break;
- case EOpDot: out << "dot-product"; break;
- case EOpCross: out << "cross-product"; break;
- case EOpFaceForward: out << "face-forward"; break;
- case EOpReflect: out << "reflect"; break;
- case EOpRefract: out << "refract"; break;
- case EOpMul: out << "component-wise multiply"; break;
- case EOpOuterProduct: out << "outer product"; break;
-
- case EOpDeclaration: out << "Declaration"; break;
-
- default: out.message(EPrefixError, "Bad aggregation op");
- }
-
- if (node->getOp() != EOpSequence && node->getOp() != EOpParameters)
- out << " (" << node->getCompleteString() << ")";
-
- out << "\n";
-
- return true;
-}
-
-bool TOutputTraverser::visitSelection(Visit visit, TIntermSelection* node)
-{
- TInfoSinkBase& out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- out << "Test condition and select";
- out << " (" << node->getCompleteString() << ")\n";
-
- ++mDepth;
-
- OutputTreeText(sink, node, mDepth);
- out << "Condition\n";
- node->getCondition()->traverse(this);
-
- OutputTreeText(sink, node, mDepth);
- if (node->getTrueBlock()) {
- out << "true case\n";
- node->getTrueBlock()->traverse(this);
- } else
- out << "true case is null\n";
-
- if (node->getFalseBlock()) {
- OutputTreeText(sink, node, mDepth);
- out << "false case\n";
- node->getFalseBlock()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-void TOutputTraverser::visitConstantUnion(TIntermConstantUnion* node)
-{
- TInfoSinkBase& out = sink;
-
- size_t size = node->getType().getObjectSize();
-
- for(size_t i = 0; i < size; i++) {
- OutputTreeText(out, node, mDepth);
- switch (node->getUnionArrayPointer()[i].getType()) {
- case EbtBool:
- if (node->getUnionArrayPointer()[i].getBConst())
- out << "true";
- else
- out << "false";
-
- out << " (" << "const bool" << ")";
- out << "\n";
- break;
- case EbtFloat:
- out << node->getUnionArrayPointer()[i].getFConst();
- out << " (const float)\n";
- break;
- case EbtInt:
- out << node->getUnionArrayPointer()[i].getIConst();
- out << " (const int)\n";
- break;
- case EbtUInt:
- out << node->getUnionArrayPointer()[i].getUConst();
- out << " (const uint)\n";
- break;
- default:
- out.message(EPrefixInternalError, "Unknown constant", node->getLine());
- break;
- }
- }
-}
-
-bool TOutputTraverser::visitLoop(Visit visit, TIntermLoop* node)
-{
- TInfoSinkBase& out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- out << "Loop with condition ";
- if (node->getType() == ELoopDoWhile)
- out << "not ";
- out << "tested first\n";
-
- ++mDepth;
-
- OutputTreeText(sink, node, mDepth);
- if (node->getCondition()) {
- out << "Loop Condition\n";
- node->getCondition()->traverse(this);
- } else
- out << "No loop condition\n";
-
- OutputTreeText(sink, node, mDepth);
- if (node->getBody()) {
- out << "Loop Body\n";
- node->getBody()->traverse(this);
- } else
- out << "No loop body\n";
-
- if (node->getExpression()) {
- OutputTreeText(sink, node, mDepth);
- out << "Loop Terminal Expression\n";
- node->getExpression()->traverse(this);
- }
-
- --mDepth;
-
- return false;
-}
-
-bool TOutputTraverser::visitBranch(Visit visit, TIntermBranch* node)
-{
- TInfoSinkBase& out = sink;
-
- OutputTreeText(out, node, mDepth);
-
- switch (node->getFlowOp()) {
- case EOpKill: out << "Branch: Kill"; break;
- case EOpBreak: out << "Branch: Break"; break;
- case EOpContinue: out << "Branch: Continue"; break;
- case EOpReturn: out << "Branch: Return"; break;
- default: out << "Branch: Unknown Branch"; break;
- }
-
- if (node->getExpression()) {
- out << " with expression\n";
- ++mDepth;
- node->getExpression()->traverse(this);
- --mDepth;
- } else
- out << "\n";
-
- return false;
-}
-
-//
-// This function is the one to call externally to start the traversal.
-// Individual functions can be initialized to 0 to skip processing of that
-// type of node. It's children will still be processed.
-//
-void TIntermediate::outputTree(TIntermNode* root)
-{
- if (root == 0)
- return;
-
- TOutputTraverser it(infoSink.info);
-
- root->traverse(&it);
-}
diff --git a/src/OpenGL/compiler/intermediate.h b/src/OpenGL/compiler/intermediate.h
deleted file mode 100644
index 5bdefd526..000000000
--- a/src/OpenGL/compiler/intermediate.h
+++ /dev/null
@@ -1,758 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// Definition of the in-memory high-level intermediate representation
-// of shaders. This is a tree that parser creates.
-//
-// Nodes in the tree are defined as a hierarchy of classes derived from
-// TIntermNode. Each is a node in a tree. There is no preset branching factor;
-// each node can have it's own type of list of children.
-//
-
-#ifndef __INTERMEDIATE_H
-#define __INTERMEDIATE_H
-
-#include "Common.h"
-#include "Types.h"
-#include "ConstantUnion.h"
-
-//
-// Operators used by the high-level (parse tree) representation.
-//
-enum TOperator {
- EOpNull, // if in a node, should only mean a node is still being built
- EOpSequence, // denotes a list of statements, or parameters, etc.
- EOpFunctionCall,
- EOpFunction, // For function definition
- EOpParameters, // an aggregate listing the parameters to a function
-
- EOpDeclaration,
- EOpInvariantDeclaration, // Specialized declarations for attributing invariance
- EOpPrototype,
-
- //
- // Unary operators
- //
-
- EOpNegative,
- EOpLogicalNot,
- EOpVectorLogicalNot,
- EOpBitwiseNot,
-
- EOpPostIncrement,
- EOpPostDecrement,
- EOpPreIncrement,
- EOpPreDecrement,
-
- //
- // binary operations
- //
-
- EOpAdd,
- EOpSub,
- EOpMul,
- EOpDiv,
- EOpEqual,
- EOpNotEqual,
- EOpVectorEqual,
- EOpVectorNotEqual,
- EOpLessThan,
- EOpGreaterThan,
- EOpLessThanEqual,
- EOpGreaterThanEqual,
- EOpComma,
-
- EOpOuterProduct,
- EOpTranspose,
- EOpDeterminant,
- EOpInverse,
-
- EOpVectorTimesScalar,
- EOpVectorTimesMatrix,
- EOpMatrixTimesVector,
- EOpMatrixTimesScalar,
-
- EOpLogicalOr,
- EOpLogicalXor,
- EOpLogicalAnd,
-
- EOpIMod,
- EOpBitShiftLeft,
- EOpBitShiftRight,
- EOpBitwiseAnd,
- EOpBitwiseXor,
- EOpBitwiseOr,
-
- EOpIndexDirect,
- EOpIndexIndirect,
- EOpIndexDirectStruct,
- EOpIndexDirectInterfaceBlock,
-
- EOpVectorSwizzle,
-
- //
- // Built-in functions potentially mapped to operators
- //
-
- EOpRadians,
- EOpDegrees,
- EOpSin,
- EOpCos,
- EOpTan,
- EOpAsin,
- EOpAcos,
- EOpAtan,
- EOpSinh,
- EOpCosh,
- EOpTanh,
- EOpAsinh,
- EOpAcosh,
- EOpAtanh,
-
- EOpPow,
- EOpExp,
- EOpLog,
- EOpExp2,
- EOpLog2,
- EOpSqrt,
- EOpInverseSqrt,
-
- EOpAbs,
- EOpSign,
- EOpFloor,
- EOpTrunc,
- EOpRound,
- EOpRoundEven,
- EOpCeil,
- EOpFract,
- EOpMod,
- EOpModf,
- EOpMin,
- EOpMax,
- EOpClamp,
- EOpMix,
- EOpStep,
- EOpSmoothStep,
- EOpIsNan,
- EOpIsInf,
- EOpFloatBitsToInt,
- EOpFloatBitsToUint,
- EOpIntBitsToFloat,
- EOpUintBitsToFloat,
- EOpPackSnorm2x16,
- EOpPackUnorm2x16,
- EOpPackHalf2x16,
- EOpUnpackSnorm2x16,
- EOpUnpackUnorm2x16,
- EOpUnpackHalf2x16,
-
- EOpLength,
- EOpDistance,
- EOpDot,
- EOpCross,
- EOpNormalize,
- EOpFaceForward,
- EOpReflect,
- EOpRefract,
-
- EOpDFdx, // Fragment only, OES_standard_derivatives extension
- EOpDFdy, // Fragment only, OES_standard_derivatives extension
- EOpFwidth, // Fragment only, OES_standard_derivatives extension
-
- EOpMatrixTimesMatrix,
-
- EOpAny,
- EOpAll,
-
- //
- // Branch
- //
-
- EOpKill, // Fragment only
- EOpReturn,
- EOpBreak,
- EOpContinue,
-
- //
- // Constructors
- //
-
- EOpConstructInt,
- EOpConstructUInt,
- EOpConstructBool,
- EOpConstructFloat,
- EOpConstructVec2,
- EOpConstructVec3,
- EOpConstructVec4,
- EOpConstructBVec2,
- EOpConstructBVec3,
- EOpConstructBVec4,
- EOpConstructIVec2,
- EOpConstructIVec3,
- EOpConstructIVec4,
- EOpConstructUVec2,
- EOpConstructUVec3,
- EOpConstructUVec4,
- EOpConstructMat2,
- EOpConstructMat2x3,
- EOpConstructMat2x4,
- EOpConstructMat3x2,
- EOpConstructMat3,
- EOpConstructMat3x4,
- EOpConstructMat4x2,
- EOpConstructMat4x3,
- EOpConstructMat4,
- EOpConstructStruct,
-
- //
- // moves
- //
-
- EOpAssign,
- EOpInitialize,
- EOpAddAssign,
- EOpSubAssign,
- EOpMulAssign,
- EOpVectorTimesMatrixAssign,
- EOpVectorTimesScalarAssign,
- EOpMatrixTimesScalarAssign,
- EOpMatrixTimesMatrixAssign,
- EOpDivAssign,
- EOpIModAssign,
- EOpBitShiftLeftAssign,
- EOpBitShiftRightAssign,
- EOpBitwiseAndAssign,
- EOpBitwiseXorAssign,
- EOpBitwiseOrAssign
-};
-
-extern TOperator TypeToConstructorOperator(const TType &type);
-extern const char* getOperatorString(TOperator op);
-
-class TIntermTraverser;
-class TIntermAggregate;
-class TIntermBinary;
-class TIntermUnary;
-class TIntermConstantUnion;
-class TIntermSelection;
-class TIntermTyped;
-class TIntermSymbol;
-class TIntermLoop;
-class TIntermBranch;
-class TInfoSink;
-class TIntermSwitch;
-class TIntermCase;
-
-//
-// Base class for the tree nodes
-//
-class TIntermNode {
-public:
- POOL_ALLOCATOR_NEW_DELETE()
-
- TIntermNode()
- {
- // TODO: Move this to TSourceLoc constructor
- // after getting rid of TPublicType.
- line.first_file = line.last_file = 0;
- line.first_line = line.last_line = 0;
- }
-
- const TSourceLoc& getLine() const { return line; }
- void setLine(const TSourceLoc& l) { line = l; }
-
- virtual void traverse(TIntermTraverser*) = 0;
- virtual TIntermTyped* getAsTyped() { return 0; }
- virtual TIntermConstantUnion* getAsConstantUnion() { return 0; }
- virtual TIntermAggregate* getAsAggregate() { return 0; }
- virtual TIntermBinary* getAsBinaryNode() { return 0; }
- virtual TIntermUnary* getAsUnaryNode() { return 0; }
- virtual TIntermSelection* getAsSelectionNode() { return 0; }
- virtual TIntermSymbol* getAsSymbolNode() { return 0; }
- virtual TIntermLoop* getAsLoopNode() { return 0; }
- virtual TIntermBranch* getAsBranchNode() { return 0; }
- virtual TIntermSwitch *getAsSwitchNode() { return 0; }
- virtual TIntermCase *getAsCaseNode() { return 0; }
- virtual ~TIntermNode() { }
-
-protected:
- TSourceLoc line;
-};
-
-//
-// This is just to help yacc.
-//
-struct TIntermNodePair {
- TIntermNode* node1;
- TIntermNode* node2;
-};
-
-//
-// Intermediate class for nodes that have a type.
-//
-class TIntermTyped : public TIntermNode {
-public:
- TIntermTyped(const TType& t) : type(t) { }
- virtual TIntermTyped* getAsTyped() { return this; }
-
- virtual void setType(const TType& t) { type = t; }
- const TType& getType() const { return type; }
- TType* getTypePointer() { return &type; }
-
- TBasicType getBasicType() const { return type.getBasicType(); }
- TQualifier getQualifier() const { return type.getQualifier(); }
- TPrecision getPrecision() const { return type.getPrecision(); }
- int getNominalSize() const { return type.getNominalSize(); }
- int getSecondarySize() const { return type.getSecondarySize(); }
-
- bool isInterfaceBlock() const { return type.isInterfaceBlock(); }
- bool isMatrix() const { return type.isMatrix(); }
- bool isArray() const { return type.isArray(); }
- bool isVector() const { return type.isVector(); }
- bool isScalar() const { return type.isScalar(); }
- bool isScalarInt() const { return type.isScalarInt(); }
- bool isRegister() const { return type.isRegister(); } // Fits in a 4-element register
- bool isStruct() const { return type.isStruct(); }
- const char* getBasicString() const { return type.getBasicString(); }
- const char* getQualifierString() const { return type.getQualifierString(); }
- TString getCompleteString() const { return type.getCompleteString(); }
-
- int totalRegisterCount() const { return type.totalRegisterCount(); }
- int blockRegisterCount(bool samplersOnly) const { return samplersOnly ? type.totalSamplerRegisterCount() : type.blockRegisterCount(); }
- int elementRegisterCount() const { return type.elementRegisterCount(); }
- int registerSize() const { return type.registerSize(); }
- int getArraySize() const { return type.getArraySize(); }
-
- static TIntermTyped *CreateIndexNode(int index);
-protected:
- TType type;
-};
-
-//
-// Handle for, do-while, and while loops.
-//
-enum TLoopType {
- ELoopFor,
- ELoopWhile,
- ELoopDoWhile
-};
-
-class TIntermLoop : public TIntermNode {
-public:
- TIntermLoop(TLoopType aType,
- TIntermNode *aInit, TIntermTyped* aCond, TIntermTyped* aExpr,
- TIntermNode* aBody) :
- type(aType),
- init(aInit),
- cond(aCond),
- expr(aExpr),
- body(aBody),
- unrollFlag(false) { }
-
- virtual TIntermLoop* getAsLoopNode() { return this; }
- virtual void traverse(TIntermTraverser*);
-
- TLoopType getType() const { return type; }
- TIntermNode* getInit() { return init; }
- TIntermTyped* getCondition() { return cond; }
- TIntermTyped* getExpression() { return expr; }
- TIntermNode* getBody() { return body; }
-
- void setUnrollFlag(bool flag) { unrollFlag = flag; }
- bool getUnrollFlag() { return unrollFlag; }
-
-protected:
- TLoopType type;
- TIntermNode* init; // for-loop initialization
- TIntermTyped* cond; // loop exit condition
- TIntermTyped* expr; // for-loop expression
- TIntermNode* body; // loop body
-
- bool unrollFlag; // Whether the loop should be unrolled or not.
-};
-
-//
-// Handle break, continue, return, and kill.
-//
-class TIntermBranch : public TIntermNode {
-public:
- TIntermBranch(TOperator op, TIntermTyped* e) :
- flowOp(op),
- expression(e) { }
-
- virtual TIntermBranch* getAsBranchNode() { return this; }
- virtual void traverse(TIntermTraverser*);
-
- TOperator getFlowOp() { return flowOp; }
- TIntermTyped* getExpression() { return expression; }
-
-protected:
- TOperator flowOp;
- TIntermTyped* expression; // non-zero except for "return exp;" statements
-};
-
-//
-// Nodes that correspond to symbols or constants in the source code.
-//
-class TIntermSymbol : public TIntermTyped {
-public:
- // if symbol is initialized as symbol(sym), the memory comes from the poolallocator of sym. If sym comes from
- // per process globalpoolallocator, then it causes increased memory usage per compile
- // it is essential to use "symbol = sym" to assign to symbol
- TIntermSymbol(int i, const TString& sym, const TType& t) :
- TIntermTyped(t), id(i) { symbol = sym; }
-
- int getId() const { return id; }
- const TString& getSymbol() const { return symbol; }
-
- void setId(int newId) { id = newId; }
-
- virtual void traverse(TIntermTraverser*);
- virtual TIntermSymbol* getAsSymbolNode() { return this; }
-
-protected:
- int id;
- TString symbol;
-};
-
-class TIntermConstantUnion : public TIntermTyped {
-public:
- TIntermConstantUnion(ConstantUnion *unionPointer, const TType& t) : TIntermTyped(t), unionArrayPointer(unionPointer)
- {
- getTypePointer()->setQualifier(EvqConstExpr);
- }
-
- ConstantUnion* getUnionArrayPointer() const { return unionArrayPointer; }
-
- int getIConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getIConst() : 0; }
- int getUConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getUConst() : 0; }
- float getFConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getFConst() : 0.0f; }
- bool getBConst(int index) const { return unionArrayPointer ? unionArrayPointer[index].getBConst() : false; }
-
- // Previous union pointer freed on pool deallocation.
- void replaceConstantUnion(ConstantUnion *safeConstantUnion) { unionArrayPointer = safeConstantUnion; }
-
- virtual TIntermConstantUnion* getAsConstantUnion() { return this; }
- virtual void traverse(TIntermTraverser*);
-
- TIntermTyped* fold(TOperator, TIntermTyped*, TInfoSink&);
-
-protected:
- ConstantUnion *unionArrayPointer;
-};
-
-//
-// Intermediate class for node types that hold operators.
-//
-class TIntermOperator : public TIntermTyped {
-public:
- TOperator getOp() const { return op; }
- void setOp(TOperator o) { op = o; }
-
- bool modifiesState() const;
- bool isConstructor() const;
-
-protected:
- TIntermOperator(TOperator o) : TIntermTyped(TType(EbtFloat, EbpUndefined)), op(o) {}
- TIntermOperator(TOperator o, TType& t) : TIntermTyped(t), op(o) {}
- TOperator op;
-};
-
-//
-// Nodes for all the basic binary math operators.
-//
-class TIntermBinary : public TIntermOperator {
-public:
- TIntermBinary(TOperator o) : TIntermOperator(o) {}
-
- TIntermBinary* getAsBinaryNode() override { return this; }
- void traverse(TIntermTraverser*) override;
-
- void setType(const TType &t) override
- {
- type = t;
-
- if(left->getQualifier() == EvqConstExpr && right->getQualifier() == EvqConstExpr)
- {
- type.setQualifier(EvqConstExpr);
- }
- }
-
- void setLeft(TIntermTyped* n) { left = n; }
- void setRight(TIntermTyped* n) { right = n; }
- TIntermTyped* getLeft() const { return left; }
- TIntermTyped* getRight() const { return right; }
- bool promote(TInfoSink&);
-
-protected:
- TIntermTyped* left;
- TIntermTyped* right;
-};
-
-//
-// Nodes for unary math operators.
-//
-class TIntermUnary : public TIntermOperator {
-public:
- TIntermUnary(TOperator o, TType& t) : TIntermOperator(o, t), operand(0) {}
- TIntermUnary(TOperator o) : TIntermOperator(o), operand(0) {}
-
- void setType(const TType &t) override
- {
- type = t;
-
- if(operand->getQualifier() == EvqConstExpr)
- {
- type.setQualifier(EvqConstExpr);
- }
- }
-
- void traverse(TIntermTraverser*) override;
- TIntermUnary* getAsUnaryNode() override { return this; }
-
- void setOperand(TIntermTyped* o) { operand = o; }
- TIntermTyped* getOperand() { return operand; }
- bool promote(TInfoSink&, const TType *funcReturnType);
-
-protected:
- TIntermTyped* operand;
-};
-
-typedef TVector<TIntermNode*> TIntermSequence;
-typedef TVector<int> TQualifierList;
-
-//
-// Nodes that operate on an arbitrary sized set of children.
-//
-class TIntermAggregate : public TIntermOperator {
-public:
- TIntermAggregate() : TIntermOperator(EOpNull), userDefined(false) { endLine = { 0, 0, 0, 0 }; }
- TIntermAggregate(TOperator o) : TIntermOperator(o), userDefined(false) { endLine = { 0, 0, 0, 0 }; }
- ~TIntermAggregate() { }
-
- TIntermAggregate* getAsAggregate() override { return this; }
- void traverse(TIntermTraverser*) override;
-
- TIntermSequence& getSequence() { return sequence; }
-
- void setType(const TType &t) override
- {
- type = t;
-
- if(op != EOpFunctionCall)
- {
- for(TIntermNode *node : sequence)
- {
- if(!node->getAsTyped() || node->getAsTyped()->getQualifier() != EvqConstExpr)
- {
- return;
- }
- }
-
- type.setQualifier(EvqConstExpr);
- }
- }
-
- void setName(const TString& n) { name = n; }
- const TString& getName() const { return name; }
-
- void setUserDefined() { userDefined = true; }
- bool isUserDefined() const { return userDefined; }
-
- void setOptimize(bool o) { optimize = o; }
- bool getOptimize() { return optimize; }
- void setDebug(bool d) { debug = d; }
- bool getDebug() { return debug; }
-
- void setEndLine(const TSourceLoc& line) { endLine = line; }
- const TSourceLoc& getEndLine() const { return endLine; }
-
- bool isConstantFoldable()
- {
- for(TIntermNode *node : sequence)
- {
- if(!node->getAsConstantUnion() || !node->getAsConstantUnion()->getUnionArrayPointer())
- {
- return false;
- }
- }
-
- return true;
- }
-
-protected:
- TIntermAggregate(const TIntermAggregate&); // disallow copy constructor
- TIntermAggregate& operator=(const TIntermAggregate&); // disallow assignment operator
- TIntermSequence sequence;
- TString name;
- bool userDefined; // used for user defined function names
-
- bool optimize;
- bool debug;
- TSourceLoc endLine;
-};
-
-//
-// For if tests. Simplified since there is no switch statement.
-//
-class TIntermSelection : public TIntermTyped {
-public:
- TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB) :
- TIntermTyped(TType(EbtVoid, EbpUndefined)), condition(cond), trueBlock(trueB), falseBlock(falseB) {}
- TIntermSelection(TIntermTyped* cond, TIntermNode* trueB, TIntermNode* falseB, const TType& type) :
- TIntermTyped(type), condition(cond), trueBlock(trueB), falseBlock(falseB)
- {
- this->type.setQualifier(EvqTemporary);
- }
-
- virtual void traverse(TIntermTraverser*);
-
- bool usesTernaryOperator() const { return getBasicType() != EbtVoid; }
- TIntermTyped* getCondition() const { return condition; }
- TIntermNode* getTrueBlock() const { return trueBlock; }
- TIntermNode* getFalseBlock() const { return falseBlock; }
- TIntermSelection* getAsSelectionNode() { return this; }
-
-protected:
- TIntermTyped* condition;
- TIntermNode* trueBlock;
- TIntermNode* falseBlock;
-};
-
-//
-// Switch statement.
-//
-class TIntermSwitch : public TIntermNode
-{
-public:
- TIntermSwitch(TIntermTyped *init, TIntermAggregate *statementList)
- : TIntermNode(), mInit(init), mStatementList(statementList)
- {}
-
- void traverse(TIntermTraverser *it);
-
- TIntermSwitch *getAsSwitchNode() { return this; }
-
- TIntermTyped *getInit() { return mInit; }
- TIntermAggregate *getStatementList() { return mStatementList; }
- void setStatementList(TIntermAggregate *statementList) { mStatementList = statementList; }
-
-protected:
- TIntermTyped *mInit;
- TIntermAggregate *mStatementList;
-};
-
-//
-// Case label.
-//
-class TIntermCase : public TIntermNode
-{
-public:
- TIntermCase(TIntermTyped *condition)
- : TIntermNode(), mCondition(condition)
- {}
-
- void traverse(TIntermTraverser *it);
-
- TIntermCase *getAsCaseNode() { return this; }
-
- bool hasCondition() const { return mCondition != nullptr; }
- TIntermTyped *getCondition() const { return mCondition; }
-
-protected:
- TIntermTyped *mCondition;
-};
-
-enum Visit
-{
- PreVisit,
- InVisit,
- PostVisit
-};
-
-//
-// For traversing the tree. User should derive from this,
-// put their traversal specific data in it, and then pass
-// it to a Traverse method.
-//
-// When using this, just fill in the methods for nodes you want visited.
-// Return false from a pre-visit to skip visiting that node's subtree.
-//
-class TIntermTraverser
-{
-public:
- POOL_ALLOCATOR_NEW_DELETE()
- TIntermTraverser(bool preVisit = true, bool inVisit = false, bool postVisit = false, bool rightToLeft = false) :
- preVisit(preVisit),
- inVisit(inVisit),
- postVisit(postVisit),
- rightToLeft(rightToLeft),
- mDepth(0) {}
- virtual ~TIntermTraverser() {}
-
- virtual void visitSymbol(TIntermSymbol*) {}
- virtual void visitConstantUnion(TIntermConstantUnion*) {}
- virtual bool visitBinary(Visit visit, TIntermBinary*) {return true;}
- virtual bool visitUnary(Visit visit, TIntermUnary*) {return true;}
- virtual bool visitSelection(Visit visit, TIntermSelection*) {return true;}
- virtual bool visitAggregate(Visit visit, TIntermAggregate*) {return true;}
- virtual bool visitLoop(Visit visit, TIntermLoop*) {return true;}
- virtual bool visitBranch(Visit visit, TIntermBranch*) {return true;}
- virtual bool visitSwitch(Visit, TIntermSwitch*) { return true; }
- virtual bool visitCase(Visit, TIntermCase*) { return true; }
-
- void incrementDepth(TIntermNode *current)
- {
- mDepth++;
- mPath.push_back(current);
- }
-
- void decrementDepth()
- {
- mDepth--;
- mPath.pop_back();
- }
-
- TIntermNode *getParentNode()
- {
- return mPath.size() == 0 ? nullptr : mPath.back();
- }
-
- const bool preVisit;
- const bool inVisit;
- const bool postVisit;
- const bool rightToLeft;
-
-protected:
- int mDepth;
-
- // All the nodes from root to the current node's parent during traversing.
- TVector<TIntermNode *> mPath;
-
-private:
- struct ParentBlock
- {
- ParentBlock(TIntermAggregate *nodeIn, TIntermSequence::size_type posIn)
- : node(nodeIn), pos(posIn)
- {}
-
- TIntermAggregate *node;
- TIntermSequence::size_type pos;
- };
- // All the code blocks from the root to the current node's parent during traversal.
- std::vector<ParentBlock> mParentBlockStack;
-};
-
-#endif // __INTERMEDIATE_H
diff --git a/src/OpenGL/compiler/localintermediate.h b/src/OpenGL/compiler/localintermediate.h
deleted file mode 100644
index 497cd5556..000000000
--- a/src/OpenGL/compiler/localintermediate.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef _LOCAL_INTERMEDIATE_INCLUDED_
-#define _LOCAL_INTERMEDIATE_INCLUDED_
-
-#include "intermediate.h"
-
-struct TVectorFields {
- int offsets[4];
- int num;
-};
-
-//
-// Set of helper functions to help parse and build the tree.
-//
-class TInfoSink;
-class TIntermediate {
-public:
- POOL_ALLOCATOR_NEW_DELETE()
-
- TIntermediate(TInfoSink& i) : infoSink(i) { }
- TIntermSymbol* addSymbol(int Id, const TString&, const TType&, const TSourceLoc&);
- TIntermTyped* addBinaryMath(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
- TIntermTyped* addAssign(TOperator op, TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
- TIntermTyped* addIndex(TOperator op, TIntermTyped* base, TIntermTyped* index, const TSourceLoc&);
- TIntermTyped* addUnaryMath(TOperator op, TIntermTyped* child, const TSourceLoc&, const TType*);
- TIntermAggregate* growAggregate(TIntermNode* left, TIntermNode* right, const TSourceLoc&);
- TIntermAggregate* makeAggregate(TIntermNode* node, const TSourceLoc&);
- TIntermAggregate* setAggregateOperator(TIntermNode*, TOperator, const TSourceLoc&);
- TIntermNode* addSelection(TIntermTyped* cond, TIntermNodePair code, const TSourceLoc&);
- TIntermTyped* addSelection(TIntermTyped* cond, TIntermTyped* trueBlock, TIntermTyped* falseBlock, const TSourceLoc&);
- TIntermSwitch *addSwitch(TIntermTyped *init, TIntermAggregate *statementList, const TSourceLoc &line);
- TIntermCase *addCase(TIntermTyped *condition, const TSourceLoc &line);
- TIntermTyped* addComma(TIntermTyped* left, TIntermTyped* right, const TSourceLoc&);
- TIntermConstantUnion* addConstantUnion(ConstantUnion*, const TType&, const TSourceLoc&);
- TIntermTyped* promoteConstantUnion(TBasicType, TIntermConstantUnion*);
- bool parseConstTree(const TSourceLoc&, TIntermNode*, ConstantUnion*, TOperator, TType, bool singleConstantParam = false);
- TIntermNode* addLoop(TLoopType, TIntermNode*, TIntermTyped*, TIntermTyped*, TIntermNode*, const TSourceLoc&);
- TIntermBranch* addBranch(TOperator, const TSourceLoc&);
- TIntermBranch* addBranch(TOperator, TIntermTyped*, const TSourceLoc&);
- TIntermTyped* addSwizzle(TVectorFields&, const TSourceLoc&);
- bool postProcess(TIntermNode*);
- void outputTree(TIntermNode*);
-
-protected:
- TInfoSink& infoSink;
-
-private:
- void operator=(TIntermediate&); // prevent assignments
-};
-
-#endif // _LOCAL_INTERMEDIATE_INCLUDED_
diff --git a/src/OpenGL/compiler/osinclude.h b/src/OpenGL/compiler/osinclude.h
deleted file mode 100644
index 54d4c7502..000000000
--- a/src/OpenGL/compiler/osinclude.h
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef __OSINCLUDE_H
-#define __OSINCLUDE_H
-
-//
-// This file contains contains os-specific datatypes and
-// declares any os-specific functions.
-//
-
-#if defined(_WIN32) || defined(_WIN64)
-#define ANGLE_OS_WIN
-#elif defined(__APPLE__) || defined(__linux__) || \
- defined(__FreeBSD__) || defined(__OpenBSD__) || \
- defined(__sun) || defined(ANDROID) || \
- defined(__GLIBC__) || defined(__GNU__) || \
- defined(__QNX__) || defined(__Fuchsia__)
-#define ANGLE_OS_POSIX
-#else
-#error Unsupported platform.
-#endif
-
-#if defined(ANGLE_OS_WIN)
-#define STRICT
-#define VC_EXTRALEAN 1
-#include <windows.h>
-#elif defined(ANGLE_OS_POSIX)
-#include <pthread.h>
-#include <semaphore.h>
-#include <errno.h>
-#endif // ANGLE_OS_WIN
-
-
-#include "debug.h"
-
-//
-// Thread Local Storage Operations
-//
-#if defined(ANGLE_OS_WIN)
-typedef DWORD OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX (TLS_OUT_OF_INDEXES)
-#elif defined(ANGLE_OS_POSIX)
-typedef pthread_key_t OS_TLSIndex;
-#define OS_INVALID_TLS_INDEX (static_cast<OS_TLSIndex>(-1))
-#endif // ANGLE_OS_WIN
-
-OS_TLSIndex OS_AllocTLSIndex();
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue);
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex);
-
-inline void* OS_GetTLSValue(OS_TLSIndex nIndex)
-{
- ASSERT(nIndex != OS_INVALID_TLS_INDEX);
-#if defined(ANGLE_OS_WIN)
- return TlsGetValue(nIndex);
-#elif defined(ANGLE_OS_POSIX)
- return pthread_getspecific(nIndex);
-#endif // ANGLE_OS_WIN
-}
-
-#endif // __OSINCLUDE_H
diff --git a/src/OpenGL/compiler/ossource_posix.cpp b/src/OpenGL/compiler/ossource_posix.cpp
deleted file mode 100644
index 0e12fdafd..000000000
--- a/src/OpenGL/compiler/ossource_posix.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// This file contains the posix specific functions
-//
-#include "osinclude.h"
-
-#if !defined(ANGLE_OS_POSIX)
-#error Trying to build a posix specific file in a non-posix build.
-#endif
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
- pthread_key_t pPoolIndex;
-
- //
- // Create global pool key.
- //
- if ((pthread_key_create(&pPoolIndex, NULL)) != 0) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return false;
- }
- else {
- return pPoolIndex;
- }
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (pthread_setspecific(nIndex, lpvValue) == 0)
- return true;
- else
- return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- //
- // Delete the global pool key.
- //
- if (pthread_key_delete(nIndex) == 0)
- return true;
- else
- return false;
-}
diff --git a/src/OpenGL/compiler/ossource_win.cpp b/src/OpenGL/compiler/ossource_win.cpp
deleted file mode 100644
index a442167f1..000000000
--- a/src/OpenGL/compiler/ossource_win.cpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "osinclude.h"
-//
-// This file contains contains the window's specific functions
-//
-
-#if !defined(ANGLE_OS_WIN)
-#error Trying to build a windows specific file in a non windows build.
-#endif
-
-
-//
-// Thread Local Storage Operations
-//
-OS_TLSIndex OS_AllocTLSIndex()
-{
- DWORD dwIndex = TlsAlloc();
- if (dwIndex == TLS_OUT_OF_INDEXES) {
- assert(0 && "OS_AllocTLSIndex(): Unable to allocate Thread Local Storage");
- return OS_INVALID_TLS_INDEX;
- }
-
- return dwIndex;
-}
-
-
-bool OS_SetTLSValue(OS_TLSIndex nIndex, void *lpvValue)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (TlsSetValue(nIndex, lpvValue))
- return true;
- else
- return false;
-}
-
-
-bool OS_FreeTLSIndex(OS_TLSIndex nIndex)
-{
- if (nIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "OS_SetTLSValue(): Invalid TLS Index");
- return false;
- }
-
- if (TlsFree(nIndex))
- return true;
- else
- return false;
-}
diff --git a/src/OpenGL/compiler/parseConst.cpp b/src/OpenGL/compiler/parseConst.cpp
deleted file mode 100644
index 26af4086f..000000000
--- a/src/OpenGL/compiler/parseConst.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ParseHelper.h"
-
-//
-// Use this class to carry along data from node to node in
-// the traversal
-//
-class TConstTraverser : public TIntermTraverser {
-public:
- TConstTraverser(ConstantUnion* cUnion, bool singleConstParam, TOperator constructType, TInfoSink& sink, TType& t)
- : error(false),
- index(0),
- unionArray(cUnion),
- type(t),
- constructorType(constructType),
- singleConstantParam(singleConstParam),
- infoSink(sink),
- size(0),
- isMatrix(false),
- matrixRows(0) {
- }
-
- bool error;
-
-protected:
- void visitSymbol(TIntermSymbol*);
- void visitConstantUnion(TIntermConstantUnion*);
- bool visitBinary(Visit visit, TIntermBinary*);
- bool visitUnary(Visit visit, TIntermUnary*);
- bool visitSelection(Visit visit, TIntermSelection*);
- bool visitAggregate(Visit visit, TIntermAggregate*);
- bool visitLoop(Visit visit, TIntermLoop*);
- bool visitBranch(Visit visit, TIntermBranch*);
-
- size_t index;
- ConstantUnion *unionArray;
- TType type;
- TOperator constructorType;
- bool singleConstantParam;
- TInfoSink& infoSink;
- size_t size; // size of the constructor ( 4 for vec4)
- bool isMatrix;
- int matrixRows; // number of rows in the matrix (nominal size and not the instance size)
-};
-
-//
-// The rest of the file are the traversal functions. The last one
-// is the one that starts the traversal.
-//
-// Return true from interior nodes to have the external traversal
-// continue on to children. If you process children yourself,
-// return false.
-//
-
-void TConstTraverser::visitSymbol(TIntermSymbol* node)
-{
- infoSink.info.message(EPrefixInternalError, "Symbol Node found in constant constructor", node->getLine());
- return;
-}
-
-bool TConstTraverser::visitBinary(Visit visit, TIntermBinary* node)
-{
- TQualifier qualifier = node->getType().getQualifier();
-
- if (qualifier != EvqConstExpr) {
- TString buf;
- buf.append("'constructor' : assigning non-constant to ");
- buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
- error = true;
- return false;
- }
-
- infoSink.info.message(EPrefixInternalError, "Binary Node found in constant constructor", node->getLine());
-
- return false;
-}
-
-bool TConstTraverser::visitUnary(Visit visit, TIntermUnary* node)
-{
- TString buf;
- buf.append("'constructor' : assigning non-constant to ");
- buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
- error = true;
- return false;
-}
-
-bool TConstTraverser::visitAggregate(Visit visit, TIntermAggregate* node)
-{
- if (!node->isConstructor() && node->getOp() != EOpComma) {
- TString buf;
- buf.append("'constructor' : assigning non-constant to ");
- buf.append(type.getCompleteString());
- infoSink.info.message(EPrefixError, buf.c_str(), node->getLine());
- error = true;
- return false;
- }
-
- if (node->getSequence().size() == 0) {
- error = true;
- return false;
- }
-
- bool flag = node->getSequence().size() == 1 && node->getSequence()[0]->getAsTyped()->getAsConstantUnion();
- if (flag)
- {
- singleConstantParam = true;
- constructorType = node->getOp();
- size = node->getType().getObjectSize();
-
- if (node->getType().isMatrix()) {
- isMatrix = true;
- matrixRows = node->getType().getSecondarySize();
- }
- }
-
- for (TIntermSequence::iterator p = node->getSequence().begin();
- p != node->getSequence().end(); p++) {
-
- if (node->getOp() == EOpComma)
- index = 0;
-
- (*p)->traverse(this);
- }
- if (flag)
- {
- singleConstantParam = false;
- constructorType = EOpNull;
- size = 0;
- isMatrix = false;
- matrixRows = 0;
- }
- return false;
-}
-
-bool TConstTraverser::visitSelection(Visit visit, TIntermSelection* node)
-{
- infoSink.info.message(EPrefixInternalError, "Selection Node found in constant constructor", node->getLine());
- error = true;
- return false;
-}
-
-void TConstTraverser::visitConstantUnion(TIntermConstantUnion* node)
-{
- if (!node->getUnionArrayPointer())
- {
- // The constant was not initialized, this should already have been logged
- assert(infoSink.info.size() != 0);
- return;
- }
-
- ConstantUnion* leftUnionArray = unionArray;
- size_t instanceSize = type.getObjectSize();
- TBasicType basicType = type.getBasicType();
-
- if (index >= instanceSize)
- return;
-
- if (!singleConstantParam) {
- size_t size = node->getType().getObjectSize();
-
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- for(size_t i = 0; i < size; i++) {
- if (index >= instanceSize)
- return;
- leftUnionArray[index].cast(basicType, rightUnionArray[i]);
-
- (index)++;
- }
- } else {
- size_t totalSize = index + size;
- ConstantUnion *rightUnionArray = node->getUnionArrayPointer();
- if (!isMatrix) {
- int count = 0;
- for(size_t i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
-
- leftUnionArray[i].cast(basicType, rightUnionArray[count]);
-
- (index)++;
-
- if (node->getType().getObjectSize() > 1)
- count++;
- }
- } else { // for matrix constructors
- int count = 0;
- int element = index;
- for(size_t i = index; i < totalSize; i++) {
- if (i >= instanceSize)
- return;
- if (element - i == 0 || (i - element) % (matrixRows + 1) == 0 )
- leftUnionArray[i].cast(basicType, rightUnionArray[0]);
- else
- leftUnionArray[i].setFConst(0.0f);
-
- (index)++;
-
- if (node->getType().getObjectSize() > 1)
- count++;
- }
- }
- }
-}
-
-bool TConstTraverser::visitLoop(Visit visit, TIntermLoop* node)
-{
- infoSink.info.message(EPrefixInternalError, "Loop Node found in constant constructor", node->getLine());
- error = true;
- return false;
-}
-
-bool TConstTraverser::visitBranch(Visit visit, TIntermBranch* node)
-{
- infoSink.info.message(EPrefixInternalError, "Branch Node found in constant constructor", node->getLine());
- error = true;
- return false;
-}
-
-//
-// This function is the one to call externally to start the traversal.
-// Individual functions can be initialized to 0 to skip processing of that
-// type of node. It's children will still be processed.
-//
-bool TIntermediate::parseConstTree(const TSourceLoc& line, TIntermNode* root, ConstantUnion* unionArray, TOperator constructorType, TType t, bool singleConstantParam)
-{
- if (root == 0)
- return false;
-
- TConstTraverser it(unionArray, singleConstantParam, constructorType, infoSink, t);
-
- root->traverse(&it);
- if (it.error)
- return true;
- else
- return false;
-}
diff --git a/src/OpenGL/compiler/preprocessor/BUILD.gn b/src/OpenGL/compiler/preprocessor/BUILD.gn
deleted file mode 100644
index e947c310b..000000000
--- a/src/OpenGL/compiler/preprocessor/BUILD.gn
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import("../../../swiftshader.gni")
-
-# Need a separate config to ensure the warnings are added to the end.
-config("swiftshader_opengl_preprocessor_private_config") {
- if (is_win) {
- cflags = [
- "/wd4005", # macro redefinition (in autogenerated code)
- "/wd4267", # conversion from size_t to int/unsigned int (in autogenerated code)
- "/wd4702", # unreachable code (in autogenerated code)
- ]
- }
-}
-
-swiftshader_source_set("swiftshader_opengl_preprocessor") {
- sources = [
- "DiagnosticsBase.cpp",
- "DirectiveHandlerBase.cpp",
- "DirectiveParser.cpp",
- "ExpressionParser.cpp",
- "Input.cpp",
- "Lexer.cpp",
- "Macro.cpp",
- "MacroExpander.cpp",
- "Preprocessor.cpp",
- "Token.cpp",
- "Tokenizer.cpp",
- ]
-
- configs = [ ":swiftshader_opengl_preprocessor_private_config" ]
-}
diff --git a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.cpp b/src/OpenGL/compiler/preprocessor/DiagnosticsBase.cpp
deleted file mode 100644
index 0cea776da..000000000
--- a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "DiagnosticsBase.h"
-
-#include <cassert>
-
-namespace pp
-{
-
-Diagnostics::~Diagnostics()
-{
-}
-
-void Diagnostics::report(ID id, const SourceLocation &loc, const std::string &text)
-{
- print(id, loc, text);
-}
-
-bool Diagnostics::isError(ID id)
-{
- if ((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
- return true;
-
- if ((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
- return false;
-
- assert(false);
- return true;
-}
-
-Diagnostics::Severity Diagnostics::severity(ID id)
-{
- if((id > PP_ERROR_BEGIN) && (id < PP_ERROR_END))
- return PP_ERROR;
-
- if((id > PP_WARNING_BEGIN) && (id < PP_WARNING_END))
- return PP_WARNING;
-
- assert(false);
- return PP_ERROR;
-}
-
-const char *Diagnostics::message(ID id)
-{
- switch (id)
- {
- // Errors begin.
- case PP_INTERNAL_ERROR:
- return "internal error";
- case PP_OUT_OF_MEMORY:
- return "out of memory";
- case PP_INVALID_CHARACTER:
- return "invalid character";
- case PP_INVALID_NUMBER:
- return "invalid number";
- case PP_INTEGER_OVERFLOW:
- return "integer overflow";
- case PP_FLOAT_OVERFLOW:
- return "float overflow";
- case PP_TOKEN_TOO_LONG:
- return "token too long";
- case PP_INVALID_EXPRESSION:
- return "invalid expression";
- case PP_DIVISION_BY_ZERO:
- return "division by zero";
- case PP_EOF_IN_COMMENT:
- return "unexpected end of file found in comment";
- case PP_UNEXPECTED_TOKEN:
- return "unexpected token";
- case PP_DIRECTIVE_INVALID_NAME:
- return "invalid directive name";
- case PP_MACRO_NAME_RESERVED:
- return "macro name is reserved";
- case PP_MACRO_REDEFINED:
- return "macro redefined";
- case PP_MACRO_PREDEFINED_REDEFINED:
- return "predefined macro redefined";
- case PP_MACRO_PREDEFINED_UNDEFINED:
- return "predefined macro undefined";
- case PP_MACRO_UNTERMINATED_INVOCATION:
- return "unterminated macro invocation";
- case PP_MACRO_UNDEFINED_WHILE_INVOKED:
- return "macro undefined while being invoked";
- case PP_MACRO_TOO_FEW_ARGS:
- return "Not enough arguments for macro";
- case PP_MACRO_TOO_MANY_ARGS:
- return "Too many arguments for macro";
- case PP_MACRO_DUPLICATE_PARAMETER_NAMES:
- return "duplicate macro parameter name";
- case PP_MACRO_INVOCATION_CHAIN_TOO_DEEP:
- return "macro invocation chain too deep";
- case PP_CONDITIONAL_ENDIF_WITHOUT_IF:
- return "unexpected #endif found without a matching #if";
- case PP_CONDITIONAL_ELSE_WITHOUT_IF:
- return "unexpected #else found without a matching #if";
- case PP_CONDITIONAL_ELSE_AFTER_ELSE:
- return "unexpected #else found after another #else";
- case PP_CONDITIONAL_ELIF_WITHOUT_IF:
- return "unexpected #elif found without a matching #if";
- case PP_CONDITIONAL_ELIF_AFTER_ELSE:
- return "unexpected #elif found after #else";
- case PP_CONDITIONAL_UNTERMINATED:
- return "unexpected end of file found in conditional block";
- case PP_INVALID_EXTENSION_NAME:
- return "invalid extension name";
- case PP_INVALID_EXTENSION_BEHAVIOR:
- return "invalid extension behavior";
- case PP_INVALID_EXTENSION_DIRECTIVE:
- return "invalid extension directive";
- case PP_INVALID_VERSION_NUMBER:
- return "invalid version number";
- case PP_INVALID_VERSION_DIRECTIVE:
- return "invalid version directive";
- case PP_VERSION_NOT_FIRST_STATEMENT:
- return "#version directive must occur before anything else, "
- "except for comments and white space";
- case PP_VERSION_NOT_FIRST_LINE_ESSL3:
- return "#version directive must occur on the first line of the shader";
- case PP_INVALID_LINE_NUMBER:
- return "invalid line number";
- case PP_INVALID_FILE_NUMBER:
- return "invalid file number";
- case PP_INVALID_LINE_DIRECTIVE:
- return "invalid line directive";
- case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3:
- return "extension directive must occur before any non-preprocessor tokens in ESSL3";
- case PP_UNDEFINED_SHIFT:
- return "shift exponent is negative or undefined";
- case PP_TOKENIZER_ERROR:
- return "internal tokenizer error";
- // Errors end.
- // Warnings begin.
- case PP_EOF_IN_DIRECTIVE:
- return "unexpected end of file found in directive";
- case PP_CONDITIONAL_UNEXPECTED_TOKEN:
- return "unexpected token after conditional expression";
- case PP_UNRECOGNIZED_PRAGMA:
- return "unrecognized pragma";
- case PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1:
- return "extension directive should occur before any non-preprocessor tokens";
- case PP_WARNING_MACRO_NAME_RESERVED:
- return "macro name with a double underscore is reserved - unintented behavior is "
- "possible";
- // Warnings end.
- default:
- assert(false);
- return "";
- }
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h b/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h
deleted file mode 100644
index d581d77c5..000000000
--- a/src/OpenGL/compiler/preprocessor/DiagnosticsBase.h
+++ /dev/null
@@ -1,107 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
-#define COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
-
-#include <string>
-
-namespace pp
-{
-
-struct SourceLocation;
-
-// Base class for reporting diagnostic messages.
-// Derived classes are responsible for formatting and printing the messages.
-class Diagnostics
-{
-public:
- // Severity is used to classify info log messages.
- enum Severity
- {
- PP_INFO,
- PP_WARNING,
- PP_ERROR
- };
-
- enum ID
- {
- PP_ERROR_BEGIN,
- PP_INTERNAL_ERROR,
- PP_OUT_OF_MEMORY,
- PP_INVALID_CHARACTER,
- PP_INVALID_NUMBER,
- PP_INTEGER_OVERFLOW,
- PP_FLOAT_OVERFLOW,
- PP_TOKEN_TOO_LONG,
- PP_INVALID_EXPRESSION,
- PP_DIVISION_BY_ZERO,
- PP_EOF_IN_COMMENT,
- PP_UNEXPECTED_TOKEN,
- PP_DIRECTIVE_INVALID_NAME,
- PP_MACRO_NAME_RESERVED,
- PP_MACRO_REDEFINED,
- PP_MACRO_PREDEFINED_REDEFINED,
- PP_MACRO_PREDEFINED_UNDEFINED,
- PP_MACRO_UNTERMINATED_INVOCATION,
- PP_MACRO_UNDEFINED_WHILE_INVOKED,
- PP_MACRO_TOO_FEW_ARGS,
- PP_MACRO_TOO_MANY_ARGS,
- PP_MACRO_DUPLICATE_PARAMETER_NAMES,
- PP_MACRO_INVOCATION_CHAIN_TOO_DEEP,
- PP_CONDITIONAL_ENDIF_WITHOUT_IF,
- PP_CONDITIONAL_ELSE_WITHOUT_IF,
- PP_CONDITIONAL_ELSE_AFTER_ELSE,
- PP_CONDITIONAL_ELIF_WITHOUT_IF,
- PP_CONDITIONAL_ELIF_AFTER_ELSE,
- PP_CONDITIONAL_UNTERMINATED,
- PP_CONDITIONAL_UNEXPECTED_TOKEN,
- PP_INVALID_EXTENSION_NAME,
- PP_INVALID_EXTENSION_BEHAVIOR,
- PP_INVALID_EXTENSION_DIRECTIVE,
- PP_INVALID_VERSION_NUMBER,
- PP_INVALID_VERSION_DIRECTIVE,
- PP_VERSION_NOT_FIRST_STATEMENT,
- PP_VERSION_NOT_FIRST_LINE_ESSL3,
- PP_INVALID_LINE_NUMBER,
- PP_INVALID_FILE_NUMBER,
- PP_INVALID_LINE_DIRECTIVE,
- PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
- PP_UNDEFINED_SHIFT,
- PP_TOKENIZER_ERROR,
- PP_ERROR_END,
-
- PP_WARNING_BEGIN,
- PP_EOF_IN_DIRECTIVE,
- PP_UNRECOGNIZED_PRAGMA,
- PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
- PP_WARNING_MACRO_NAME_RESERVED,
- PP_WARNING_END
- };
-
- virtual ~Diagnostics();
-
- void report(ID id, const SourceLocation &loc, const std::string &text);
-
-protected:
- bool isError(ID id);
- const char *message(ID id);
- Severity severity(ID id);
-
- virtual void print(ID id, const SourceLocation &loc, const std::string &text) = 0;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_DIAGNOSTICSBASE_H_
diff --git a/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp b/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp
deleted file mode 100644
index e1f10155c..000000000
--- a/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "DirectiveHandlerBase.h"
-
-namespace pp
-{
-
-DirectiveHandler::~DirectiveHandler()
-{
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.h b/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.h
deleted file mode 100644
index 54ddc9d7f..000000000
--- a/src/OpenGL/compiler/preprocessor/DirectiveHandlerBase.h
+++ /dev/null
@@ -1,51 +0,0 @@
-// Copyright 2017 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
-
-#include <string>
-
-namespace pp
-{
-
-struct SourceLocation;
-
-// Base class for handling directives.
-// Preprocessor uses this class to notify the clients about certain
-// preprocessor directives. Derived classes are responsible for
-// handling them in an appropriate manner.
-class DirectiveHandler
-{
- public:
- virtual ~DirectiveHandler();
-
- virtual void handleError(const SourceLocation &loc, const std::string &msg) = 0;
-
- // Handle pragma of form: #pragma name[(value)]
- virtual void handlePragma(const SourceLocation &loc,
- const std::string &name,
- const std::string &value,
- bool stdgl) = 0;
-
- virtual void handleExtension(const SourceLocation &loc,
- const std::string &name,
- const std::string &behavior) = 0;
-
- virtual void handleVersion(const SourceLocation &loc, int version) = 0;
-};
-
-} // namespace pp
-
-#endif // COMPILER_PREPROCESSOR_DIRECTIVEHANDLERBASE_H_
diff --git a/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp b/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp
deleted file mode 100644
index ed2ec0746..000000000
--- a/src/OpenGL/compiler/preprocessor/DirectiveParser.cpp
+++ /dev/null
@@ -1,1013 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "DirectiveParser.h"
-
-#include <algorithm>
-#include <cassert>
-#include <cstdlib>
-#include <sstream>
-
-#include "DiagnosticsBase.h"
-#include "DirectiveHandlerBase.h"
-#include "ExpressionParser.h"
-#include "MacroExpander.h"
-#include "Token.h"
-#include "Tokenizer.h"
-
-namespace {
-enum DirectiveType
-{
- DIRECTIVE_NONE,
- DIRECTIVE_DEFINE,
- DIRECTIVE_UNDEF,
- DIRECTIVE_IF,
- DIRECTIVE_IFDEF,
- DIRECTIVE_IFNDEF,
- DIRECTIVE_ELSE,
- DIRECTIVE_ELIF,
- DIRECTIVE_ENDIF,
- DIRECTIVE_ERROR,
- DIRECTIVE_PRAGMA,
- DIRECTIVE_EXTENSION,
- DIRECTIVE_VERSION,
- DIRECTIVE_LINE
-};
-} // namespace
-
-static DirectiveType getDirective(const pp::Token *token)
-{
- static const char kDirectiveDefine[] = "define";
- static const char kDirectiveUndef[] = "undef";
- static const char kDirectiveIf[] = "if";
- static const char kDirectiveIfdef[] = "ifdef";
- static const char kDirectiveIfndef[] = "ifndef";
- static const char kDirectiveElse[] = "else";
- static const char kDirectiveElif[] = "elif";
- static const char kDirectiveEndif[] = "endif";
- static const char kDirectiveError[] = "error";
- static const char kDirectivePragma[] = "pragma";
- static const char kDirectiveExtension[] = "extension";
- static const char kDirectiveVersion[] = "version";
- static const char kDirectiveLine[] = "line";
-
- if (token->type != pp::Token::IDENTIFIER)
- return DIRECTIVE_NONE;
-
- if (token->text == kDirectiveDefine)
- return DIRECTIVE_DEFINE;
- else if (token->text == kDirectiveUndef)
- return DIRECTIVE_UNDEF;
- else if (token->text == kDirectiveIf)
- return DIRECTIVE_IF;
- else if (token->text == kDirectiveIfdef)
- return DIRECTIVE_IFDEF;
- else if (token->text == kDirectiveIfndef)
- return DIRECTIVE_IFNDEF;
- else if (token->text == kDirectiveElse)
- return DIRECTIVE_ELSE;
- else if (token->text == kDirectiveElif)
- return DIRECTIVE_ELIF;
- else if (token->text == kDirectiveEndif)
- return DIRECTIVE_ENDIF;
- else if (token->text == kDirectiveError)
- return DIRECTIVE_ERROR;
- else if (token->text == kDirectivePragma)
- return DIRECTIVE_PRAGMA;
- else if (token->text == kDirectiveExtension)
- return DIRECTIVE_EXTENSION;
- else if (token->text == kDirectiveVersion)
- return DIRECTIVE_VERSION;
- else if (token->text == kDirectiveLine)
- return DIRECTIVE_LINE;
-
- return DIRECTIVE_NONE;
-}
-
-static bool isConditionalDirective(DirectiveType directive)
-{
- switch (directive)
- {
- case DIRECTIVE_IF:
- case DIRECTIVE_IFDEF:
- case DIRECTIVE_IFNDEF:
- case DIRECTIVE_ELSE:
- case DIRECTIVE_ELIF:
- case DIRECTIVE_ENDIF:
- return true;
- default:
- return false;
- }
-}
-
-// Returns true if the token represents End Of Directive.
-static bool isEOD(const pp::Token *token)
-{
- return (token->type == '\n') || (token->type == pp::Token::LAST);
-}
-
-static void skipUntilEOD(pp::Lexer *lexer, pp::Token *token)
-{
- while(!isEOD(token))
- {
- lexer->lex(token);
- }
-}
-
-static bool isMacroNameReserved(const std::string& name)
-{
- // Names prefixed with "GL_" are reserved.
- return (name.substr(0, 3) == "GL_");
-}
-
-bool hasDoubleUnderscores(const std::string &name)
-{
- return (name.find("__") != std::string::npos);
-}
-
-static bool isMacroPredefined(const std::string& name,
- const pp::MacroSet& macroSet)
-{
- pp::MacroSet::const_iterator iter = macroSet.find(name);
- return iter != macroSet.end() ? iter->second->predefined : false;
-}
-
-namespace pp
-{
-
-class DefinedParser : public Lexer
-{
-public:
- DefinedParser(Lexer *lexer, const MacroSet *macroSet, Diagnostics *diagnostics)
- : mLexer(lexer), mMacroSet(macroSet), mDiagnostics(diagnostics)
- {
- }
-
-protected:
- void lex(Token *token) override
- {
- const char kDefined[] = "defined";
-
- mLexer->lex(token);
- if (token->type != Token::IDENTIFIER)
- return;
- if (token->text != kDefined)
- return;
-
- bool paren = false;
- mLexer->lex(token);
- if (token->type == '(')
- {
- paren = true;
- mLexer->lex(token);
- }
-
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
- skipUntilEOD(mLexer, token);
- return;
- }
- MacroSet::const_iterator iter = mMacroSet->find(token->text);
- std::string expression = iter != mMacroSet->end() ? "1" : "0";
-
- if (paren)
- {
- mLexer->lex(token);
- if (token->type != ')')
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mLexer, token);
- return;
- }
- }
-
- // We have a valid defined operator.
- // Convert the current token into a CONST_INT token.
- token->type = Token::CONST_INT;
- token->text = expression;
- }
-
-private:
- Lexer *mLexer;
- const MacroSet *mMacroSet;
- Diagnostics *mDiagnostics;
-};
-
-DirectiveParser::DirectiveParser(Tokenizer *tokenizer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- int maxMacroExpansionDepth)
- : mPastFirstStatement(false),
- mSeenNonPreprocessorToken(false),
- mTokenizer(tokenizer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mDirectiveHandler(directiveHandler),
- mShaderVersion(100),
- mMaxMacroExpansionDepth(maxMacroExpansionDepth)
-{
-}
-
-DirectiveParser::~DirectiveParser()
-{
-}
-
-void DirectiveParser::lex(Token *token)
-{
- do
- {
- mTokenizer->lex(token);
-
- if (token->type == Token::PP_HASH)
- {
- parseDirective(token);
- mPastFirstStatement = true;
- }
- else if (!isEOD(token))
- {
- mSeenNonPreprocessorToken = true;
- }
-
- if (token->type == Token::LAST)
- {
- if (!mConditionalStack.empty())
- {
- const ConditionalBlock &block = mConditionalStack.back();
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNTERMINATED,
- block.location, block.type);
- }
- break;
- }
-
- } while (skipping() || (token->type == '\n'));
-
- mPastFirstStatement = true;
-}
-
-void DirectiveParser::parseDirective(Token *token)
-{
- assert(token->type == Token::PP_HASH);
-
- mTokenizer->lex(token);
- if (isEOD(token))
- {
- // Empty Directive.
- return;
- }
-
- DirectiveType directive = getDirective(token);
-
- // While in an excluded conditional block/group,
- // we only parse conditional directives.
- if (skipping() && !isConditionalDirective(directive))
- {
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- switch(directive)
- {
- case DIRECTIVE_NONE:
- mDiagnostics->report(Diagnostics::PP_DIRECTIVE_INVALID_NAME,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- break;
- case DIRECTIVE_DEFINE:
- parseDefine(token);
- break;
- case DIRECTIVE_UNDEF:
- parseUndef(token);
- break;
- case DIRECTIVE_IF:
- parseIf(token);
- break;
- case DIRECTIVE_IFDEF:
- parseIfdef(token);
- break;
- case DIRECTIVE_IFNDEF:
- parseIfndef(token);
- break;
- case DIRECTIVE_ELSE:
- parseElse(token);
- break;
- case DIRECTIVE_ELIF:
- parseElif(token);
- break;
- case DIRECTIVE_ENDIF:
- parseEndif(token);
- break;
- case DIRECTIVE_ERROR:
- parseError(token);
- break;
- case DIRECTIVE_PRAGMA:
- parsePragma(token);
- break;
- case DIRECTIVE_EXTENSION:
- parseExtension(token);
- break;
- case DIRECTIVE_VERSION:
- parseVersion(token);
- break;
- case DIRECTIVE_LINE:
- parseLine(token);
- break;
- default:
- assert(false);
- break;
- }
-
- skipUntilEOD(mTokenizer, token);
- if (token->type == Token::LAST)
- {
- mDiagnostics->report(Diagnostics::PP_EOF_IN_DIRECTIVE,
- token->location, token->text);
- }
-}
-
-void DirectiveParser::parseDefine(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_DEFINE);
-
- mTokenizer->lex(token);
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- return;
- }
- if (isMacroPredefined(token->text, *mMacroSet))
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_REDEFINED,
- token->location, token->text);
- return;
- }
- if (isMacroNameReserved(token->text))
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_NAME_RESERVED,
- token->location, token->text);
- return;
- }
- // Using double underscores is allowed, but may result in unintended
- // behavior, so a warning is issued. At the time of writing this was
- // specified in ESSL 3.10, but the intent judging from Khronos
- // discussions and dEQP tests was that double underscores should be
- // allowed in earlier ESSL versions too.
- if (hasDoubleUnderscores(token->text))
- {
- mDiagnostics->report(Diagnostics::PP_WARNING_MACRO_NAME_RESERVED, token->location,
- token->text);
- }
-
- std::shared_ptr<Macro> macro = std::make_shared<Macro>();
- macro->type = Macro::kTypeObj;
- macro->name = token->text;
-
- mTokenizer->lex(token);
- if (token->type == '(' && !token->hasLeadingSpace())
- {
- // Function-like macro. Collect arguments.
- macro->type = Macro::kTypeFunc;
- do {
- mTokenizer->lex(token);
- if (token->type != Token::IDENTIFIER)
- break;
-
- if (std::find(macro->parameters.begin(), macro->parameters.end(), token->text) != macro->parameters.end())
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_DUPLICATE_PARAMETER_NAMES,
- token->location, token->text);
- return;
- }
-
- macro->parameters.push_back(token->text);
-
- mTokenizer->lex(token); // Get ','.
- } while (token->type == ',');
-
- if (token->type != ')')
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location,
- token->text);
- return;
- }
- mTokenizer->lex(token); // Get ')'.
- }
-
- while ((token->type != '\n') && (token->type != Token::LAST))
- {
- // Reset the token location because it is unnecessary in replacement
- // list. Resetting it also allows us to reuse Token::equals() to
- // compare macros.
- token->location = SourceLocation();
- macro->replacements.push_back(*token);
- mTokenizer->lex(token);
- }
- if (!macro->replacements.empty())
- {
- // Whitespace preceding the replacement list is not considered part of
- // the replacement list for either form of macro.
- macro->replacements.front().setHasLeadingSpace(false);
- }
-
- // Check for macro redefinition.
- MacroSet::const_iterator iter = mMacroSet->find(macro->name);
- if (iter != mMacroSet->end() && !macro->equals(*iter->second))
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_REDEFINED, token->location, macro->name);
- return;
- }
- mMacroSet->insert(std::make_pair(macro->name, macro));
-}
-
-void DirectiveParser::parseUndef(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_UNDEF);
-
- mTokenizer->lex(token);
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- return;
- }
-
- MacroSet::iterator iter = mMacroSet->find(token->text);
- if (iter != mMacroSet->end())
- {
- if (iter->second->predefined)
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_PREDEFINED_UNDEFINED,
- token->location, token->text);
- return;
- }
- else if (iter->second->expansionCount > 0)
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_UNDEFINED_WHILE_INVOKED,
- token->location, token->text);
- return;
- }
- else
- {
- mMacroSet->erase(iter);
- }
- }
-
- mTokenizer->lex(token);
- if (!isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- }
-}
-
-void DirectiveParser::parseIf(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_IF);
- parseConditionalIf(token);
-}
-
-void DirectiveParser::parseIfdef(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_IFDEF);
- parseConditionalIf(token);
-}
-
-void DirectiveParser::parseIfndef(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_IFNDEF);
- parseConditionalIf(token);
-}
-
-void DirectiveParser::parseElse(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_ELSE);
-
- if (mConditionalStack.empty())
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_WITHOUT_IF,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- ConditionalBlock &block = mConditionalStack.back();
- if (block.skipBlock)
- {
- // No diagnostics. Just skip the whole line.
- skipUntilEOD(mTokenizer, token);
- return;
- }
- if (block.foundElseGroup)
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELSE_AFTER_ELSE,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- block.foundElseGroup = true;
- block.skipGroup = block.foundValidGroup;
- block.foundValidGroup = true;
-
- // Check if there are extra tokens after #else.
- mTokenizer->lex(token);
- if (!isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- }
-}
-
-void DirectiveParser::parseElif(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_ELIF);
-
- if (mConditionalStack.empty())
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_WITHOUT_IF,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- ConditionalBlock &block = mConditionalStack.back();
- if (block.skipBlock)
- {
- // No diagnostics. Just skip the whole line.
- skipUntilEOD(mTokenizer, token);
- return;
- }
- if (block.foundElseGroup)
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ELIF_AFTER_ELSE,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
- if (block.foundValidGroup)
- {
- // Do not parse the expression.
- // Also be careful not to emit a diagnostic.
- block.skipGroup = true;
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- int expression = parseExpressionIf(token);
- block.skipGroup = expression == 0;
- block.foundValidGroup = expression != 0;
-}
-
-void DirectiveParser::parseEndif(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_ENDIF);
-
- if (mConditionalStack.empty())
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_ENDIF_WITHOUT_IF,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- mConditionalStack.pop_back();
-
- // Check if there are tokens after #endif.
- mTokenizer->lex(token);
- if (!isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- }
-}
-
-void DirectiveParser::parseError(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_ERROR);
-
- std::ostringstream stream;
- mTokenizer->lex(token);
- while ((token->type != '\n') && (token->type != Token::LAST))
- {
- stream << *token;
- mTokenizer->lex(token);
- }
- mDirectiveHandler->handleError(token->location, stream.str());
-}
-
-// Parses pragma of form: #pragma name[(value)].
-void DirectiveParser::parsePragma(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_PRAGMA);
-
- enum State
- {
- PRAGMA_NAME,
- LEFT_PAREN,
- PRAGMA_VALUE,
- RIGHT_PAREN
- };
-
- bool valid = true;
- std::string name, value;
- int state = PRAGMA_NAME;
-
- mTokenizer->lex(token);
- bool stdgl = token->text == "STDGL";
- if (stdgl)
- {
- mTokenizer->lex(token);
- }
- while ((token->type != '\n') && (token->type != Token::LAST))
- {
- switch(state++)
- {
- case PRAGMA_NAME:
- name = token->text;
- valid = valid && (token->type == Token::IDENTIFIER);
- break;
- case LEFT_PAREN:
- valid = valid && (token->type == '(');
- break;
- case PRAGMA_VALUE:
- value = token->text;
- valid = valid && (token->type == Token::IDENTIFIER);
- break;
- case RIGHT_PAREN:
- valid = valid && (token->type == ')');
- break;
- default:
- valid = false;
- break;
- }
- mTokenizer->lex(token);
- }
-
- valid = valid && ((state == PRAGMA_NAME) || // Empty pragma.
- (state == LEFT_PAREN) || // Without value.
- (state == RIGHT_PAREN + 1)); // With value.
- if (!valid)
- {
- mDiagnostics->report(Diagnostics::PP_UNRECOGNIZED_PRAGMA, token->location, name);
- }
- else if (state > PRAGMA_NAME) // Do not notify for empty pragma.
- {
- mDirectiveHandler->handlePragma(token->location, name, value, stdgl);
- }
-}
-
-void DirectiveParser::parseExtension(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_EXTENSION);
-
- enum State
- {
- EXT_NAME,
- COLON,
- EXT_BEHAVIOR
- };
-
- bool valid = true;
- std::string name, behavior;
- int state = EXT_NAME;
-
- mTokenizer->lex(token);
- while ((token->type != '\n') && (token->type != Token::LAST))
- {
- switch (state++)
- {
- case EXT_NAME:
- if (valid && (token->type != Token::IDENTIFIER))
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_NAME, token->location,
- token->text);
- valid = false;
- }
- if (valid)
- name = token->text;
- break;
- case COLON:
- if (valid && (token->type != ':'))
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
- token->text);
- valid = false;
- }
- break;
- case EXT_BEHAVIOR:
- if (valid && (token->type != Token::IDENTIFIER))
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_BEHAVIOR,
- token->location, token->text);
- valid = false;
- }
- if (valid)
- behavior = token->text;
- break;
- default:
- if (valid)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
- token->text);
- valid = false;
- }
- break;
- }
- mTokenizer->lex(token);
- }
- if (valid && (state != EXT_BEHAVIOR + 1))
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_EXTENSION_DIRECTIVE, token->location,
- token->text);
- valid = false;
- }
- if (valid && mSeenNonPreprocessorToken)
- {
- if (mShaderVersion >= 300)
- {
- mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL3,
- token->location, token->text);
- valid = false;
- }
- else
- {
- mDiagnostics->report(Diagnostics::PP_NON_PP_TOKEN_BEFORE_EXTENSION_ESSL1,
- token->location, token->text);
- }
- }
- if (valid)
- mDirectiveHandler->handleExtension(token->location, name, behavior);
-}
-
-void DirectiveParser::parseVersion(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_VERSION);
-
- if (mPastFirstStatement)
- {
- mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_STATEMENT, token->location,
- token->text);
- skipUntilEOD(mTokenizer, token);
- return;
- }
-
- enum State
- {
- VERSION_NUMBER,
- VERSION_PROFILE,
- VERSION_ENDLINE
- };
-
- bool valid = true;
- int version = 0;
- int state = VERSION_NUMBER;
-
- mTokenizer->lex(token);
- while (valid && (token->type != '\n') && (token->type != Token::LAST))
- {
- switch (state)
- {
- case VERSION_NUMBER:
- if (token->type != Token::CONST_INT)
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_NUMBER,
- token->location, token->text);
- valid = false;
- }
- if (valid && !token->iValue(&version))
- {
- mDiagnostics->report(Diagnostics::PP_INTEGER_OVERFLOW,
- token->location, token->text);
- valid = false;
- }
- if (valid)
- {
- state = (version < 300) ? VERSION_ENDLINE : VERSION_PROFILE;
- }
- break;
- case VERSION_PROFILE:
- if (token->type != Token::IDENTIFIER || token->text != "es")
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
- token->location, token->text);
- valid = false;
- }
- state = VERSION_ENDLINE;
- break;
- default:
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- valid = false;
- break;
- }
-
- mTokenizer->lex(token);
- }
-
- if (valid && (state != VERSION_ENDLINE))
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_VERSION_DIRECTIVE,
- token->location, token->text);
- valid = false;
- }
-
- if (valid && version >= 300 && token->location.line > 1)
- {
- mDiagnostics->report(Diagnostics::PP_VERSION_NOT_FIRST_LINE_ESSL3, token->location,
- token->text);
- valid = false;
- }
-
- if (valid)
- {
- mDirectiveHandler->handleVersion(token->location, version);
- mShaderVersion = version;
- PredefineMacro(mMacroSet, "__VERSION__", version);
- }
-}
-
-void DirectiveParser::parseLine(Token *token)
-{
- assert(getDirective(token) == DIRECTIVE_LINE);
-
- bool valid = true;
- bool parsedFileNumber = false;
- int line = 0, file = 0;
-
- MacroExpander macroExpander(mTokenizer, mMacroSet, mDiagnostics, false, mMaxMacroExpansionDepth);
-
- // Lex the first token after "#line" so we can check it for EOD.
- macroExpander.lex(token);
-
- if (isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_INVALID_LINE_DIRECTIVE, token->location, token->text);
- valid = false;
- }
- else
- {
- ExpressionParser expressionParser(&macroExpander, mDiagnostics);
- ExpressionParser::ErrorSettings errorSettings;
-
- // See GLES3 section 12.42
- errorSettings.integerLiteralsMustFit32BitSignedRange = true;
-
- errorSettings.unexpectedIdentifier = Diagnostics::PP_INVALID_LINE_NUMBER;
- // The first token was lexed earlier to check if it was EOD. Include
- // the token in parsing for a second time by setting the
- // parsePresetToken flag to true.
- expressionParser.parse(token, &line, true, errorSettings, &valid);
- if (!isEOD(token) && valid)
- {
- errorSettings.unexpectedIdentifier = Diagnostics::PP_INVALID_FILE_NUMBER;
- // After parsing the line expression expressionParser has also
- // advanced to the first token of the file expression - this is the
- // token that makes the parser reduce the "input" rule for the line
- // expression and stop. So we're using parsePresetToken = true here
- // as well.
- expressionParser.parse(token, &file, true, errorSettings, &valid);
- parsedFileNumber = true;
- }
- if (!isEOD(token))
- {
- if (valid)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- valid = false;
- }
- skipUntilEOD(mTokenizer, token);
- }
- }
-
- if (valid)
- {
- mTokenizer->setLineNumber(line);
- if (parsedFileNumber)
- mTokenizer->setFileNumber(file);
- }
-}
-
-bool DirectiveParser::skipping() const
-{
- if (mConditionalStack.empty())
- return false;
-
- const ConditionalBlock &block = mConditionalStack.back();
- return block.skipBlock || block.skipGroup;
-}
-
-void DirectiveParser::parseConditionalIf(Token *token)
-{
- ConditionalBlock block;
- block.type = token->text;
- block.location = token->location;
-
- if (skipping())
- {
- // This conditional block is inside another conditional group
- // which is skipped. As a consequence this whole block is skipped.
- // Be careful not to parse the conditional expression that might
- // emit a diagnostic.
- skipUntilEOD(mTokenizer, token);
- block.skipBlock = true;
- }
- else
- {
- DirectiveType directive = getDirective(token);
-
- int expression = 0;
- switch (directive)
- {
- case DIRECTIVE_IF:
- expression = parseExpressionIf(token);
- break;
- case DIRECTIVE_IFDEF:
- expression = parseExpressionIfdef(token);
- break;
- case DIRECTIVE_IFNDEF:
- expression = parseExpressionIfdef(token) == 0 ? 1 : 0;
- break;
- default:
- assert(false);
- break;
- }
- block.skipGroup = expression == 0;
- block.foundValidGroup = expression != 0;
- }
- mConditionalStack.push_back(block);
-}
-
-int DirectiveParser::parseExpressionIf(Token *token)
-{
- assert((getDirective(token) == DIRECTIVE_IF) || (getDirective(token) == DIRECTIVE_ELIF));
-
- DefinedParser definedParser(mTokenizer, mMacroSet, mDiagnostics);
- MacroExpander macroExpander(&definedParser, mMacroSet, mDiagnostics, true, mMaxMacroExpansionDepth);
- ExpressionParser expressionParser(&macroExpander, mDiagnostics);
-
- int expression = 0;
- ExpressionParser::ErrorSettings errorSettings;
- errorSettings.integerLiteralsMustFit32BitSignedRange = false;
- errorSettings.unexpectedIdentifier = Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN;
-
- bool valid = true;
- expressionParser.parse(token, &expression, false, errorSettings, &valid);
-
- // Check if there are tokens after #if expression.
- if (!isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- }
-
- return expression;
-}
-
-int DirectiveParser::parseExpressionIfdef(Token* token)
-{
- assert((getDirective(token) == DIRECTIVE_IFDEF) ||
- (getDirective(token) == DIRECTIVE_IFNDEF));
-
- mTokenizer->lex(token);
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- return 0;
- }
-
- MacroSet::const_iterator iter = mMacroSet->find(token->text);
- int expression = iter != mMacroSet->end() ? 1 : 0;
-
- // Check if there are tokens after #ifdef expression.
- mTokenizer->lex(token);
- if (!isEOD(token))
- {
- mDiagnostics->report(Diagnostics::PP_CONDITIONAL_UNEXPECTED_TOKEN,
- token->location, token->text);
- skipUntilEOD(mTokenizer, token);
- }
- return expression;
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/DirectiveParser.h b/src/OpenGL/compiler/preprocessor/DirectiveParser.h
deleted file mode 100644
index d1e113518..000000000
--- a/src/OpenGL/compiler/preprocessor/DirectiveParser.h
+++ /dev/null
@@ -1,97 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
-#define COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
-
-#include "Lexer.h"
-#include "Macro.h"
-#include "pp_utils.h"
-#include "SourceLocation.h"
-
-namespace pp
-{
-
-class Diagnostics;
-class DirectiveHandler;
-class Tokenizer;
-
-class DirectiveParser : public Lexer
-{
-public:
- DirectiveParser(Tokenizer *tokenizer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- int maxMacroExpansionDepth);
- ~DirectiveParser() override;
-
- void lex(Token *token) override;
-
-private:
- PP_DISALLOW_COPY_AND_ASSIGN(DirectiveParser);
-
- void parseDirective(Token *token);
- void parseDefine(Token *token);
- void parseUndef(Token *token);
- void parseIf(Token *token);
- void parseIfdef(Token *token);
- void parseIfndef(Token *token);
- void parseElse(Token *token);
- void parseElif(Token *token);
- void parseEndif(Token *token);
- void parseError(Token *token);
- void parsePragma(Token *token);
- void parseExtension(Token *token);
- void parseVersion(Token *token);
- void parseLine(Token *token);
-
- bool skipping() const;
- void parseConditionalIf(Token *token);
- int parseExpressionIf(Token *token);
- int parseExpressionIfdef(Token *token);
-
- struct ConditionalBlock
- {
- std::string type;
- SourceLocation location;
- bool skipBlock;
- bool skipGroup;
- bool foundValidGroup;
- bool foundElseGroup;
-
- ConditionalBlock() :
- skipBlock(false),
- skipGroup(false),
- foundValidGroup(false),
- foundElseGroup(false)
- {
- }
- };
- bool mPastFirstStatement;
- bool mSeenNonPreprocessorToken; // Tracks if a non-preprocessor token has been seen yet. Some
- // macros, such as
- // #extension must be declared before all shader code.
- std::vector<ConditionalBlock> mConditionalStack;
- Tokenizer *mTokenizer;
- MacroSet *mMacroSet;
- Diagnostics *mDiagnostics;
- DirectiveHandler *mDirectiveHandler;
- int mShaderVersion;
- int mMaxMacroExpansionDepth;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_DIRECTIVE_PARSER_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/ExpressionParser.cpp b/src/OpenGL/compiler/preprocessor/ExpressionParser.cpp
deleted file mode 100644
index 752252b39..000000000
--- a/src/OpenGL/compiler/preprocessor/ExpressionParser.cpp
+++ /dev/null
@@ -1,2056 +0,0 @@
-/* A Bison parser, made by GNU Bison 3.0.4. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "3.0.4"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 1
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-
-/* Substitute the variable and function names. */
-#define yyparse ppparse
-#define yylex pplex
-#define yyerror pperror
-#define yydebug ppdebug
-#define yynerrs ppnerrs
-
-
-/* Copy the first part of user declarations. */
-
-
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-#if defined(__GNUC__)
-// Triggered by the auto-generated pplval variable.
-#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#else
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#endif
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065 4244 4701 4702)
-#endif
-
-#include "ExpressionParser.h"
-
-#if defined(_MSC_VER)
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
-
-#include <limits>
-#include <cassert>
-#include <sstream>
-#include <stdint.h>
-
-#include "DiagnosticsBase.h"
-#include "Lexer.h"
-#include "Token.h"
-#include "../../common/debug.h"
-
-typedef int32_t YYSTYPE;
-typedef uint32_t UNSIGNED_TYPE;
-
-#define YYENABLE_NLS 0
-#define YYLTYPE_IS_TRIVIAL 1
-#define YYSTYPE_IS_TRIVIAL 1
-#define YYSTYPE_IS_DECLARED 1
-
-namespace {
-struct Context
-{
- pp::Diagnostics* diagnostics;
- pp::Lexer* lexer;
- pp::Token* token;
- int* result;
- bool parsePresetToken;
-
- pp::ExpressionParser::ErrorSettings errorSettings;
- bool *valid;
-
- void startIgnoreErrors() { ++ignoreErrors; }
- void endIgnoreErrors() { --ignoreErrors; }
-
- bool isIgnoringErrors() { return ignoreErrors > 0; }
-
- int ignoreErrors;
-};
-} // namespace
-
-
-static int yylex(YYSTYPE* lvalp, Context* context);
-static void yyerror(Context* context, const char* reason);
-
-
-
-# ifndef YY_NULLPTR
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULLPTR nullptr
-# else
-# define YY_NULLPTR 0
-# endif
-# endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-
-/* Debug traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int ppdebug;
-#endif
-
-/* Token type. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- enum yytokentype
- {
- TOK_CONST_INT = 258,
- TOK_IDENTIFIER = 259,
- TOK_OP_OR = 260,
- TOK_OP_AND = 261,
- TOK_OP_EQ = 262,
- TOK_OP_NE = 263,
- TOK_OP_LE = 264,
- TOK_OP_GE = 265,
- TOK_OP_LEFT = 266,
- TOK_OP_RIGHT = 267,
- TOK_UNARY = 268
- };
-#endif
-
-/* Value type. */
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef int YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-
-
-int ppparse (Context *context);
-
-
-
-/* Copy the second part of user declarations. */
-
-
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#else
-typedef signed char yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE
-# if (defined __GNUC__ \
- && (2 < __GNUC__ || (__GNUC__ == 2 && 96 <= __GNUC_MINOR__))) \
- || defined __SUNPRO_C && 0x5110 <= __SUNPRO_C
-# define YY_ATTRIBUTE(Spec) __attribute__(Spec)
-# else
-# define YY_ATTRIBUTE(Spec) /* empty */
-# endif
-#endif
-
-#ifndef YY_ATTRIBUTE_PURE
-# define YY_ATTRIBUTE_PURE YY_ATTRIBUTE ((__pure__))
-#endif
-
-#ifndef YY_ATTRIBUTE_UNUSED
-# define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
-#endif
-
-#if !defined _Noreturn \
- && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-# define _Noreturn __declspec (noreturn)
-# else
-# define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
-/* Suppress an incorrect diagnostic about yylval being uninitialized. */
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
- _Pragma ("GCC diagnostic push") \
- _Pragma ("GCC diagnostic ignored \"-Wuninitialized\"")\
- _Pragma ("GCC diagnostic ignored \"-Wmaybe-uninitialized\"")
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END \
- _Pragma ("GCC diagnostic pop")
-#else
-# define YY_INITIAL_VALUE(Value) Value
-#endif
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
-#endif
-
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's 'empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 15
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 176
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 28
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 5
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 29
-/* YYNSTATES -- Number of states. */
-#define YYNSTATES 55
-
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
- by yylex, with out-of-bounds checking. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 268
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
- as returned by yylex, without out-of-bounds checking. */
-static const yytype_uint8 yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 24, 2, 2, 2, 22, 9, 2,
- 26, 27, 20, 18, 2, 19, 2, 21, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 12, 2, 13, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 8, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 7, 2, 25, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 10, 11, 14, 15, 16, 17, 23
-};
-
-#if YYDEBUG
- /* YYRLINE[YYN] -- Source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
-{
- 0, 125, 125, 132, 133, 144, 144, 165, 165, 186,
- 189, 192, 195, 198, 201, 204, 207, 210, 213, 238,
- 260, 263, 266, 292, 319, 322, 325, 328, 340, 343
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
-static const char *const yytname[] =
-{
- "$end", "error", "$undefined", "TOK_CONST_INT", "TOK_IDENTIFIER",
- "TOK_OP_OR", "TOK_OP_AND", "'|'", "'^'", "'&'", "TOK_OP_EQ", "TOK_OP_NE",
- "'<'", "'>'", "TOK_OP_LE", "TOK_OP_GE", "TOK_OP_LEFT", "TOK_OP_RIGHT",
- "'+'", "'-'", "'*'", "'/'", "'%'", "TOK_UNARY", "'!'", "'~'", "'('",
- "')'", "$accept", "input", "expression", "$@1", "$@2", YY_NULLPTR
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[NUM] -- (External) token number corresponding to the
- (internal) symbol number NUM (which must be that of a token). */
-static const yytype_uint16 yytoknum[] =
-{
- 0, 256, 257, 258, 259, 260, 261, 124, 94, 38,
- 262, 263, 60, 62, 264, 265, 266, 267, 43, 45,
- 42, 47, 37, 268, 33, 126, 40, 41
-};
-# endif
-
-#define YYPACT_NINF -12
-
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-12)))
-
-#define YYTABLE_NINF -1
-
-#define yytable_value_is_error(Yytable_value) \
- 0
-
- /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-static const yytype_int16 yypact[] =
-{
- 31, -12, -12, 31, 31, 31, 31, 31, 51, 76,
- -12, -12, -12, -12, 53, -12, -12, -12, 31, 31,
- 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
- 31, 31, 31, 31, -12, 31, 31, 124, 138, 26,
- 149, 149, -11, -11, -11, -11, 154, 154, -8, -8,
- -12, -12, -12, 93, 109
-};
-
- /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE does not specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
-{
- 0, 3, 4, 0, 0, 0, 0, 0, 0, 2,
- 28, 27, 25, 26, 0, 1, 5, 7, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 29, 0, 0, 9, 10, 11,
- 13, 12, 17, 16, 15, 14, 19, 18, 21, 20,
- 24, 23, 22, 6, 8
-};
-
- /* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -12, -12, -3, -12, -12
-};
-
- /* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
-{
- -1, 8, 9, 35, 36
-};
-
- /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule whose
- number is the opposite. If YYTABLE_NINF, syntax error. */
-static const yytype_uint8 yytable[] =
-{
- 10, 11, 12, 13, 14, 27, 28, 29, 30, 31,
- 32, 33, 31, 32, 33, 37, 38, 39, 40, 41,
- 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 0, 53, 54, 1, 2, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 3,
- 4, 15, 0, 0, 0, 5, 6, 7, 16, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 0, 0, 0, 0,
- 34, 16, 17, 18, 19, 20, 21, 22, 23, 24,
- 25, 26, 27, 28, 29, 30, 31, 32, 33, 17,
- 18, 19, 20, 21, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 18, 19, 20, 21,
- 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 19, 20, 21, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 23, 24, 25, 26, 27, 28, 29, 30, 31,
- 32, 33, 29, 30, 31, 32, 33
-};
-
-static const yytype_int8 yycheck[] =
-{
- 3, 4, 5, 6, 7, 16, 17, 18, 19, 20,
- 21, 22, 20, 21, 22, 18, 19, 20, 21, 22,
- 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, -1, 35, 36, 3, 4, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 18,
- 19, 0, -1, -1, -1, 24, 25, 26, 5, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, -1, -1, -1, -1,
- 27, 5, 6, 7, 8, 9, 10, 11, 12, 13,
- 14, 15, 16, 17, 18, 19, 20, 21, 22, 6,
- 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
- 17, 18, 19, 20, 21, 22, 7, 8, 9, 10,
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 22, 9, 10, 11,
- 12, 13, 14, 15, 16, 17, 18, 19, 20, 21,
- 22, 12, 13, 14, 15, 16, 17, 18, 19, 20,
- 21, 22, 18, 19, 20, 21, 22
-};
-
- /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
-{
- 0, 3, 4, 18, 19, 24, 25, 26, 29, 30,
- 30, 30, 30, 30, 30, 0, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 22, 27, 31, 32, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30
-};
-
- /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
-{
- 0, 28, 29, 30, 30, 31, 30, 32, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
- 30, 30, 30, 30, 30, 30, 30, 30, 30, 30
-};
-
- /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
-{
- 0, 2, 1, 1, 1, 0, 4, 0, 4, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 2, 2, 2, 2, 3
-};
-
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
-#define YYEOF 0
-
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
-#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (context, YY_("syntax error: cannot back up")); \
- YYERROR; \
- } \
-while (0)
-
-/* Error token number */
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-#endif
-
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value, context); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (0)
-
-
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT. |
-`----------------------------------------*/
-
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context)
-{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- YYUSE (context);
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# endif
- YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep, Context *context)
-{
- YYFPRINTF (yyoutput, "%s %s (",
- yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
-
- yy_symbol_value_print (yyoutput, yytype, yyvaluep, context);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (0)
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-static void
-yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule, Context *context)
-{
- unsigned long int yylno = yyrline[yyrule];
- int yynrhs = yyr2[yyrule];
- int yyi;
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr,
- yystos[yyssp[yyi + 1 - yynrhs]],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- , context);
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyssp, yyvsp, Rule, context); \
-} while (0)
-
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-yystrlen (const char *yystr)
-{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
- continue;
- return yylen;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-{
- char *yyd = yydest;
- const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
-
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
-
- return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (YY_NULLPTR, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULLPTR;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
-
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep, Context *context)
-{
- YYUSE (yyvaluep);
- YYUSE (context);
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- YYUSE (yytype);
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-}
-
-
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-int
-yyparse (Context *context)
-{
-/* The lookahead symbol. */
-int yychar;
-
-
-/* The semantic value of the lookahead symbol. */
-/* Default value used for initialization, for pacifying older GCCs
- or non-GCC compilers. */
-YY_INITIAL_VALUE (static YYSTYPE yyval_default;)
-YYSTYPE yylval YY_INITIAL_VALUE (= yyval_default);
-
- /* Number of syntax errors so far. */
- int yynerrs;
-
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
-
- /* The stacks and their tools:
- 'yyss': related to states.
- 'yyvs': related to semantic values.
-
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyss + yystacksize - 1 <= yyssp)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
- /* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
- yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
- yystacksize = YYMAXDEPTH;
-
- {
- yytype_int16 *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyss + yystacksize - 1 <= yyssp)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- if (yystate == YYFINAL)
- YYACCEPT;
-
- goto yybackup;
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
-
- /* First try to decide what to do without reference to lookahead token. */
- yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = yylex (&yylval, context);
- }
-
- if (yychar <= YYEOF)
- {
- yychar = yytoken = YYEOF;
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
- }
-
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
- goto yydefault;
- yyn = yytable[yyn];
- if (yyn <= 0)
- {
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- /* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
- /* Discard the shifted token. */
- yychar = YYEMPTY;
-
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- '$$ = $1'.
-
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
- {
- case 2:
-
- {
- *(context->result) = static_cast<int>((yyvsp[0]));
- YYACCEPT;
- }
-
- break;
-
- case 4:
-
- {
- if (!context->isIgnoringErrors())
- {
- // This rule should be applied right after the token is lexed, so we can
- // refer to context->token in the error message.
- context->diagnostics->report(context->errorSettings.unexpectedIdentifier,
- context->token->location, context->token->text);
- *(context->valid) = false;
- }
- (yyval) = (yyvsp[0]);
- }
-
- break;
-
- case 5:
-
- {
- if ((yyvsp[-1]) != 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
- }
-
- break;
-
- case 6:
-
- {
- if ((yyvsp[-3]) != 0)
- {
- context->endIgnoreErrors();
- (yyval) = static_cast<YYSTYPE>(1);
- }
- else
- {
- (yyval) = (yyvsp[-3]) || (yyvsp[0]);
- }
- }
-
- break;
-
- case 7:
-
- {
- if ((yyvsp[-1]) == 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
- }
-
- break;
-
- case 8:
-
- {
- if ((yyvsp[-3]) == 0)
- {
- context->endIgnoreErrors();
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else
- {
- (yyval) = (yyvsp[-3]) && (yyvsp[0]);
- }
- }
-
- break;
-
- case 9:
-
- {
- (yyval) = (yyvsp[-2]) | (yyvsp[0]);
- }
-
- break;
-
- case 10:
-
- {
- (yyval) = (yyvsp[-2]) ^ (yyvsp[0]);
- }
-
- break;
-
- case 11:
-
- {
- (yyval) = (yyvsp[-2]) & (yyvsp[0]);
- }
-
- break;
-
- case 12:
-
- {
- (yyval) = (yyvsp[-2]) != (yyvsp[0]);
- }
-
- break;
-
- case 13:
-
- {
- (yyval) = (yyvsp[-2]) == (yyvsp[0]);
- }
-
- break;
-
- case 14:
-
- {
- (yyval) = (yyvsp[-2]) >= (yyvsp[0]);
- }
-
- break;
-
- case 15:
-
- {
- (yyval) = (yyvsp[-2]) <= (yyvsp[0]);
- }
-
- break;
-
- case 16:
-
- {
- (yyval) = (yyvsp[-2]) > (yyvsp[0]);
- }
-
- break;
-
- case 17:
-
- {
- (yyval) = (yyvsp[-2]) < (yyvsp[0]);
- }
-
- break;
-
- case 18:
-
- {
- if ((yyvsp[0]) < 0 || (yyvsp[0]) > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " >> " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else if ((yyvsp[-2]) < 0)
- {
- // Logical shift right.
- (yyval) = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>((yyvsp[-2])) >> (yyvsp[0]));
- }
- else
- {
- (yyval) = (yyvsp[-2]) >> (yyvsp[0]);
- }
- }
-
- break;
-
- case 19:
-
- {
- if ((yyvsp[0]) < 0 || (yyvsp[0]) > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " << " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else
- {
- // Logical shift left. Casting to unsigned is needed to ensure there's no signed integer
- // overflow, which some tools treat as an error.
- (yyval) = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>((yyvsp[-2])) << (yyvsp[0]));
- }
- }
-
- break;
-
- case 20:
-
- {
- (yyval) = (yyvsp[-2]) - (yyvsp[0]);
- }
-
- break;
-
- case 21:
-
- {
- (yyval) = (yyvsp[-2]) + (yyvsp[0]);
- }
-
- break;
-
- case 22:
-
- {
- if ((yyvsp[0]) == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " % " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else if (((yyvsp[-2]) == std::numeric_limits<YYSTYPE>::min()) && ((yyvsp[0]) == -1))
- {
- // Check for the special case where the minimum representable number is
- // divided by -1. If left alone this has undefined results.
- (yyval) = 0;
- }
- else
- {
- (yyval) = (yyvsp[-2]) % (yyvsp[0]);
- }
- }
-
- break;
-
- case 23:
-
- {
- if ((yyvsp[0]) == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << (yyvsp[-2]) << " / " << (yyvsp[0]);
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- (yyval) = static_cast<YYSTYPE>(0);
- }
- else if (((yyvsp[-2]) == std::numeric_limits<YYSTYPE>::min()) && ((yyvsp[0]) == -1))
- {
- // Check for the special case where the minimum representable number is
- // divided by -1. If left alone this leads to integer overflow in C++, which
- // has undefined results.
- (yyval) = std::numeric_limits<YYSTYPE>::max();
- }
- else
- {
- (yyval) = (yyvsp[-2]) / (yyvsp[0]);
- }
- }
-
- break;
-
- case 24:
-
- {
- (yyval) = (yyvsp[-2]) * (yyvsp[0]);
- }
-
- break;
-
- case 25:
-
- {
- (yyval) = ! (yyvsp[0]);
- }
-
- break;
-
- case 26:
-
- {
- (yyval) = ~ (yyvsp[0]);
- }
-
- break;
-
- case 27:
-
- {
- // Check for negation of minimum representable integer to prevent undefined signed int
- // overflow.
- if ((yyvsp[0]) == std::numeric_limits<YYSTYPE>::min())
- {
- (yyval) = std::numeric_limits<YYSTYPE>::min();
- }
- else
- {
- (yyval) = -(yyvsp[0]);
- }
- }
-
- break;
-
- case 28:
-
- {
- (yyval) = + (yyvsp[0]);
- }
-
- break;
-
- case 29:
-
- {
- (yyval) = (yyvsp[-1]);
- }
-
- break;
-
-
-
- default: break;
- }
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
-
- *++yyvsp = yyval;
-
- /* Now 'shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTOKENS];
-
- goto yynewstate;
-
-
-/*--------------------------------------.
-| yyerrlab -- here on detecting error. |
-`--------------------------------------*/
-yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (context, YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (context, yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
-
-
-
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval, context);
- yychar = YYEMPTY;
- }
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
- goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
-
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
-
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
-
- for (;;)
- {
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
-
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
-
-
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp, context);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
- }
-
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
-
-
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (context, YY_("memory exhausted"));
- yyresult = 2;
- /* Fall through. */
-#endif
-
-yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval, context);
- }
- /* Do not reclaim the symbols of the rule whose action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp, context);
- YYPOPSTACK (1);
- }
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- return yyresult;
-}
-
-
-
-int yylex(YYSTYPE *lvalp, Context *context)
-{
- pp::Token *token = context->token;
- if (!context->parsePresetToken)
- {
- context->lexer->lex(token);
- }
- context->parsePresetToken = false;
-
- int type = 0;
-
- switch (token->type)
- {
- case pp::Token::CONST_INT: {
- unsigned int val = 0;
- int testVal = 0;
- if (!token->uValue(&val) || (!token->iValue(&testVal) &&
- context->errorSettings.integerLiteralsMustFit32BitSignedRange))
- {
- context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
- token->location, token->text);
- *(context->valid) = false;
- }
- *lvalp = static_cast<YYSTYPE>(val);
- type = TOK_CONST_INT;
- break;
- }
- case pp::Token::IDENTIFIER:
- *lvalp = static_cast<YYSTYPE>(-1);
- type = TOK_IDENTIFIER;
- break;
- case pp::Token::OP_OR:
- type = TOK_OP_OR;
- break;
- case pp::Token::OP_AND:
- type = TOK_OP_AND;
- break;
- case pp::Token::OP_NE:
- type = TOK_OP_NE;
- break;
- case pp::Token::OP_EQ:
- type = TOK_OP_EQ;
- break;
- case pp::Token::OP_GE:
- type = TOK_OP_GE;
- break;
- case pp::Token::OP_LE:
- type = TOK_OP_LE;
- break;
- case pp::Token::OP_RIGHT:
- type = TOK_OP_RIGHT;
- break;
- case pp::Token::OP_LEFT:
- type = TOK_OP_LEFT;
- break;
- case '|':
- case '^':
- case '&':
- case '>':
- case '<':
- case '-':
- case '+':
- case '%':
- case '/':
- case '*':
- case '!':
- case '~':
- case '(':
- case ')':
- type = token->type;
- break;
-
- default:
- break;
- }
-
- return type;
-}
-
-void yyerror(Context *context, const char *reason)
-{
- context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
- context->token->location,
- reason);
-}
-
-namespace pp {
-
-ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
- : mLexer(lexer),
- mDiagnostics(diagnostics)
-{
-}
-
-bool ExpressionParser::parse(Token *token,
- int *result,
- bool parsePresetToken,
- const ErrorSettings &errorSettings,
- bool *valid)
-{
- Context context;
- context.diagnostics = mDiagnostics;
- context.lexer = mLexer;
- context.token = token;
- context.result = result;
- context.ignoreErrors = 0;
- context.parsePresetToken = parsePresetToken;
- context.errorSettings = errorSettings;
- context.valid = valid;
- int ret = yyparse(&context);
- switch (ret)
- {
- case 0:
- case 1:
- break;
-
- case 2:
- mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
- break;
-
- default:
- assert(false);
- mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
- break;
- }
-
- return ret == 0;
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/ExpressionParser.h b/src/OpenGL/compiler/preprocessor/ExpressionParser.h
deleted file mode 100644
index 47bd477bf..000000000
--- a/src/OpenGL/compiler/preprocessor/ExpressionParser.h
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
-#define COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
-
-#include "DiagnosticsBase.h"
-
-namespace pp
-{
-
-class Lexer;
-struct Token;
-
-class ExpressionParser
-{
-public:
- struct ErrorSettings
- {
- Diagnostics::ID unexpectedIdentifier;
- bool integerLiteralsMustFit32BitSignedRange;
- };
-
- ExpressionParser(Lexer *lexer, Diagnostics *diagnostics);
-
- bool parse(Token *token,
- int *result,
- bool parsePresetToken,
- const ErrorSettings &errorSettings,
- bool *valid);
-
-private:
- Lexer *mLexer;
- Diagnostics *mDiagnostics;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_EXPRESSION_PARSER_H_
diff --git a/src/OpenGL/compiler/preprocessor/ExpressionParser.y b/src/OpenGL/compiler/preprocessor/ExpressionParser.y
deleted file mode 100644
index 534293524..000000000
--- a/src/OpenGL/compiler/preprocessor/ExpressionParser.y
+++ /dev/null
@@ -1,479 +0,0 @@
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Yacc grammar for GLSL ES preprocessor expression.
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh,
-WHICH GENERATES THE GLSL ES preprocessor expression parser.
-*/
-
-%{
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-#if defined(__GNUC__)
-// Triggered by the auto-generated pplval variable.
-#if !defined(__clang__) && ((__GNUC__ > 4) || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
-#else
-#pragma GCC diagnostic ignored "-Wuninitialized"
-#endif
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4065 4244 4701 4702)
-#endif
-
-#include "ExpressionParser.h"
-
-#if defined(_MSC_VER)
-#include <malloc.h>
-#else
-#include <stdlib.h>
-#endif
-
-#include <limits>
-#include <cassert>
-#include <sstream>
-#include <stdint.h>
-
-#include "DiagnosticsBase.h"
-#include "Lexer.h"
-#include "Token.h"
-#include "../../common/debug.h"
-
-typedef int32_t YYSTYPE;
-typedef uint32_t UNSIGNED_TYPE;
-
-#define YYENABLE_NLS 0
-#define YYLTYPE_IS_TRIVIAL 1
-#define YYSTYPE_IS_TRIVIAL 1
-#define YYSTYPE_IS_DECLARED 1
-
-namespace {
-struct Context
-{
- pp::Diagnostics* diagnostics;
- pp::Lexer* lexer;
- pp::Token* token;
- int* result;
- bool parsePresetToken;
-
- pp::ExpressionParser::ErrorSettings errorSettings;
- bool *valid;
-
- void startIgnoreErrors() { ++ignoreErrors; }
- void endIgnoreErrors() { --ignoreErrors; }
-
- bool isIgnoringErrors() { return ignoreErrors > 0; }
-
- int ignoreErrors;
-};
-} // namespace
-%}
-
-%pure-parser
-%name-prefix "pp"
-%parse-param {Context *context}
-%lex-param {Context *context}
-
-%{
-static int yylex(YYSTYPE* lvalp, Context* context);
-static void yyerror(Context* context, const char* reason);
-%}
-
-%token TOK_CONST_INT
-%token TOK_IDENTIFIER
-%left TOK_OP_OR
-%left TOK_OP_AND
-%left '|'
-%left '^'
-%left '&'
-%left TOK_OP_EQ TOK_OP_NE
-%left '<' '>' TOK_OP_LE TOK_OP_GE
-%left TOK_OP_LEFT TOK_OP_RIGHT
-%left '+' '-'
-%left '*' '/' '%'
-%right TOK_UNARY
-
-%%
-
-input
- : expression {
- *(context->result) = static_cast<int>($1);
- YYACCEPT;
- }
-;
-
-expression
- : TOK_CONST_INT
- | TOK_IDENTIFIER {
- if (!context->isIgnoringErrors())
- {
- // This rule should be applied right after the token is lexed, so we can
- // refer to context->token in the error message.
- context->diagnostics->report(context->errorSettings.unexpectedIdentifier,
- context->token->location, context->token->text);
- *(context->valid) = false;
- }
- $$ = $1;
- }
- | expression TOK_OP_OR {
- if ($1 != 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
- } expression {
- if ($1 != 0)
- {
- context->endIgnoreErrors();
- $$ = static_cast<YYSTYPE>(1);
- }
- else
- {
- $$ = $1 || $4;
- }
- }
- | expression TOK_OP_AND {
- if ($1 == 0)
- {
- // Ignore errors in the short-circuited part of the expression.
- // ESSL3.00 section 3.4:
- // If an operand is not evaluated, the presence of undefined identifiers
- // in the operand will not cause an error.
- // Unevaluated division by zero should not cause an error either.
- context->startIgnoreErrors();
- }
- } expression {
- if ($1 == 0)
- {
- context->endIgnoreErrors();
- $$ = static_cast<YYSTYPE>(0);
- }
- else
- {
- $$ = $1 && $4;
- }
- }
- | expression '|' expression {
- $$ = $1 | $3;
- }
- | expression '^' expression {
- $$ = $1 ^ $3;
- }
- | expression '&' expression {
- $$ = $1 & $3;
- }
- | expression TOK_OP_NE expression {
- $$ = $1 != $3;
- }
- | expression TOK_OP_EQ expression {
- $$ = $1 == $3;
- }
- | expression TOK_OP_GE expression {
- $$ = $1 >= $3;
- }
- | expression TOK_OP_LE expression {
- $$ = $1 <= $3;
- }
- | expression '>' expression {
- $$ = $1 > $3;
- }
- | expression '<' expression {
- $$ = $1 < $3;
- }
- | expression TOK_OP_RIGHT expression {
- if ($3 < 0 || $3 > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " >> " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if ($1 < 0)
- {
- // Logical shift right.
- $$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) >> $3);
- }
- else
- {
- $$ = $1 >> $3;
- }
- }
- | expression TOK_OP_LEFT expression {
- if ($3 < 0 || $3 > 31)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " << " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_UNDEFINED_SHIFT,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else
- {
- // Logical shift left. Casting to unsigned is needed to ensure there's no signed integer
- // overflow, which some tools treat as an error.
- $$ = static_cast<YYSTYPE>(static_cast<UNSIGNED_TYPE>($1) << $3);
- }
- }
- | expression '-' expression {
- $$ = $1 - $3;
- }
- | expression '+' expression {
- $$ = $1 + $3;
- }
- | expression '%' expression {
- if ($3 == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " % " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -1))
- {
- // Check for the special case where the minimum representable number is
- // divided by -1. If left alone this has undefined results.
- $$ = 0;
- }
- else
- {
- $$ = $1 % $3;
- }
- }
- | expression '/' expression {
- if ($3 == 0)
- {
- if (!context->isIgnoringErrors())
- {
- std::ostringstream stream;
- stream << $1 << " / " << $3;
- std::string text = stream.str();
- context->diagnostics->report(pp::Diagnostics::PP_DIVISION_BY_ZERO,
- context->token->location,
- text.c_str());
- *(context->valid) = false;
- }
- $$ = static_cast<YYSTYPE>(0);
- }
- else if (($1 == std::numeric_limits<YYSTYPE>::min()) && ($3 == -1))
- {
- // Check for the special case where the minimum representable number is
- // divided by -1. If left alone this leads to integer overflow in C++, which
- // has undefined results.
- $$ = std::numeric_limits<YYSTYPE>::max();
- }
- else
- {
- $$ = $1 / $3;
- }
- }
- | expression '*' expression {
- $$ = $1 * $3;
- }
- | '!' expression %prec TOK_UNARY {
- $$ = ! $2;
- }
- | '~' expression %prec TOK_UNARY {
- $$ = ~ $2;
- }
- | '-' expression %prec TOK_UNARY {
- // Check for negation of minimum representable integer to prevent undefined signed int
- // overflow.
- if ($2 == std::numeric_limits<YYSTYPE>::min())
- {
- $$ = std::numeric_limits<YYSTYPE>::min();
- }
- else
- {
- $$ = -$2;
- }
- }
- | '+' expression %prec TOK_UNARY {
- $$ = + $2;
- }
- | '(' expression ')' {
- $$ = $2;
- }
-;
-
-%%
-
-int yylex(YYSTYPE *lvalp, Context *context)
-{
- pp::Token *token = context->token;
- if (!context->parsePresetToken)
- {
- context->lexer->lex(token);
- }
- context->parsePresetToken = false;
-
- int type = 0;
-
- switch (token->type)
- {
- case pp::Token::CONST_INT: {
- unsigned int val = 0;
- int testVal = 0;
- if (!token->uValue(&val) || (!token->iValue(&testVal) &&
- context->errorSettings.integerLiteralsMustFit32BitSignedRange))
- {
- context->diagnostics->report(pp::Diagnostics::PP_INTEGER_OVERFLOW,
- token->location, token->text);
- *(context->valid) = false;
- }
- *lvalp = static_cast<YYSTYPE>(val);
- type = TOK_CONST_INT;
- break;
- }
- case pp::Token::IDENTIFIER:
- *lvalp = static_cast<YYSTYPE>(-1);
- type = TOK_IDENTIFIER;
- break;
- case pp::Token::OP_OR:
- type = TOK_OP_OR;
- break;
- case pp::Token::OP_AND:
- type = TOK_OP_AND;
- break;
- case pp::Token::OP_NE:
- type = TOK_OP_NE;
- break;
- case pp::Token::OP_EQ:
- type = TOK_OP_EQ;
- break;
- case pp::Token::OP_GE:
- type = TOK_OP_GE;
- break;
- case pp::Token::OP_LE:
- type = TOK_OP_LE;
- break;
- case pp::Token::OP_RIGHT:
- type = TOK_OP_RIGHT;
- break;
- case pp::Token::OP_LEFT:
- type = TOK_OP_LEFT;
- break;
- case '|':
- case '^':
- case '&':
- case '>':
- case '<':
- case '-':
- case '+':
- case '%':
- case '/':
- case '*':
- case '!':
- case '~':
- case '(':
- case ')':
- type = token->type;
- break;
-
- default:
- break;
- }
-
- return type;
-}
-
-void yyerror(Context *context, const char *reason)
-{
- context->diagnostics->report(pp::Diagnostics::PP_INVALID_EXPRESSION,
- context->token->location,
- reason);
-}
-
-namespace pp {
-
-ExpressionParser::ExpressionParser(Lexer *lexer, Diagnostics *diagnostics)
- : mLexer(lexer),
- mDiagnostics(diagnostics)
-{
-}
-
-bool ExpressionParser::parse(Token *token,
- int *result,
- bool parsePresetToken,
- const ErrorSettings &errorSettings,
- bool *valid)
-{
- Context context;
- context.diagnostics = mDiagnostics;
- context.lexer = mLexer;
- context.token = token;
- context.result = result;
- context.ignoreErrors = 0;
- context.parsePresetToken = parsePresetToken;
- context.errorSettings = errorSettings;
- context.valid = valid;
- int ret = yyparse(&context);
- switch (ret)
- {
- case 0:
- case 1:
- break;
-
- case 2:
- mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token->location, "");
- break;
-
- default:
- assert(false);
- mDiagnostics->report(Diagnostics::PP_INTERNAL_ERROR, token->location, "");
- break;
- }
-
- return ret == 0;
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/Input.cpp b/src/OpenGL/compiler/preprocessor/Input.cpp
deleted file mode 100644
index 0626af7b4..000000000
--- a/src/OpenGL/compiler/preprocessor/Input.cpp
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Input.h"
-
-#include <algorithm>
-#include <cassert>
-#include <cstring>
-
-namespace pp
-{
-
-Input::Input() : mCount(0), mString(0)
-{
-}
-
-Input::~Input()
-{
-}
-
-Input::Input(size_t count, const char *const string[], const int length[])
- : mCount(count), mString(string)
-{
- mLength.reserve(mCount);
- for (size_t i = 0; i < mCount; ++i)
- {
- int len = length ? length[i] : -1;
- mLength.push_back(len < 0 ? std::strlen(mString[i]) : len);
- }
-}
-
-const char *Input::skipChar()
-{
- // This function should only be called when there is a character to skip.
- assert(mReadLoc.cIndex < mLength[mReadLoc.sIndex]);
- ++mReadLoc.cIndex;
- if (mReadLoc.cIndex == mLength[mReadLoc.sIndex])
- {
- ++mReadLoc.sIndex;
- mReadLoc.cIndex = 0;
- }
- if (mReadLoc.sIndex >= mCount)
- {
- return nullptr;
- }
- return mString[mReadLoc.sIndex] + mReadLoc.cIndex;
-}
-
-size_t Input::read(char *buf, size_t maxSize, int *lineNo)
-{
- size_t nRead = 0;
- // The previous call to read might have stopped copying the string when encountering a line
- // continuation. Check for this possibility first.
- if (mReadLoc.sIndex < mCount && maxSize > 0)
- {
- const char *c = mString[mReadLoc.sIndex] + mReadLoc.cIndex;
- if ((*c) == '\\')
- {
- c = skipChar();
- if (c != nullptr && (*c) == '\n')
- {
- // Line continuation of backslash + newline.
- skipChar();
- // Fake an EOF if the line number would overflow.
- if (*lineNo == INT_MAX)
- {
- return 0;
- }
- ++(*lineNo);
- }
- else if (c != nullptr && (*c) == '\r')
- {
- // Line continuation. Could be backslash + '\r\n' or just backslash + '\r'.
- c = skipChar();
- if (c != nullptr && (*c) == '\n')
- {
- skipChar();
- }
- // Fake an EOF if the line number would overflow.
- if (*lineNo == INT_MAX)
- {
- return 0;
- }
- ++(*lineNo);
- }
- else
- {
- // Not line continuation, so write the skipped backslash to buf.
- *buf = '\\';
- ++nRead;
- }
- }
- }
-
- size_t maxRead = maxSize;
- while ((nRead < maxRead) && (mReadLoc.sIndex < mCount))
- {
- size_t size = mLength[mReadLoc.sIndex] - mReadLoc.cIndex;
- size = std::min(size, maxSize);
- for (size_t i = 0; i < size; ++i)
- {
- // Stop if a possible line continuation is encountered.
- // It will be processed on the next call on input, which skips it
- // and increments line number if necessary.
- if (*(mString[mReadLoc.sIndex] + mReadLoc.cIndex + i) == '\\')
- {
- size = i;
- maxRead = nRead + size; // Stop reading right before the backslash.
- }
- }
- std::memcpy(buf + nRead, mString[mReadLoc.sIndex] + mReadLoc.cIndex, size);
- nRead += size;
- mReadLoc.cIndex += size;
-
- // Advance string if we reached the end of current string.
- if (mReadLoc.cIndex == mLength[mReadLoc.sIndex])
- {
- ++mReadLoc.sIndex;
- mReadLoc.cIndex = 0;
- }
- }
- return nRead;
-}
-
-} // namespace pp
-
diff --git a/src/OpenGL/compiler/preprocessor/Input.h b/src/OpenGL/compiler/preprocessor/Input.h
deleted file mode 100644
index 59083bff4..000000000
--- a/src/OpenGL/compiler/preprocessor/Input.h
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_INPUT_H_
-#define COMPILER_PREPROCESSOR_INPUT_H_
-
-#include <cstddef>
-#include <vector>
-#include <climits>
-
-namespace pp
-{
-
-// Holds and reads input for Lexer.
-class Input
-{
-public:
- Input();
- ~Input();
- Input(size_t count, const char *const string[], const int length[]);
-
- size_t count() const { return mCount; }
- const char *string(size_t index) const { return mString[index]; }
- size_t length(size_t index) const { return mLength[index]; }
-
- size_t read(char *buf, size_t maxSize, int *lineNo);
-
- struct Location
- {
- size_t sIndex; // String index;
- size_t cIndex; // Char index.
-
- Location() : sIndex(0), cIndex(0) {}
- };
- const Location &readLoc() const { return mReadLoc; }
-
-private:
- // Skip a character and return the next character after the one that was skipped.
- // Return nullptr if data runs out.
- const char *skipChar();
-
- // Input.
- size_t mCount;
- const char *const *mString;
- std::vector<size_t> mLength;
-
- Location mReadLoc;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_INPUT_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/Lexer.cpp b/src/OpenGL/compiler/preprocessor/Lexer.cpp
deleted file mode 100644
index 157a99890..000000000
--- a/src/OpenGL/compiler/preprocessor/Lexer.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Lexer.h"
-
-namespace pp
-{
-
-Lexer::~Lexer()
-{
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/Lexer.h b/src/OpenGL/compiler/preprocessor/Lexer.h
deleted file mode 100644
index 54de51663..000000000
--- a/src/OpenGL/compiler/preprocessor/Lexer.h
+++ /dev/null
@@ -1,33 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_LEXER_H_
-#define COMPILER_PREPROCESSOR_LEXER_H_
-
-namespace pp
-{
-
-struct Token;
-
-class Lexer
-{
-public:
- virtual ~Lexer();
-
- virtual void lex(Token *token) = 0;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_LEXER_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/Macro.cpp b/src/OpenGL/compiler/preprocessor/Macro.cpp
deleted file mode 100644
index d3b419c47..000000000
--- a/src/OpenGL/compiler/preprocessor/Macro.cpp
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Macro.h"
-
-#include "Token.h"
-
-namespace pp
-{
-
-Macro::Macro() : predefined(false), disabled(false), expansionCount(0), type(kTypeObj)
-{
-}
-
-Macro::~Macro()
-{
-}
-
-bool Macro::equals(const Macro &other) const
-{
- return (type == other.type) && (name == other.name) && (parameters == other.parameters) &&
- (replacements == other.replacements);
-}
-
-void PredefineMacro(MacroSet *macroSet, const char *name, int value)
-{
- Token token;
- token.type = Token::CONST_INT;
- token.text = std::to_string(value);
-
- std::shared_ptr<Macro> macro = std::make_shared<Macro>();
- macro->predefined = true;
- macro->type = Macro::kTypeObj;
- macro->name = name;
- macro->replacements.push_back(token);
-
- (*macroSet)[name] = macro;
-}
-
-} // namespace pp
-
diff --git a/src/OpenGL/compiler/preprocessor/Macro.h b/src/OpenGL/compiler/preprocessor/Macro.h
deleted file mode 100644
index c2daeca78..000000000
--- a/src/OpenGL/compiler/preprocessor/Macro.h
+++ /dev/null
@@ -1,57 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_MACRO_H_
-#define COMPILER_PREPROCESSOR_MACRO_H_
-
-#include <map>
-#include <memory>
-#include <string>
-#include <vector>
-
-namespace pp
-{
-
-struct Token;
-
-struct Macro
-{
- enum Type
- {
- kTypeObj,
- kTypeFunc
- };
- typedef std::vector<std::string> Parameters;
- typedef std::vector<Token> Replacements;
-
- Macro();
- ~Macro();
- bool equals(const Macro &other) const;
-
- bool predefined;
- mutable bool disabled;
- mutable int expansionCount;
-
- Type type;
- std::string name;
- Parameters parameters;
- Replacements replacements;
-};
-
-typedef std::map<std::string, std::shared_ptr<Macro>> MacroSet;
-
-void PredefineMacro(MacroSet *macroSet, const char *name, int value);
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_MACRO_H_
diff --git a/src/OpenGL/compiler/preprocessor/MacroExpander.cpp b/src/OpenGL/compiler/preprocessor/MacroExpander.cpp
deleted file mode 100644
index 7df8c095c..000000000
--- a/src/OpenGL/compiler/preprocessor/MacroExpander.cpp
+++ /dev/null
@@ -1,538 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "MacroExpander.h"
-
-#include <algorithm>
-#include <cassert>
-
-#include "DiagnosticsBase.h"
-#include "pp_utils.h"
-#include "Token.h"
-
-namespace pp
-{
-
-namespace
-{
-
-const size_t kMaxContextTokens = 10000;
-
-class TokenLexer : public Lexer
-{
- public:
- typedef std::vector<Token> TokenVector;
-
- TokenLexer(TokenVector *tokens)
- {
- tokens->swap(mTokens);
- mIter = mTokens.begin();
- }
-
- void lex(Token *token) override
- {
- if (mIter == mTokens.end())
- {
- token->reset();
- token->type = Token::LAST;
- }
- else
- {
- *token = *mIter++;
- }
- }
-
- private:
- PP_DISALLOW_COPY_AND_ASSIGN(TokenLexer);
-
- TokenVector mTokens;
- TokenVector::const_iterator mIter;
-};
-
-} // anonymous namespace
-
-class MacroExpander::ScopedMacroReenabler final
-{
- public:
- ScopedMacroReenabler(MacroExpander *expander);
- ~ScopedMacroReenabler();
-
- private:
- PP_DISALLOW_COPY_AND_ASSIGN(ScopedMacroReenabler);
-
- MacroExpander *mExpander;
-};
-
-MacroExpander::ScopedMacroReenabler::ScopedMacroReenabler(MacroExpander *expander)
- : mExpander(expander)
-{
- mExpander->mDeferReenablingMacros = true;
-}
-
-MacroExpander::ScopedMacroReenabler::~ScopedMacroReenabler()
-{
- mExpander->mDeferReenablingMacros = false;
- for (const auto &macro : mExpander->mMacrosToReenable)
- {
- // Copying the string here by using substr is a check for use-after-free. It detects
- // use-after-free more reliably than just toggling the disabled flag.
- assert(!macro->name.substr().empty());
- macro->disabled = false;
- }
- mExpander->mMacrosToReenable.clear();
-}
-
-MacroExpander::MacroExpander(Lexer *lexer,
- MacroSet *macroSet,
- Diagnostics *diagnostics,
- bool parseDefined,
- int allowedMacroExpansionDepth)
- : mLexer(lexer),
- mMacroSet(macroSet),
- mDiagnostics(diagnostics),
- mParseDefined(parseDefined),
- mTotalTokensInContexts(0),
- mAllowedMacroExpansionDepth(allowedMacroExpansionDepth),
- mDeferReenablingMacros(false)
-{
-}
-
-MacroExpander::~MacroExpander()
-{
- assert(mMacrosToReenable.empty());
- for (MacroContext *context : mContextStack)
- {
- delete context;
- }
-}
-
-void MacroExpander::lex(Token *token)
-{
- while (true)
- {
- getToken(token);
-
- if (token->type != Token::IDENTIFIER)
- break;
-
- // Defined operator is parsed here since it may be generated by macro expansion.
- // Defined operator produced by macro expansion has undefined behavior according to C++
- // spec, which the GLSL spec references (see C++14 draft spec section 16.1.4), but this
- // behavior is needed for passing dEQP tests, which enforce stricter compatibility between
- // implementations.
- if (mParseDefined && token->text == "defined")
- {
- bool paren = false;
- getToken(token);
- if (token->type == '(')
- {
- paren = true;
- getToken(token);
- }
- if (token->type != Token::IDENTIFIER)
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
- token->text);
- break;
- }
- auto iter = mMacroSet->find(token->text);
- std::string expression = iter != mMacroSet->end() ? "1" : "0";
-
- if (paren)
- {
- getToken(token);
- if (token->type != ')')
- {
- mDiagnostics->report(Diagnostics::PP_UNEXPECTED_TOKEN, token->location,
- token->text);
- break;
- }
- }
-
- // We have a valid defined operator.
- // Convert the current token into a CONST_INT token.
- token->type = Token::CONST_INT;
- token->text = expression;
- break;
- }
-
- if (token->expansionDisabled())
- break;
-
- MacroSet::const_iterator iter = mMacroSet->find(token->text);
- if (iter == mMacroSet->end())
- break;
-
- std::shared_ptr<Macro> macro = iter->second;
- if (macro->disabled)
- {
- // If a particular token is not expanded, it is never expanded.
- token->setExpansionDisabled(true);
- break;
- }
-
- // Bump the expansion count before peeking if the next token is a '('
- // otherwise there could be a #undef of the macro before the next token.
- macro->expansionCount++;
- if ((macro->type == Macro::kTypeFunc) && !isNextTokenLeftParen())
- {
- // If the token immediately after the macro name is not a '(',
- // this macro should not be expanded.
- macro->expansionCount--;
- break;
- }
-
- pushMacro(macro, *token);
- }
-}
-
-void MacroExpander::getToken(Token *token)
-{
- if (mReserveToken.get())
- {
- *token = *mReserveToken;
- mReserveToken.reset();
- return;
- }
-
- // First pop all empty macro contexts.
- while (!mContextStack.empty() && mContextStack.back()->empty())
- {
- popMacro();
- }
-
- if (!mContextStack.empty())
- {
- *token = mContextStack.back()->get();
- }
- else
- {
- assert(mTotalTokensInContexts == 0);
- mLexer->lex(token);
- }
-}
-
-void MacroExpander::ungetToken(const Token &token)
-{
- if (!mContextStack.empty())
- {
- MacroContext *context = mContextStack.back();
- context->unget();
- assert(context->replacements[context->index] == token);
- }
- else
- {
- assert(!mReserveToken.get());
- mReserveToken.reset(new Token(token));
- }
-}
-
-bool MacroExpander::isNextTokenLeftParen()
-{
- Token token;
- getToken(&token);
-
- bool lparen = token.type == '(';
- ungetToken(token);
-
- return lparen;
-}
-
-bool MacroExpander::pushMacro(std::shared_ptr<Macro> macro, const Token &identifier)
-{
- assert(!macro->disabled);
- assert(!identifier.expansionDisabled());
- assert(identifier.type == Token::IDENTIFIER);
- assert(identifier.text == macro->name);
-
- std::vector<Token> replacements;
- if (!expandMacro(*macro, identifier, &replacements))
- return false;
-
- // Macro is disabled for expansion until it is popped off the stack.
- macro->disabled = true;
-
- MacroContext *context = new MacroContext;
- context->macro = macro;
- context->replacements.swap(replacements);
- mContextStack.push_back(context);
- mTotalTokensInContexts += context->replacements.size();
- return true;
-}
-
-void MacroExpander::popMacro()
-{
- assert(!mContextStack.empty());
-
- MacroContext *context = mContextStack.back();
- mContextStack.pop_back();
-
- assert(context->empty());
- assert(context->macro->disabled);
- assert(context->macro->expansionCount > 0);
- if (mDeferReenablingMacros)
- {
- mMacrosToReenable.push_back(context->macro);
- }
- else
- {
- context->macro->disabled = false;
- }
- context->macro->expansionCount--;
- mTotalTokensInContexts -= context->replacements.size();
- delete context;
-}
-
-bool MacroExpander::expandMacro(const Macro &macro,
- const Token &identifier,
- std::vector<Token> *replacements)
-{
- replacements->clear();
-
- // In the case of an object-like macro, the replacement list gets its location
- // from the identifier, but in the case of a function-like macro, the replacement
- // list gets its location from the closing parenthesis of the macro invocation.
- // This is tested by dEQP-GLES3.functional.shaders.preprocessor.predefined_macros.*
- SourceLocation replacementLocation = identifier.location;
- if (macro.type == Macro::kTypeObj)
- {
- replacements->assign(macro.replacements.begin(), macro.replacements.end());
-
- if (macro.predefined)
- {
- const char kLine[] = "__LINE__";
- const char kFile[] = "__FILE__";
-
- assert(replacements->size() == 1);
- Token &repl = replacements->front();
- if (macro.name == kLine)
- {
- repl.text = std::to_string(identifier.location.line);
- }
- else if (macro.name == kFile)
- {
- repl.text = std::to_string(identifier.location.file);
- }
- }
- }
- else
- {
- assert(macro.type == Macro::kTypeFunc);
- std::vector<MacroArg> args;
- args.reserve(macro.parameters.size());
- if (!collectMacroArgs(macro, identifier, &args, &replacementLocation))
- return false;
-
- replaceMacroParams(macro, args, replacements);
- }
-
- for (std::size_t i = 0; i < replacements->size(); ++i)
- {
- Token &repl = replacements->at(i);
- if (i == 0)
- {
- // The first token in the replacement list inherits the padding
- // properties of the identifier token.
- repl.setAtStartOfLine(identifier.atStartOfLine());
- repl.setHasLeadingSpace(identifier.hasLeadingSpace());
- }
- repl.location = replacementLocation;
- }
- return true;
-}
-
-bool MacroExpander::collectMacroArgs(const Macro &macro,
- const Token &identifier,
- std::vector<MacroArg> *args,
- SourceLocation *closingParenthesisLocation)
-{
- Token token;
- getToken(&token);
- assert(token.type == '(');
-
- args->push_back(MacroArg());
-
- // Defer reenabling macros until args collection is finished to avoid the possibility of
- // infinite recursion. Otherwise infinite recursion might happen when expanding the args after
- // macros have been popped from the context stack when parsing the args.
- ScopedMacroReenabler deferReenablingMacros(this);
-
- int openParens = 1;
- while (openParens != 0)
- {
- getToken(&token);
-
- if (token.type == Token::LAST)
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_UNTERMINATED_INVOCATION, identifier.location,
- identifier.text);
- // Do not lose EOF token.
- ungetToken(token);
- return false;
- }
-
- bool isArg = false; // True if token is part of the current argument.
- switch (token.type)
- {
- case '(':
- ++openParens;
- isArg = true;
- break;
- case ')':
- --openParens;
- isArg = openParens != 0;
- *closingParenthesisLocation = token.location;
- break;
- case ',':
- // The individual arguments are separated by comma tokens, but
- // the comma tokens between matching inner parentheses do not
- // seperate arguments.
- if (openParens == 1)
- args->push_back(MacroArg());
- isArg = openParens != 1;
- break;
- default:
- isArg = true;
- break;
- }
- if (isArg)
- {
- MacroArg &arg = args->back();
- // Initial whitespace is not part of the argument.
- if (arg.empty())
- token.setHasLeadingSpace(false);
- arg.push_back(token);
- }
- }
-
- const Macro::Parameters &params = macro.parameters;
- // If there is only one empty argument, it is equivalent to no argument.
- if (params.empty() && (args->size() == 1) && args->front().empty())
- {
- args->clear();
- }
- // Validate the number of arguments.
- if (args->size() != params.size())
- {
- Diagnostics::ID id = args->size() < macro.parameters.size() ?
- Diagnostics::PP_MACRO_TOO_FEW_ARGS :
- Diagnostics::PP_MACRO_TOO_MANY_ARGS;
- mDiagnostics->report(id, identifier.location, identifier.text);
- return false;
- }
-
- // Pre-expand each argument before substitution.
- // This step expands each argument individually before they are
- // inserted into the macro body.
- size_t numTokens = 0;
- for (auto &arg : *args)
- {
- TokenLexer lexer(&arg);
- if (mAllowedMacroExpansionDepth < 1)
- {
- mDiagnostics->report(Diagnostics::PP_MACRO_INVOCATION_CHAIN_TOO_DEEP,
- token.location, token.text);
- return false;
- }
- MacroExpander expander(&lexer, mMacroSet, mDiagnostics, mParseDefined, mAllowedMacroExpansionDepth - 1);
-
- arg.clear();
- expander.lex(&token);
- while (token.type != Token::LAST)
- {
- arg.push_back(token);
- expander.lex(&token);
- numTokens++;
- if (numTokens + mTotalTokensInContexts > kMaxContextTokens)
- {
- mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token.location, token.text);
- return false;
- }
- }
- }
- return true;
-}
-
-void MacroExpander::replaceMacroParams(const Macro &macro,
- const std::vector<MacroArg> &args,
- std::vector<Token> *replacements)
-{
- for (std::size_t i = 0; i < macro.replacements.size(); ++i)
- {
- if (!replacements->empty() &&
- replacements->size() + mTotalTokensInContexts > kMaxContextTokens)
- {
- const Token &token = replacements->back();
- mDiagnostics->report(Diagnostics::PP_OUT_OF_MEMORY, token.location, token.text);
- return;
- }
-
- const Token &repl = macro.replacements[i];
- if (repl.type != Token::IDENTIFIER)
- {
- replacements->push_back(repl);
- continue;
- }
-
- // TODO(alokp): Optimize this.
- // There is no need to search for macro params every time.
- // The param index can be cached with the replacement token.
- Macro::Parameters::const_iterator iter =
- std::find(macro.parameters.begin(), macro.parameters.end(), repl.text);
- if (iter == macro.parameters.end())
- {
- replacements->push_back(repl);
- continue;
- }
-
- std::size_t iArg = std::distance(macro.parameters.begin(), iter);
- const MacroArg &arg = args[iArg];
- if (arg.empty())
- {
- continue;
- }
- std::size_t iRepl = replacements->size();
- replacements->insert(replacements->end(), arg.begin(), arg.end());
- // The replacement token inherits padding properties from
- // macro replacement token.
- replacements->at(iRepl).setHasLeadingSpace(repl.hasLeadingSpace());
- }
-}
-
-MacroExpander::MacroContext::MacroContext() : macro(0), index(0)
-{
-}
-
-MacroExpander::MacroContext::~MacroContext()
-{
-}
-
-bool MacroExpander::MacroContext::empty() const
-{
- return index == replacements.size();
-}
-
-const Token &MacroExpander::MacroContext::get()
-{
- return replacements[index++];
-}
-
-void MacroExpander::MacroContext::unget()
-{
- assert(index > 0);
- --index;
-}
-
-} // namespace pp
-
diff --git a/src/OpenGL/compiler/preprocessor/MacroExpander.h b/src/OpenGL/compiler/preprocessor/MacroExpander.h
deleted file mode 100644
index f7c1701ed..000000000
--- a/src/OpenGL/compiler/preprocessor/MacroExpander.h
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
-#define COMPILER_PREPROCESSOR_MACRO_EXPANDER_H_
-
-#include <memory>
-#include <vector>
-
-#include "Lexer.h"
-#include "Macro.h"
-#include "pp_utils.h"
-
-namespace pp
-{
-
-class Diagnostics;
-struct SourceLocation;
-
-class MacroExpander : public Lexer
-{
-public:
- MacroExpander(Lexer *lexer, MacroSet *macroSet, Diagnostics *diagnostics, bool parseDefined, int allowedMacroExpansionDepth);
- ~MacroExpander() override;
-
- void lex(Token *token) override;
-
-private:
- PP_DISALLOW_COPY_AND_ASSIGN(MacroExpander);
-
- void getToken(Token *token);
- void ungetToken(const Token &token);
- bool isNextTokenLeftParen();
-
- bool pushMacro(std::shared_ptr<Macro> macro, const Token &identifier);
- void popMacro();
-
- bool expandMacro(const Macro &macro, const Token &identifier, std::vector<Token> *replacements);
-
- typedef std::vector<Token> MacroArg;
- bool collectMacroArgs(const Macro &macro,
- const Token &identifier,
- std::vector<MacroArg> *args,
- SourceLocation *closingParenthesisLocation);
- void replaceMacroParams(const Macro &macro,
- const std::vector<MacroArg> &args,
- std::vector<Token> *replacements);
-
- struct MacroContext
- {
- MacroContext();
- ~MacroContext();
- bool empty() const;
- const Token &get();
- void unget();
-
- std::shared_ptr<Macro> macro;
- std::size_t index;
- std::vector<Token> replacements;
- };
-
- Lexer *mLexer;
- MacroSet *mMacroSet;
- Diagnostics *mDiagnostics;
- const bool mParseDefined;
-
- std::unique_ptr<Token> mReserveToken;
- std::vector<MacroContext *> mContextStack;
- size_t mTotalTokensInContexts;
-
- int mAllowedMacroExpansionDepth;
-
- bool mDeferReenablingMacros;
- std::vector<std::shared_ptr<Macro>> mMacrosToReenable;
-
- class ScopedMacroReenabler;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_MACROEXPANDER_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/Preprocessor.cpp b/src/OpenGL/compiler/preprocessor/Preprocessor.cpp
deleted file mode 100644
index e4e2b5e71..000000000
--- a/src/OpenGL/compiler/preprocessor/Preprocessor.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Preprocessor.h"
-
-#include <cassert>
-
-#include "DiagnosticsBase.h"
-#include "DirectiveParser.h"
-#include "Macro.h"
-#include "MacroExpander.h"
-#include "Token.h"
-#include "Tokenizer.h"
-
-namespace pp
-{
-
-struct PreprocessorImpl
-{
- Diagnostics *diagnostics;
- MacroSet macroSet;
- Tokenizer tokenizer;
- DirectiveParser directiveParser;
- MacroExpander macroExpander;
-
- PreprocessorImpl(Diagnostics *diag,
- DirectiveHandler *directiveHandler,
- const PreprocessorSettings &settings)
- : diagnostics(diag),
- tokenizer(diag),
- directiveParser(&tokenizer, &macroSet, diag, directiveHandler, settings.maxMacroExpansionDepth),
- macroExpander(&directiveParser, &macroSet, diag, false, settings.maxMacroExpansionDepth)
- {
- }
-};
-
-Preprocessor::Preprocessor(Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- const PreprocessorSettings &settings)
-{
- mImpl = new PreprocessorImpl(diagnostics, directiveHandler, settings);
-}
-
-Preprocessor::~Preprocessor()
-{
- delete mImpl;
-}
-
-bool Preprocessor::init(size_t count, const char *const string[], const int length[])
-{
- static const int kDefaultGLSLVersion = 100;
-
- // Add standard pre-defined macros.
- predefineMacro("__LINE__", 0);
- predefineMacro("__FILE__", 0);
- predefineMacro("__VERSION__", kDefaultGLSLVersion);
- predefineMacro("GL_ES", 1);
-
- return mImpl->tokenizer.init(count, string, length);
-}
-
-void Preprocessor::predefineMacro(const char *name, int value)
-{
- PredefineMacro(&mImpl->macroSet, name, value);
-}
-
-void Preprocessor::lex(Token *token)
-{
- bool validToken = false;
- while (!validToken)
- {
- mImpl->macroExpander.lex(token);
- switch (token->type)
- {
- // We should not be returning internal preprocessing tokens.
- // Convert preprocessing tokens to compiler tokens or report
- // diagnostics.
- case Token::PP_HASH:
- assert(false);
- break;
- case Token::PP_NUMBER:
- mImpl->diagnostics->report(Diagnostics::PP_INVALID_NUMBER,
- token->location, token->text);
- break;
- case Token::PP_OTHER:
- mImpl->diagnostics->report(Diagnostics::PP_INVALID_CHARACTER,
- token->location, token->text);
- break;
- default:
- validToken = true;
- break;
- }
- }
-}
-
-void Preprocessor::setMaxTokenSize(size_t maxTokenSize)
-{
- mImpl->tokenizer.setMaxTokenSize(maxTokenSize);
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/Preprocessor.h b/src/OpenGL/compiler/preprocessor/Preprocessor.h
deleted file mode 100644
index a8e139c7f..000000000
--- a/src/OpenGL/compiler/preprocessor/Preprocessor.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_PREPROCESSOR_H_
-#define COMPILER_PREPROCESSOR_PREPROCESSOR_H_
-
-#include "pp_utils.h"
-
-#include <cstddef>
-
-namespace pp
-{
-
-class Diagnostics;
-class DirectiveHandler;
-struct PreprocessorImpl;
-struct Token;
-
-struct PreprocessorSettings
-{
- PreprocessorSettings() : maxMacroExpansionDepth(1000) {}
- int maxMacroExpansionDepth;
-};
-
-class Preprocessor
-{
-public:
- Preprocessor(Diagnostics *diagnostics,
- DirectiveHandler *directiveHandler,
- const PreprocessorSettings &settings);
- ~Preprocessor();
-
- // count: specifies the number of elements in the string and length arrays.
- // string: specifies an array of pointers to strings.
- // length: specifies an array of string lengths.
- // If length is NULL, each string is assumed to be null terminated.
- // If length is a value other than NULL, it points to an array containing
- // a string length for each of the corresponding elements of string.
- // Each element in the length array may contain the length of the
- // corresponding string or a value less than 0 to indicate that the string
- // is null terminated.
- bool init(size_t count, const char *const string[], const int length[]);
- // Adds a pre-defined macro.
- void predefineMacro(const char *name, int value);
-
- void lex(Token *token);
-
- // Set maximum preprocessor token size
- void setMaxTokenSize(size_t maxTokenSize);
-
-private:
- PP_DISALLOW_COPY_AND_ASSIGN(Preprocessor);
-
- PreprocessorImpl *mImpl;
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_PREPROCESSOR_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/SourceLocation.h b/src/OpenGL/compiler/preprocessor/SourceLocation.h
deleted file mode 100644
index 234d30429..000000000
--- a/src/OpenGL/compiler/preprocessor/SourceLocation.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
-#define COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
-
-namespace pp
-{
-
-struct SourceLocation
-{
- SourceLocation() : file(0), line(0) {}
- SourceLocation(int f, int l) : file(f), line(l) {}
-
- bool equals(const SourceLocation &other) const
- {
- return (file == other.file) && (line == other.line);
- }
-
- int file;
- int line;
-};
-
-inline bool operator==(const SourceLocation &lhs, const SourceLocation &rhs)
-{
- return lhs.equals(rhs);
-}
-
-inline bool operator!=(const SourceLocation &lhs, const SourceLocation &rhs)
-{
- return !lhs.equals(rhs);
-}
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_SOURCE_LOCATION_H_
diff --git a/src/OpenGL/compiler/preprocessor/Token.cpp b/src/OpenGL/compiler/preprocessor/Token.cpp
deleted file mode 100644
index 731a59275..000000000
--- a/src/OpenGL/compiler/preprocessor/Token.cpp
+++ /dev/null
@@ -1,91 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Token.h"
-
-#include <cassert>
-
-#include "numeric_lex.h"
-
-namespace pp
-{
-
-void Token::reset()
-{
- type = 0;
- flags = 0;
- location = SourceLocation();
- text.clear();
-}
-
-bool Token::equals(const Token &other) const
-{
- return (type == other.type) &&
- (flags == other.flags) &&
- (location == other.location) &&
- (text == other.text);
-}
-
-void Token::setAtStartOfLine(bool start)
-{
- if (start)
- flags |= AT_START_OF_LINE;
- else
- flags &= ~AT_START_OF_LINE;
-}
-
-void Token::setHasLeadingSpace(bool space)
-{
- if (space)
- flags |= HAS_LEADING_SPACE;
- else
- flags &= ~HAS_LEADING_SPACE;
-}
-
-void Token::setExpansionDisabled(bool disable)
-{
- if (disable)
- flags |= EXPANSION_DISABLED;
- else
- flags &= ~EXPANSION_DISABLED;
-}
-
-bool Token::iValue(int *value) const
-{
- assert(type == CONST_INT);
- return numeric_lex_int(text, value);
-}
-
-bool Token::uValue(unsigned int *value) const
-{
- assert(type == CONST_INT);
- return numeric_lex_int(text, value);
-}
-
-bool Token::fValue(float *value) const
-{
- assert(type == CONST_FLOAT);
- return numeric_lex_float(text, value);
-}
-
-std::ostream &operator<<(std::ostream &out, const Token &token)
-{
- if (token.hasLeadingSpace())
- out << " ";
-
- out << token.text;
- return out;
-}
-
-} // namespace pp
diff --git a/src/OpenGL/compiler/preprocessor/Token.h b/src/OpenGL/compiler/preprocessor/Token.h
deleted file mode 100644
index c0475a896..000000000
--- a/src/OpenGL/compiler/preprocessor/Token.h
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_TOKEN_H_
-#define COMPILER_PREPROCESSOR_TOKEN_H_
-
-#include <ostream>
-#include <string>
-
-#include "SourceLocation.h"
-
-namespace pp
-{
-
-struct Token
-{
- enum Type
- {
- // Calling this ERROR causes a conflict with wingdi.h
- GOT_ERROR = -1,
- LAST = 0, // EOF.
-
- IDENTIFIER = 258,
-
- CONST_INT,
- CONST_FLOAT,
-
- OP_INC,
- OP_DEC,
- OP_LEFT,
- OP_RIGHT,
- OP_LE,
- OP_GE,
- OP_EQ,
- OP_NE,
- OP_AND,
- OP_XOR,
- OP_OR,
- OP_ADD_ASSIGN,
- OP_SUB_ASSIGN,
- OP_MUL_ASSIGN,
- OP_DIV_ASSIGN,
- OP_MOD_ASSIGN,
- OP_LEFT_ASSIGN,
- OP_RIGHT_ASSIGN,
- OP_AND_ASSIGN,
- OP_XOR_ASSIGN,
- OP_OR_ASSIGN,
-
- // Preprocessing token types.
- // These types are used by the preprocessor internally.
- // Preprocessor clients must not depend or check for them.
- PP_HASH,
- PP_NUMBER,
- PP_OTHER
- };
- enum Flags
- {
- AT_START_OF_LINE = 1 << 0,
- HAS_LEADING_SPACE = 1 << 1,
- EXPANSION_DISABLED = 1 << 2
- };
-
- Token() : type(0), flags(0) {}
-
- void reset();
- bool equals(const Token &other) const;
-
- // Returns true if this is the first token on line.
- // It disregards any leading whitespace.
- bool atStartOfLine() const { return (flags & AT_START_OF_LINE) != 0; }
- void setAtStartOfLine(bool start);
-
- bool hasLeadingSpace() const { return (flags & HAS_LEADING_SPACE) != 0; }
- void setHasLeadingSpace(bool space);
-
- bool expansionDisabled() const { return (flags & EXPANSION_DISABLED) != 0; }
- void setExpansionDisabled(bool disable);
-
- // Converts text into numeric value for CONST_INT and CONST_FLOAT token.
- // Returns false if the parsed value cannot fit into an int or float.
- bool iValue(int *value) const;
- bool uValue(unsigned int *value) const;
- bool fValue(float *value) const;
-
- int type;
- unsigned int flags;
- SourceLocation location;
- std::string text;
-};
-
-inline bool operator==(const Token &lhs, const Token &rhs)
-{
- return lhs.equals(rhs);
-}
-
-inline bool operator!=(const Token &lhs, const Token &rhs)
-{
- return !lhs.equals(rhs);
-}
-
-std::ostream &operator<<(std::ostream &out, const Token &token);
-
-} // namepsace pp
-#endif // COMPILER_PREPROCESSOR_TOKEN_H_
diff --git a/src/OpenGL/compiler/preprocessor/Tokenizer.cpp b/src/OpenGL/compiler/preprocessor/Tokenizer.cpp
deleted file mode 100644
index 44025a962..000000000
--- a/src/OpenGL/compiler/preprocessor/Tokenizer.cpp
+++ /dev/null
@@ -1,3082 +0,0 @@
-#line 24 "./Tokenizer.l"
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-
-
-
-#define YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-
-
-
-
-
-
-
-
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 6
-#define YY_FLEX_SUBMINOR_VERSION 4
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-#ifdef yy_create_buffer
-#define pp_create_buffer_ALREADY_DEFINED
-#else
-#define yy_create_buffer pp_create_buffer
-#endif
-
-
-#ifdef yy_delete_buffer
-#define pp_delete_buffer_ALREADY_DEFINED
-#else
-#define yy_delete_buffer pp_delete_buffer
-#endif
-
-
-#ifdef yy_scan_buffer
-#define pp_scan_buffer_ALREADY_DEFINED
-#else
-#define yy_scan_buffer pp_scan_buffer
-#endif
-
-
-#ifdef yy_scan_string
-#define pp_scan_string_ALREADY_DEFINED
-#else
-#define yy_scan_string pp_scan_string
-#endif
-
-
-#ifdef yy_scan_bytes
-#define pp_scan_bytes_ALREADY_DEFINED
-#else
-#define yy_scan_bytes pp_scan_bytes
-#endif
-
-
-#ifdef yy_init_buffer
-#define pp_init_buffer_ALREADY_DEFINED
-#else
-#define yy_init_buffer pp_init_buffer
-#endif
-
-
-#ifdef yy_flush_buffer
-#define pp_flush_buffer_ALREADY_DEFINED
-#else
-#define yy_flush_buffer pp_flush_buffer
-#endif
-
-
-#ifdef yy_load_buffer_state
-#define pp_load_buffer_state_ALREADY_DEFINED
-#else
-#define yy_load_buffer_state pp_load_buffer_state
-#endif
-
-
-#ifdef yy_switch_to_buffer
-#define pp_switch_to_buffer_ALREADY_DEFINED
-#else
-#define yy_switch_to_buffer pp_switch_to_buffer
-#endif
-
-
-#ifdef yypush_buffer_state
-#define pppush_buffer_state_ALREADY_DEFINED
-#else
-#define yypush_buffer_state pppush_buffer_state
-#endif
-
-
-#ifdef yypop_buffer_state
-#define pppop_buffer_state_ALREADY_DEFINED
-#else
-#define yypop_buffer_state pppop_buffer_state
-#endif
-
-
-#ifdef yyensure_buffer_stack
-#define ppensure_buffer_stack_ALREADY_DEFINED
-#else
-#define yyensure_buffer_stack ppensure_buffer_stack
-#endif
-
-
-#ifdef yylex
-#define pplex_ALREADY_DEFINED
-#else
-#define yylex pplex
-#endif
-
-
-#ifdef yyrestart
-#define pprestart_ALREADY_DEFINED
-#else
-#define yyrestart pprestart
-#endif
-
-
-#ifdef yylex_init
-#define pplex_init_ALREADY_DEFINED
-#else
-#define yylex_init pplex_init
-#endif
-
-
-#ifdef yylex_init_extra
-#define pplex_init_extra_ALREADY_DEFINED
-#else
-#define yylex_init_extra pplex_init_extra
-#endif
-
-
-#ifdef yylex_destroy
-#define pplex_destroy_ALREADY_DEFINED
-#else
-#define yylex_destroy pplex_destroy
-#endif
-
-
-#ifdef yyget_debug
-#define ppget_debug_ALREADY_DEFINED
-#else
-#define yyget_debug ppget_debug
-#endif
-
-
-#ifdef yyset_debug
-#define ppset_debug_ALREADY_DEFINED
-#else
-#define yyset_debug ppset_debug
-#endif
-
-
-#ifdef yyget_extra
-#define ppget_extra_ALREADY_DEFINED
-#else
-#define yyget_extra ppget_extra
-#endif
-
-
-#ifdef yyset_extra
-#define ppset_extra_ALREADY_DEFINED
-#else
-#define yyset_extra ppset_extra
-#endif
-
-
-#ifdef yyget_in
-#define ppget_in_ALREADY_DEFINED
-#else
-#define yyget_in ppget_in
-#endif
-
-
-#ifdef yyset_in
-#define ppset_in_ALREADY_DEFINED
-#else
-#define yyset_in ppset_in
-#endif
-
-
-#ifdef yyget_out
-#define ppget_out_ALREADY_DEFINED
-#else
-#define yyget_out ppget_out
-#endif
-
-
-#ifdef yyset_out
-#define ppset_out_ALREADY_DEFINED
-#else
-#define yyset_out ppset_out
-#endif
-
-
-#ifdef yyget_leng
-#define ppget_leng_ALREADY_DEFINED
-#else
-#define yyget_leng ppget_leng
-#endif
-
-
-#ifdef yyget_text
-#define ppget_text_ALREADY_DEFINED
-#else
-#define yyget_text ppget_text
-#endif
-
-
-#ifdef yyget_lineno
-#define ppget_lineno_ALREADY_DEFINED
-#else
-#define yyget_lineno ppget_lineno
-#endif
-
-
-#ifdef yyset_lineno
-#define ppset_lineno_ALREADY_DEFINED
-#else
-#define yyset_lineno ppset_lineno
-#endif
-
-
-
-#ifdef yyget_column
-#define ppget_column_ALREADY_DEFINED
-#else
-#define yyget_column ppget_column
-#endif
-
-
-#ifdef yyset_column
-#define ppset_column_ALREADY_DEFINED
-#else
-#define yyset_column ppset_column
-#endif
-
-
-
-#ifdef yywrap
-#define ppwrap_ALREADY_DEFINED
-#else
-#define yywrap ppwrap
-#endif
-
-
-
-
-
-#ifdef yyget_lval
-#define ppget_lval_ALREADY_DEFINED
-#else
-#define yyget_lval ppget_lval
-#endif
-
-
-#ifdef yyset_lval
-#define ppset_lval_ALREADY_DEFINED
-#else
-#define yyset_lval ppset_lval
-#endif
-
-
-
-
-
-#ifdef yyget_lloc
-#define ppget_lloc_ALREADY_DEFINED
-#else
-#define yyget_lloc ppget_lloc
-#endif
-
-
-#ifdef yyset_lloc
-#define ppset_lloc_ALREADY_DEFINED
-#else
-#define yyset_lloc ppset_lloc
-#endif
-
-
-
-
-#ifdef yyalloc
-#define ppalloc_ALREADY_DEFINED
-#else
-#define yyalloc ppalloc
-#endif
-
-
-#ifdef yyrealloc
-#define pprealloc_ALREADY_DEFINED
-#else
-#define yyrealloc pprealloc
-#endif
-
-
-#ifdef yyfree
-#define ppfree_ALREADY_DEFINED
-#else
-#define yyfree ppfree
-#endif
-
-
-
-
-
-
-
-
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#ifndef SIZE_MAX
-#define SIZE_MAX (~(size_t)0)
-#endif
-
-#endif /* ! C99 */
-
-#endif /* ! FLEXINT_H */
-
-
-/* begin standard C++ headers. */
-
-/* TODO: this is always defined, so inline it */
-#define yyconst const
-
-#if defined(__GNUC__) && __GNUC__ >= 3
-#define yynoreturn __attribute__((__noreturn__))
-#else
-#define yynoreturn
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-
-/* Promotes a possibly negative, possibly signed char to an
- * integer in range [0..255] for use as an array index.
- */
-#define YY_SC_TO_UI(c) ((YY_CHAR) (c))
-
-
-
-
-
-/* An opaque pointer. */
-#ifndef YY_TYPEDEF_YY_SCANNER_T
-#define YY_TYPEDEF_YY_SCANNER_T
-typedef void* yyscan_t;
-#endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* For convenience, these vars (plus the bison vars far below)
- are macros in the reentrant scanner. */
-#define yyin yyg->yyin_r
-#define yyout yyg->yyout_r
-#define yyextra yyg->yyextra_r
-#define yyleng yyg->yyleng_r
-#define yytext yyg->yytext_r
-#define yylineno (YY_CURRENT_BUFFER_LVALUE->yy_bs_lineno)
-#define yycolumn (YY_CURRENT_BUFFER_LVALUE->yy_bs_column)
-#define yy_flex_debug yyg->yy_flex_debug_r
-
-
-
-
-
-
-
-
-
-
-
-
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yyg->yy_start = 1 + 2 *
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yyg->yy_start - 1) / 2)
-#define YYSTATE YY_START
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin , yyscanner )
-#define YY_END_OF_BUFFER_CHAR 0
-
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
-#define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
-#endif
-
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-
-
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
- #define YY_LESS_LINENO(n)
- #define YY_LINENO_REWIND_TO(ptr)
-
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = yyg->yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yyg->yy_c_buf_p = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-#define unput(c) yyunput( c, yyg->yytext_ptr , yyscanner )
-
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
-
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- int yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
-
- };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-
-
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( yyg->yy_buffer_stack \
- ? yyg->yy_buffer_stack[yyg->yy_buffer_stack_top] \
- : NULL)
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE yyg->yy_buffer_stack[yyg->yy_buffer_stack_top]
-
-
-
-
-
-void yyrestart ( FILE *input_file , yyscan_t yyscanner );
-void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size , yyscan_t yyscanner );
-void yy_delete_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yy_flush_buffer ( YY_BUFFER_STATE b , yyscan_t yyscanner );
-void yypush_buffer_state ( YY_BUFFER_STATE new_buffer , yyscan_t yyscanner );
-void yypop_buffer_state ( yyscan_t yyscanner );
-
-
-static void yyensure_buffer_stack ( yyscan_t yyscanner );
-static void yy_load_buffer_state ( yyscan_t yyscanner );
-static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file , yyscan_t yyscanner );
-#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER , yyscanner)
-
-
-YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_string ( const char *yy_str , yyscan_t yyscanner );
-YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len , yyscan_t yyscanner );
-
-
-void *yyalloc ( yy_size_t , yyscan_t yyscanner );
-void *yyrealloc ( void *, yy_size_t , yyscan_t yyscanner );
-void yyfree ( void * , yyscan_t yyscanner );
-
-
-#define yy_new_buffer yy_create_buffer
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
- }
-#define yy_set_bol(at_bol) \
- { \
- if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (yyscanner); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
- }
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-
-/* Begin user sect3 */
-
-#define ppwrap(yyscanner) (/*CONSTCOND*/1)
-#define YY_SKIP_YYWRAP
-typedef flex_uint8_t YY_CHAR;
-
-
-typedef int yy_state_type;
-
-#define yytext_ptr yytext_r
-
-
-
-
-
-
-static yy_state_type yy_get_previous_state ( yyscan_t yyscanner );
-static yy_state_type yy_try_NUL_trans ( yy_state_type current_state , yyscan_t yyscanner);
-static int yy_get_next_buffer ( yyscan_t yyscanner );
-static void yynoreturn yy_fatal_error ( const char* msg , yyscan_t yyscanner );
-
-
-
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yyg->yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yyg->yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- yyg->yy_c_buf_p = yy_cp;
-#define YY_NUM_RULES 37
-#define YY_END_OF_BUFFER 38
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static const flex_int16_t yy_accept[95] =
- { 0,
- 0, 0, 0, 0, 38, 36, 34, 35, 35, 33,
- 7, 33, 33, 33, 33, 33, 33, 33, 33, 9,
- 9, 33, 33, 33, 8, 33, 33, 3, 5, 5,
- 4, 34, 35, 19, 27, 20, 30, 25, 12, 23,
- 13, 24, 10, 2, 1, 26, 10, 9, 11, 11,
- 11, 9, 11, 9, 9, 14, 16, 18, 17, 15,
- 8, 31, 21, 32, 22, 3, 5, 6, 11, 10,
- 11, 10, 1, 10, 11, 10, 0, 10, 9, 9,
- 9, 28, 29, 0, 10, 10, 10, 10, 9, 10,
- 10, 9, 10, 0
-
- } ;
-
-static const YY_CHAR yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 2, 2, 4, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 2, 5, 1, 6, 1, 7, 8, 1, 9,
- 9, 10, 11, 9, 12, 13, 14, 15, 16, 16,
- 16, 16, 16, 16, 16, 17, 17, 9, 9, 18,
- 19, 20, 9, 1, 21, 21, 21, 21, 22, 23,
- 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 25, 24, 24, 26, 24, 24,
- 9, 1, 9, 27, 24, 1, 21, 21, 21, 21,
-
- 22, 23, 24, 24, 24, 24, 24, 24, 24, 24,
- 24, 24, 24, 24, 24, 24, 25, 24, 24, 26,
- 24, 24, 9, 28, 9, 9, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static const YY_CHAR yy_meta[29] =
- { 0,
- 1, 1, 2, 2, 1, 1, 1, 1, 1, 3,
- 1, 1, 4, 1, 5, 5, 5, 1, 1, 1,
- 5, 5, 5, 5, 5, 5, 1, 1
- } ;
-
-static const flex_int16_t yy_base[100] =
- { 0,
- 0, 0, 26, 28, 133, 195, 130, 195, 128, 105,
- 195, 104, 25, 195, 100, 23, 27, 32, 31, 38,
- 50, 38, 93, 49, 0, 16, 51, 0, 195, 105,
- 87, 93, 195, 195, 195, 195, 195, 195, 195, 195,
- 195, 195, 67, 195, 0, 195, 81, 55, 84, 98,
- 110, 53, 61, 0, 52, 39, 195, 195, 195, 33,
- 0, 195, 195, 195, 195, 0, 195, 195, 113, 0,
- 126, 0, 0, 0, 133, 0, 56, 128, 0, 133,
- 0, 195, 195, 101, 141, 143, 145, 0, 15, 154,
- 195, 0, 195, 195, 177, 32, 182, 187, 189
-
- } ;
-
-static const flex_int16_t yy_def[100] =
- { 0,
- 94, 1, 95, 95, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 20, 94, 94, 94, 96, 94, 94, 97, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 98, 94, 94, 20, 20, 49,
- 50, 50, 99, 21, 50, 94, 94, 94, 94, 94,
- 96, 94, 94, 94, 94, 97, 94, 94, 43, 43,
- 69, 69, 98, 47, 50, 50, 94, 51, 50, 99,
- 50, 94, 94, 94, 71, 75, 94, 50, 50, 94,
- 94, 50, 94, 0, 94, 94, 94, 94, 94
-
- } ;
-
-static const flex_int16_t yy_nxt[224] =
- { 0,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, 21, 22, 23, 24,
- 25, 25, 25, 25, 25, 25, 26, 27, 29, 30,
- 29, 30, 36, 39, 62, 31, 61, 31, 41, 92,
- 44, 40, 63, 37, 45, 42, 43, 43, 43, 46,
- 47, 83, 48, 48, 49, 56, 57, 82, 50, 51,
- 50, 50, 52, 53, 54, 54, 54, 59, 60, 64,
- 87, 87, 87, 50, 55, 50, 81, 79, 65, 69,
- 50, 70, 70, 70, 50, 50, 50, 69, 71, 72,
- 69, 69, 69, 50, 32, 74, 74, 74, 49, 49,
-
- 68, 50, 75, 76, 50, 50, 50, 67, 50, 50,
- 50, 58, 50, 50, 50, 90, 90, 90, 38, 50,
- 77, 77, 35, 34, 78, 78, 78, 69, 69, 69,
- 33, 32, 94, 94, 69, 69, 84, 84, 94, 94,
- 85, 85, 85, 84, 84, 50, 94, 86, 86, 86,
- 88, 94, 94, 94, 94, 94, 50, 89, 50, 87,
- 87, 87, 94, 72, 94, 76, 94, 91, 90, 90,
- 90, 94, 94, 94, 94, 94, 93, 28, 28, 28,
- 28, 28, 66, 94, 94, 66, 66, 73, 94, 73,
- 73, 73, 80, 80, 5, 94, 94, 94, 94, 94,
-
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94
- } ;
-
-static const flex_int16_t yy_chk[224] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 3, 3,
- 4, 4, 13, 16, 26, 3, 96, 4, 17, 89,
- 19, 16, 26, 13, 19, 17, 18, 18, 18, 19,
- 20, 60, 20, 20, 20, 22, 22, 56, 20, 20,
- 20, 20, 20, 20, 21, 21, 21, 24, 24, 27,
- 77, 77, 77, 53, 21, 21, 55, 52, 27, 43,
- 48, 43, 43, 43, 53, 53, 53, 43, 43, 43,
- 43, 43, 43, 47, 32, 47, 47, 47, 49, 49,
-
- 31, 47, 47, 47, 47, 47, 47, 30, 49, 49,
- 50, 23, 50, 50, 50, 84, 84, 84, 15, 50,
- 51, 51, 12, 10, 51, 51, 51, 69, 69, 69,
- 9, 7, 5, 0, 69, 69, 71, 71, 78, 78,
- 71, 71, 71, 75, 75, 80, 0, 75, 75, 75,
- 78, 85, 85, 86, 86, 0, 80, 80, 80, 87,
- 87, 87, 0, 85, 0, 86, 0, 87, 90, 90,
- 90, 0, 0, 0, 0, 0, 90, 95, 95, 95,
- 95, 95, 97, 0, 0, 97, 97, 98, 0, 98,
- 98, 98, 99, 99, 94, 94, 94, 94, 94, 94,
-
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
- 94, 94, 94
- } ;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Lex specification for GLSL ES preprocessor.
-Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
-http://msdn.microsoft.com/en-us/library/2scxys89.aspx
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
-*/
-
-#if defined(_MSC_VER)
-#pragma warning(disable: 4005)
-#endif
-
-#include "Tokenizer.h"
-
-#include "DiagnosticsBase.h"
-#include "Token.h"
-
-#if defined(__GNUC__)
-// Triggered by the auto-generated yy_fatal_error function.
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4244)
-#endif
-
-// Workaround for flex using the register keyword, deprecated in C++11.
-#ifdef __cplusplus
-#if __cplusplus > 199711L
-#define register
-#endif
-#endif
-
-typedef std::string YYSTYPE;
-typedef pp::SourceLocation YYLTYPE;
-
-// Use the unused yycolumn variable to track file (string) number.
-#define yyfileno yycolumn
-
-#define YY_USER_INIT \
- do { \
- yyfileno = 0; \
- yylineno = 1; \
- yyextra->leadingSpace = false; \
- yyextra->lineStart = true; \
- } while(0);
-
-#define YY_USER_ACTION \
- do \
- { \
- pp::Input* input = &yyextra->input; \
- pp::Input::Location* scanLoc = &yyextra->scanLoc; \
- while ((scanLoc->sIndex < input->count()) && \
- (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
- { \
- scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
- ++yyfileno; yylineno = 1; \
- } \
- yylloc->file = yyfileno; \
- yylloc->line = yylineno; \
- scanLoc->cIndex += yyleng; \
- } while(0);
-
-#define YY_INPUT(buf, result, maxSize) \
- result = yyextra->input.read(buf, maxSize, &yylineno);
-
-
-
-
-
-#define INITIAL 0
-#define COMMENT 1
-
-
-
-
-
-
-#define YY_EXTRA_TYPE pp::Tokenizer::Context*
-
-
-
-
-/* Holds the entire state of the reentrant scanner. */
-struct yyguts_t
- {
-
- /* User-defined. Not touched by flex. */
- YY_EXTRA_TYPE yyextra_r;
-
- /* The rest are the same as the globals declared in the non-reentrant scanner. */
- FILE *yyin_r, *yyout_r;
- size_t yy_buffer_stack_top; /**< index of top of stack. */
- size_t yy_buffer_stack_max; /**< capacity of stack. */
- YY_BUFFER_STATE * yy_buffer_stack; /**< Stack as an array. */
- char yy_hold_char;
- int yy_n_chars;
- int yyleng_r;
- char *yy_c_buf_p;
- int yy_init;
- int yy_start;
- int yy_did_buffer_switch_on_eof;
- int yy_start_stack_ptr;
- int yy_start_stack_depth;
- int *yy_start_stack;
- yy_state_type yy_last_accepting_state;
- char* yy_last_accepting_cpos;
-
- int yylineno_r;
- int yy_flex_debug_r;
-
-
-
-
- char *yytext_r;
- int yy_more_flag;
- int yy_more_len;
-
-
-
- YYSTYPE * yylval_r;
-
-
-
- YYLTYPE * yylloc_r;
-
-
- }; /* end struct yyguts_t */
-
-
-
-
-static int yy_init_globals ( yyscan_t yyscanner );
-
-
-
-
-
- /* This must go here because YYSTYPE and YYLTYPE are included
- * from bison output in section 1.*/
- # define yylval yyg->yylval_r
-
-
-
- # define yylloc yyg->yylloc_r
-
-
-
-int yylex_init (yyscan_t* scanner);
-
-int yylex_init_extra ( YY_EXTRA_TYPE user_defined, yyscan_t* scanner);
-
-
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-
-int yylex_destroy ( yyscan_t yyscanner );
-
-
-
-int yyget_debug ( yyscan_t yyscanner );
-
-
-
-void yyset_debug ( int debug_flag , yyscan_t yyscanner );
-
-
-
-YY_EXTRA_TYPE yyget_extra ( yyscan_t yyscanner );
-
-
-
-void yyset_extra ( YY_EXTRA_TYPE user_defined , yyscan_t yyscanner );
-
-
-
-FILE *yyget_in ( yyscan_t yyscanner );
-
-
-
-void yyset_in ( FILE * _in_str , yyscan_t yyscanner );
-
-
-
-FILE *yyget_out ( yyscan_t yyscanner );
-
-
-
-void yyset_out ( FILE * _out_str , yyscan_t yyscanner );
-
-
-
- int yyget_leng ( yyscan_t yyscanner );
-
-
-
-char *yyget_text ( yyscan_t yyscanner );
-
-
-
-int yyget_lineno ( yyscan_t yyscanner );
-
-
-
-void yyset_lineno ( int _line_number , yyscan_t yyscanner );
-
-
-
-
-int yyget_column ( yyscan_t yyscanner );
-
-
-
-
-
-void yyset_column ( int _column_no , yyscan_t yyscanner );
-
-
-
-
-YYSTYPE * yyget_lval ( yyscan_t yyscanner );
-
-
-void yyset_lval ( YYSTYPE * yylval_param , yyscan_t yyscanner );
-
-
-
- YYLTYPE *yyget_lloc ( yyscan_t yyscanner );
-
-
-
- void yyset_lloc ( YYLTYPE * yylloc_param , yyscan_t yyscanner );
-
-
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap ( yyscan_t yyscanner );
-#else
-extern int yywrap ( yyscan_t yyscanner );
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy ( char *, const char *, int , yyscan_t yyscanner);
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen ( const char * , yyscan_t yyscanner);
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput ( yyscan_t yyscanner );
-#else
-static int input ( yyscan_t yyscanner );
-#endif
-
-#endif
-
-
-
-
-
-
-
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
-#define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
-#endif
-
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0)
-#endif
-
-
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
- { \
- int c = '*'; \
- int n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else \
- { \
- errno=0; \
- while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \
- { \
- if( errno != EINTR) \
- { \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- break; \
- } \
- errno=0; \
- clearerr(yyin); \
- } \
- }\
-\
-
-#endif
-
-
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg , yyscanner)
-#endif
-
-
-
-/* end tables serialization structures and prototypes */
-
-
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-extern int yylex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner);
-
-#define YY_DECL int yylex \
- (YYSTYPE * yylval_param, YYLTYPE * yylloc_param , yyscan_t yyscanner)
-#endif /* !YY_DECL */
-
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK /*LINTED*/break;
-#endif
-
-
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
- yy_state_type yy_current_state;
- char *yy_cp, *yy_bp;
- int yy_act;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
-
-
- yylval = yylval_param;
-
-
-
- yylloc = yylloc_param;
-
-
- if ( !yyg->yy_init )
- {
- yyg->yy_init = 1;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
-
-
- if ( ! yyg->yy_start )
- yyg->yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_load_buffer_state( yyscanner );
- }
-
- {
-
-
- /* Line comment */
-
- while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yyg->yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yyg->yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yyg->yy_start;
-yy_match:
- do
- {
- YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)] ;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 95 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- ++yy_cp;
- }
- while ( yy_current_state != 94 );
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
-
- YY_DO_BEFORE_ACTION;
-
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yyg->yy_hold_char;
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-
- YY_BREAK
-/* Block comment */
-/* Line breaks are just counted - not returned. */
-/* The comment is replaced by a single space. */
-case 2:
-YY_RULE_SETUP
-{ BEGIN(COMMENT); }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-
- YY_BREAK
-case 5:
-/* rule 5 can match eol */
-YY_RULE_SETUP
-{
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
-}
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-{
- yyextra->leadingSpace = true;
- BEGIN(INITIAL);
-}
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-{
- // # is only valid at start of line for preprocessor directives.
- yylval->assign(1, yytext[0]);
- return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
-}
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::IDENTIFIER;
-}
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_INT;
-}
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_FLOAT;
-}
- YY_BREAK
-/* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
-/* Rule to catch all invalid integers and floats. */
-case 11:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::PP_NUMBER;
-}
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_INC;
-}
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DEC;
-}
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT;
-}
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT;
-}
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LE;
-}
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_GE;
-}
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_EQ;
-}
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_NE;
-}
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND;
-}
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR;
-}
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR;
-}
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_ADD_ASSIGN;
-}
- YY_BREAK
-case 24:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_SUB_ASSIGN;
-}
- YY_BREAK
-case 25:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MUL_ASSIGN;
-}
- YY_BREAK
-case 26:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DIV_ASSIGN;
-}
- YY_BREAK
-case 27:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MOD_ASSIGN;
-}
- YY_BREAK
-case 28:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT_ASSIGN;
-}
- YY_BREAK
-case 29:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT_ASSIGN;
-}
- YY_BREAK
-case 30:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND_ASSIGN;
-}
- YY_BREAK
-case 31:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR_ASSIGN;
-}
- YY_BREAK
-case 32:
-YY_RULE_SETUP
-{
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR_ASSIGN;
-}
- YY_BREAK
-case 33:
-YY_RULE_SETUP
-{
- yylval->assign(1, yytext[0]);
- return yytext[0];
-}
- YY_BREAK
-case 34:
-YY_RULE_SETUP
-{ yyextra->leadingSpace = true; }
- YY_BREAK
-case 35:
-/* rule 35 can match eol */
-YY_RULE_SETUP
-{
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
- yylval->assign(1, '\n');
- return '\n';
-}
- YY_BREAK
-case 36:
-YY_RULE_SETUP
-{
- yylval->assign(1, yytext[0]);
- return pp::Token::PP_OTHER;
-}
- YY_BREAK
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(COMMENT):
-{
- // YY_USER_ACTION is not invoked for handling EOF.
- // Set the location for EOF token manually.
- pp::Input* input = &yyextra->input;
- pp::Input::Location* scanLoc = &yyextra->scanLoc;
- yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
- if (scanLoc->sIndex != sIndexMax)
- {
- // We can only reach here if there are empty strings at the
- // end of the input.
- scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
- // FIXME: this is not 64-bit clean.
- yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
- }
- yylloc->file = yyfileno;
- yylloc->line = yylineno;
- yylval->clear();
-
- // Line number overflows fake EOFs to exit early, check for this case.
- if (yylineno == INT_MAX) {
- yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
- pp::SourceLocation(yyfileno, yylineno),
- "Integer overflow on line number");
- }
- else if (YY_START == COMMENT)
- {
- yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
- pp::SourceLocation(yyfileno, yylineno),
- "EOF while in a comment");
- }
- yyterminate();
-}
- YY_BREAK
-case 37:
-YY_RULE_SETUP
-ECHO;
- YY_BREAK
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yyg->yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yyg->yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yyg->yy_c_buf_p <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yyg->yy_c_buf_p = yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state , yyscanner);
-
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yyg->yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yyg->yy_last_accepting_cpos;
- yy_current_state = yyg->yy_last_accepting_state;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yyg->yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap( yyscanner ) )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yyg->yy_c_buf_p = yyg->yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p =
- yyg->yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yyg->yy_c_buf_p =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars];
-
- yy_current_state = yy_get_previous_state( yyscanner );
-
- yy_cp = yyg->yy_c_buf_p;
- yy_bp = yyg->yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of user's declarations */
-} /* end of yylex */
-
-
-
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- char *source = yyg->yytext_ptr;
- int number_to_move, i;
- int ret_val;
-
- if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr - 1);
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
-
- int yy_c_buf_p_offset =
- (int) (yyg->yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yyrealloc( (void *) b->yy_ch_buf,
- (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = NULL;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
- number_to_move - 1;
-
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- yyg->yy_n_chars, num_to_read );
-
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- if ( yyg->yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin , yyscanner);
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- if ((yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- int new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc(
- (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size , yyscanner );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- /* "- 2" to take care of EOB's */
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2);
- }
-
- yyg->yy_n_chars += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
- return ret_val;
-}
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
- static yy_state_type yy_get_previous_state (yyscan_t yyscanner)
-{
- yy_state_type yy_current_state;
- char *yy_cp;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_current_state = yyg->yy_start;
-
- for ( yy_cp = yyg->yytext_ptr + YY_MORE_ADJ; yy_cp < yyg->yy_c_buf_p; ++yy_cp )
- {
- YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 95 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- }
-
- return yy_current_state;
-}
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state , yyscan_t yyscanner)
-{
- int yy_is_jam;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; /* This var may be unused depending upon options. */
- char *yy_cp = yyg->yy_c_buf_p;
-
- YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yyg->yy_last_accepting_state = yy_current_state;
- yyg->yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 95 )
- yy_c = yy_meta[yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
- yy_is_jam = (yy_current_state == 94);
-
- (void)yyg;
- return yy_is_jam ? 0 : yy_current_state;
-}
-
-
-#ifndef YY_NO_UNPUT
-
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
- static int yyinput (yyscan_t yyscanner)
-#else
- static int input (yyscan_t yyscanner)
-#endif
-
-{
- int c;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
-
- if ( *yyg->yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yyg->yy_c_buf_p < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] )
- /* This was really a NUL. */
- *yyg->yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = (int) (yyg->yy_c_buf_p - yyg->yytext_ptr);
- ++yyg->yy_c_buf_p;
-
- switch ( yy_get_next_buffer( yyscanner ) )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin , yyscanner);
-
- /*FALLTHROUGH*/
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap( yyscanner ) )
- return 0;
-
- if ( ! yyg->yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput(yyscanner);
-#else
- return input(yyscanner);
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yyg->yy_c_buf_p = yyg->yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yyg->yy_c_buf_p; /* cast for 8-bit char's */
- *yyg->yy_c_buf_p = '\0'; /* preserve yytext */
- yyg->yy_hold_char = *++yyg->yy_c_buf_p;
-
-
- return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * @param yyscanner The scanner object.
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void yyrestart (FILE * input_file , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack (yyscanner);
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
- }
-
- yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
- yy_load_buffer_state( yyscanner );
-}
-
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * @param yyscanner The scanner object.
- */
- void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
- */
- yyensure_buffer_stack (yyscanner);
- if ( YY_CURRENT_BUFFER == new_buffer )
- return;
-
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( yyscanner );
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-
-static void yy_load_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyg->yy_n_chars = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- yyg->yytext_ptr = yyg->yy_c_buf_p = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- yyg->yy_hold_char = *yyg->yy_c_buf_p;
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * @param yyscanner The scanner object.
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE yy_create_buffer (FILE * file, int size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) , yyscanner );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file , yyscanner);
-
- return b;
-}
-
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * @param yyscanner The scanner object.
- */
- void yy_delete_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if ( ! b )
- return;
-
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yyfree( (void *) b->yy_ch_buf , yyscanner );
-
- yyfree( (void *) b , yyscanner );
-}
-
-
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file , yyscan_t yyscanner)
-
-{
- int oerrno = errno;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- yy_flush_buffer( b , yyscanner);
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
- /* If b is the current buffer, then yy_init_buffer was _probably_
- * called from yyrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
-
-
- b->yy_is_interactive = 0;
-
-
- errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * @param yyscanner The scanner object.
- */
- void yy_flush_buffer (YY_BUFFER_STATE b , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( yyscanner );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- * @param yyscanner The scanner object.
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack(yyscanner);
-
- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *yyg->yy_c_buf_p = yyg->yy_hold_char;
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = yyg->yy_c_buf_p;
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars;
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- yyg->yy_buffer_stack_top++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
-}
-
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- * @param yyscanner The scanner object.
- */
-void yypop_buffer_state (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_delete_buffer(YY_CURRENT_BUFFER , yyscanner);
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if (yyg->yy_buffer_stack_top > 0)
- --yyg->yy_buffer_stack_top;
-
- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( yyscanner );
- yyg->yy_did_buffer_switch_on_eof = 1;
- }
-}
-
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (yyscan_t yyscanner)
-{
- yy_size_t num_to_alloc;
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- if (!yyg->yy_buffer_stack) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
-
- memset(yyg->yy_buffer_stack, 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- yyg->yy_buffer_stack_max = num_to_alloc;
- yyg->yy_buffer_stack_top = 0;
- return;
- }
-
- if (yyg->yy_buffer_stack_top >= (yyg->yy_buffer_stack_max) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- yy_size_t grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = yyg->yy_buffer_stack_max + grow_size;
- yyg->yy_buffer_stack = (struct yy_buffer_state**)yyrealloc
- (yyg->yy_buffer_stack,
- num_to_alloc * sizeof(struct yy_buffer_state*)
- , yyscanner);
- if ( ! yyg->yy_buffer_stack )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- /* zero only the new slots.*/
- memset(yyg->yy_buffer_stack + yyg->yy_buffer_stack_max, 0, grow_size * sizeof(struct yy_buffer_state*));
- yyg->yy_buffer_stack_max = num_to_alloc;
- }
-}
-
-
-
-
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return NULL;
-
- b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) , yyscanner );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = NULL;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b , yyscanner );
-
- return b;
-}
-
-
-
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (const char * yystr , yyscan_t yyscanner)
-{
-
- return yy_scan_bytes( yystr, (int) strlen(yystr) , yyscanner);
-}
-
-
-
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- * @param yyscanner The scanner object.
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len , yyscan_t yyscanner)
-{
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = (yy_size_t) (_yybytes_len + 2);
- buf = (char *) yyalloc( n , yyscanner );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
-
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n , yyscanner);
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
-}
-
-
-
-
-
-
-
-
-
-
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yynoreturn yy_fatal_error (const char* msg , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = yyg->yy_hold_char; \
- yyg->yy_c_buf_p = yytext + yyless_macro_arg; \
- yyg->yy_hold_char = *yyg->yy_c_buf_p; \
- *yyg->yy_c_buf_p = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
-
-
-
-/* Accessor methods (get/set functions) to struct members. */
-
-
-/** Get the user-defined data for this scanner.
- * @param yyscanner The scanner object.
- */
-YY_EXTRA_TYPE yyget_extra (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyextra;
-}
-
-
-
-/** Get the current line number.
- * @param yyscanner The scanner object.
- */
-int yyget_lineno (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yylineno;
-}
-
-
-
-
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int yyget_column (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- if (! YY_CURRENT_BUFFER)
- return 0;
-
- return yycolumn;
-}
-
-
-
-
-/** Get the input stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_in (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyin;
-}
-
-
-
-/** Get the output stream.
- * @param yyscanner The scanner object.
- */
-FILE *yyget_out (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyout;
-}
-
-
-
-/** Get the length of the current token.
- * @param yyscanner The scanner object.
- */
-int yyget_leng (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yyleng;
-}
-
-
-/** Get the current token.
- * @param yyscanner The scanner object.
- */
-
-char *yyget_text (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yytext;
-}
-
-
-
-/** Set the user-defined data. This data is never touched by the scanner.
- * @param user_defined The data to be associated with this scanner.
- * @param yyscanner The scanner object.
- */
-void yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyextra = user_defined ;
-}
-
-
-
-/** Set the current line number.
- * @param _line_number line number
- * @param yyscanner The scanner object.
- */
-void yyset_lineno (int _line_number , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- /* lineno is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_lineno called with no buffer" );
-
- yylineno = _line_number;
-}
-
-
-
-
-/** Set the current column.
- * @param _column_no column number
- * @param yyscanner The scanner object.
- */
-void yyset_column (int _column_no , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-
- /* column is only valid if an input buffer exists. */
- if (! YY_CURRENT_BUFFER )
- YY_FATAL_ERROR( "yyset_column called with no buffer" );
-
- yycolumn = _column_no;
-}
-
-
-
-
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param _in_str A readable stream.
- * @param yyscanner The scanner object.
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE * _in_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyin = _in_str ;
-}
-
-
-
-void yyset_out (FILE * _out_str , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yyout = _out_str ;
-}
-
-
-
-
-int yyget_debug (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yy_flex_debug;
-}
-
-
-
-void yyset_debug (int _bdebug , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yy_flex_debug = _bdebug ;
-}
-
-
-/* Accessor methods for yylval and yylloc */
-
-
-YYSTYPE * yyget_lval (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylval;
-}
-
-
-
-void yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylval = yylval_param;
-}
-
-
-
-
-YYLTYPE *yyget_lloc (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- return yylloc;
-}
-
-
-
-void yyset_lloc (YYLTYPE * yylloc_param , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- yylloc = yylloc_param;
-}
-
-
-
-
-
-/* User-visible API */
-
-/* yylex_init is special because it creates the scanner itself, so it is
- * the ONLY reentrant function that doesn't take the scanner as the last argument.
- * That's why we explicitly handle the declaration, instead of using our macros.
- */
-int yylex_init(yyscan_t* ptr_yy_globals)
-{
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), NULL );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-
-/* yylex_init_extra has the same functionality as yylex_init, but follows the
- * convention of taking the scanner as the last argument. Note however, that
- * this is a *pointer* to a scanner, as it will be allocated by this call (and
- * is the reason, too, why this function also must handle its own declaration).
- * The user defined value in the first argument will be available to yyalloc in
- * the yyextra field.
- */
-int yylex_init_extra( YY_EXTRA_TYPE yy_user_defined, yyscan_t* ptr_yy_globals )
-{
- struct yyguts_t dummy_yyguts;
-
- yyset_extra (yy_user_defined, &dummy_yyguts);
-
- if (ptr_yy_globals == NULL){
- errno = EINVAL;
- return 1;
- }
-
- *ptr_yy_globals = (yyscan_t) yyalloc ( sizeof( struct yyguts_t ), &dummy_yyguts );
-
- if (*ptr_yy_globals == NULL){
- errno = ENOMEM;
- return 1;
- }
-
- /* By setting to 0xAA, we expose bugs in
- yy_init_globals. Leave at 0x00 for releases. */
- memset(*ptr_yy_globals,0x00,sizeof(struct yyguts_t));
-
- yyset_extra (yy_user_defined, *ptr_yy_globals);
-
- return yy_init_globals ( *ptr_yy_globals );
-}
-
-
-static int yy_init_globals (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from yylex_destroy(), so don't allocate here.
- */
-
-
- yyg->yy_buffer_stack = NULL;
- yyg->yy_buffer_stack_top = 0;
- yyg->yy_buffer_stack_max = 0;
- yyg->yy_c_buf_p = NULL;
- yyg->yy_init = 0;
- yyg->yy_start = 0;
-
-
- yyg->yy_start_stack_ptr = 0;
- yyg->yy_start_stack_depth = 0;
- yyg->yy_start_stack = NULL;
-
-
-
-
-
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
-#else
- yyin = NULL;
- yyout = NULL;
-#endif
-
- /* For future reference: Set errno on error, since we are called by
- * yylex_init()
- */
- return 0;
-}
-
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer( YY_CURRENT_BUFFER , yyscanner );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state(yyscanner);
- }
-
- /* Destroy the stack itself. */
- yyfree(yyg->yy_buffer_stack , yyscanner);
- yyg->yy_buffer_stack = NULL;
-
-
- /* Destroy the start condition stack. */
- yyfree( yyg->yy_start_stack , yyscanner );
- yyg->yy_start_stack = NULL;
-
-
-
-
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * yylex() is called, initialization will occur. */
- yy_init_globals( yyscanner);
-
- /* Destroy the main struct (reentrant only). */
- yyfree ( yyscanner , yyscanner );
- yyscanner = NULL;
- return 0;
-}
-
-
-
-/*
- * Internal utility routines.
- */
-
-
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, const char * s2, int n , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
-}
-#endif
-
-
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (const char * s , yyscan_t yyscanner)
-{
- int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
-}
-#endif
-
-
-
-void *yyalloc (yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- return malloc(size);
-}
-
-
-
-void *yyrealloc (void * ptr, yy_size_t size , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
-
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return realloc(ptr, size);
-}
-
-
-
-void yyfree (void * ptr , yyscan_t yyscanner)
-{
- struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
- (void)yyg;
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
-}
-
-
-#define YYTABLES_NAME "yytables"
-
-
-
-
-
-
-
-
-namespace pp {
-
-Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(1024)
-{
- mContext.diagnostics = diagnostics;
-}
-
-Tokenizer::~Tokenizer()
-{
- destroyScanner();
-}
-
-bool Tokenizer::init(size_t count, const char * const string[], const int length[])
-{
- if ((count > 0) && (string == 0))
- return false;
-
- mContext.input = Input(count, string, length);
- return initScanner();
-}
-
-void Tokenizer::setFileNumber(int file)
-{
- // We use column number as file number.
- // See macro yyfileno.
- yyset_column(file, mHandle);
-}
-
-void Tokenizer::setLineNumber(int line)
-{
- yyset_lineno(line, mHandle);
-}
-
-void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
-{
- mMaxTokenSize = maxTokenSize;
-}
-
-void Tokenizer::lex(Token *token)
-{
- int tokenType = yylex(&token->text, &token->location, mHandle);
-
- if (tokenType == Token::GOT_ERROR)
- {
- mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
- token->type = Token::LAST;
- }
- else
- {
- token->type = tokenType;
- }
-
- if (token->text.size() > mMaxTokenSize)
- {
- mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
- token->location, token->text);
- token->text.erase(mMaxTokenSize);
- }
-
- token->flags = 0;
-
- token->setAtStartOfLine(mContext.lineStart);
- mContext.lineStart = token->type == '\n';
-
- token->setHasLeadingSpace(mContext.leadingSpace);
- mContext.leadingSpace = false;
-}
-
-bool Tokenizer::initScanner()
-{
- if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
- return false;
-
- yyrestart(0, mHandle);
- return true;
-}
-
-void Tokenizer::destroyScanner()
-{
- if (mHandle == nullptr)
- return;
-
- yylex_destroy(mHandle);
- mHandle = nullptr;
-}
-
-} // namespace pp
-
-
diff --git a/src/OpenGL/compiler/preprocessor/Tokenizer.h b/src/OpenGL/compiler/preprocessor/Tokenizer.h
deleted file mode 100644
index 7227fe0a4..000000000
--- a/src/OpenGL/compiler/preprocessor/Tokenizer.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_PREPROCESSOR_TOKENIZER_H_
-#define COMPILER_PREPROCESSOR_TOKENIZER_H_
-
-#include "Input.h"
-#include "Lexer.h"
-#include "pp_utils.h"
-
-namespace pp
-{
-
-class Diagnostics;
-
-class Tokenizer : public Lexer
-{
-public:
- struct Context
- {
- Diagnostics *diagnostics;
-
- Input input;
- // The location where yytext points to. Token location should track
- // scanLoc instead of Input::mReadLoc because they may not be the same
- // if text is buffered up in the scanner input buffer.
- Input::Location scanLoc;
-
- bool leadingSpace;
- bool lineStart;
- };
-
- Tokenizer(Diagnostics *diagnostics);
- ~Tokenizer() override;
-
- bool init(size_t count, const char *const string[], const int length[]);
-
- void setFileNumber(int file);
- void setLineNumber(int line);
- void setMaxTokenSize(size_t maxTokenSize);
-
- void lex(Token *token) override;
-
-private:
- PP_DISALLOW_COPY_AND_ASSIGN(Tokenizer);
- bool initScanner();
- void destroyScanner();
-
- void *mHandle; // Scanner handle.
- Context mContext; // Scanner extra.
- size_t mMaxTokenSize; // Maximum token size
-};
-
-} // namespace pp
-#endif // COMPILER_PREPROCESSOR_TOKENIZER_H_
-
diff --git a/src/OpenGL/compiler/preprocessor/Tokenizer.l b/src/OpenGL/compiler/preprocessor/Tokenizer.l
deleted file mode 100644
index f99cfd403..000000000
--- a/src/OpenGL/compiler/preprocessor/Tokenizer.l
+++ /dev/null
@@ -1,400 +0,0 @@
-/*
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-This file contains the Lex specification for GLSL ES preprocessor.
-Based on Microsoft Visual Studio 2010 Preprocessor Grammar:
-http://msdn.microsoft.com/en-us/library/2scxys89.aspx
-
-IF YOU MODIFY THIS FILE YOU ALSO NEED TO RUN generate_parser.sh.
-*/
-
-%top{
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is auto-generated by generate_parser.sh. DO NOT EDIT!
-}
-
-%{
-#if defined(_MSC_VER)
-#pragma warning(disable: 4005)
-#endif
-
-#include "Tokenizer.h"
-
-#include "DiagnosticsBase.h"
-#include "Token.h"
-
-#if defined(__GNUC__)
-// Triggered by the auto-generated yy_fatal_error function.
-#pragma GCC diagnostic ignored "-Wmissing-noreturn"
-#elif defined(_MSC_VER)
-#pragma warning(disable: 4244)
-#endif
-
-// Workaround for flex using the register keyword, deprecated in C++11.
-#ifdef __cplusplus
-#if __cplusplus > 199711L
-#define register
-#endif
-#endif
-
-typedef std::string YYSTYPE;
-typedef pp::SourceLocation YYLTYPE;
-
-// Use the unused yycolumn variable to track file (string) number.
-#define yyfileno yycolumn
-
-#define YY_USER_INIT \
- do { \
- yyfileno = 0; \
- yylineno = 1; \
- yyextra->leadingSpace = false; \
- yyextra->lineStart = true; \
- } while(0);
-
-#define YY_USER_ACTION \
- do \
- { \
- pp::Input* input = &yyextra->input; \
- pp::Input::Location* scanLoc = &yyextra->scanLoc; \
- while ((scanLoc->sIndex < input->count()) && \
- (scanLoc->cIndex >= input->length(scanLoc->sIndex))) \
- { \
- scanLoc->cIndex -= input->length(scanLoc->sIndex++); \
- ++yyfileno; yylineno = 1; \
- } \
- yylloc->file = yyfileno; \
- yylloc->line = yylineno; \
- scanLoc->cIndex += yyleng; \
- } while(0);
-
-#define YY_INPUT(buf, result, maxSize) \
- result = yyextra->input.read(buf, maxSize, &yylineno);
-
-%}
-
-%option noyywrap nounput never-interactive
-%option reentrant bison-bridge bison-locations
-%option prefix="pp"
-%option extra-type="pp::Tokenizer::Context*"
-%x COMMENT
-
-NEWLINE \n|\r|\r\n
-IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
-PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
-
-DECIMAL_CONSTANT [1-9][0-9]*[uU]?
-OCTAL_CONSTANT 0[0-7]*[uU]?
-HEXADECIMAL_CONSTANT 0[xX][0-9a-fA-F]+[uU]?
-
-DIGIT [0-9]
-EXPONENT_PART [eE][+-]?{DIGIT}+
-FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
-
-%%
-
- /* Line comment */
-"//"[^\r\n]*
-
- /* Block comment */
- /* Line breaks are just counted - not returned. */
- /* The comment is replaced by a single space. */
-"/*" { BEGIN(COMMENT); }
-<COMMENT>[^*\r\n]+
-<COMMENT>"*"
-<COMMENT>{NEWLINE} {
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
-}
-<COMMENT>"*/" {
- yyextra->leadingSpace = true;
- BEGIN(INITIAL);
-}
-
-# {
- // # is only valid at start of line for preprocessor directives.
- yylval->assign(1, yytext[0]);
- return yyextra->lineStart ? pp::Token::PP_HASH : pp::Token::PP_OTHER;
-}
-
-{IDENTIFIER} {
- yylval->assign(yytext, yyleng);
- return pp::Token::IDENTIFIER;
-}
-
-({DECIMAL_CONSTANT}[uU]?)|({OCTAL_CONSTANT}[uU]?)|({HEXADECIMAL_CONSTANT}[uU]?) {
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_INT;
-}
-
-({DIGIT}+{EXPONENT_PART}[fF]?)|({FRACTIONAL_CONSTANT}{EXPONENT_PART}?[fF]?) {
- yylval->assign(yytext, yyleng);
- return pp::Token::CONST_FLOAT;
-}
-
- /* Anything that starts with a {DIGIT} or .{DIGIT} must be a number. */
- /* Rule to catch all invalid integers and floats. */
-({DIGIT}+[_a-zA-Z0-9.]*)|("."{DIGIT}+[_a-zA-Z0-9.]*) {
- yylval->assign(yytext, yyleng);
- return pp::Token::PP_NUMBER;
-}
-
-"++" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_INC;
-}
-"--" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DEC;
-}
-"<<" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT;
-}
-">>" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT;
-}
-"<=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LE;
-}
-">=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_GE;
-}
-"==" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_EQ;
-}
-"!=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_NE;
-}
-"&&" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND;
-}
-"^^" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR;
-}
-"||" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR;
-}
-"+=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_ADD_ASSIGN;
-}
-"-=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_SUB_ASSIGN;
-}
-"*=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MUL_ASSIGN;
-}
-"/=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_DIV_ASSIGN;
-}
-"%=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_MOD_ASSIGN;
-}
-"<<=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_LEFT_ASSIGN;
-}
-">>=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_RIGHT_ASSIGN;
-}
-"&=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_AND_ASSIGN;
-}
-"^=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_XOR_ASSIGN;
-}
-"|=" {
- yylval->assign(yytext, yyleng);
- return pp::Token::OP_OR_ASSIGN;
-}
-
-{PUNCTUATOR} {
- yylval->assign(1, yytext[0]);
- return yytext[0];
-}
-
-[ \t\v\f]+ { yyextra->leadingSpace = true; }
-
-{NEWLINE} {
- if (yylineno == INT_MAX)
- {
- *yylval = "Integer overflow on line number";
- return pp::Token::GOT_ERROR;
- }
- ++yylineno;
- yylval->assign(1, '\n');
- return '\n';
-}
-
-. {
- yylval->assign(1, yytext[0]);
- return pp::Token::PP_OTHER;
-}
-
-<*><<EOF>> {
- // YY_USER_ACTION is not invoked for handling EOF.
- // Set the location for EOF token manually.
- pp::Input* input = &yyextra->input;
- pp::Input::Location* scanLoc = &yyextra->scanLoc;
- yy_size_t sIndexMax = input->count() ? input->count() - 1 : 0;
- if (scanLoc->sIndex != sIndexMax)
- {
- // We can only reach here if there are empty strings at the
- // end of the input.
- scanLoc->sIndex = sIndexMax; scanLoc->cIndex = 0;
- // FIXME: this is not 64-bit clean.
- yyfileno = static_cast<int>(sIndexMax); yylineno = 1;
- }
- yylloc->file = yyfileno;
- yylloc->line = yylineno;
- yylval->clear();
-
- // Line number overflows fake EOFs to exit early, check for this case.
- if (yylineno == INT_MAX) {
- yyextra->diagnostics->report(pp::Diagnostics::PP_TOKENIZER_ERROR,
- pp::SourceLocation(yyfileno, yylineno),
- "Integer overflow on line number");
- }
- else if (YY_START == COMMENT)
- {
- yyextra->diagnostics->report(pp::Diagnostics::PP_EOF_IN_COMMENT,
- pp::SourceLocation(yyfileno, yylineno),
- "EOF while in a comment");
- }
- yyterminate();
-}
-
-%%
-
-namespace pp {
-
-Tokenizer::Tokenizer(Diagnostics *diagnostics) : mHandle(nullptr), mMaxTokenSize(1024)
-{
- mContext.diagnostics = diagnostics;
-}
-
-Tokenizer::~Tokenizer()
-{
- destroyScanner();
-}
-
-bool Tokenizer::init(size_t count, const char * const string[], const int length[])
-{
- if ((count > 0) && (string == 0))
- return false;
-
- mContext.input = Input(count, string, length);
- return initScanner();
-}
-
-void Tokenizer::setFileNumber(int file)
-{
- // We use column number as file number.
- // See macro yyfileno.
- yyset_column(file, mHandle);
-}
-
-void Tokenizer::setLineNumber(int line)
-{
- yyset_lineno(line, mHandle);
-}
-
-void Tokenizer::setMaxTokenSize(size_t maxTokenSize)
-{
- mMaxTokenSize = maxTokenSize;
-}
-
-void Tokenizer::lex(Token *token)
-{
- int tokenType = yylex(&token->text, &token->location, mHandle);
-
- if (tokenType == Token::GOT_ERROR)
- {
- mContext.diagnostics->report(Diagnostics::PP_TOKENIZER_ERROR, token->location, token->text);
- token->type = Token::LAST;
- }
- else
- {
- token->type = tokenType;
- }
-
- if (token->text.size() > mMaxTokenSize)
- {
- mContext.diagnostics->report(Diagnostics::PP_TOKEN_TOO_LONG,
- token->location, token->text);
- token->text.erase(mMaxTokenSize);
- }
-
- token->flags = 0;
-
- token->setAtStartOfLine(mContext.lineStart);
- mContext.lineStart = token->type == '\n';
-
- token->setHasLeadingSpace(mContext.leadingSpace);
- mContext.leadingSpace = false;
-}
-
-bool Tokenizer::initScanner()
-{
- if ((mHandle == nullptr) && yylex_init_extra(&mContext, &mHandle))
- return false;
-
- yyrestart(0, mHandle);
- return true;
-}
-
-void Tokenizer::destroyScanner()
-{
- if (mHandle == nullptr)
- return;
-
- yylex_destroy(mHandle);
- mHandle = nullptr;
-}
-
-} // namespace pp
-
diff --git a/src/OpenGL/compiler/preprocessor/generate_parser.sh b/src/OpenGL/compiler/preprocessor/generate_parser.sh
deleted file mode 100644
index 36bd84eae..000000000
--- a/src/OpenGL/compiler/preprocessor/generate_parser.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/bash
-# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Generates various components of GLSL ES preprocessor.
-
-run_flex()
-{
-input_file=$script_dir/$1
-output_source=$script_dir/$2
-flex --noline --nounistd --outfile=$output_source $input_file
-}
-
-run_bison()
-{
-input_file=$script_dir/$1
-output_source=$script_dir/$2
-bison --no-lines --skeleton=yacc.c --output=$output_source $input_file
-}
-
-script_dir=$(dirname $0)
-
-# Generate preprocessor
-run_flex Tokenizer.l Tokenizer.cpp
-run_bison ExpressionParser.y ExpressionParser.cpp
diff --git a/src/OpenGL/compiler/preprocessor/length_limits.h b/src/OpenGL/compiler/preprocessor/length_limits.h
deleted file mode 100644
index 1c91447d3..000000000
--- a/src/OpenGL/compiler/preprocessor/length_limits.h
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-//
-// length_limits.h
-//
-
-#if !defined(__LENGTH_LIMITS_H)
-#define __LENGTH_LIMITS_H 1
-
-// These constants are factored out from the rest of the headers to
-// make it easier to reference them from the compiler sources.
-
-// These lengths do not include the NULL terminator.
-#define MAX_SYMBOL_NAME_LEN 256
-#define MAX_STRING_LEN 511
-
-#endif // !(defined(__LENGTH_LIMITS_H)
diff --git a/src/OpenGL/compiler/preprocessor/numeric_lex.h b/src/OpenGL/compiler/preprocessor/numeric_lex.h
deleted file mode 100644
index ed22e0381..000000000
--- a/src/OpenGL/compiler/preprocessor/numeric_lex.h
+++ /dev/null
@@ -1,70 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// numeric_lex.h: Functions to extract numeric values from string.
-
-#ifndef COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
-#define COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
-
-#include <sstream>
-#include <cmath>
-
-namespace pp {
-
-inline std::ios::fmtflags numeric_base_int(const std::string& str)
-{
- if ((str.size() >= 2) &&
- (str[0] == '0') &&
- (str[1] == 'x' || str[1] == 'X'))
- {
- return std::ios::hex;
- }
- else if ((str.size() >= 1) && (str[0] == '0'))
- {
- return std::ios::oct;
- }
- return std::ios::dec;
-}
-
-// The following functions parse the given string to extract a numerical
-// value of the given type. These functions assume that the string is
-// of the correct form. They can only fail if the parsed value is too big,
-// in which case false is returned.
-
-template<typename IntType>
-bool numeric_lex_int(const std::string& str, IntType* value)
-{
- std::istringstream stream(str);
- // This should not be necessary, but MSVS has a buggy implementation.
- // It returns incorrect results if the base is not specified.
- stream.setf(numeric_base_int(str), std::ios::basefield);
-
- stream >> (*value);
- return !stream.fail();
-}
-
-template<typename FloatType>
-bool numeric_lex_float(const std::string& str, FloatType* value)
-{
- std::istringstream stream(str);
- // Force "C" locale so that decimal character is always '.', and
- // not dependent on the current locale.
- stream.imbue(std::locale::classic());
-
- stream >> (*value);
- return !stream.fail() && std::isfinite(*value);
-}
-
-} // namespace pp.
-#endif // COMPILER_PREPROCESSOR_NUMERIC_LEX_H_
diff --git a/src/OpenGL/compiler/preprocessor/pp_utils.h b/src/OpenGL/compiler/preprocessor/pp_utils.h
deleted file mode 100644
index d0ea4c482..000000000
--- a/src/OpenGL/compiler/preprocessor/pp_utils.h
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// pp_utils.h: Common preprocessor utilities
-
-#ifndef COMPILER_PREPROCESSOR_PPUTILS_H_
-#define COMPILER_PREPROCESSOR_PPUTILS_H_
-
-// A macro to disallow the copy constructor and operator= functions
-// This must be used in the private: declarations for a class.
-#define PP_DISALLOW_COPY_AND_ASSIGN(TypeName) \
- TypeName(const TypeName&); \
- void operator=(const TypeName&)
-
-#endif // COMPILER_PREPROCESSOR_PPUTILS_H_
diff --git a/src/OpenGL/compiler/util.cpp b/src/OpenGL/compiler/util.cpp
deleted file mode 100644
index bd9783cc6..000000000
--- a/src/OpenGL/compiler/util.cpp
+++ /dev/null
@@ -1,42 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include <limits>
-
-#include "util.h"
-#include "preprocessor/numeric_lex.h"
-
-bool atof_clamp(const char *str, float *value)
-{
- bool success = pp::numeric_lex_float(str, value);
- if(!success)
- *value = std::numeric_limits<float>::max();
- return success;
-}
-
-bool atoi_clamp(const char *str, int *value)
-{
- bool success = pp::numeric_lex_int(str, value);
- if(!success)
- *value = std::numeric_limits<int>::max();
- return success;
-}
-
-bool atou_clamp(const char *str, unsigned int *value)
-{
- bool success = pp::numeric_lex_int(str, value);
- if(!success)
- *value = std::numeric_limits<unsigned int>::max();
- return success;
-}
diff --git a/src/OpenGL/compiler/util.h b/src/OpenGL/compiler/util.h
deleted file mode 100644
index 563407e42..000000000
--- a/src/OpenGL/compiler/util.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef COMPILER_UTIL_H
-#define COMPILER_UTIL_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-// atof_clamp is like atof but
-// 1. it forces C locale, i.e. forcing '.' as decimal point.
-// 2. it sets the value to FLT_MAX if overflow happens.
-// Return false if overflow happens.
-bool atof_clamp(const char *str, float *value);
-
-// If overflow happens, value is set to INT_MAX.
-// Return false if overflow happens.
-bool atoi_clamp(const char *str, int *value);
-
-// If overflow happens, value is set to UINT_MAX.
-// Return false if overflow happens.
-bool atou_clamp(const char *str, unsigned int *value);
-
-#ifdef __cplusplus
-} // end extern "C"
-#endif
-
-#endif // COMPILER_UTIL_H
diff --git a/src/OpenGL/libEGL/Config.cpp b/src/OpenGL/libEGL/Config.cpp
deleted file mode 100644
index 17d219c5f..000000000
--- a/src/OpenGL/libEGL/Config.cpp
+++ /dev/null
@@ -1,467 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Config.cpp: Implements the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.4] section 3.4 page 15.
-
-#include "Config.h"
-
-#include "Display.h"
-#include "common/debug.h"
-
-#include <EGL/eglext.h>
-#if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
-#include <system/graphics.h>
-#endif
-
-#include <algorithm>
-#include <cstring>
-#include <map>
-#include <string.h>
-#include <vector>
-
-using namespace std;
-
-namespace egl
-{
-
-Config::Config(sw::Format displayFormat, EGLint minInterval, EGLint maxInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
- : mRenderTargetFormat(renderTargetFormat), mDepthStencilFormat(depthStencilFormat), mMultiSample(multiSample)
-{
- mBindToTextureRGB = EGL_FALSE;
- mBindToTextureRGBA = EGL_FALSE;
-
- // Initialize to a high value to lower the preference of formats for which there's no native support
- mNativeVisualID = 0x7FFFFFFF;
-
- switch(renderTargetFormat)
- {
- case sw::FORMAT_A1R5G5B5:
- mRedSize = 5;
- mGreenSize = 5;
- mBlueSize = 5;
- mAlphaSize = 1;
- break;
- case sw::FORMAT_A2R10G10B10:
- mRedSize = 10;
- mGreenSize = 10;
- mBlueSize = 10;
- mAlphaSize = 2;
- break;
- case sw::FORMAT_A8R8G8B8:
- mRedSize = 8;
- mGreenSize = 8;
- mBlueSize = 8;
- mAlphaSize = 8;
- mBindToTextureRGBA = EGL_TRUE;
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- mNativeVisualID = HAL_PIXEL_FORMAT_BGRA_8888;
- #else
- mNativeVisualID = 2; // Arbitrary; prefer over ABGR
- #endif
- break;
- case sw::FORMAT_A8B8G8R8:
- mRedSize = 8;
- mGreenSize = 8;
- mBlueSize = 8;
- mAlphaSize = 8;
- mBindToTextureRGBA = EGL_TRUE;
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- mNativeVisualID = HAL_PIXEL_FORMAT_RGBA_8888;
- #endif
- break;
- case sw::FORMAT_R5G6B5:
- mRedSize = 5;
- mGreenSize = 6;
- mBlueSize = 5;
- mAlphaSize = 0;
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- mNativeVisualID = HAL_PIXEL_FORMAT_RGB_565;
- #endif
- break;
- case sw::FORMAT_X8R8G8B8:
- mRedSize = 8;
- mGreenSize = 8;
- mBlueSize = 8;
- mAlphaSize = 0;
- mBindToTextureRGB = EGL_TRUE;
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- mNativeVisualID = 0x1FF; // HAL_PIXEL_FORMAT_BGRX_8888
- #else
- mNativeVisualID = 1; // Arbitrary; prefer over XBGR
- #endif
- break;
- case sw::FORMAT_X8B8G8R8:
- mRedSize = 8;
- mGreenSize = 8;
- mBlueSize = 8;
- mAlphaSize = 0;
- mBindToTextureRGB = EGL_TRUE;
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- mNativeVisualID = HAL_PIXEL_FORMAT_RGBX_8888;
- #endif
- break;
- default:
- UNREACHABLE(renderTargetFormat);
- }
-
- mLuminanceSize = 0;
- mBufferSize = mRedSize + mGreenSize + mBlueSize + mLuminanceSize + mAlphaSize;
- mAlphaMaskSize = 0;
- mColorBufferType = EGL_RGB_BUFFER;
- mConfigCaveat = EGL_NONE;
- mConfigID = 0;
- mConformant = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
-
- switch(depthStencilFormat)
- {
- case sw::FORMAT_NULL:
- mDepthSize = 0;
- mStencilSize = 0;
- break;
-// case sw::FORMAT_D16_LOCKABLE:
-// mDepthSize = 16;
-// mStencilSize = 0;
-// break;
- case sw::FORMAT_D32:
- mDepthSize = 32;
- mStencilSize = 0;
- break;
-// case sw::FORMAT_D15S1:
-// mDepthSize = 15;
-// mStencilSize = 1;
-// break;
- case sw::FORMAT_D24S8:
- mDepthSize = 24;
- mStencilSize = 8;
- break;
- case sw::FORMAT_D24X8:
- mDepthSize = 24;
- mStencilSize = 0;
- break;
-// case sw::FORMAT_D24X4S4:
-// mDepthSize = 24;
-// mStencilSize = 4;
-// break;
- case sw::FORMAT_D16:
- mDepthSize = 16;
- mStencilSize = 0;
- break;
-// case sw::FORMAT_D32F_LOCKABLE:
-// mDepthSize = 32;
-// mStencilSize = 0;
-// break;
-// case sw::FORMAT_D24FS8:
-// mDepthSize = 24;
-// mStencilSize = 8;
-// break;
- default:
- UNREACHABLE(depthStencilFormat);
- }
-
- mLevel = 0;
- mMatchNativePixmap = EGL_NONE;
- mMaxPBufferWidth = 4096;
- mMaxPBufferHeight = 4096;
- mMaxPBufferPixels = mMaxPBufferWidth * mMaxPBufferHeight;
- mMaxSwapInterval = maxInterval;
- mMinSwapInterval = minInterval;
- mNativeRenderable = EGL_FALSE;
- mNativeVisualType = 0;
- mRenderableType = EGL_OPENGL_ES2_BIT | EGL_OPENGL_ES3_BIT;
- mSampleBuffers = (multiSample > 0) ? 1 : 0;
- mSamples = multiSample;
- mSurfaceType = EGL_PBUFFER_BIT | EGL_WINDOW_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT | EGL_MULTISAMPLE_RESOLVE_BOX_BIT;
- mTransparentType = EGL_NONE;
- mTransparentRedValue = 0;
- mTransparentGreenValue = 0;
- mTransparentBlueValue = 0;
-
- // Although we could support any format as an Android HWComposer compatible config by converting when necessary,
- // the intent of EGL_ANDROID_framebuffer_target is to prevent any copies or conversions.
- mFramebufferTargetAndroid = (displayFormat == renderTargetFormat) ? EGL_TRUE : EGL_FALSE;
- mRecordableAndroid = EGL_TRUE;
- mBindToTextureTargetANGLE = EGL_TEXTURE_RECTANGLE_ANGLE;
-}
-
-EGLConfig Config::getHandle() const
-{
- return (EGLConfig)(size_t)mConfigID;
-}
-
-// This ordering determines the config ID
-bool CompareConfig::operator()(const Config &x, const Config &y) const
-{
- #define SORT_SMALLER(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, "");
- SORT_SMALLER(mConfigCaveat);
-
- static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "");
- SORT_SMALLER(mColorBufferType);
-
- SORT_SMALLER(mRedSize);
- SORT_SMALLER(mGreenSize);
- SORT_SMALLER(mBlueSize);
- SORT_SMALLER(mAlphaSize);
-
- SORT_SMALLER(mBufferSize);
- SORT_SMALLER(mSampleBuffers);
- SORT_SMALLER(mSamples);
- SORT_SMALLER(mDepthSize);
- SORT_SMALLER(mStencilSize);
- SORT_SMALLER(mAlphaMaskSize);
- SORT_SMALLER(mNativeVisualType);
- SORT_SMALLER(mNativeVisualID);
-
- #undef SORT_SMALLER
-
- // Strict ordering requires sorting all non-equal fields above
- assert(memcmp(&x, &y, sizeof(Config)) == 0);
-
- return false;
-}
-
-// Function object used by STL sorting routines for ordering Configs according to [EGL] section 3.4.1 page 24.
-class SortConfig
-{
-public:
- explicit SortConfig(const EGLint *attribList);
-
- bool operator()(const Config *x, const Config *y) const;
-
-private:
- EGLint wantedComponentsSize(const Config *config) const;
-
- bool mWantRed;
- bool mWantGreen;
- bool mWantBlue;
- bool mWantAlpha;
- bool mWantLuminance;
-};
-
-SortConfig::SortConfig(const EGLint *attribList)
- : mWantRed(false), mWantGreen(false), mWantBlue(false), mWantAlpha(false), mWantLuminance(false)
-{
- // [EGL] section 3.4.1 page 24
- // Sorting rule #3: by larger total number of color bits,
- // not considering components that are 0 or don't-care.
- for(const EGLint *attr = attribList; attr[0] != EGL_NONE; attr += 2)
- {
- // When multiple instances of the same attribute are present, last wins.
- bool isSpecified = attr[1] && attr[1] != EGL_DONT_CARE;
- switch(attr[0])
- {
- case EGL_RED_SIZE: mWantRed = isSpecified; break;
- case EGL_GREEN_SIZE: mWantGreen = isSpecified; break;
- case EGL_BLUE_SIZE: mWantBlue = isSpecified; break;
- case EGL_ALPHA_SIZE: mWantAlpha = isSpecified; break;
- case EGL_LUMINANCE_SIZE: mWantLuminance = isSpecified; break;
- }
- }
-}
-
-EGLint SortConfig::wantedComponentsSize(const Config *config) const
-{
- EGLint total = 0;
-
- if(mWantRed) total += config->mRedSize;
- if(mWantGreen) total += config->mGreenSize;
- if(mWantBlue) total += config->mBlueSize;
- if(mWantAlpha) total += config->mAlphaSize;
- if(mWantLuminance) total += config->mLuminanceSize;
-
- return total;
-}
-
-bool SortConfig::operator()(const Config *x, const Config *y) const
-{
- #define SORT_SMALLER(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, "");
- SORT_SMALLER(mConfigCaveat);
-
- static_assert(EGL_RGB_BUFFER < EGL_LUMINANCE_BUFFER, "");
- SORT_SMALLER(mColorBufferType);
-
- // 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_SMALLER(mBufferSize);
- SORT_SMALLER(mSampleBuffers);
- SORT_SMALLER(mSamples);
- SORT_SMALLER(mDepthSize);
- SORT_SMALLER(mStencilSize);
- SORT_SMALLER(mAlphaMaskSize);
- SORT_SMALLER(mNativeVisualType);
- SORT_SMALLER(mConfigID);
-
- #undef SORT_SMALLER
-
- return false;
-}
-
-ConfigSet::ConfigSet()
-{
-}
-
-void ConfigSet::add(sw::Format displayFormat, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample)
-{
- Config conformantConfig(displayFormat, minSwapInterval, maxSwapInterval, renderTargetFormat, depthStencilFormat, multiSample);
- mSet.insert(conformantConfig);
-}
-
-size_t ConfigSet::size() const
-{
- return mSet.size();
-}
-
-bool ConfigSet::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
-{
- vector<const Config*> passed;
- passed.reserve(mSet.size());
-
- /* Conformance expects for multiple instances of the same attribute that the
- * last instance `wins`. Reduce the attribute list first to comply with
- * this.
- */
- /* TODO: C++11: unordered_map would be fine here */
- map<EGLint, EGLint> attribs;
- const EGLint *attribute = attribList;
- while (attribute[0] != EGL_NONE)
- {
- attribs[attribute[0]] = attribute[1];
- attribute += 2;
- }
-
- for(Iterator config = mSet.begin(); config != mSet.end(); config++)
- {
- bool match = true;
- bool caveatMatch = (config->mConfigCaveat == EGL_NONE);
- for (map<EGLint, EGLint>::iterator attribIt = attribs.begin(); attribIt != attribs.end(); attribIt++)
- {
- if(attribIt->second != EGL_DONT_CARE)
- {
- switch(attribIt->first)
- {
- case EGL_BUFFER_SIZE: match = config->mBufferSize >= attribIt->second; break;
- case EGL_ALPHA_SIZE: match = config->mAlphaSize >= attribIt->second; break;
- case EGL_BLUE_SIZE: match = config->mBlueSize >= attribIt->second; break;
- case EGL_GREEN_SIZE: match = config->mGreenSize >= attribIt->second; break;
- case EGL_RED_SIZE: match = config->mRedSize >= attribIt->second; break;
- case EGL_DEPTH_SIZE: match = config->mDepthSize >= attribIt->second; break;
- case EGL_STENCIL_SIZE: match = config->mStencilSize >= attribIt->second; break;
- case EGL_CONFIG_CAVEAT: match = config->mConfigCaveat == (EGLenum)attribIt->second; break;
- case EGL_CONFIG_ID: match = config->mConfigID == attribIt->second; break;
- case EGL_LEVEL: match = config->mLevel >= attribIt->second; break;
- case EGL_NATIVE_RENDERABLE: match = config->mNativeRenderable == (EGLBoolean)attribIt->second; break;
- case EGL_NATIVE_VISUAL_TYPE: match = config->mNativeVisualType == attribIt->second; break;
- case EGL_SAMPLES: match = config->mSamples >= attribIt->second; break;
- case EGL_SAMPLE_BUFFERS: match = config->mSampleBuffers >= attribIt->second; break;
- case EGL_SURFACE_TYPE: match = (config->mSurfaceType & attribIt->second) == attribIt->second; break;
- case EGL_TRANSPARENT_TYPE: match = config->mTransparentType == (EGLenum)attribIt->second; break;
- case EGL_TRANSPARENT_BLUE_VALUE: match = config->mTransparentBlueValue == attribIt->second; break;
- case EGL_TRANSPARENT_GREEN_VALUE: match = config->mTransparentGreenValue == attribIt->second; break;
- case EGL_TRANSPARENT_RED_VALUE: match = config->mTransparentRedValue == attribIt->second; break;
- case EGL_BIND_TO_TEXTURE_RGB: match = config->mBindToTextureRGB == (EGLBoolean)attribIt->second; break;
- case EGL_BIND_TO_TEXTURE_RGBA: match = config->mBindToTextureRGBA == (EGLBoolean)attribIt->second; break;
- case EGL_MIN_SWAP_INTERVAL: match = config->mMinSwapInterval == attribIt->second; break;
- case EGL_MAX_SWAP_INTERVAL: match = config->mMaxSwapInterval == attribIt->second; break;
- case EGL_LUMINANCE_SIZE: match = config->mLuminanceSize >= attribIt->second; break;
- case EGL_ALPHA_MASK_SIZE: match = config->mAlphaMaskSize >= attribIt->second; break;
- case EGL_COLOR_BUFFER_TYPE: match = config->mColorBufferType == (EGLenum)attribIt->second; break;
- case EGL_RENDERABLE_TYPE: match = (config->mRenderableType & attribIt->second) == attribIt->second; break;
- case EGL_MATCH_NATIVE_PIXMAP: match = false; UNIMPLEMENTED(); break;
- case EGL_CONFORMANT: match = (config->mConformant & attribIt->second) == attribIt->second; break;
- case EGL_RECORDABLE_ANDROID: match = config->mRecordableAndroid == (EGLBoolean)attribIt->second; break;
- case EGL_FRAMEBUFFER_TARGET_ANDROID: match = config->mFramebufferTargetAndroid == (EGLBoolean)attribIt->second; break;
- case EGL_BIND_TO_TEXTURE_TARGET_ANGLE: match = config->mBindToTextureTargetANGLE == (EGLBoolean)attribIt->second; break;
-
- // Ignored attributes
- case EGL_MAX_PBUFFER_WIDTH:
- case EGL_MAX_PBUFFER_HEIGHT:
- case EGL_MAX_PBUFFER_PIXELS:
- case EGL_NATIVE_VISUAL_ID:
- break;
-
- default:
- *numConfig = 0;
- return false;
- }
-
- if(!match)
- {
- break;
- }
- }
-
- if(attribIt->first == EGL_CONFIG_CAVEAT)
- {
- caveatMatch = match;
- }
- }
-
- if(match && caveatMatch) // We require the caveats to be NONE or the requested flags
- {
- passed.push_back(&*config);
- }
- }
-
- if(configs)
- {
- sort(passed.begin(), passed.end(), SortConfig(attribList));
-
- EGLint index;
- for(index = 0; index < configSize && index < static_cast<EGLint>(passed.size()); index++)
- {
- configs[index] = passed[index]->getHandle();
- }
-
- *numConfig = index;
- }
- else
- {
- *numConfig = static_cast<EGLint>(passed.size());
- }
-
- return true;
-}
-
-const egl::Config *ConfigSet::get(EGLConfig configHandle)
-{
- for(Iterator config = mSet.begin(); config != mSet.end(); config++)
- {
- if(config->getHandle() == configHandle)
- {
- return &(*config);
- }
- }
-
- return nullptr;
-}
-}
diff --git a/src/OpenGL/libEGL/Config.h b/src/OpenGL/libEGL/Config.h
deleted file mode 100644
index d173b51d6..000000000
--- a/src/OpenGL/libEGL/Config.h
+++ /dev/null
@@ -1,106 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Config.h: Defines the egl::Config class, describing the format, type
-// and size for an egl::Surface. Implements EGLConfig and related functionality.
-// [EGL 1.4] section 3.4 page 15.
-
-#ifndef INCLUDE_CONFIG_H_
-#define INCLUDE_CONFIG_H_
-
-#include "Renderer/Surface.hpp"
-
-#include <EGL/egl.h>
-
-#include <set>
-
-namespace egl
-{
-class Display;
-
-class Config
-{
-public:
- Config(sw::Format displayFormat, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
-
- EGLConfig getHandle() const;
-
- const sw::Format mRenderTargetFormat;
- const sw::Format mDepthStencilFormat;
- const EGLint mMultiSample;
-
- EGLint mBufferSize; // Depth of the color buffer
- EGLint mRedSize; // Bits of Red in the color buffer
- EGLint mGreenSize; // Bits of Green in the color buffer
- EGLint mBlueSize; // Bits of Blue in the color buffer
- EGLint mLuminanceSize; // Bits of Luminance in the color buffer
- EGLint mAlphaSize; // Bits of Alpha in the color buffer
- EGLint mAlphaMaskSize; // Bits of Alpha Mask in the mask buffer
- EGLBoolean mBindToTextureRGB; // True if bindable to RGB textures.
- EGLBoolean mBindToTextureRGBA; // True if bindable to RGBA textures.
- EGLenum mColorBufferType; // Color buffer type
- EGLenum mConfigCaveat; // Any caveats for the configuration
- EGLint mConfigID; // Unique EGLConfig identifier
- EGLint mConformant; // Whether contexts created with this config are conformant
- EGLint mDepthSize; // Bits of Z in the depth buffer
- EGLint mLevel; // Frame buffer level
- EGLBoolean mMatchNativePixmap; // Match the native pixmap format
- EGLint mMaxPBufferWidth; // Maximum width of pbuffer
- EGLint mMaxPBufferHeight; // Maximum height of pbuffer
- EGLint mMaxPBufferPixels; // Maximum size of pbuffer
- EGLint mMaxSwapInterval; // Maximum swap interval
- EGLint mMinSwapInterval; // Minimum swap interval
- EGLBoolean mNativeRenderable; // EGL_TRUE if native rendering APIs can render to surface
- EGLint mNativeVisualID; // Handle of corresponding native visual
- EGLint mNativeVisualType; // Native visual type of the associated visual
- EGLint mRenderableType; // Which client rendering APIs are supported.
- EGLint mSampleBuffers; // Number of multisample buffers
- EGLint mSamples; // Number of samples per pixel
- EGLint mStencilSize; // Bits of Stencil in the stencil buffer
- EGLint mSurfaceType; // Which types of EGL surfaces are supported.
- EGLenum mTransparentType; // Type of transparency supported
- EGLint mTransparentRedValue; // Transparent red value
- EGLint mTransparentGreenValue; // Transparent green value
- EGLint mTransparentBlueValue; // Transparent blue value
-
- EGLBoolean mRecordableAndroid; // EGL_ANDROID_recordable
- EGLBoolean mFramebufferTargetAndroid; // EGL_ANDROID_framebuffer_target
- EGLenum mBindToTextureTargetANGLE; // EGL_ANGLE_iosurface_client_buffer
-};
-
-struct CompareConfig
-{
- bool operator()(const Config &x, const Config &y) const;
-};
-
-class ConfigSet
-{
- friend class Display;
-
-public:
- ConfigSet();
-
- void add(sw::Format displayFormat, EGLint minSwapInterval, EGLint maxSwapInterval, sw::Format renderTargetFormat, sw::Format depthStencilFormat, EGLint multiSample);
- size_t size() const;
- bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
- const egl::Config *get(EGLConfig configHandle);
-
-private:
- typedef std::set<Config, CompareConfig> Set;
- typedef Set::iterator Iterator;
- Set mSet;
-};
-}
-
-#endif // INCLUDE_CONFIG_H_
diff --git a/src/OpenGL/libEGL/Context.hpp b/src/OpenGL/libEGL/Context.hpp
deleted file mode 100644
index c9fe4cf6f..000000000
--- a/src/OpenGL/libEGL/Context.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef egl_Context_hpp
-#define egl_Context_hpp
-
-#include "common/Object.hpp"
-#include "Renderer/Surface.hpp"
-
-#include <EGL/egl.h>
-#undef Bool
-
-#include <GLES/gl.h>
-
-namespace gl { class Surface; }
-
-namespace egl
-{
-class Display;
-class Image;
-
-class [[clang::lto_visibility_public]] Context : public gl::Object
-{
-public:
- virtual void makeCurrent(gl::Surface *surface) = 0;
- virtual void bindTexImage(gl::Surface *surface) = 0;
- virtual EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
- virtual Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) = 0;
- virtual EGLint getClientVersion() const = 0;
- virtual EGLint getConfigID() const = 0;
- virtual void finish() = 0;
- virtual void blit(sw::Surface *source, const sw::SliceRect &sRect, sw::Surface *dest, const sw::SliceRect &dRect) = 0;
-
- Display *getDisplay() const { return display; }
-
-protected:
- Context(egl::Display *display) : display(display) {}
- virtual ~Context() {}
-
- egl::Display *const display;
-};
-}
-
-#endif // egl_Context_hpp
diff --git a/src/OpenGL/libEGL/Display.cpp b/src/OpenGL/libEGL/Display.cpp
deleted file mode 100644
index 0410efcc4..000000000
--- a/src/OpenGL/libEGL/Display.cpp
+++ /dev/null
@@ -1,871 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// 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 "Display.h"
-
-#include "Common/RecursiveLock.hpp"
-#include "common/Image.hpp"
-#include "common/debug.h"
-#include "libEGL/Context.hpp"
-#include "libEGL/Surface.hpp"
-#include "main.h"
-
-#if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
-#include <fcntl.h>
-#include <linux/fb.h>
-#include <sys/ioctl.h>
-#include <vndk/window.h>
-#elif defined(SWIFTSHADER_USE_X11)
-#include "Main/libX11.hpp"
-#elif defined(__APPLE__)
-#include "OSXUtils.hpp"
-#include <CoreFoundation/CoreFoundation.h>
-#include <IOSurface/IOSurface.h>
-#endif
-
-#include <algorithm>
-#include <map>
-#include <vector>
-
-namespace egl
-{
-
-class DisplayImplementation : public Display
-{
-public:
- DisplayImplementation(EGLDisplay dpy, void *nativeDisplay) : Display(dpy, nativeDisplay) {}
- ~DisplayImplementation() override {}
-
- Image *getSharedImage(EGLImageKHR name) override
- {
- return Display::getSharedImage(name);
- }
-};
-
-Display *Display::get(EGLDisplay dpy)
-{
- if(dpy != PRIMARY_DISPLAY && dpy != HEADLESS_DISPLAY) // We only support the default display
- {
- return nullptr;
- }
-
- static void *nativeDisplay = nullptr;
-
- #if defined(SWIFTSHADER_USE_X11)
- // Even if the application provides a native display handle, we open (and close) our own connection
- if(!nativeDisplay && dpy != HEADLESS_DISPLAY && libX11 && libX11->XOpenDisplay)
- {
- nativeDisplay = libX11->XOpenDisplay(NULL);
- }
- #endif
-
- static DisplayImplementation display(dpy, nativeDisplay);
-
- return &display;
-}
-
-Display::Display(EGLDisplay eglDisplay, void *nativeDisplay) : eglDisplay(eglDisplay), nativeDisplay(nativeDisplay)
-{
- mMinSwapInterval = 1;
- mMaxSwapInterval = 1;
-}
-
-Display::~Display()
-{
- terminate();
-
- #if defined(SWIFTSHADER_USE_X11)
- if(nativeDisplay && libX11->XCloseDisplay)
- {
- libX11->XCloseDisplay((::Display*)nativeDisplay);
- }
- #endif
-}
-
-#if !defined(__i386__) && defined(_M_IX86)
- #define __i386__ 1
-#endif
-
-#if !defined(__x86_64__) && (defined(_M_AMD64) || defined (_M_X64))
- #define __x86_64__ 1
-#endif
-
-#if defined(__i386__) || defined(__x86_64__)
-static void cpuid(int registers[4], int info)
-{
- #if defined(__i386__) || defined(__x86_64__)
- #if defined(_WIN32)
- __cpuid(registers, info);
- #else
- __asm volatile("cpuid": "=a" (registers[0]), "=b" (registers[1]), "=c" (registers[2]), "=d" (registers[3]): "a" (info));
- #endif
- #else
- registers[0] = 0;
- registers[1] = 0;
- registers[2] = 0;
- registers[3] = 0;
- #endif
-}
-
-static bool detectSSE()
-{
- int registers[4];
- cpuid(registers, 1);
- return (registers[3] & 0x02000000) != 0;
-}
-#endif
-
-bool Display::initialize()
-{
- if(isInitialized())
- {
- return true;
- }
-
- #if defined(__i386__) || defined(__x86_64__)
- if(!detectSSE())
- {
- return false;
- }
- #endif
-
- mMinSwapInterval = 0;
- mMaxSwapInterval = 4;
-
- const int samples[] =
- {
- 0,
- 2,
- 4
- };
-
- const sw::Format renderTargetFormats[] =
- {
- // sw::FORMAT_A1R5G5B5,
- // sw::FORMAT_A2R10G10B10, // The color_ramp conformance test uses ReadPixels with UNSIGNED_BYTE causing it to think that rendering skipped a colour value.
- sw::FORMAT_A8R8G8B8,
- sw::FORMAT_A8B8G8R8,
- sw::FORMAT_R5G6B5,
- // sw::FORMAT_X1R5G5B5, // Has no compatible OpenGL ES renderbuffer format
- sw::FORMAT_X8R8G8B8,
- sw::FORMAT_X8B8G8R8
- };
-
- const sw::Format depthStencilFormats[] =
- {
- sw::FORMAT_NULL,
- // sw::FORMAT_D16_LOCKABLE,
- sw::FORMAT_D32,
- // sw::FORMAT_D15S1,
- sw::FORMAT_D24S8,
- sw::FORMAT_D24X8,
- // sw::FORMAT_D24X4S4,
- sw::FORMAT_D16,
- // sw::FORMAT_D32F_LOCKABLE,
- // sw::FORMAT_D24FS8
- };
-
- sw::Format currentDisplayFormat = getDisplayFormat();
- ConfigSet configSet;
-
- for(unsigned int samplesIndex = 0; samplesIndex < sizeof(samples) / sizeof(int); samplesIndex++)
- {
- for(sw::Format renderTargetFormat : renderTargetFormats)
- {
- for(sw::Format depthStencilFormat : depthStencilFormats)
- {
- configSet.add(currentDisplayFormat, mMinSwapInterval, mMaxSwapInterval, renderTargetFormat, depthStencilFormat, samples[samplesIndex]);
- }
- }
- }
-
- // Give the sorted configs a unique ID and store them internally
- EGLint index = 1;
- for(ConfigSet::Iterator config = configSet.mSet.begin(); config != configSet.mSet.end(); config++)
- {
- Config configuration = *config;
- configuration.mConfigID = index;
- index++;
-
- mConfigSet.mSet.insert(configuration);
- }
-
- if(!isInitialized())
- {
- terminate();
-
- return false;
- }
-
- return true;
-}
-
-void Display::terminate()
-{
- while(!mSurfaceSet.empty())
- {
- destroySurface(*mSurfaceSet.begin());
- }
-
- while(!mContextSet.empty())
- {
- destroyContext(*mContextSet.begin());
- }
-
- while(!mSharedImageNameSpace.empty())
- {
- destroySharedImage(reinterpret_cast<EGLImageKHR>((intptr_t)mSharedImageNameSpace.firstName()));
- }
-}
-
-bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
-{
- return mConfigSet.getConfigs(configs, attribList, configSize, numConfig);
-}
-
-bool Display::getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value)
-{
- const egl::Config *configuration = mConfigSet.get(config);
-
- switch(attribute)
- {
- case EGL_BUFFER_SIZE: *value = configuration->mBufferSize; break;
- case EGL_ALPHA_SIZE: *value = configuration->mAlphaSize; break;
- case EGL_BLUE_SIZE: *value = configuration->mBlueSize; break;
- case EGL_GREEN_SIZE: *value = configuration->mGreenSize; break;
- case EGL_RED_SIZE: *value = configuration->mRedSize; break;
- case EGL_DEPTH_SIZE: *value = configuration->mDepthSize; break;
- case EGL_STENCIL_SIZE: *value = configuration->mStencilSize; break;
- case EGL_CONFIG_CAVEAT: *value = configuration->mConfigCaveat; break;
- case EGL_CONFIG_ID: *value = configuration->mConfigID; break;
- case EGL_LEVEL: *value = configuration->mLevel; break;
- case EGL_NATIVE_RENDERABLE: *value = configuration->mNativeRenderable; break;
- case EGL_NATIVE_VISUAL_ID: *value = configuration->mNativeVisualID; break;
- case EGL_NATIVE_VISUAL_TYPE: *value = configuration->mNativeVisualType; break;
- case EGL_SAMPLES: *value = configuration->mSamples; break;
- case EGL_SAMPLE_BUFFERS: *value = configuration->mSampleBuffers; break;
- case EGL_SURFACE_TYPE: *value = configuration->mSurfaceType; break;
- case EGL_TRANSPARENT_TYPE: *value = configuration->mTransparentType; break;
- case EGL_TRANSPARENT_BLUE_VALUE: *value = configuration->mTransparentBlueValue; break;
- case EGL_TRANSPARENT_GREEN_VALUE: *value = configuration->mTransparentGreenValue; break;
- case EGL_TRANSPARENT_RED_VALUE: *value = configuration->mTransparentRedValue; break;
- case EGL_BIND_TO_TEXTURE_RGB: *value = configuration->mBindToTextureRGB; break;
- case EGL_BIND_TO_TEXTURE_RGBA: *value = configuration->mBindToTextureRGBA; break;
- case EGL_MIN_SWAP_INTERVAL: *value = configuration->mMinSwapInterval; break;
- case EGL_MAX_SWAP_INTERVAL: *value = configuration->mMaxSwapInterval; break;
- case EGL_LUMINANCE_SIZE: *value = configuration->mLuminanceSize; break;
- case EGL_ALPHA_MASK_SIZE: *value = configuration->mAlphaMaskSize; break;
- case EGL_COLOR_BUFFER_TYPE: *value = configuration->mColorBufferType; break;
- case EGL_RENDERABLE_TYPE: *value = configuration->mRenderableType; break;
- case EGL_MATCH_NATIVE_PIXMAP: *value = EGL_FALSE; UNIMPLEMENTED(); break;
- case EGL_CONFORMANT: *value = configuration->mConformant; break;
- case EGL_MAX_PBUFFER_WIDTH: *value = configuration->mMaxPBufferWidth; break;
- case EGL_MAX_PBUFFER_HEIGHT: *value = configuration->mMaxPBufferHeight; break;
- case EGL_MAX_PBUFFER_PIXELS: *value = configuration->mMaxPBufferPixels; break;
- case EGL_RECORDABLE_ANDROID: *value = configuration->mRecordableAndroid; break;
- case EGL_FRAMEBUFFER_TARGET_ANDROID: *value = configuration->mFramebufferTargetAndroid; break;
- case EGL_BIND_TO_TEXTURE_TARGET_ANGLE: *value = configuration->mBindToTextureTargetANGLE; break;
- default:
- return false;
- }
-
- return true;
-}
-
-EGLSurface Display::createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLAttrib *attribList)
-{
- const Config *configuration = mConfigSet.get(config);
-
- if(attribList)
- {
- while(*attribList != EGL_NONE)
- {
- switch(attribList[0])
- {
- case EGL_RENDER_BUFFER:
- switch(attribList[1])
- {
- case EGL_BACK_BUFFER:
- break;
- case EGL_SINGLE_BUFFER:
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE); // Rendering directly to front buffer not supported
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- break;
- case EGL_VG_COLORSPACE:
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- case EGL_VG_ALPHA_FORMAT:
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-
- attribList += 2;
- }
- }
-
- if(hasExistingWindowSurface(window))
- {
- return error(EGL_BAD_ALLOC, EGL_NO_SURFACE);
- }
-
- Surface *surface = new WindowSurface(this, configuration, window);
-
- if(!surface->initialize())
- {
- surface->release();
- return EGL_NO_SURFACE;
- }
-
- surface->addRef();
- mSurfaceSet.insert(surface);
-
- return success(surface);
-}
-
-EGLSurface Display::createPBufferSurface(EGLConfig config, const EGLint *attribList, EGLClientBuffer clientBuffer)
-{
- EGLint width = -1, height = -1, ioSurfacePlane = -1;
- EGLenum textureFormat = EGL_NO_TEXTURE;
- EGLenum textureTarget = EGL_NO_TEXTURE;
- EGLenum clientBufferFormat = EGL_NO_TEXTURE;
- EGLenum clientBufferType = EGL_NO_TEXTURE;
- EGLBoolean largestPBuffer = EGL_FALSE;
- const Config *configuration = mConfigSet.get(config);
-
- if(attribList)
- {
- while(*attribList != EGL_NONE)
- {
- switch(attribList[0])
- {
- case EGL_WIDTH:
- width = attribList[1];
- break;
- case EGL_HEIGHT:
- height = attribList[1];
- break;
- case EGL_LARGEST_PBUFFER:
- largestPBuffer = attribList[1];
- break;
- case EGL_TEXTURE_FORMAT:
- switch(attribList[1])
- {
- case EGL_NO_TEXTURE:
- case EGL_TEXTURE_RGB:
- case EGL_TEXTURE_RGBA:
- textureFormat = attribList[1];
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- break;
- case EGL_TEXTURE_INTERNAL_FORMAT_ANGLE:
- switch(attribList[1])
- {
- case GL_RED:
- case GL_R16UI:
- case GL_RG:
- case GL_RGB:
- case GL_BGRA_EXT:
- case GL_RGBA:
- clientBufferFormat = attribList[1];
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- break;
- case EGL_TEXTURE_TYPE_ANGLE:
- switch(attribList[1])
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT:
- clientBufferType = attribList[1];
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- break;
- case EGL_IOSURFACE_PLANE_ANGLE:
- if(attribList[1] < 0)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- ioSurfacePlane = attribList[1];
- break;
- case EGL_TEXTURE_TARGET:
- switch(attribList[1])
- {
- case EGL_NO_TEXTURE:
- case EGL_TEXTURE_2D:
- case EGL_TEXTURE_RECTANGLE_ANGLE:
- textureTarget = attribList[1];
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- break;
- case EGL_MIPMAP_TEXTURE:
- if(attribList[1] != EGL_FALSE)
- {
- UNIMPLEMENTED();
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
- break;
- case EGL_VG_COLORSPACE:
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- case EGL_VG_ALPHA_FORMAT:
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-
- attribList += 2;
- }
- }
-
- if(width < 0 || height < 0)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
-
- if(width == 0 || height == 0)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-
- if((textureFormat != EGL_NO_TEXTURE && textureTarget == EGL_NO_TEXTURE) ||
- (textureFormat == EGL_NO_TEXTURE && textureTarget != EGL_NO_TEXTURE))
- {
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- if(!(configuration->mSurfaceType & EGL_PBUFFER_BIT))
- {
- return error(EGL_BAD_MATCH, EGL_NO_SURFACE);
- }
-
- if(clientBuffer)
- {
- switch(clientBufferType)
- {
- case GL_UNSIGNED_BYTE:
- switch(clientBufferFormat)
- {
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_BGRA_EXT:
- break;
- case GL_R16UI:
- case GL_RGBA:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
- break;
- case GL_UNSIGNED_SHORT:
- switch(clientBufferFormat)
- {
- case GL_R16UI:
- break;
- case GL_RED:
- case GL_RG:
- case GL_BGRA_EXT:
- case GL_RGBA:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
- break;
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT:
- switch(clientBufferFormat)
- {
- case GL_RGBA:
- break;
- case GL_RED:
- case GL_R16UI:
- case GL_RG:
- case GL_BGRA_EXT:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
- break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
-
- if(ioSurfacePlane < 0)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
-
- if(textureFormat != EGL_TEXTURE_RGBA)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-
- if(textureTarget != EGL_TEXTURE_RECTANGLE_ANGLE)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-
-#if defined(__APPLE__)
- IOSurfaceRef ioSurface = reinterpret_cast<IOSurfaceRef>(clientBuffer);
- size_t planeCount = IOSurfaceGetPlaneCount(ioSurface);
- if((static_cast<size_t>(width) > IOSurfaceGetWidthOfPlane(ioSurface, ioSurfacePlane)) ||
- (static_cast<size_t>(height) > IOSurfaceGetHeightOfPlane(ioSurface, ioSurfacePlane)) ||
- ((planeCount != 0) && static_cast<size_t>(ioSurfacePlane) >= planeCount))
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
-#endif
- }
- else
- {
- if((textureFormat == EGL_TEXTURE_RGB && configuration->mBindToTextureRGB != EGL_TRUE) ||
- ((textureFormat == EGL_TEXTURE_RGBA && configuration->mBindToTextureRGBA != EGL_TRUE)))
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE);
- }
- }
-
- Surface *surface = new PBufferSurface(this, configuration, width, height, textureFormat, textureTarget, clientBufferFormat, clientBufferType, largestPBuffer, clientBuffer, ioSurfacePlane);
-
- if(!surface->initialize())
- {
- surface->release();
- return EGL_NO_SURFACE;
- }
-
- surface->addRef();
- mSurfaceSet.insert(surface);
-
- return success(surface);
-}
-
-EGLContext Display::createContext(EGLConfig configHandle, const egl::Context *shareContext, EGLint clientVersion)
-{
- const egl::Config *config = mConfigSet.get(configHandle);
- egl::Context *context = nullptr;
-
- if((clientVersion == 2 && config->mRenderableType & EGL_OPENGL_ES2_BIT) ||
- (clientVersion == 3 && config->mRenderableType & EGL_OPENGL_ES3_BIT))
- {
- if(libGLESv2)
- {
- context = libGLESv2->es2CreateContext(this, shareContext, config);
- }
- }
- else
- {
- return error(EGL_BAD_CONFIG, EGL_NO_CONTEXT);
- }
-
- if(!context)
- {
- return error(EGL_BAD_ALLOC, EGL_NO_CONTEXT);
- }
-
- context->addRef();
- mContextSet.insert(context);
-
- return success(context);
-}
-
-EGLSyncKHR Display::createSync(Context *context)
-{
- FenceSync *fenceSync = new egl::FenceSync(context);
- mSyncSet.insert(fenceSync);
- return fenceSync;
-}
-
-void Display::destroySurface(egl::Surface *surface)
-{
- surface->release();
- mSurfaceSet.erase(surface);
-
- if(surface == getCurrentDrawSurface())
- {
- setCurrentDrawSurface(nullptr);
- }
-
- if(surface == getCurrentReadSurface())
- {
- setCurrentReadSurface(nullptr);
- }
-}
-
-void Display::destroyContext(egl::Context *context)
-{
- context->release();
- mContextSet.erase(context);
-
- if(context == getCurrentContext())
- {
- setCurrentContext(nullptr);
- setCurrentDrawSurface(nullptr);
- setCurrentReadSurface(nullptr);
- }
-}
-
-void Display::destroySync(FenceSync *sync)
-{
- {
- mSyncSet.erase(sync);
- }
- delete sync;
-}
-
-bool Display::isInitialized() const
-{
- return mConfigSet.size() > 0;
-}
-
-bool Display::isValidConfig(EGLConfig config)
-{
- return mConfigSet.get(config) != nullptr;
-}
-
-bool Display::isValidContext(egl::Context *context)
-{
- return mContextSet.find(context) != mContextSet.end();
-}
-
-bool Display::isValidSurface(egl::Surface *surface)
-{
- return mSurfaceSet.find(surface) != mSurfaceSet.end();
-}
-
-bool Display::isValidWindow(EGLNativeWindowType window)
-{
- #if defined(_WIN32)
- return IsWindow(window) == TRUE;
- #elif defined(__ANDROID__)
- if(!window)
- {
- ERR("%s called with window==NULL %s:%d", __FUNCTION__, __FILE__, __LINE__);
- return false;
- }
- return true;
- #elif defined(SWIFTSHADER_USE_X11)
- if(nativeDisplay)
- {
- XWindowAttributes windowAttributes;
- Status status = libX11->XGetWindowAttributes((::Display*)nativeDisplay, window, &windowAttributes);
-
- return status != 0;
- }
- return false;
- #elif defined(__linux__)
- return false; // Non X11 linux is headless only
- #elif defined(__APPLE__)
- return sw::OSX::IsValidWindow(window);
- #elif defined(__Fuchsia__)
- // TODO(crbug.com/800951): Integrate with Mozart.
- return true;
- #else
- #error "Display::isValidWindow unimplemented for this platform"
- return false;
- #endif
-}
-
-bool Display::hasExistingWindowSurface(EGLNativeWindowType window)
-{
- for(const auto &surface : mSurfaceSet)
- {
- if(surface->isWindowSurface())
- {
- if(surface->getWindowHandle() == window)
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool Display::isValidSync(FenceSync *sync)
-{
- return mSyncSet.find(sync) != mSyncSet.end();
-}
-
-EGLint Display::getMinSwapInterval() const
-{
- return mMinSwapInterval;
-}
-
-EGLint Display::getMaxSwapInterval() const
-{
- return mMaxSwapInterval;
-}
-
-EGLDisplay Display::getEGLDisplay() const
-{
- return eglDisplay;
-}
-
-void *Display::getNativeDisplay() const
-{
- return nativeDisplay;
-}
-
-EGLImageKHR Display::createSharedImage(Image *image)
-{
- return reinterpret_cast<EGLImageKHR>((intptr_t)mSharedImageNameSpace.allocate(image));
-}
-
-bool Display::destroySharedImage(EGLImageKHR image)
-{
- GLuint name = (GLuint)reinterpret_cast<intptr_t>(image);
- Image *eglImage = mSharedImageNameSpace.find(name);
-
- if(!eglImage)
- {
- return false;
- }
-
- eglImage->destroyShared();
- mSharedImageNameSpace.remove(name);
-
- return true;
-}
-
-Image *Display::getSharedImage(EGLImageKHR image)
-{
- GLuint name = (GLuint)reinterpret_cast<intptr_t>(image);
- return mSharedImageNameSpace.find(name);
-}
-
-sw::Format Display::getDisplayFormat() const
-{
- #if defined(_WIN32)
- HDC deviceContext = GetDC(0);
- unsigned int bpp = ::GetDeviceCaps(deviceContext, BITSPIXEL);
- ReleaseDC(0, deviceContext);
-
- switch(bpp)
- {
- case 32: return sw::FORMAT_X8R8G8B8;
- case 24: return sw::FORMAT_R8G8B8;
- case 16: return sw::FORMAT_R5G6B5;
- default: UNREACHABLE(bpp); // Unexpected display mode color depth
- }
- #elif defined(__ANDROID__)
- #if !defined(ANDROID_NDK_BUILD)
- static const char *const framebuffer[] =
- {
- "/dev/graphics/fb0",
- "/dev/fb0",
- 0
- };
-
- for(int i = 0; framebuffer[i]; i++)
- {
- int fd = open(framebuffer[i], O_RDONLY, 0);
-
- if(fd != -1)
- {
- struct fb_var_screeninfo info;
- int io = ioctl(fd, FBIOGET_VSCREENINFO, &info);
- close(fd);
-
- if(io >= 0)
- {
- switch(info.bits_per_pixel)
- {
- case 16:
- return sw::FORMAT_R5G6B5;
- case 32:
- if(info.red.length == 8 && info.red.offset == 16 &&
- info.green.length == 8 && info.green.offset == 8 &&
- info.blue.length == 8 && info.blue.offset == 0 &&
- info.transp.length == 0)
- {
- return sw::FORMAT_X8R8G8B8;
- }
- if(info.red.length == 8 && info.red.offset == 0 &&
- info.green.length == 8 && info.green.offset == 8 &&
- info.blue.length == 8 && info.blue.offset == 16 &&
- info.transp.length == 0)
- {
- return sw::FORMAT_X8B8G8R8;
- }
- if(info.red.length == 8 && info.red.offset == 16 &&
- info.green.length == 8 && info.green.offset == 8 &&
- info.blue.length == 8 && info.blue.offset == 0 &&
- info.transp.length == 8 && info.transp.offset == 24)
- {
- return sw::FORMAT_A8R8G8B8;
- }
- if(info.red.length == 8 && info.red.offset == 0 &&
- info.green.length == 8 && info.green.offset == 8 &&
- info.blue.length == 8 && info.blue.offset == 16 &&
- info.transp.length == 8 && info.transp.offset == 24)
- {
- return sw::FORMAT_A8B8G8R8;
- }
- else UNIMPLEMENTED();
- default:
- UNIMPLEMENTED();
- }
- }
- }
- }
- #endif // !defined_ANDROID_NDK_BUILD)
-
- // No framebuffer device found, or we're in user space
- return sw::FORMAT_X8B8G8R8;
- #elif defined(SWIFTSHADER_USE_X11)
- if(nativeDisplay)
- {
- Screen *screen = libX11->XDefaultScreenOfDisplay((::Display*)nativeDisplay);
- unsigned int bpp = libX11->XPlanesOfScreen(screen);
-
- switch(bpp)
- {
- case 32: return sw::FORMAT_X8R8G8B8;
- case 24: return sw::FORMAT_R8G8B8;
- case 16: return sw::FORMAT_R5G6B5;
- default: UNREACHABLE(bpp); // Unexpected display mode color depth
- }
- }
- else
- {
- return sw::FORMAT_X8R8G8B8;
- }
- #elif defined(__linux__) // Non X11 linux is headless only
- return sw::FORMAT_A8B8G8R8;
- #elif defined(__APPLE__)
- return sw::FORMAT_A8B8G8R8;
- #elif defined(__Fuchsia__)
- return sw::FORMAT_A8B8G8R8;
- #else
- #error "Display::isValidWindow unimplemented for this platform"
- #endif
-
- return sw::FORMAT_X8R8G8B8;
-}
-
-}
diff --git a/src/OpenGL/libEGL/Display.h b/src/OpenGL/libEGL/Display.h
deleted file mode 100644
index 106a4e068..000000000
--- a/src/OpenGL/libEGL/Display.h
+++ /dev/null
@@ -1,117 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// 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 INCLUDE_DISPLAY_H_
-#define INCLUDE_DISPLAY_H_
-
-#include "Config.h"
-#include "Sync.hpp"
-#include "Common/RecursiveLock.hpp"
-#include "common/NameSpace.hpp"
-
-#include <set>
-
-#ifndef EGL_ANGLE_iosurface_client_buffer
-#define EGL_ANGLE_iosurface_client_buffer 1
-#define EGL_IOSURFACE_ANGLE 0x3454
-#define EGL_IOSURFACE_PLANE_ANGLE 0x345A
-#define EGL_TEXTURE_RECTANGLE_ANGLE 0x345B
-#define EGL_TEXTURE_TYPE_ANGLE 0x345C
-#define EGL_TEXTURE_INTERNAL_FORMAT_ANGLE 0x345D
-#define EGL_BIND_TO_TEXTURE_TARGET_ANGLE 0x348D
-#endif // EGL_ANGLE_iosurface_client_buffer
-
-namespace egl
-{
- class Surface;
- class Context;
- class Image;
-
- const EGLDisplay PRIMARY_DISPLAY = reinterpret_cast<EGLDisplay>((intptr_t)1);
- const EGLDisplay HEADLESS_DISPLAY = reinterpret_cast<EGLDisplay>((intptr_t)0xFACE1E55);
-
- class [[clang::lto_visibility_public]] Display
- {
- protected:
- explicit Display(EGLDisplay eglDisplay, void *nativeDisplay);
- virtual ~Display() = 0;
-
- public:
- static Display *get(EGLDisplay dpy);
-
- bool initialize();
- void terminate();
-
- bool getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig);
- bool getConfigAttrib(EGLConfig config, EGLint attribute, EGLint *value);
-
- EGLSurface createWindowSurface(EGLNativeWindowType window, EGLConfig config, const EGLAttrib *attribList);
- EGLSurface createPBufferSurface(EGLConfig config, const EGLint *attribList, EGLClientBuffer clientBuffer = nullptr);
- EGLContext createContext(EGLConfig configHandle, const Context *shareContext, EGLint clientVersion);
- EGLSyncKHR createSync(Context *context);
-
- void destroySurface(Surface *surface);
- void destroyContext(Context *context);
- void destroySync(FenceSync *sync);
-
- bool isInitialized() const;
- bool isValidConfig(EGLConfig config);
- bool isValidContext(Context *context);
- bool isValidSurface(Surface *surface);
- bool isValidWindow(EGLNativeWindowType window);
- bool hasExistingWindowSurface(EGLNativeWindowType window);
- bool isValidSync(FenceSync *sync);
-
- EGLint getMinSwapInterval() const;
- EGLint getMaxSwapInterval() const;
-
- EGLDisplay getEGLDisplay() const;
- void *getNativeDisplay() const;
-
- EGLImageKHR createSharedImage(Image *image);
- bool destroySharedImage(EGLImageKHR);
- virtual Image *getSharedImage(EGLImageKHR name) = 0;
-
- sw::RecursiveLock *getLock() { return &mApiMutex; }
-
- private:
- sw::Format getDisplayFormat() const;
-
- const EGLDisplay eglDisplay;
- void *const nativeDisplay;
-
- EGLint mMaxSwapInterval;
- EGLint mMinSwapInterval;
-
- typedef std::set<Surface*> SurfaceSet;
- SurfaceSet mSurfaceSet;
-
- ConfigSet mConfigSet;
-
- typedef std::set<Context*> ContextSet;
- ContextSet mContextSet;
-
- typedef std::set<FenceSync*> SyncSet;
- SyncSet mSyncSet;
-
- gl::NameSpace<Image> mSharedImageNameSpace;
- sw::RecursiveLock mApiMutex;
- };
-}
-
-#endif // INCLUDE_DISPLAY_H_
diff --git a/src/OpenGL/libEGL/OSXUtils.hpp b/src/OpenGL/libEGL/OSXUtils.hpp
deleted file mode 100644
index 3830b8bf7..000000000
--- a/src/OpenGL/libEGL/OSXUtils.hpp
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_OSXUtils_hpp
-#define sw_OSXUtils_hpp
-
-#include <EGL/egl.h>
-
-namespace sw
-{
-namespace OSX
-{
- bool IsValidWindow(EGLNativeWindowType window);
- void GetNativeWindowSize(EGLNativeWindowType window, int &width, int &height);
-}
-}
-
-#endif // sw_OSXUtils_hpp
diff --git a/src/OpenGL/libEGL/OSXUtils.mm b/src/OpenGL/libEGL/OSXUtils.mm
deleted file mode 100644
index e346728ef..000000000
--- a/src/OpenGL/libEGL/OSXUtils.mm
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "OSXUtils.hpp"
-
-#include "common/debug.h"
-
-#import <Cocoa/Cocoa.h>
-
-namespace sw
-{
-namespace OSX
-{
- bool IsValidWindow(EGLNativeWindowType window)
- {
- NSObject *object = reinterpret_cast<NSObject*>(window);
- return window && ([object isKindOfClass:[NSView class]] || [object isKindOfClass:[CALayer class]]);
- }
-
- void GetNativeWindowSize(EGLNativeWindowType window, int &width, int &height)
- {
- NSObject *object = reinterpret_cast<NSObject*>(window);
-
- if([object isKindOfClass:[NSView class]])
- {
- NSView *view = reinterpret_cast<NSView*>(object);
- width = [view convertRectToBacking:[view bounds]].size.width;
- height = [view convertRectToBacking:[view bounds]].size.height;
- }
- else if([object isKindOfClass:[CALayer class]])
- {
- CALayer *layer = reinterpret_cast<CALayer*>(object);
- width = [layer bounds].size.width * layer.contentsScale;
- height = [layer bounds].size.height * layer.contentsScale;
- }
- else UNREACHABLE(0);
- }
-}
-}
diff --git a/src/OpenGL/libEGL/Surface.cpp b/src/OpenGL/libEGL/Surface.cpp
deleted file mode 100644
index a1c79e054..000000000
--- a/src/OpenGL/libEGL/Surface.cpp
+++ /dev/null
@@ -1,455 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Surface.cpp: Implements the egl::Surface class, representing a drawing surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
-#include "Surface.hpp"
-
-#include "Context.hpp"
-#include "Display.h"
-#include "Main/FrameBuffer.hpp"
-#include "Texture.hpp"
-#include "common/Image.hpp"
-#include "common/debug.h"
-#include "main.h"
-
-#if defined(SWIFTSHADER_USE_X11)
-#include "Main/libX11.hpp"
-#elif defined(_WIN32)
-#include <tchar.h>
-#elif defined(__APPLE__)
-#include "OSXUtils.hpp"
-#endif
-#if defined(__ANDROID__) && defined(ANDROID_NDK_BUILD)
-#include <android/native_window.h>
-#endif
-
-#include <algorithm>
-
-namespace gl
-{
-Surface::Surface()
-{
-}
-
-Surface::~Surface()
-{
-}
-}
-
-namespace egl
-{
-Surface::Surface(const Display *display, const Config *config) : display(display), config(config)
-{
-}
-
-Surface::~Surface()
-{
- Surface::deleteResources();
-}
-
-bool Surface::initialize()
-{
- ASSERT(!backBuffer && !depthStencil);
-
- if(libGLESv2)
- {
- if(clientBuffer)
- {
- backBuffer = libGLESv2->createBackBufferFromClientBuffer(
- egl::ClientBuffer(width, height, getClientBufferFormat(), clientBuffer, clientBufferPlane));
- }
- else
- {
- backBuffer = libGLESv2->createBackBuffer(width, height, config->mRenderTargetFormat, config->mSamples);
- }
- }
-
- if(!backBuffer)
- {
- ERR("Could not create back buffer");
- deleteResources();
- return error(EGL_BAD_ALLOC, false);
- }
-
- if(config->mDepthStencilFormat != sw::FORMAT_NULL)
- {
- if(libGLESv2)
- {
- depthStencil = libGLESv2->createDepthStencil(width, height, config->mDepthStencilFormat, config->mSamples);
- }
-
- if(!depthStencil)
- {
- ERR("Could not create depth/stencil buffer for surface");
- deleteResources();
- return error(EGL_BAD_ALLOC, false);
- }
- }
-
- return true;
-}
-
-void Surface::deleteResources()
-{
- if(depthStencil)
- {
- depthStencil->release();
- depthStencil = nullptr;
- }
-
- if(texture)
- {
- texture->releaseTexImage();
- texture = nullptr;
- }
-
- if(backBuffer)
- {
- backBuffer->release();
- backBuffer = nullptr;
- }
-}
-
-egl::Image *Surface::getRenderTarget()
-{
- if(backBuffer)
- {
- backBuffer->addRef();
- }
-
- return backBuffer;
-}
-
-egl::Image *Surface::getDepthStencil()
-{
- if(depthStencil)
- {
- depthStencil->addRef();
- }
-
- return depthStencil;
-}
-
-void Surface::setMipmapLevel(EGLint mipmapLevel)
-{
- this->mipmapLevel = mipmapLevel;
-}
-
-void Surface::setMultisampleResolve(EGLenum multisampleResolve)
-{
- this->multisampleResolve = multisampleResolve;
-}
-
-void Surface::setSwapBehavior(EGLenum swapBehavior)
-{
- this->swapBehavior = swapBehavior;
-}
-
-void Surface::setSwapInterval(EGLint interval)
-{
- if(swapInterval == interval)
- {
- return;
- }
-
- swapInterval = interval;
- swapInterval = std::max(swapInterval, display->getMinSwapInterval());
- swapInterval = std::min(swapInterval, display->getMaxSwapInterval());
-}
-
-EGLint Surface::getConfigID() const
-{
- return config->mConfigID;
-}
-
-EGLenum Surface::getSurfaceType() const
-{
- return config->mSurfaceType;
-}
-
-EGLint Surface::getWidth() const
-{
- return width;
-}
-
-EGLint Surface::getHeight() const
-{
- return height;
-}
-
-EGLint Surface::getMipmapLevel() const
-{
- return mipmapLevel;
-}
-
-EGLenum Surface::getMultisampleResolve() const
-{
- return multisampleResolve;
-}
-
-EGLint Surface::getPixelAspectRatio() const
-{
- return pixelAspectRatio;
-}
-
-EGLenum Surface::getRenderBuffer() const
-{
- return renderBuffer;
-}
-
-EGLenum Surface::getSwapBehavior() const
-{
- return swapBehavior;
-}
-
-EGLenum Surface::getTextureFormat() const
-{
- return textureFormat;
-}
-
-EGLenum Surface::getTextureTarget() const
-{
- return textureTarget;
-}
-
-EGLBoolean Surface::getLargestPBuffer() const
-{
- return largestPBuffer;
-}
-
-sw::Format Surface::getClientBufferFormat() const
-{
- switch(clientBufferType)
- {
- case GL_UNSIGNED_BYTE:
- switch(clientBufferFormat)
- {
- case GL_RED:
- return sw::FORMAT_R8;
- case GL_RG:
- return sw::FORMAT_G8R8;
- case GL_RGB:
- return sw::FORMAT_X8R8G8B8;
- case GL_BGRA_EXT:
- return sw::FORMAT_A8R8G8B8;
- default:
- UNREACHABLE(clientBufferFormat);
- break;
- }
- break;
- case GL_UNSIGNED_SHORT:
- switch(clientBufferFormat)
- {
- case GL_R16UI:
- return sw::FORMAT_R16UI;
- default:
- UNREACHABLE(clientBufferFormat);
- break;
- }
- break;
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT:
- switch(clientBufferFormat)
- {
- case GL_RGBA:
- return sw::FORMAT_A16B16G16R16F;
- default:
- UNREACHABLE(clientBufferFormat);
- break;
- }
- default:
- UNREACHABLE(clientBufferType);
- break;
- }
-
- return sw::FORMAT_NULL;
-}
-
-void Surface::setBoundTexture(egl::Texture *texture)
-{
- this->texture = texture;
-}
-
-egl::Texture *Surface::getBoundTexture() const
-{
- return texture;
-}
-
-WindowSurface::WindowSurface(Display *display, const Config *config, EGLNativeWindowType window)
- : Surface(display, config), window(window)
-{
- pixelAspectRatio = (EGLint)(1.0 * EGL_DISPLAY_SCALING); // FIXME: Determine actual pixel aspect ratio
-}
-
-WindowSurface::~WindowSurface()
-{
- WindowSurface::deleteResources();
-}
-
-bool WindowSurface::initialize()
-{
- ASSERT(!frameBuffer && !backBuffer && !depthStencil);
-
- return checkForResize();
-}
-
-void WindowSurface::swap()
-{
- if(backBuffer && frameBuffer)
- {
- frameBuffer->flip(backBuffer);
-
- checkForResize();
- }
-}
-
-EGLNativeWindowType WindowSurface::getWindowHandle() const
-{
- return window;
-}
-
-bool WindowSurface::checkForResize()
-{
- #if defined(_WIN32)
- RECT client;
- BOOL status = GetClientRect(window, &client);
-
- if(status == 0)
- {
- return error(EGL_BAD_NATIVE_WINDOW, false);
- }
-
- int windowWidth = client.right - client.left;
- int windowHeight = client.bottom - client.top;
- #elif defined(__ANDROID__)
- int windowWidth = ANativeWindow_getWidth(window);
- int windowHeight = ANativeWindow_getHeight(window);
- #elif defined(SWIFTSHADER_USE_X11)
- XWindowAttributes windowAttributes;
- Status status = libX11->XGetWindowAttributes((::Display*)display->getNativeDisplay(), window, &windowAttributes);
-
- if(status == 0)
- {
- return error(EGL_BAD_NATIVE_WINDOW, false);
- }
-
- int windowWidth = windowAttributes.width;
- int windowHeight = windowAttributes.height;
- #elif defined(__linux__)
- // Non X11 linux is headless only
- int windowWidth = 100;
- int windowHeight = 100;
- #elif defined(__APPLE__)
- int windowWidth;
- int windowHeight;
- sw::OSX::GetNativeWindowSize(window, windowWidth, windowHeight);
- #elif defined(__Fuchsia__)
- // TODO(crbug.com/800951): Integrate with Mozart.
- int windowWidth = 100;
- int windowHeight = 100;
- #else
- #error "WindowSurface::checkForResize unimplemented for this platform"
- #endif
-
- if((windowWidth != width) || (windowHeight != height))
- {
- bool success = reset(windowWidth, windowHeight);
-
- if(getCurrentDrawSurface() == this)
- {
- getCurrentContext()->makeCurrent(this);
- }
-
- return success;
- }
-
- return true; // Success
-}
-
-void WindowSurface::deleteResources()
-{
- delete frameBuffer;
- frameBuffer = nullptr;
-
- Surface::deleteResources();
-}
-
-bool WindowSurface::reset(int backBufferWidth, int backBufferHeight)
-{
- width = backBufferWidth;
- height = backBufferHeight;
-
- deleteResources();
-
- if(window)
- {
- if(libGLESv2)
- {
- frameBuffer = libGLESv2->createFrameBuffer(display->getNativeDisplay(), window, width, height);
- }
-
- if(!frameBuffer)
- {
- ERR("Could not create frame buffer");
- deleteResources();
- return error(EGL_BAD_ALLOC, false);
- }
- }
-
- return Surface::initialize();
-}
-
-PBufferSurface::PBufferSurface(Display *display, const Config *config, EGLint width, EGLint height,
- EGLenum textureFormat, EGLenum textureTarget, EGLenum clientBufferFormat,
- EGLenum clientBufferType, EGLBoolean largestPBuffer, EGLClientBuffer clientBuffer,
- EGLint clientBufferPlane)
- : Surface(display, config)
-{
- this->width = width;
- this->height = height;
- this->largestPBuffer = largestPBuffer;
- this->textureFormat = textureFormat;
- this->textureTarget = textureTarget;
- this->clientBufferFormat = clientBufferFormat;
- this->clientBufferType = clientBufferType;
- this->clientBuffer = clientBuffer;
- this->clientBufferPlane = clientBufferPlane;
-}
-
-PBufferSurface::~PBufferSurface()
-{
- PBufferSurface::deleteResources();
-}
-
-void PBufferSurface::swap()
-{
- // No effect
-}
-
-EGLNativeWindowType PBufferSurface::getWindowHandle() const
-{
- UNREACHABLE(-1); // Should not be called. Only WindowSurface has a window handle.
-
- return 0;
-}
-
-void PBufferSurface::deleteResources()
-{
- Surface::deleteResources();
-}
-
-}
diff --git a/src/OpenGL/libEGL/Surface.hpp b/src/OpenGL/libEGL/Surface.hpp
deleted file mode 100644
index 183a10403..000000000
--- a/src/OpenGL/libEGL/Surface.hpp
+++ /dev/null
@@ -1,155 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Surface.hpp: Defines the egl::Surface class, representing a rendering surface
-// such as the client area of a window, including any back buffers.
-// Implements EGLSurface and related functionality. [EGL 1.4] section 2.2 page 3.
-
-#ifndef INCLUDE_EGL_SURFACE_H_
-#define INCLUDE_EGL_SURFACE_H_
-
-#include "common/Object.hpp"
-#include "common/Surface.hpp"
-
-#include "Main/FrameBuffer.hpp"
-
-#include <EGL/egl.h>
-
-namespace egl
-{
-class Display;
-class Config;
-
-class Surface : public gl::Surface, public gl::Object
-{
-public:
- virtual bool initialize();
- virtual void swap() = 0;
-
- egl::Image *getRenderTarget() override;
- egl::Image *getDepthStencil() override;
-
- void setMipmapLevel(EGLint mipmapLevel);
- void setMultisampleResolve(EGLenum multisampleResolve);
- void setSwapBehavior(EGLenum swapBehavior);
- void setSwapInterval(EGLint interval);
-
- virtual EGLint getConfigID() const;
- virtual EGLenum getSurfaceType() const;
-
- EGLint getWidth() const override;
- EGLint getHeight() const override;
- EGLenum getTextureTarget() const override;
- virtual EGLint getMipmapLevel() const;
- virtual EGLenum getMultisampleResolve() const;
- virtual EGLint getPixelAspectRatio() const;
- virtual EGLenum getRenderBuffer() const;
- virtual EGLenum getSwapBehavior() const;
- virtual EGLenum getTextureFormat() const;
- virtual EGLBoolean getLargestPBuffer() const;
- virtual EGLNativeWindowType getWindowHandle() const = 0;
-
- void setBoundTexture(egl::Texture *texture) override;
- virtual egl::Texture *getBoundTexture() const;
-
- virtual bool isWindowSurface() const { return false; }
- virtual bool isPBufferSurface() const { return false; }
- bool hasClientBuffer() const { return clientBuffer != nullptr; }
-
-protected:
- Surface(const Display *display, const Config *config);
-
- ~Surface() override;
-
- virtual void deleteResources();
-
- sw::Format getClientBufferFormat() const;
-
- const Display *const display;
- const Config *const config;
-
- Image *depthStencil = nullptr;
- Image *backBuffer = nullptr;
- Texture *texture = nullptr;
-
- bool reset(int backbufferWidth, int backbufferHeight);
-
- // Surface attributes:
- EGLint width = 0; // Width of surface
- EGLint height= 0; // Height of surface
-// EGLint horizontalResolution = EGL_UNKNOWN; // Horizontal dot pitch
-// EGLint verticalResolution = EGL_UNKNOWN; // Vertical dot pitch
- EGLBoolean largestPBuffer = EGL_FALSE; // If true, create largest pbuffer possible
-// EGLBoolean mipmapTexture = EGL_FALSE; // True if texture has mipmaps
- EGLint mipmapLevel = 0; // Mipmap level to render to
- EGLenum multisampleResolve = EGL_MULTISAMPLE_RESOLVE_DEFAULT; // Multisample resolve behavior
- EGLint pixelAspectRatio = EGL_UNKNOWN; // Display aspect ratio
- EGLenum renderBuffer = EGL_BACK_BUFFER; // Render buffer
- EGLenum swapBehavior = EGL_BUFFER_PRESERVED; // Buffer swap behavior (initial value chosen by implementation)
- EGLenum textureFormat = EGL_NO_TEXTURE; // Format of texture: RGB, RGBA, or no texture
- EGLenum textureTarget = EGL_NO_TEXTURE; // Type of texture: 2D or no texture
-// EGLenum vgAlphaFormat = EGL_VG_ALPHA_FORMAT_NONPRE; // Alpha format for OpenVG
-// EGLenum vgColorSpace = EGL_VG_COLORSPACE_sRGB; // Color space for OpenVG
-
- EGLint swapInterval = 1;
-
- // EGL_ANGLE_iosurface_client_buffer attributes:
- EGLClientBuffer clientBuffer = nullptr;
- EGLint clientBufferPlane;
- EGLenum clientBufferFormat; // Format of the client buffer
- EGLenum clientBufferType; // Type of the client buffer
-};
-
-class WindowSurface : public Surface
-{
-public:
- WindowSurface(Display *display, const egl::Config *config, EGLNativeWindowType window);
- ~WindowSurface() override;
-
- bool initialize() override;
-
- bool isWindowSurface() const override { return true; }
- void swap() override;
-
- EGLNativeWindowType getWindowHandle() const override;
-
-private:
- void deleteResources() override;
- bool checkForResize();
- bool reset(int backBufferWidth, int backBufferHeight);
-
- const EGLNativeWindowType window;
- sw::FrameBuffer *frameBuffer = nullptr;
-};
-
-class PBufferSurface : public Surface
-{
-public:
- PBufferSurface(Display *display, const egl::Config *config, EGLint width, EGLint height,
- EGLenum textureFormat, EGLenum textureTarget, EGLenum internalFormat,
- EGLenum textureType, EGLBoolean largestPBuffer, EGLClientBuffer clientBuffer,
- EGLint clientBufferPlane);
- ~PBufferSurface() override;
-
- bool isPBufferSurface() const override { return true; }
- void swap() override;
-
- EGLNativeWindowType getWindowHandle() const override;
-
-private:
- void deleteResources() override;
-};
-}
-
-#endif // INCLUDE_EGL_SURFACE_H_
diff --git a/src/OpenGL/libEGL/Sync.hpp b/src/OpenGL/libEGL/Sync.hpp
deleted file mode 100644
index 847cb705b..000000000
--- a/src/OpenGL/libEGL/Sync.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Sync.hpp: Defines sync objects for the EGL_KHR_fence_sync extension.
-
-#ifndef LIBEGL_SYNC_H_
-#define LIBEGL_SYNC_H_
-
-#include "Context.hpp"
-
-#include <EGL/eglext.h>
-
-namespace egl
-{
-
-class FenceSync
-{
-public:
- explicit FenceSync(Context *context) : context(context)
- {
- status = EGL_UNSIGNALED_KHR;
- context->addRef();
- }
-
- ~FenceSync()
- {
- context->release();
- context = nullptr;
- }
-
- void wait() { context->finish(); signal(); }
- void signal() { status = EGL_SIGNALED_KHR; }
- bool isSignaled() const { return status == EGL_SIGNALED_KHR; }
-
-private:
- EGLint status;
- Context *context;
-};
-
-}
-
-#endif // LIBEGL_SYNC_H_
diff --git a/src/OpenGL/libEGL/Texture.hpp b/src/OpenGL/libEGL/Texture.hpp
deleted file mode 100644
index ebeb8d189..000000000
--- a/src/OpenGL/libEGL/Texture.hpp
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef egl_Texture_hpp
-#define egl_Texture_hpp
-
-#include "common/Object.hpp"
-
-namespace sw
-{
- class Resource;
-}
-
-namespace egl
-{
-class [[clang::lto_visibility_public]] Texture : public gl::NamedObject
-{
-public:
- Texture(GLuint name) : NamedObject(name) {}
-
- virtual void releaseTexImage() = 0;
- virtual sw::Resource *getResource() const = 0;
-
- virtual void sweep() = 0; // Garbage collect if no external references
-
- void release() override
- {
- int refs = dereference();
-
- if(refs > 0)
- {
- sweep();
- }
- else
- {
- delete this;
- }
- }
-};
-}
-
-#endif // egl_Texture_hpp
diff --git a/src/OpenGL/libEGL/libEGL.cpp b/src/OpenGL/libEGL/libEGL.cpp
deleted file mode 100644
index 42f6c2be8..000000000
--- a/src/OpenGL/libEGL/libEGL.cpp
+++ /dev/null
@@ -1,1622 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// libEGL.cpp: Implements the exported EGL functions.
-
-#include "Common/Version.h"
-#include "Context.hpp"
-#include "Display.h"
-#include "Surface.hpp"
-#include "Texture.hpp"
-#include "common/Image.hpp"
-#include "common/debug.h"
-#include "main.h"
-
-#if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
-#include <vndk/window.h>
-#elif defined(SWIFTSHADER_USE_X11)
-#include "Main/libX11.hpp"
-#endif
-
-#include <algorithm>
-#include <string.h>
-#include <vector>
-
-namespace egl
-{
-namespace
-{
-sw::RecursiveLock *getDisplayLock(egl::Display *display) {
- if (!display) return nullptr;
- return display->getLock();
-}
-
-bool validateDisplay(egl::Display *display)
-{
- if(display == EGL_NO_DISPLAY)
- {
- return error(EGL_BAD_DISPLAY, false);
- }
-
- if(!display->isInitialized())
- {
- return error(EGL_NOT_INITIALIZED, false);
- }
-
- return true;
-}
-
-bool validateConfig(egl::Display *display, EGLConfig config)
-{
- if(!validateDisplay(display))
- {
- return false;
- }
-
- if(!display->isValidConfig(config))
- {
- return error(EGL_BAD_CONFIG, false);
- }
-
- return true;
-}
-
-bool validateContext(egl::Display *display, egl::Context *context)
-{
- if(!validateDisplay(display))
- {
- return false;
- }
-
- if(!display->isValidContext(context))
- {
- return error(EGL_BAD_CONTEXT, false);
- }
-
- return true;
-}
-
-bool validateSurface(egl::Display *display, egl::Surface *surface)
-{
- if(!validateDisplay(display))
- {
- return false;
- }
-
- if(!display->isValidSurface(surface))
- {
- return error(EGL_BAD_SURFACE, false);
- }
-
- return true;
-}
-
-// Class to facilitate conversion from EGLint to EGLAttrib lists.
-class EGLAttribs
-{
-public:
- explicit EGLAttribs(const EGLint *attrib_list)
- {
- if(attrib_list)
- {
- while(*attrib_list != EGL_NONE)
- {
- attrib.push_back(static_cast<EGLAttrib>(*attrib_list));
- attrib_list++;
- }
- }
-
- attrib.push_back(EGL_NONE);
- }
-
- const EGLAttrib *operator&() const
- {
- return &attrib[0];
- }
-
-private:
- std::vector<EGLAttrib> attrib;
-};
-}
-
-EGLint EGLAPIENTRY GetError(void)
-{
- TRACE("()");
-
- EGLint error = egl::getCurrentError();
-
- if(error != EGL_SUCCESS)
- {
- egl::setCurrentError(EGL_SUCCESS);
- }
-
- return error;
-}
-
-EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
-{
- TRACE("(EGLNativeDisplayType display_id = %p)", display_id);
-
- if(display_id != EGL_DEFAULT_DISPLAY)
- {
- // FIXME: Check if display_id is the default display
- }
-
- #if defined(__linux__) && !defined(__ANDROID__)
- #if defined(SWIFTSHADER_USE_X11)
- if(!libX11)
- #endif // Non X11 linux is headless only
- {
- return success(HEADLESS_DISPLAY);
- }
- #endif
-
- return success(PRIMARY_DISPLAY); // We only support the default display
-}
-
-EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- TRACE("(EGLDisplay dpy = %p, EGLint *major = %p, EGLint *minor = %p)",
- dpy, major, minor);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!display)
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- if(!display->initialize())
- {
- return error(EGL_NOT_INITIALIZED, EGL_FALSE);
- }
-
- if(major) *major = 1;
- if(minor) *minor = 4;
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy)
-{
- TRACE("(EGLDisplay dpy = %p)", dpy);
-
- if(dpy == EGL_NO_DISPLAY)
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- display->terminate();
-
- return success(EGL_TRUE);
-}
-
-const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
-{
- TRACE("(EGLDisplay dpy = %p, EGLint name = %d)", dpy, name);
-
- if(dpy == EGL_NO_DISPLAY && name == EGL_EXTENSIONS)
- {
- return success(
- "EGL_KHR_client_get_all_proc_addresses "
-#if defined(__linux__) && !defined(__ANDROID__)
- "EGL_KHR_platform_gbm "
-#endif
-#if defined(SWIFTSHADER_USE_X11)
- "EGL_KHR_platform_x11 "
-#endif
- "EGL_EXT_client_extensions "
- "EGL_EXT_platform_base");
- }
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return nullptr;
- }
-
- switch(name)
- {
- case EGL_CLIENT_APIS:
- return success("OpenGL_ES");
- case EGL_EXTENSIONS:
- return success("EGL_KHR_create_context "
- "EGL_KHR_get_all_proc_addresses "
- "EGL_KHR_gl_texture_2D_image "
- "EGL_KHR_gl_texture_cubemap_image "
- "EGL_KHR_gl_renderbuffer_image "
- "EGL_KHR_fence_sync "
- "EGL_KHR_image_base "
- "EGL_KHR_surfaceless_context "
- "EGL_ANGLE_iosurface_client_buffer "
- "EGL_ANDROID_framebuffer_target "
- "EGL_ANDROID_recordable");
- case EGL_VENDOR:
- return success("Google Inc.");
- case EGL_VERSION:
- return success("1.4 SwiftShader " VERSION_STRING);
- }
-
- return error(EGL_BAD_PARAMETER, (const char*)nullptr);
-}
-
-EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig *configs = %p, "
- "EGLint config_size = %d, EGLint *num_config = %p)",
- dpy, configs, config_size, num_config);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return EGL_FALSE;
- }
-
- if(!num_config)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- const EGLint attribList[] = {EGL_NONE};
-
- if(!display->getConfigs(configs, attribList, config_size, num_config))
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- TRACE("(EGLDisplay dpy = %p, const EGLint *attrib_list = %p, "
- "EGLConfig *configs = %p, EGLint config_size = %d, EGLint *num_config = %p)",
- dpy, attrib_list, configs, config_size, num_config);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return EGL_FALSE;
- }
-
- if(!num_config)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- const EGLint attribList[] = {EGL_NONE};
-
- if(!attrib_list)
- {
- attrib_list = attribList;
- }
-
- if(!display->getConfigs(configs, attrib_list, config_size, num_config))
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLint attribute = %d, EGLint *value = %p)",
- dpy, config, attribute, value);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_FALSE;
- }
-
- if(!display->getConfigAttrib(config, attribute, value))
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_window = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, native_window, attrib_list);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_NO_SURFACE;
- }
-
- #if defined(SWIFTSHADER_USE_X11)
- native_window = (void *)(*(::Window*)native_window);
- #endif
-
- if(!display->isValidWindow((EGLNativeWindowType)native_window))
- {
- return error(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE);
- }
-
- return display->createWindowSurface((EGLNativeWindowType)native_window, config, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_window = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, native_window, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return CreatePlatformWindowSurface(dpy, config, native_window, &attribs);
-}
-
-EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativeWindowType window = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, window, attrib_list);
-
- EGLAttribs attribs(attrib_list);
-
- #if defined(SWIFTSHADER_USE_X11)
- return CreatePlatformWindowSurface(dpy, config, (void*)&window, &attribs);
- #else
- return CreatePlatformWindowSurface(dpy, config, (void*)window, &attribs);
- #endif
-}
-
-EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, const EGLint *attrib_list = %p)",
- dpy, config, attrib_list);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_NO_SURFACE;
- }
-
- return display->createPBufferSurface(config, attrib_list);
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_pixmap = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, native_pixmap, attrib_list);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_NO_SURFACE;
- }
-
- UNIMPLEMENTED(); // FIXME
-
- return success(EGL_NO_SURFACE);
-}
-
-EGLSurface EGLAPIENTRY CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, void *native_pixmap = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, native_pixmap, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return CreatePlatformPixmapSurface(dpy, config, native_pixmap, &attribs);
-}
-
-EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLNativePixmapType pixmap = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, pixmap, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return CreatePlatformPixmapSurface(dpy, config, (void*)pixmap, &attribs);
-}
-
-EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p)", dpy, surface);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- if(surface == EGL_NO_SURFACE)
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- display->destroySurface((egl::Surface*)surface);
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p, EGLint attribute = %d, EGLint *value = %p)",
- dpy, surface, attribute, value);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = (egl::Surface*)surface;
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- if(surface == EGL_NO_SURFACE)
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- switch(attribute)
- {
- case EGL_VG_ALPHA_FORMAT:
- *value = EGL_VG_ALPHA_FORMAT_NONPRE; // Default
- break;
- case EGL_VG_COLORSPACE:
- *value = EGL_VG_COLORSPACE_sRGB; // Default
- break;
- case EGL_CONFIG_ID:
- *value = eglSurface->getConfigID();
- break;
- case EGL_HEIGHT:
- *value = eglSurface->getHeight();
- break;
- case EGL_HORIZONTAL_RESOLUTION:
- *value = EGL_UNKNOWN;
- break;
- case EGL_LARGEST_PBUFFER:
- if(eglSurface->isPBufferSurface()) // For a window or pixmap surface, the contents of *value are not modified.
- {
- *value = eglSurface->getLargestPBuffer();
- }
- break;
- case EGL_MIPMAP_TEXTURE:
- if(eglSurface->isPBufferSurface()) // For a window or pixmap surface, the contents of *value are not modified.
- {
- *value = EGL_FALSE; // UNIMPLEMENTED
- }
- break;
- case EGL_MIPMAP_LEVEL:
- if(eglSurface->isPBufferSurface()) // For a window or pixmap surface, the contents of *value are not modified.
- {
- *value = eglSurface->getMipmapLevel();
- }
- break;
- case EGL_MULTISAMPLE_RESOLVE:
- *value = eglSurface->getMultisampleResolve();
- break;
- case EGL_PIXEL_ASPECT_RATIO:
- *value = eglSurface->getPixelAspectRatio();
- break;
- case EGL_RENDER_BUFFER:
- *value = eglSurface->getRenderBuffer();
- break;
- case EGL_SWAP_BEHAVIOR:
- *value = eglSurface->getSwapBehavior();
- break;
- case EGL_TEXTURE_FORMAT:
- if(eglSurface->isPBufferSurface()) // For a window or pixmap surface, the contents of *value are not modified.
- {
- *value = eglSurface->getTextureFormat();
- }
- break;
- case EGL_TEXTURE_TARGET:
- if(eglSurface->isPBufferSurface()) // For a window or pixmap surface, the contents of *value are not modified.
- {
- *value = eglSurface->getTextureTarget();
- }
- break;
- case EGL_VERTICAL_RESOLUTION:
- *value = EGL_UNKNOWN;
- break;
- case EGL_WIDTH:
- *value = eglSurface->getWidth();
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY BindAPI(EGLenum api)
-{
- TRACE("(EGLenum api = 0x%X)", api);
-
- switch(api)
- {
- case EGL_OPENGL_API:
- case EGL_OPENVG_API:
- return error(EGL_BAD_PARAMETER, EGL_FALSE); // Not supported by this implementation
- case EGL_OPENGL_ES_API:
- break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- egl::setCurrentAPI(api);
-
- return success(EGL_TRUE);
-}
-
-EGLenum EGLAPIENTRY QueryAPI(void)
-{
- TRACE("()");
-
- EGLenum API = egl::getCurrentAPI();
-
- return success(API);
-}
-
-EGLBoolean EGLAPIENTRY WaitClient(void)
-{
- TRACE("()");
-
- // eglWaitClient is ignored if there is no current EGL rendering context for the current rendering API.
- egl::Context *context = egl::getCurrentContext();
-
- if(context)
- {
- context->finish();
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY ReleaseThread(void)
-{
- TRACE("()");
-
- detachThread();
-
- return EGL_TRUE; // success() is not called here because it would re-allocate thread-local storage.
-}
-
-EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = %p, "
- "EGLConfig config = %p, const EGLint *attrib_list = %p)",
- dpy, buftype, buffer, config, attrib_list);
-
- switch(buftype)
- {
- case EGL_IOSURFACE_ANGLE:
- {
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_NO_SURFACE;
- }
-
- return display->createPBufferSurface(config, attrib_list, buffer);
- }
- case EGL_OPENVG_IMAGE:
- UNIMPLEMENTED();
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- };
-}
-
-EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p, EGLint attribute = %d, EGLint value = %d)",
- dpy, surface, attribute, value);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- switch(attribute)
- {
- case EGL_MIPMAP_LEVEL:
- eglSurface->setMipmapLevel(value);
- break;
- case EGL_MULTISAMPLE_RESOLVE:
- switch(value)
- {
- case EGL_MULTISAMPLE_RESOLVE_DEFAULT:
- break;
- case EGL_MULTISAMPLE_RESOLVE_BOX:
- if(!(eglSurface->getSurfaceType() & EGL_MULTISAMPLE_RESOLVE_BOX_BIT))
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
- break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
- eglSurface->setMultisampleResolve(value);
- break;
- case EGL_SWAP_BEHAVIOR:
- switch(value)
- {
- case EGL_BUFFER_DESTROYED:
- break;
- case EGL_BUFFER_PRESERVED:
- if(!(eglSurface->getSurfaceType() & EGL_SWAP_BEHAVIOR_PRESERVED_BIT))
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
- break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
- eglSurface->setSwapBehavior(value);
- break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p, EGLint buffer = %d)", dpy, surface, buffer);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- if(buffer != EGL_BACK_BUFFER)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- if(surface == EGL_NO_SURFACE || eglSurface->isWindowSurface())
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- if(eglSurface->getBoundTexture())
- {
- return error(EGL_BAD_ACCESS, EGL_FALSE);
- }
-
- if(eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
-
- egl::Context *context = egl::getCurrentContext();
-
- if(context)
- {
- context->bindTexImage(eglSurface);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p, EGLint buffer = %d)", dpy, surface, buffer);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- if(buffer != EGL_BACK_BUFFER)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- if(surface == EGL_NO_SURFACE || eglSurface->isWindowSurface())
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- if(eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
-
- egl::Texture *texture = eglSurface->getBoundTexture();
-
- if(texture)
- {
- texture->releaseTexImage();
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
-{
- TRACE("(EGLDisplay dpy = %p, EGLint interval = %d)", dpy, interval);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *context = egl::getCurrentContext();
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateContext(display, context))
- {
- return EGL_FALSE;
- }
-
- egl::Surface *draw_surface = static_cast<egl::Surface*>(egl::getCurrentDrawSurface());
-
- if(!draw_surface)
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- draw_surface->setSwapInterval(interval);
-
- return success(EGL_TRUE);
-}
-
-EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
- ASSERT(false && "Legacy SwiftShader OpenGL ES is deprecated. Use SwANGLE instead.");
-
- TRACE("(EGLDisplay dpy = %p, EGLConfig config = %p, EGLContext share_context = %p, "
- "const EGLint *attrib_list = %p)", dpy, config, share_context, attrib_list);
-
- EGLint majorVersion = 1;
- EGLint minorVersion = 0;
-
- if(attrib_list)
- {
- for(const EGLint* attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
- {
- switch(attribute[0])
- {
- case EGL_CONTEXT_MAJOR_VERSION_KHR: // This token is an alias for EGL_CONTEXT_CLIENT_VERSION
- majorVersion = attribute[1];
- break;
- case EGL_CONTEXT_MINOR_VERSION_KHR:
- minorVersion = attribute[1];
- break;
- case EGL_CONTEXT_FLAGS_KHR:
- switch(attribute[1])
- {
- case EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR:
- // According to the EGL_KHR_create_context spec:
- // "Khronos is still defining the expected and required features of debug contexts, so
- // implementations are currently free to implement "debug contexts" with little or no debug
- // functionality. However, OpenGL and OpenGL ES implementations supporting the GL_KHR_debug
- // extension should enable it when this bit is set."
- break;
- case EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR:
- case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR:
- // These bits are for OpenGL contexts only, not OpenGL ES contexts
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- }
- break;
- case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
- switch(attribute[1])
- {
- case EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR:
- case EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR:
- // These bits are for OpenGL contexts only, not OpenGL ES contexts
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- }
- break;
- case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
- switch(attribute[1])
- {
- case EGL_NO_RESET_NOTIFICATION_KHR:
- case EGL_LOSE_CONTEXT_ON_RESET_KHR:
- // These bits are for OpenGL contexts only, not OpenGL ES contexts
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- }
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_CONTEXT);
- }
- }
- }
-
- switch(majorVersion)
- {
- case 1:
- if(minorVersion != 0 && minorVersion != 1)
- {
- // 1.X: Only OpenGL ES 1.0 and 1.1 contexts are supported
- return error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
- break;
- case 2:
- case 3:
- if(minorVersion != 0)
- {
- // 2.X and 3.X: Only OpenGL ES 2.0 and 3.0 contexts are currently supported
- return error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
- break;
- default:
- return error(EGL_BAD_MATCH, EGL_NO_CONTEXT);
- }
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *shareContext = static_cast<egl::Context*>(share_context);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateConfig(display, config))
- {
- return EGL_NO_CONTEXT;
- }
-
- // Allow sharing between different context versions >= 2.0, but isolate 1.x
- // contexts from 2.0+. Strict matching between context versions >= 2.0 is
- // confusing for apps to navigate because of version promotion.
- if(shareContext && ((shareContext->getClientVersion() >= 2) ^ (majorVersion >= 2)))
- {
- return error(EGL_BAD_CONTEXT, EGL_NO_CONTEXT);
- }
-
- return display->createContext(config, shareContext, majorVersion);
-}
-
-EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p)", dpy, ctx);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *context = static_cast<egl::Context*>(ctx);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateContext(display, context))
- {
- return EGL_FALSE;
- }
-
- if(ctx == EGL_NO_CONTEXT)
- {
- return error(EGL_BAD_CONTEXT, EGL_FALSE);
- }
-
- display->destroyContext(context);
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface draw = %p, EGLSurface read = %p, EGLContext ctx = %p)",
- dpy, draw, read, ctx);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *context = static_cast<egl::Context*>(ctx);
- egl::Surface *drawSurface = static_cast<egl::Surface*>(draw);
- egl::Surface *readSurface = static_cast<egl::Surface*>(read);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(ctx != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE)
- {
- if(!validateDisplay(display))
- {
- return EGL_FALSE;
- }
- }
-
- if(ctx == EGL_NO_CONTEXT && (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
-
- if(ctx != EGL_NO_CONTEXT && !validateContext(display, context))
- {
- return EGL_FALSE;
- }
-
- if((draw != EGL_NO_SURFACE && !validateSurface(display, drawSurface)) ||
- (read != EGL_NO_SURFACE && !validateSurface(display, readSurface)))
- {
- return EGL_FALSE;
- }
-
- if((draw != EGL_NO_SURFACE) ^ (read != EGL_NO_SURFACE))
- {
- return error(EGL_BAD_MATCH, EGL_FALSE);
- }
-
- if(draw != read)
- {
- UNIMPLEMENTED(); // FIXME
- }
-
- egl::setCurrentDrawSurface(drawSurface);
- egl::setCurrentReadSurface(readSurface);
- egl::setCurrentContext(context);
-
- if(context)
- {
- context->makeCurrent(drawSurface);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLContext EGLAPIENTRY GetCurrentContext(void)
-{
- TRACE("()");
-
- EGLContext context = egl::getCurrentContext();
-
- return success(context);
-}
-
-EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw)
-{
- TRACE("(EGLint readdraw = %d)", readdraw);
-
- if(readdraw == EGL_READ)
- {
- EGLSurface read = egl::getCurrentReadSurface();
- return success(read);
- }
- else if(readdraw == EGL_DRAW)
- {
- EGLSurface draw = egl::getCurrentDrawSurface();
- return success(draw);
- }
- else
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_SURFACE);
- }
-}
-
-EGLDisplay EGLAPIENTRY GetCurrentDisplay(void)
-{
- TRACE("()");
-
- egl::Context *context = egl::getCurrentContext();
-
- if(!context)
- {
- return success(EGL_NO_DISPLAY);
- }
-
- egl::Display *display = context->getDisplay();
-
- if(!display)
- {
- return error(EGL_BAD_ACCESS, EGL_NO_DISPLAY);
- }
-
- return success(display->getEGLDisplay());
-}
-
-EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLint attribute = %d, EGLint *value = %p)",
- dpy, ctx, attribute, value);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *context = static_cast<egl::Context*>(ctx);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateContext(display, context))
- {
- return EGL_FALSE;
- }
-
- switch(attribute)
- {
- case EGL_CONFIG_ID:
- *value = context->getConfigID();
- break;
- case EGL_CONTEXT_CLIENT_TYPE:
- *value = egl::getCurrentAPI();
- break;
- case EGL_CONTEXT_CLIENT_VERSION:
- *value = context->getClientVersion();
- break;
- case EGL_RENDER_BUFFER:
- *value = EGL_BACK_BUFFER;
- break;
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY WaitGL(void)
-{
- TRACE("()");
-
- // glWaitGL is ignored if there is no current EGL rendering context for OpenGL ES.
- egl::Context *context = egl::getCurrentContext();
-
- if(context)
- {
- context->finish();
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY WaitNative(EGLint engine)
-{
- TRACE("(EGLint engine = %d)", engine);
-
- if(engine != EGL_CORE_NATIVE_ENGINE)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- // eglWaitNative is ignored if there is no current EGL rendering context.
- egl::Context *context = egl::getCurrentContext();
-
- if(context)
- {
- #if defined(SWIFTSHADER_USE_X11)
- egl::Display *display = context->getDisplay();
-
- if(!display)
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- libX11->XSync((::Display*)display->getNativeDisplay(), False);
- #else
- UNIMPLEMENTED();
- #endif
- }
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p)", dpy, surface);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = (egl::Surface*)surface;
-
- {
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
- }
-
- if(surface == EGL_NO_SURFACE)
- {
- return error(EGL_BAD_SURFACE, EGL_FALSE);
- }
-
- eglSurface->swap();
-
- return success(EGL_TRUE);
-}
-
-EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSurface surface = %p, EGLNativePixmapType target = %p)", dpy, surface, target);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Surface *eglSurface = static_cast<egl::Surface*>(surface);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateSurface(display, eglSurface))
- {
- return EGL_FALSE;
- }
-
- UNIMPLEMENTED(); // FIXME
-
- return success(EGL_FALSE);
-}
-
-EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLenum target = 0x%X, buffer = %p, const EGLAttrib *attrib_list = %p)", dpy, ctx, target, buffer, attrib_list);
-
- egl::Display *display = egl::Display::get(dpy);
- egl::Context *context = static_cast<egl::Context*>(ctx);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_NO_IMAGE_KHR);
- }
-
- if(context != EGL_NO_CONTEXT && !display->isValidContext(context))
- {
- return error(EGL_BAD_CONTEXT, EGL_NO_IMAGE_KHR);
- }
-
- EGLenum imagePreserved = EGL_FALSE;
- (void)imagePreserved; // currently unused
-
- GLuint textureLevel = 0;
- if(attrib_list)
- {
- for(const EGLAttrib *attribute = attrib_list; attribute[0] != EGL_NONE; attribute += 2)
- {
- if(attribute[0] == EGL_IMAGE_PRESERVED_KHR)
- {
- imagePreserved = static_cast<EGLenum>(attribute[1]);
- }
- else if(attribute[0] == EGL_GL_TEXTURE_LEVEL_KHR)
- {
- textureLevel = static_cast<GLuint>(attribute[1]);
- }
- else
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_IMAGE_KHR);
- }
- }
- }
-
- #if defined(__ANDROID__) && !defined(ANDROID_NDK_BUILD)
- if(target == EGL_NATIVE_BUFFER_ANDROID)
- {
- ANativeWindowBuffer *nativeBuffer = reinterpret_cast<ANativeWindowBuffer*>(buffer);
-
- if(!nativeBuffer || GLPixelFormatFromAndroid(nativeBuffer->format) == GL_NONE)
- {
- ERR("%s badness unsupported HAL format=%x", __FUNCTION__, nativeBuffer ? nativeBuffer->format : 0);
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_IMAGE_KHR);
- }
-
- Image *image = new AndroidNativeImage(nativeBuffer);
- EGLImageKHR eglImage = display->createSharedImage(image);
-
- return success(eglImage);
- }
- #endif
-
- GLuint name = static_cast<GLuint>(reinterpret_cast<uintptr_t>(buffer));
-
- if(name == 0)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- EGLenum validationResult = context->validateSharedImage(target, name, textureLevel);
-
- if(validationResult != EGL_SUCCESS)
- {
- return error(validationResult, EGL_NO_IMAGE_KHR);
- }
-
- Image *image = context->createSharedImage(target, name, textureLevel);
-
- if(!image)
- {
- return error(EGL_BAD_MATCH, EGL_NO_IMAGE_KHR);
- }
-
- if(image->getDepth() > 1)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR);
- }
-
- EGLImage eglImage = display->createSharedImage(image);
-
- return success(eglImage);
-}
-
-EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLContext ctx = %p, EGLenum target = 0x%X, buffer = %p, const EGLint attrib_list = %p)", dpy, ctx, target, buffer, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return CreateImage(dpy, ctx, target, buffer, &attribs);
-}
-
-EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- TRACE("(EGLDisplay dpy = %p, EGLImageKHR image = %p)", dpy, image);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- if(!display->destroySharedImage(image))
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- return success(EGL_TRUE);
-}
-
-EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
-{
- TRACE("(EGLenum platform = 0x%X, void *native_display = %p, const EGLAttrib *attrib_list = %p)", platform, native_display, attrib_list);
-
- #if defined(__linux__) && !defined(__ANDROID__)
- switch(platform)
- {
- #if defined(SWIFTSHADER_USE_X11)
- case EGL_PLATFORM_X11_EXT: break;
- #endif
- case EGL_PLATFORM_GBM_KHR: break;
- default:
- return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
- }
-
- if(platform == EGL_PLATFORM_GBM_KHR)
- {
- if(native_display != (void*)EGL_DEFAULT_DISPLAY)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY); // Unimplemented
- }
-
- if(attrib_list && attrib_list[0] != EGL_NONE)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented
- }
-
- return success(HEADLESS_DISPLAY);
- }
- #if defined(SWIFTSHADER_USE_X11)
- else if(platform == EGL_PLATFORM_X11_EXT)
- {
- if(!libX11)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
- }
-
- if(native_display != (void*)EGL_DEFAULT_DISPLAY)
- {
- return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY); // Unimplemented
- }
-
- if(attrib_list && attrib_list[0] != EGL_NONE)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_DISPLAY); // Unimplemented
- }
- }
- #endif
-
- return success(PRIMARY_DISPLAY); // We only support the default display
- #else
- return error(EGL_BAD_PARAMETER, EGL_NO_DISPLAY);
- #endif
-}
-
-EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
-{
- TRACE("(EGLenum platform = 0x%X, void *native_display = %p, const EGLint *attrib_list = %p)", platform, native_display, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return GetPlatformDisplay(platform, native_display, &attribs);
-}
-
-EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLunum type = %x, EGLAttrib *attrib_list=%p)", dpy, type, attrib_list);
-
- egl::Display *display = egl::Display::get(dpy);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_NO_SYNC_KHR);
- }
-
- if(type != EGL_SYNC_FENCE_KHR)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SYNC_KHR);
- }
-
- if(attrib_list && attrib_list[0] != EGL_NONE)
- {
- return error(EGL_BAD_ATTRIBUTE, EGL_NO_SYNC_KHR);
- }
-
- egl::Context *context = egl::getCurrentContext();
-
- if(!validateContext(display, context))
- {
- return error(EGL_BAD_MATCH, EGL_NO_SYNC_KHR);
- }
-
- EGLSyncKHR sync = display->createSync(context);
-
- return success(sync);
-}
-
-EGLSyncKHR EGLAPIENTRY CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
-{
- TRACE("(EGLDisplay dpy = %p, EGLunum type = %x, EGLint *attrib_list=%p)", dpy, type, attrib_list);
-
- EGLAttribs attribs(attrib_list);
- return CreateSync(dpy, type, &attribs);
-}
-
-EGLBoolean EGLAPIENTRY DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p)", dpy, sync);
-
- egl::Display *display = egl::Display::get(dpy);
- FenceSync *eglSync = static_cast<FenceSync*>(sync);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- if(!display->isValidSync(eglSync))
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- display->destroySync(eglSync);
-
- return success(EGL_TRUE);
-}
-
-EGLint EGLAPIENTRY ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p, EGLint flags = %x, EGLTimeKHR value = %llx)", dpy, sync, flags, timeout);
-
- egl::Display *display = egl::Display::get(dpy);
- FenceSync *eglSync = static_cast<FenceSync*>(sync);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- if(!display->isValidSync(eglSync))
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- (void)flags;
- (void)timeout;
-
- if(!eglSync->isSignaled())
- {
- eglSync->wait();
- }
-
- return success(EGL_CONDITION_SATISFIED_KHR);
-}
-
-EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value)
-{
- TRACE("(EGLDisplay dpy = %p, EGLSyncKHR sync = %p, EGLint attribute = %x, EGLAttrib *value = %p)", dpy, sync, attribute, value);
-
- egl::Display *display = egl::Display::get(dpy);
- FenceSync *eglSync = static_cast<FenceSync*>(sync);
-
- RecursiveLockGuard lock(egl::getDisplayLock(display));
-
- if(!validateDisplay(display))
- {
- return error(EGL_BAD_DISPLAY, EGL_FALSE);
- }
-
- if(!display->isValidSync(eglSync))
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- if(!value)
- {
- return error(EGL_BAD_PARAMETER, EGL_FALSE);
- }
-
- switch(attribute)
- {
- case EGL_SYNC_TYPE_KHR:
- *value = EGL_SYNC_FENCE_KHR;
- return success(EGL_TRUE);
- case EGL_SYNC_STATUS_KHR:
- eglSync->wait(); // TODO: Don't block. Just poll based on sw::Query.
- *value = eglSync->isSignaled() ? EGL_SIGNALED_KHR : EGL_UNSIGNALED_KHR;
- return success(EGL_TRUE);
- case EGL_SYNC_CONDITION_KHR:
- *value = EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR;
- return success(EGL_TRUE);
- default:
- return error(EGL_BAD_ATTRIBUTE, EGL_FALSE);
- }
-}
-
-EGLBoolean EGLAPIENTRY GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
-{
- EGLAttrib attrib_value;
- EGLBoolean result = GetSyncAttrib(dpy, sync, attribute, &attrib_value);
- *value = static_cast<EGLint>(attrib_value);
- return result;
-}
-
-__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname)
-{
- TRACE("(const char *procname = \"%s\")", procname);
-
- struct Function
- {
- const char *name;
- __eglMustCastToProperFunctionPointerType address;
- };
-
- struct CompareFunctor
- {
- bool operator()(const Function &a, const Function &b) const
- {
- return strcmp(a.name, b.name) < 0;
- }
- };
-
- // This array must be kept sorted with respect to strcmp(), so that binary search works correctly.
- // The Unix command "LC_COLLATE=C sort" will generate the correct order.
- static const Function eglFunctions[] =
- {
- #define FUNCTION(name) {#name, (__eglMustCastToProperFunctionPointerType)name}
-
- FUNCTION(eglBindAPI),
- FUNCTION(eglBindTexImage),
- FUNCTION(eglChooseConfig),
- FUNCTION(eglClientWaitSync),
- FUNCTION(eglClientWaitSyncKHR),
- FUNCTION(eglCopyBuffers),
- FUNCTION(eglCreateContext),
- FUNCTION(eglCreateImage),
- FUNCTION(eglCreateImageKHR),
- FUNCTION(eglCreatePbufferFromClientBuffer),
- FUNCTION(eglCreatePbufferSurface),
- FUNCTION(eglCreatePixmapSurface),
- FUNCTION(eglCreatePlatformPixmapSurface),
- FUNCTION(eglCreatePlatformPixmapSurfaceEXT),
- FUNCTION(eglCreatePlatformWindowSurface),
- FUNCTION(eglCreatePlatformWindowSurfaceEXT),
- FUNCTION(eglCreateSync),
- FUNCTION(eglCreateSyncKHR),
- FUNCTION(eglCreateWindowSurface),
- FUNCTION(eglDestroyContext),
- FUNCTION(eglDestroyImage),
- FUNCTION(eglDestroyImageKHR),
- FUNCTION(eglDestroySurface),
- FUNCTION(eglDestroySync),
- FUNCTION(eglDestroySyncKHR),
- FUNCTION(eglGetConfigAttrib),
- FUNCTION(eglGetConfigs),
- FUNCTION(eglGetCurrentContext),
- FUNCTION(eglGetCurrentDisplay),
- FUNCTION(eglGetCurrentSurface),
- FUNCTION(eglGetDisplay),
- FUNCTION(eglGetError),
- FUNCTION(eglGetPlatformDisplay),
- FUNCTION(eglGetPlatformDisplayEXT),
- FUNCTION(eglGetProcAddress),
- FUNCTION(eglGetSyncAttrib),
- FUNCTION(eglGetSyncAttribKHR),
- FUNCTION(eglInitialize),
- FUNCTION(eglMakeCurrent),
- FUNCTION(eglQueryAPI),
- FUNCTION(eglQueryContext),
- FUNCTION(eglQueryString),
- FUNCTION(eglQuerySurface),
- FUNCTION(eglReleaseTexImage),
- FUNCTION(eglReleaseThread),
- FUNCTION(eglSurfaceAttrib),
- FUNCTION(eglSwapBuffers),
- FUNCTION(eglSwapInterval),
- FUNCTION(eglTerminate),
- FUNCTION(eglWaitClient),
- FUNCTION(eglWaitGL),
- FUNCTION(eglWaitNative),
- FUNCTION(eglWaitSync),
- FUNCTION(eglWaitSyncKHR),
-
- #undef FUNCTION
- };
-
- static const size_t numFunctions = sizeof eglFunctions / sizeof(Function);
- static const Function *const eglFunctionsEnd = eglFunctions + numFunctions;
-
- Function needle;
- needle.name = procname;
-
- if(procname && strncmp("egl", procname, 3) == 0)
- {
- const Function *result = std::lower_bound(eglFunctions, eglFunctionsEnd, needle, CompareFunctor());
- if (result != eglFunctionsEnd && strcmp(procname, result->name) == 0)
- {
- return success((__eglMustCastToProperFunctionPointerType)result->address);
- }
- }
-
- if(libGLESv2)
- {
- __eglMustCastToProperFunctionPointerType proc = libGLESv2->es2GetProcAddress(procname);
- if(proc) return success(proc);
- }
-
- return success((__eglMustCastToProperFunctionPointerType)NULL);
-}
-}
diff --git a/src/OpenGL/libEGL/libEGL.def b/src/OpenGL/libEGL/libEGL.def
deleted file mode 100644
index 525099eac..000000000
--- a/src/OpenGL/libEGL/libEGL.def
+++ /dev/null
@@ -1,49 +0,0 @@
-LIBRARY libEGL
-EXPORTS
- eglBindAPI @14
- eglBindTexImage @20
- eglChooseConfig @7
- eglCopyBuffers @33
- eglCreateContext @23
- eglCreatePbufferFromClientBuffer @18
- eglCreatePbufferSurface @10
- eglCreatePixmapSurface @11
- eglCreateWindowSurface @9
- eglDestroyContext @24
- eglDestroySurface @12
- eglGetConfigAttrib @8
- eglGetConfigs @6
- eglGetCurrentContext @26
- eglGetCurrentDisplay @28
- eglGetCurrentSurface @27
- eglGetDisplay @2
- eglGetError @1
- eglGetProcAddress @34
- eglInitialize @3
- eglMakeCurrent @25
- eglQueryAPI @15
- eglQueryContext @29
- eglQueryString @5
- eglQuerySurface @13
- eglReleaseTexImage @21
- eglReleaseThread @17
- eglSurfaceAttrib @19
- eglSwapBuffers @32
- eglSwapInterval @22
- eglTerminate @4
- eglWaitClient @16
- eglWaitGL @30
- eglWaitNative @31
-
- ; Extensions
- eglCreateImageKHR
- eglDestroyImageKHR
- eglGetPlatformDisplayEXT
- eglCreatePlatformWindowSurfaceEXT
- eglCreatePlatformPixmapSurfaceEXT
- eglCreateSyncKHR
- eglDestroySyncKHR
- eglClientWaitSyncKHR
- eglGetSyncAttribKHR
-
- libEGL_swiftshader
diff --git a/src/OpenGL/libEGL/libEGL.hpp b/src/OpenGL/libEGL/libEGL.hpp
deleted file mode 100644
index 71a627a8c..000000000
--- a/src/OpenGL/libEGL/libEGL.hpp
+++ /dev/null
@@ -1,141 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef libEGL_hpp
-#define libEGL_hpp
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-#include "Common/SharedLibrary.hpp"
-
-class LibEGLexports
-{
-public:
- LibEGLexports();
-
- EGLint (EGLAPIENTRY* eglGetError)(void);
- EGLDisplay (EGLAPIENTRY* eglGetDisplay)(EGLNativeDisplayType display_id);
- EGLBoolean (EGLAPIENTRY* eglInitialize)(EGLDisplay dpy, EGLint *major, EGLint *minor);
- EGLBoolean (EGLAPIENTRY* eglTerminate)(EGLDisplay dpy);
- const char *(EGLAPIENTRY* eglQueryString)(EGLDisplay dpy, EGLint name);
- EGLBoolean (EGLAPIENTRY* eglGetConfigs)(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
- EGLBoolean (EGLAPIENTRY* eglChooseConfig)(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
- EGLBoolean (EGLAPIENTRY* eglGetConfigAttrib)(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
- EGLSurface (EGLAPIENTRY* eglCreateWindowSurface)(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list);
- EGLSurface (EGLAPIENTRY* eglCreatePbufferSurface)(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
- EGLSurface (EGLAPIENTRY* eglCreatePixmapSurface)(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY* eglDestroySurface)(EGLDisplay dpy, EGLSurface surface);
- EGLBoolean (EGLAPIENTRY* eglQuerySurface)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
- EGLBoolean (EGLAPIENTRY* eglBindAPI)(EGLenum api);
- EGLenum (EGLAPIENTRY* eglQueryAPI)(void);
- EGLBoolean (EGLAPIENTRY* eglWaitClient)(void);
- EGLBoolean (EGLAPIENTRY* eglReleaseThread)(void);
- EGLSurface (EGLAPIENTRY* eglCreatePbufferFromClientBuffer)(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY* eglSurfaceAttrib)(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
- EGLBoolean (EGLAPIENTRY* eglBindTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
- EGLBoolean (EGLAPIENTRY* eglReleaseTexImage)(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
- EGLBoolean (EGLAPIENTRY* eglSwapInterval)(EGLDisplay dpy, EGLint interval);
- EGLContext (EGLAPIENTRY* eglCreateContext)(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY* eglDestroyContext)(EGLDisplay dpy, EGLContext ctx);
- EGLBoolean (EGLAPIENTRY* eglMakeCurrent)(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
- EGLContext (EGLAPIENTRY* eglGetCurrentContext)(void);
- EGLSurface (EGLAPIENTRY* eglGetCurrentSurface)(EGLint readdraw);
- EGLDisplay (EGLAPIENTRY* eglGetCurrentDisplay)(void);
- EGLBoolean (EGLAPIENTRY* eglQueryContext)(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
- EGLBoolean (EGLAPIENTRY* eglWaitGL)(void);
- EGLBoolean (EGLAPIENTRY* eglWaitNative)(EGLint engine);
- EGLBoolean (EGLAPIENTRY* eglSwapBuffers)(EGLDisplay dpy, EGLSurface surface);
- EGLBoolean (EGLAPIENTRY* eglCopyBuffers)(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
- EGLImageKHR (EGLAPIENTRY* eglCreateImageKHR)(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY* eglDestroyImageKHR)(EGLDisplay dpy, EGLImageKHR image);
- __eglMustCastToProperFunctionPointerType (EGLAPIENTRY* eglGetProcAddress)(const char*);
- EGLSyncKHR (EGLAPIENTRY* eglCreateSyncKHR)(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
- EGLBoolean (EGLAPIENTRY* eglDestroySyncKHR)(EGLDisplay dpy, EGLSyncKHR sync);
- EGLint (EGLAPIENTRY* eglClientWaitSyncKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
- EGLBoolean (EGLAPIENTRY* eglGetSyncAttribKHR)(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-
- // Functions that don't change the error code, for use by client APIs
- egl::Context *(*clientGetCurrentContext)();
-};
-
-class LibEGL
-{
-public:
- LibEGL()
- {
- }
-
- ~LibEGL()
- {
- freeLibrary(libEGL);
- }
-
- LibEGLexports *operator->()
- {
- return loadExports();
- }
-
-private:
- LibEGLexports *loadExports()
- {
- if(!loadLibraryAttempted && !libEGL)
- {
- #if defined(_WIN32)
- #if defined(__LP64__)
- const char *libEGL_lib[] = {"libswiftshader_libEGL.dll", "libEGL.dll", "lib64EGL_translator.dll", "libEGL_deprecated.dll"};
- #else
- const char *libEGL_lib[] = {"libswiftshader_libEGL.dll", "libEGL.dll", "libEGL_translator.dll", "libEGL_deprecated.dll"};
- #endif
- #elif defined(__ANDROID__)
- const char *libEGL_lib[] = {"libEGL_swiftshader.so", "libEGL_swiftshader.so"};
- #elif defined(__linux__)
- #if defined(__LP64__)
- const char *libEGL_lib[] = {"lib64EGL_translator.so", "libEGL.so.1", "libEGL.so", "libEGL_deprecated.so.1", "libEGL_deprecated.so"};
- #else
- const char *libEGL_lib[] = {"libEGL_translator.so", "libEGL.so.1", "libEGL.so", "libEGL_deprecated.so.1", "libEGL_deprecated.so"};
- #endif
- #elif defined(__APPLE__)
- #if defined(__LP64__)
- const char *libEGL_lib[] = {"libswiftshader_libEGL.dylib", "lib64EGL_translator.dylib", "libEGL.so", "libEGL.dylib", "libEGL_deprecated.dylib"};
- #else
- const char *libEGL_lib[] = {"libswiftshader_libEGL.dylib", "libEGL_translator.dylib", "libEGL.so", "libEGL_deprecated.dylib"};
- #endif
- #elif defined(__Fuchsia__)
- const char *libEGL_lib[] = {"libswiftshader_libEGL.so", "libEGL.so", "libEGL_deprecated.so"};
- #else
- #error "libEGL::loadExports unimplemented for this platform"
- #endif
-
- std::string directory = getModuleDirectory();
- libEGL = loadLibrary(directory, libEGL_lib, "libEGL_swiftshader");
-
- if(libEGL)
- {
- auto libEGL_swiftshader = (LibEGLexports *(*)())getProcAddress(libEGL, "libEGL_swiftshader");
- libEGLexports = libEGL_swiftshader();
- }
-
- loadLibraryAttempted = true;
- }
-
- return libEGLexports;
- }
-
- void *libEGL = nullptr;
- LibEGLexports *libEGLexports = nullptr;
- bool loadLibraryAttempted = false;
-};
-
-#endif // libEGL_hpp
diff --git a/src/OpenGL/libEGL/libEGL.rc b/src/OpenGL/libEGL/libEGL.rc
deleted file mode 100644
index 6814ece42..000000000
--- a/src/OpenGL/libEGL/libEGL.rc
+++ /dev/null
@@ -1,139 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include "../../Common/Version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (United States) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "#include ""../Common/Version.h""\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- #ifdef WIN64
- VALUE "FileDescription", "SwiftShader libEGL 64-bit Dynamic Link Library"
- #else
- VALUE "FileDescription", "SwiftShader libEGL 32-bit Dynamic Link Library"
- #endif
- VALUE "FileVersion", VERSION_STRING
- VALUE "InternalName", "libEGL"
- VALUE "LegalCopyright", "Copyright (C) 2016 Google Inc."
- VALUE "OriginalFilename", "libEGL.dll"
- VALUE "PrivateBuild", VERSION_STRING
- VALUE "ProductName", "SwiftShader libEGL Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Dialog
-//
-
-IDD_DIALOG1 DIALOGEX 0, 0, 129, 47
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Waiting for debugger"
-FONT 8, "MS Shell Dlg", 400, 0, 0x1
-BEGIN
- PUSHBUTTON "Cancel",IDCANCEL,72,26,50,14
- LTEXT "Attach a debugger or ESC to cancel",IDC_STATIC,7,7,115,8
-END
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// DESIGNINFO
-//
-
-#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO
-BEGIN
- IDD_DIALOG1, DIALOG
- BEGIN
- LEFTMARGIN, 7
- RIGHTMARGIN, 122
- TOPMARGIN, 7
- BOTTOMMARGIN, 40
- END
-END
-#endif // APSTUDIO_INVOKED
-
-#endif // English (United States) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
-
diff --git a/src/OpenGL/libEGL/libEGL_deprecated.def b/src/OpenGL/libEGL/libEGL_deprecated.def
deleted file mode 100644
index 602a9de1d..000000000
--- a/src/OpenGL/libEGL/libEGL_deprecated.def
+++ /dev/null
@@ -1,49 +0,0 @@
-LIBRARY libEGL_deprecated
-EXPORTS
- eglBindAPI @14
- eglBindTexImage @20
- eglChooseConfig @7
- eglCopyBuffers @33
- eglCreateContext @23
- eglCreatePbufferFromClientBuffer @18
- eglCreatePbufferSurface @10
- eglCreatePixmapSurface @11
- eglCreateWindowSurface @9
- eglDestroyContext @24
- eglDestroySurface @12
- eglGetConfigAttrib @8
- eglGetConfigs @6
- eglGetCurrentContext @26
- eglGetCurrentDisplay @28
- eglGetCurrentSurface @27
- eglGetDisplay @2
- eglGetError @1
- eglGetProcAddress @34
- eglInitialize @3
- eglMakeCurrent @25
- eglQueryAPI @15
- eglQueryContext @29
- eglQueryString @5
- eglQuerySurface @13
- eglReleaseTexImage @21
- eglReleaseThread @17
- eglSurfaceAttrib @19
- eglSwapBuffers @32
- eglSwapInterval @22
- eglTerminate @4
- eglWaitClient @16
- eglWaitGL @30
- eglWaitNative @31
-
- ; Extensions
- eglCreateImageKHR
- eglDestroyImageKHR
- eglGetPlatformDisplayEXT
- eglCreatePlatformWindowSurfaceEXT
- eglCreatePlatformPixmapSurfaceEXT
- eglCreateSyncKHR
- eglDestroySyncKHR
- eglClientWaitSyncKHR
- eglGetSyncAttribKHR
-
- libEGL_swiftshader
diff --git a/src/OpenGL/libEGL/libEGL_deprecated.exports b/src/OpenGL/libEGL/libEGL_deprecated.exports
deleted file mode 100644
index 982432660..000000000
--- a/src/OpenGL/libEGL/libEGL_deprecated.exports
+++ /dev/null
@@ -1,64 +0,0 @@
-# EGL core functions
-_eglBindAPI
-_eglBindTexImage
-_eglChooseConfig
-_eglClientWaitSync
-_eglCopyBuffers
-_eglCreateContext
-_eglCreateImage
-_eglCreatePbufferFromClientBuffer
-_eglCreatePbufferSurface
-_eglCreatePixmapSurface
-_eglCreatePlatformPixmapSurface
-_eglCreatePlatformWindowSurface
-_eglCreateSync
-_eglCreateWindowSurface
-_eglDestroyContext
-_eglDestroyImage
-_eglDestroySurface
-_eglDestroySync
-_eglGetConfigAttrib
-_eglGetConfigs
-_eglGetCurrentContext
-_eglGetCurrentDisplay
-_eglGetCurrentSurface
-_eglGetDisplay
-_eglGetError
-_eglGetPlatformDisplay
-_eglGetProcAddress
-_eglGetSyncAttrib
-_eglInitialize
-_eglMakeCurrent
-_eglQueryAPI
-_eglQueryContext
-_eglQueryString
-_eglQuerySurface
-_eglReleaseTexImage
-_eglReleaseThread
-_eglSurfaceAttrib
-_eglSwapBuffers
-_eglSwapInterval
-_eglTerminate
-_eglWaitClient
-_eglWaitGL
-_eglWaitNative
-_eglWaitSync
-
-# Extensions
-_eglCreateImageKHR
-_eglDestroyImageKHR
-_eglGetPlatformDisplayEXT
-_eglCreatePlatformWindowSurfaceEXT
-_eglCreatePlatformPixmapSurfaceEXT
-_eglCreateSyncKHR
-_eglDestroySyncKHR
-_eglClientWaitSyncKHR
-_eglGetSyncAttribKHR
-
-# Table of function pointers to disambiguate between libraries
-_libEGL_swiftshader
-
-# Type-strings and type-infos required by sanitizers
-_ZTS*
-_ZTI*
-
diff --git a/src/OpenGL/libEGL/libEGL_deprecated.lds b/src/OpenGL/libEGL/libEGL_deprecated.lds
deleted file mode 100644
index 7a85337a7..000000000
--- a/src/OpenGL/libEGL/libEGL_deprecated.lds
+++ /dev/null
@@ -1,65 +0,0 @@
-{
-global:
- # EGL core functions
- eglBindAPI;
- eglBindTexImage;
- eglChooseConfig;
- eglClientWaitSync;
- eglCopyBuffers;
- eglCreateContext;
- eglCreateImage;
- eglCreatePbufferFromClientBuffer;
- eglCreatePbufferSurface;
- eglCreatePixmapSurface;
- eglCreatePlatformPixmapSurface;
- eglCreatePlatformWindowSurface;
- eglCreateSync;
- eglCreateWindowSurface;
- eglDestroyContext;
- eglDestroyImage;
- eglDestroySurface;
- eglDestroySync;
- eglGetConfigAttrib;
- eglGetConfigs;
- eglGetCurrentContext;
- eglGetCurrentDisplay;
- eglGetCurrentSurface;
- eglGetDisplay;
- eglGetError;
- eglGetPlatformDisplay;
- eglGetProcAddress;
- eglGetSyncAttrib;
- eglInitialize;
- eglMakeCurrent;
- eglQueryAPI;
- eglQueryContext;
- eglQueryString;
- eglQuerySurface;
- eglReleaseTexImage;
- eglReleaseThread;
- eglSurfaceAttrib;
- eglSwapBuffers;
- eglSwapInterval;
- eglTerminate;
- eglWaitClient;
- eglWaitGL;
- eglWaitNative;
- eglWaitSync;
-
- # Extensions
- eglCreateImageKHR;
- eglDestroyImageKHR;
- eglGetPlatformDisplayEXT;
- eglCreatePlatformWindowSurfaceEXT;
- eglCreatePlatformPixmapSurfaceEXT;
- eglCreateSyncKHR;
- eglDestroySyncKHR;
- eglClientWaitSyncKHR;
- eglGetSyncAttribKHR;
-
- # Table of function pointers to disambiguate between libraries
- libEGL_swiftshader;
-
-local:
- *;
-};
diff --git a/src/OpenGL/libEGL/main.cpp b/src/OpenGL/libEGL/main.cpp
deleted file mode 100644
index 65a052e85..000000000
--- a/src/OpenGL/libEGL/main.cpp
+++ /dev/null
@@ -1,723 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// main.cpp: DLL entry point and management of thread-local data.
-
-#include "main.h"
-
-#include "Context.hpp"
-#include "Display.h"
-#include "Surface.hpp"
-#include "libEGL.hpp"
-
-#include "Common/SharedLibrary.hpp"
-#include "Common/Thread.hpp"
-#include "common/debug.h"
-#include "resource.h"
-
-#include <EGL/eglext.h>
-
-static sw::Thread::LocalStorageKey currentTLS = TLS_OUT_OF_INDEXES;
-
-#if !defined(_MSC_VER)
-#define CONSTRUCTOR __attribute__((constructor))
-#define DESTRUCTOR __attribute__((destructor))
-#else
-#define CONSTRUCTOR
-#define DESTRUCTOR
-#endif
-
-namespace egl
-{
-void releaseCurrent(void *storage)
-{
- // This pthread destructor is called after the TLS is already reset to NULL,
- // so we can't call EGL functions here to do the cleanup.
-
- Current *current = (Current*)storage;
-
- if(current)
- {
- if(current->drawSurface)
- {
- current->drawSurface->release();
- }
-
- if(current->readSurface)
- {
- current->readSurface->release();
- }
-
- if(current->context)
- {
- current->context->release();
- }
-
- free(current);
- }
-}
-
-Current *attachThread()
-{
- TRACE("()");
-
- if(currentTLS == TLS_OUT_OF_INDEXES)
- {
- currentTLS = sw::Thread::allocateLocalStorageKey(releaseCurrent);
- }
-
- Current *current = (Current*)sw::Thread::allocateLocalStorage(currentTLS, sizeof(Current));
-
- current->error = EGL_SUCCESS;
- current->API = EGL_OPENGL_ES_API;
- current->context = nullptr;
- current->drawSurface = nullptr;
- current->readSurface = nullptr;
-
- return current;
-}
-
-void detachThread()
-{
- TRACE("()");
-
- eglMakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
-
- sw::Thread::freeLocalStorage(currentTLS);
-}
-
-CONSTRUCTOR void attachProcess()
-{
- TRACE("()");
-
- #if !defined(ANGLE_DISABLE_TRACE) && defined(TRACE_OUTPUT_FILE)
- FILE *debug = fopen(TRACE_OUTPUT_FILE, "rt");
-
- if(debug)
- {
- fclose(debug);
- debug = fopen(TRACE_OUTPUT_FILE, "wt"); // Erase
- fclose(debug);
- }
- #endif
-
- attachThread();
-}
-
-DESTRUCTOR void detachProcess()
-{
- TRACE("()");
-
- detachThread();
- sw::Thread::freeLocalStorageKey(currentTLS);
-}
-}
-
-#if defined(_WIN32)
-#ifdef DEBUGGER_WAIT_DIALOG
-static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
-{
- RECT rect;
-
- switch(uMsg)
- {
- case WM_INITDIALOG:
- GetWindowRect(GetDesktopWindow(), &rect);
- SetWindowPos(hwnd, HWND_TOP, rect.right / 2, rect.bottom / 2, 0, 0, SWP_NOSIZE);
- SetTimer(hwnd, 1, 100, NULL);
- return TRUE;
- case WM_COMMAND:
- if(LOWORD(wParam) == IDCANCEL)
- {
- EndDialog(hwnd, 0);
- }
- break;
- case WM_TIMER:
- if(IsDebuggerPresent())
- {
- EndDialog(hwnd, 0);
- }
- }
-
- return FALSE;
-}
-
-static void WaitForDebugger(HINSTANCE instance)
-{
- if(!IsDebuggerPresent())
- {
- HRSRC dialog = FindResource(instance, MAKEINTRESOURCE(IDD_DIALOG1), RT_DIALOG);
- DLGTEMPLATE *dialogTemplate = (DLGTEMPLATE*)LoadResource(instance, dialog);
- DialogBoxIndirect(instance, dialogTemplate, NULL, DebuggerWaitDialogProc);
- }
-}
-#endif
-
-extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_PROCESS_ATTACH:
- #ifdef DEBUGGER_WAIT_DIALOG
- {
- char disable_debugger_wait_dialog[] = "0";
- GetEnvironmentVariable("SWIFTSHADER_DISABLE_DEBUGGER_WAIT_DIALOG", disable_debugger_wait_dialog, sizeof(disable_debugger_wait_dialog));
-
- if(disable_debugger_wait_dialog[0] != '1')
- {
- WaitForDebugger(instance);
- }
- }
- #endif
- egl::attachProcess();
- break;
- case DLL_THREAD_ATTACH:
- egl::attachThread();
- break;
- case DLL_THREAD_DETACH:
- egl::detachThread();
- break;
- case DLL_PROCESS_DETACH:
- egl::detachProcess();
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-#endif
-
-namespace egl
-{
-static Current *getCurrent(void)
-{
- Current *current = (Current*)sw::Thread::getLocalStorage(currentTLS);
-
- if(!current)
- {
- current = attachThread();
- }
-
- return current;
-}
-
-void setCurrentError(EGLint error)
-{
- Current *current = getCurrent();
-
- current->error = error;
-}
-
-EGLint getCurrentError()
-{
- Current *current = getCurrent();
-
- return current->error;
-}
-
-void setCurrentAPI(EGLenum API)
-{
- Current *current = getCurrent();
-
- current->API = API;
-}
-
-EGLenum getCurrentAPI()
-{
- Current *current = getCurrent();
-
- return current->API;
-}
-
-void setCurrentContext(egl::Context *ctx)
-{
- Current *current = getCurrent();
-
- if(ctx)
- {
- ctx->addRef();
- }
-
- if(current->context)
- {
- current->context->release();
- }
-
- current->context = ctx;
-}
-
-NO_SANITIZE_FUNCTION egl::Context *getCurrentContext()
-{
- Current *current = getCurrent();
-
- return current->context;
-}
-
-void setCurrentDrawSurface(egl::Surface *surface)
-{
- Current *current = getCurrent();
-
- if(surface)
- {
- surface->addRef();
- }
-
- if(current->drawSurface)
- {
- current->drawSurface->release();
- }
-
- current->drawSurface = surface;
-}
-
-egl::Surface *getCurrentDrawSurface()
-{
- Current *current = getCurrent();
-
- return current->drawSurface;
-}
-
-void setCurrentReadSurface(egl::Surface *surface)
-{
- Current *current = getCurrent();
-
- if(surface)
- {
- surface->addRef();
- }
-
- if(current->readSurface)
- {
- current->readSurface->release();
- }
-
- current->readSurface = surface;
-}
-
-egl::Surface *getCurrentReadSurface()
-{
- Current *current = getCurrent();
-
- return current->readSurface;
-}
-
-void error(EGLint errorCode)
-{
- egl::setCurrentError(errorCode);
-
- if(errorCode != EGL_SUCCESS)
- {
- switch(errorCode)
- {
- case EGL_NOT_INITIALIZED: TRACE("\t! Error generated: not initialized\n"); break;
- case EGL_BAD_ACCESS: TRACE("\t! Error generated: bad access\n"); break;
- case EGL_BAD_ALLOC: TRACE("\t! Error generated: bad alloc\n"); break;
- case EGL_BAD_ATTRIBUTE: TRACE("\t! Error generated: bad attribute\n"); break;
- case EGL_BAD_CONFIG: TRACE("\t! Error generated: bad config\n"); break;
- case EGL_BAD_CONTEXT: TRACE("\t! Error generated: bad context\n"); break;
- case EGL_BAD_CURRENT_SURFACE: TRACE("\t! Error generated: bad current surface\n"); break;
- case EGL_BAD_DISPLAY: TRACE("\t! Error generated: bad display\n"); break;
- case EGL_BAD_MATCH: TRACE("\t! Error generated: bad match\n"); break;
- case EGL_BAD_NATIVE_PIXMAP: TRACE("\t! Error generated: bad native pixmap\n"); break;
- case EGL_BAD_NATIVE_WINDOW: TRACE("\t! Error generated: bad native window\n"); break;
- case EGL_BAD_PARAMETER: TRACE("\t! Error generated: bad parameter\n"); break;
- case EGL_BAD_SURFACE: TRACE("\t! Error generated: bad surface\n"); break;
- case EGL_CONTEXT_LOST: TRACE("\t! Error generated: context lost\n"); break;
- default: TRACE("\t! Error generated: <0x%X>\n", errorCode); break;
- }
- }
-}
-
-}
-
-namespace egl
-{
-EGLint EGLAPIENTRY GetError(void);
-EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id);
-EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor);
-EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy);
-const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name);
-EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config);
-EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value);
-EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list);
-EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list);
-EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list);
-EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface);
-EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value);
-EGLBoolean EGLAPIENTRY BindAPI(EGLenum api);
-EGLenum EGLAPIENTRY QueryAPI(void);
-EGLBoolean EGLAPIENTRY WaitClient(void);
-EGLBoolean EGLAPIENTRY ReleaseThread(void);
-EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list);
-EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value);
-EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer);
-EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval);
-EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list);
-EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx);
-EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx);
-EGLContext EGLAPIENTRY GetCurrentContext(void);
-EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw);
-EGLDisplay EGLAPIENTRY GetCurrentDisplay(void);
-EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value);
-EGLBoolean EGLAPIENTRY WaitGL(void);
-EGLBoolean EGLAPIENTRY WaitNative(EGLint engine);
-EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface);
-EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target);
-EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
-EGLImageKHR EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list);
-EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image);
-EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list);
-EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list);
-EGLSurface EGLAPIENTRY CreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
-EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list);
-EGLSurface EGLAPIENTRY CreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
-EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list);
-EGLSyncKHR EGLAPIENTRY CreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
-EGLSyncKHR EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
-EGLBoolean EGLAPIENTRY DestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
-EGLint EGLAPIENTRY ClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
-EGLBoolean EGLAPIENTRY GetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
-EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value);
-__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname);
-}
-
-extern "C"
-{
-EGLAPI EGLint EGLAPIENTRY eglGetError(void)
-{
- return egl::GetError();
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetDisplay(EGLNativeDisplayType display_id)
-{
- return egl::GetDisplay(display_id);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
-{
- return egl::Initialize(dpy, major, minor);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglTerminate(EGLDisplay dpy)
-{
- return egl::Terminate(dpy);
-}
-
-EGLAPI const char *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
-{
- return egl::QueryString(dpy, name);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- return egl::GetConfigs(dpy, configs, config_size, num_config);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
-{
- return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
-{
- return egl::GetConfigAttrib(dpy, config, attribute, value);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType window, const EGLint *attrib_list)
-{
- return egl::CreateWindowSurface(dpy, config, window, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
-{
- return egl::CreatePbufferSurface(dpy, config, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
-{
- return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
-{
- return egl::DestroySurface(dpy, surface);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
-{
- return egl::QuerySurface(dpy, surface, attribute, value);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI(EGLenum api)
-{
- return egl::BindAPI(api);
-}
-
-EGLAPI EGLenum EGLAPIENTRY eglQueryAPI(void)
-{
- return egl::QueryAPI();
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient(void)
-{
- return egl::WaitClient();
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseThread(void)
-{
- return egl::ReleaseThread();
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
-{
- return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
-{
- return egl::SurfaceAttrib(dpy, surface, attribute, value);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglBindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return egl::BindTexImage(dpy, surface, buffer);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
-{
- return egl::ReleaseTexImage(dpy, surface, buffer);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapInterval(EGLDisplay dpy, EGLint interval)
-{
- return egl::SwapInterval(dpy, interval);
-}
-
-EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
-{
- return egl::CreateContext(dpy, config, share_context, attrib_list);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyContext(EGLDisplay dpy, EGLContext ctx)
-{
- return egl::DestroyContext(dpy, ctx);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
-{
- return egl::MakeCurrent(dpy, draw, read, ctx);
-}
-
-EGLAPI EGLContext EGLAPIENTRY eglGetCurrentContext(void)
-{
- return egl::GetCurrentContext();
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglGetCurrentSurface(EGLint readdraw)
-{
- return egl::GetCurrentSurface(readdraw);
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetCurrentDisplay(void)
-{
- return egl::GetCurrentDisplay();
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
-{
- return egl::QueryContext(dpy, ctx, attribute, value);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitGL(void)
-{
- return egl::WaitClient();
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitNative(EGLint engine)
-{
- return egl::WaitNative(engine);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffers(EGLDisplay dpy, EGLSurface surface)
-{
- return egl::SwapBuffers(dpy, surface);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
-{
- return egl::CopyBuffers(dpy, surface, target);
-}
-
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list)
-{
- return egl::CreateImageKHR(dpy, ctx, target, buffer, attrib_list);
-}
-
-EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
-{
- return egl::CreateImage(dpy, ctx, target, buffer, attrib_list);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR image)
-{
- return egl::DestroyImageKHR(dpy, image);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImageKHR image)
-{
- return egl::DestroyImageKHR(dpy, image);
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
-{
- return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
-}
-
-EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
-{
- return egl::GetPlatformDisplay(platform, native_display, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list)
-{
- return egl::CreatePlatformWindowSurfaceEXT(dpy, config, native_window, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
-{
- return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list)
-{
- return egl::CreatePlatformPixmapSurfaceEXT(dpy, config, native_pixmap, attrib_list);
-}
-
-EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
-{
- return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
-}
-
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list)
-{
- return egl::CreateSyncKHR(dpy, type, attrib_list);
-}
-
-EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
-{
- return egl::CreateSync(dpy, type, attrib_list);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync)
-{
- return egl::DestroySyncKHR(dpy, sync);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync(EGLDisplay dpy, EGLSyncKHR sync)
-{
- return egl::DestroySyncKHR(dpy, sync);
-}
-
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
-{
- return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout);
-}
-
-EGLAPI EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout)
-{
- return egl::ClientWaitSyncKHR(dpy, sync, flags, timeout);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value)
-{
- return egl::GetSyncAttribKHR(dpy, sync, attribute, value);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLAttrib *value)
-{
- return egl::GetSyncAttrib(dpy, sync, attribute, value);
-}
-
-EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags)
-{
- return egl::ClientWaitSyncKHR(dpy, sync, flags, EGL_FOREVER_KHR);
-}
-
-EGLAPI EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
-{
- return egl::ClientWaitSyncKHR(dpy, sync, flags, EGL_FOREVER_KHR);
-}
-
-EGLAPI __eglMustCastToProperFunctionPointerType EGLAPIENTRY eglGetProcAddress(const char *procname)
-{
- return egl::GetProcAddress(procname);
-}
-}
-
-LibEGLexports::LibEGLexports()
-{
- this->eglGetError = egl::GetError;
- this->eglGetDisplay = egl::GetDisplay;
- this->eglInitialize = egl::Initialize;
- this->eglTerminate = egl::Terminate;
- this->eglQueryString = egl::QueryString;
- this->eglGetConfigs = egl::GetConfigs;
- this->eglChooseConfig = egl::ChooseConfig;
- this->eglGetConfigAttrib = egl::GetConfigAttrib;
- this->eglCreateWindowSurface = egl::CreateWindowSurface;
- this->eglCreatePbufferSurface = egl::CreatePbufferSurface;
- this->eglCreatePixmapSurface = egl::CreatePixmapSurface;
- this->eglDestroySurface = egl::DestroySurface;
- this->eglQuerySurface = egl::QuerySurface;
- this->eglBindAPI = egl::BindAPI;
- this->eglQueryAPI = egl::QueryAPI;
- this->eglWaitClient = egl::WaitClient;
- this->eglReleaseThread = egl::ReleaseThread;
- this->eglCreatePbufferFromClientBuffer = egl::CreatePbufferFromClientBuffer;
- this->eglSurfaceAttrib = egl::SurfaceAttrib;
- this->eglBindTexImage = egl::BindTexImage;
- this->eglReleaseTexImage = egl::ReleaseTexImage;
- this->eglSwapInterval = egl::SwapInterval;
- this->eglCreateContext = egl::CreateContext;
- this->eglDestroyContext = egl::DestroyContext;
- this->eglMakeCurrent = egl::MakeCurrent;
- this->eglGetCurrentContext = egl::GetCurrentContext;
- this->eglGetCurrentSurface = egl::GetCurrentSurface;
- this->eglGetCurrentDisplay = egl::GetCurrentDisplay;
- this->eglQueryContext = egl::QueryContext;
- this->eglWaitGL = egl::WaitGL;
- this->eglWaitNative = egl::WaitNative;
- this->eglSwapBuffers = egl::SwapBuffers;
- this->eglCopyBuffers = egl::CopyBuffers;
- this->eglCreateImageKHR = egl::CreateImageKHR;
- this->eglDestroyImageKHR = egl::DestroyImageKHR;
- this->eglGetProcAddress = egl::GetProcAddress;
- this->eglCreateSyncKHR = egl::CreateSyncKHR;
- this->eglDestroySyncKHR = egl::DestroySyncKHR;
- this->eglClientWaitSyncKHR = egl::ClientWaitSyncKHR;
- this->eglGetSyncAttribKHR = egl::GetSyncAttribKHR;
-
- this->clientGetCurrentContext = egl::getCurrentContext;
-}
-
-extern "C" EGLAPI LibEGLexports *libEGL_swiftshader()
-{
- static LibEGLexports libEGL;
- return &libEGL;
-}
-
-LibGLESv2 libGLESv2;
diff --git a/src/OpenGL/libEGL/main.h b/src/OpenGL/libEGL/main.h
deleted file mode 100644
index 1667a696e..000000000
--- a/src/OpenGL/libEGL/main.h
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// main.h: Management of thread-local data.
-
-#ifndef LIBEGL_MAIN_H_
-#define LIBEGL_MAIN_H_
-
-#include "libGLESv2/libGLESv2.hpp"
-
-#include <EGL/egl.h>
-#include <EGL/eglext.h>
-
-namespace egl
-{
- class Display;
- class Context;
- class Surface;
- class Config;
- class Image;
-
- struct Current
- {
- EGLint error;
- EGLenum API;
- Context *context;
- Surface *drawSurface;
- Surface *readSurface;
- };
-
- void detachThread();
-
- void setCurrentError(EGLint error);
- EGLint getCurrentError();
-
- void setCurrentAPI(EGLenum API);
- EGLenum getCurrentAPI();
-
- void setCurrentContext(Context *ctx);
- Context *getCurrentContext();
-
- void setCurrentDrawSurface(Surface *surface);
- Surface *getCurrentDrawSurface();
-
- void setCurrentReadSurface(Surface *surface);
- Surface *getCurrentReadSurface();
-
- void error(EGLint errorCode);
-
- template<class T>
- const T &error(EGLint errorCode, const T &returnValue)
- {
- egl::error(errorCode);
-
- return returnValue;
- }
-
- template<class T>
- const T &success(const T &returnValue)
- {
- egl::setCurrentError(EGL_SUCCESS);
-
- return returnValue;
- }
-}
-
-extern LibGLESv2 libGLESv2;
-
-#endif // LIBEGL_MAIN_H_
diff --git a/src/OpenGL/libEGL/resource.h b/src/OpenGL/libEGL/resource.h
deleted file mode 100644
index 62eff144c..000000000
--- a/src/OpenGL/libEGL/resource.h
+++ /dev/null
@@ -1,17 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libEGL.rc
-//
-#define IDD_DIALOG1 101
-#define IDC_STATIC -1
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 102
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/OpenGL/libGLESv2/Buffer.cpp b/src/OpenGL/libGLESv2/Buffer.cpp
deleted file mode 100644
index 69182d9df..000000000
--- a/src/OpenGL/libGLESv2/Buffer.cpp
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Buffer.cpp: Implements the 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 "Buffer.h"
-
-#include "main.h"
-#include "VertexDataManager.h"
-#include "IndexDataManager.h"
-
-namespace es2
-{
-
-Buffer::Buffer(GLuint name) : NamedObject(name)
-{
- mContents = 0;
- mSize = 0;
- mUsage = GL_STATIC_DRAW;
- mIsMapped = false;
- mOffset = 0;
- mLength = 0;
- mAccess = 0;
-}
-
-Buffer::~Buffer()
-{
- if(mContents)
- {
- mContents->destruct();
- }
-}
-
-void Buffer::bufferData(const void *data, GLsizeiptr size, GLenum usage)
-{
- if(mContents)
- {
- mContents->destruct();
- mContents = 0;
- }
-
- mSize = size;
- mUsage = usage;
-
- if(size > 0)
- {
- const int padding = 1024; // For SIMD processing of vertices
- mContents = new sw::Resource(size + padding);
-
- if(!mContents)
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- if(data)
- {
- char *buffer = (char*)mContents->data();
- memcpy(buffer + mOffset, data, size);
- }
- }
-}
-
-void Buffer::bufferSubData(const void *data, GLsizeiptr size, GLintptr offset)
-{
- if(mContents && data)
- {
- char *buffer = (char*)mContents->lock(sw::PUBLIC);
- memcpy(buffer + offset, data, size);
- mContents->unlock();
- }
-}
-
-void* Buffer::mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- if(mContents)
- {
- char* buffer = (char*)mContents->lock(sw::PUBLIC);
- mIsMapped = true;
- mOffset = offset;
- mLength = length;
- mAccess = access;
- return buffer + offset;
- }
- return nullptr;
-}
-
-bool Buffer::unmap()
-{
- if(mContents)
- {
- mContents->unlock();
- }
- mIsMapped = false;
- mOffset = 0;
- mLength = 0;
- mAccess = 0;
- return true;
-}
-
-sw::Resource *Buffer::getResource()
-{
- return mContents;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/Buffer.h b/src/OpenGL/libGLESv2/Buffer.h
deleted file mode 100644
index 4a792f123..000000000
--- a/src/OpenGL/libGLESv2/Buffer.h
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Buffer.h: Defines the 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 LIBGLESV2_BUFFER_H_
-#define LIBGLESV2_BUFFER_H_
-
-#include "common/Object.hpp"
-#include "Common/Resource.hpp"
-
-#include <GLES2/gl2.h>
-
-#include <cstddef>
-#include <vector>
-
-namespace es2
-{
-class Buffer : public gl::NamedObject
-{
-public:
- explicit Buffer(GLuint name);
-
- virtual ~Buffer();
-
- void bufferData(const void *data, GLsizeiptr size, GLenum usage);
- void bufferSubData(const void *data, GLsizeiptr size, GLintptr offset);
-
- const void *data() const { return mContents ? mContents->data() : 0; }
- size_t size() const { return mSize; }
- GLenum usage() const { return mUsage; }
- bool isMapped() const { return mIsMapped; }
- GLintptr offset() const { return mOffset; }
- GLsizeiptr length() const { return mLength; }
- GLbitfield access() const { return mAccess; }
-
- void* mapRange(GLintptr offset, GLsizeiptr length, GLbitfield access);
- bool unmap();
- void flushMappedRange(GLintptr offset, GLsizeiptr length) {}
-
- sw::Resource *getResource();
-
-private:
- sw::Resource *mContents;
- size_t mSize;
- GLenum mUsage;
- bool mIsMapped;
- GLintptr mOffset;
- GLsizeiptr mLength;
- GLbitfield mAccess;
-};
-
-class BufferBinding
-{
-public:
- BufferBinding() : offset(0), size(0) { }
-
- void set(Buffer *newBuffer, int newOffset = 0, int newSize = 0)
- {
- buffer = newBuffer;
- offset = newOffset;
- size = newSize;
- }
-
- int getOffset() const { return offset; }
- int getSize() const { return size; }
- const gl::BindingPointer<Buffer>& get() const { return buffer; }
-
-private:
- gl::BindingPointer<Buffer> buffer;
- int offset;
- int size;
-};
-
-}
-
-#endif // LIBGLESV2_BUFFER_H_
diff --git a/src/OpenGL/libGLESv2/Context.cpp b/src/OpenGL/libGLESv2/Context.cpp
deleted file mode 100644
index 2ad6b0252..000000000
--- a/src/OpenGL/libGLESv2/Context.cpp
+++ /dev/null
@@ -1,4588 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Context.cpp: Implements the es2::Context class, managing all GL state and performing
-// rendering operations. It is the GLES2 specific implementation of EGLContext.
-
-#include "Context.h"
-
-#include "main.h"
-#include "mathutil.h"
-#include "utilities.h"
-#include "ResourceManager.h"
-#include "Buffer.h"
-#include "Fence.h"
-#include "Framebuffer.h"
-#include "Program.h"
-#include "Query.h"
-#include "Renderbuffer.h"
-#include "Sampler.h"
-#include "Shader.h"
-#include "Texture.h"
-#include "TransformFeedback.h"
-#include "VertexArray.h"
-#include "VertexDataManager.h"
-#include "IndexDataManager.h"
-#include "libEGL/Display.h"
-#include "common/Surface.hpp"
-#include "Common/Half.hpp"
-
-#include <EGL/eglext.h>
-
-#include <algorithm>
-#include <string>
-
-namespace es2
-{
-Context::Context(egl::Display *display, const Context *shareContext, const egl::Config *config)
- : egl::Context(display), config(config)
-{
- sw::Context *context = new sw::Context();
- device = new es2::Device(context);
-
- setClearColor(0.0f, 0.0f, 0.0f, 0.0f);
-
- mState.depthClearValue = 1.0f;
- mState.stencilClearValue = 0;
-
- mState.cullFaceEnabled = false;
- mState.cullMode = GL_BACK;
- mState.frontFace = GL_CCW;
- mState.depthTestEnabled = false;
- mState.depthFunc = GL_LESS;
- mState.blendEnabled = false;
- mState.sourceBlendRGB = GL_ONE;
- mState.sourceBlendAlpha = GL_ONE;
- mState.destBlendRGB = GL_ZERO;
- mState.destBlendAlpha = GL_ZERO;
- mState.blendEquationRGB = GL_FUNC_ADD;
- mState.blendEquationAlpha = GL_FUNC_ADD;
- mState.blendColor.red = 0;
- mState.blendColor.green = 0;
- mState.blendColor.blue = 0;
- mState.blendColor.alpha = 0;
- mState.stencilTestEnabled = false;
- mState.stencilFunc = GL_ALWAYS;
- mState.stencilRef = 0;
- mState.stencilMask = 0xFFFFFFFFu;
- mState.stencilWritemask = 0xFFFFFFFFu;
- mState.stencilBackFunc = GL_ALWAYS;
- mState.stencilBackRef = 0;
- mState.stencilBackMask = 0xFFFFFFFFu;
- mState.stencilBackWritemask = 0xFFFFFFFFu;
- mState.stencilFail = GL_KEEP;
- mState.stencilPassDepthFail = GL_KEEP;
- mState.stencilPassDepthPass = GL_KEEP;
- mState.stencilBackFail = GL_KEEP;
- mState.stencilBackPassDepthFail = GL_KEEP;
- mState.stencilBackPassDepthPass = GL_KEEP;
- mState.polygonOffsetFillEnabled = false;
- mState.polygonOffsetFactor = 0.0f;
- mState.polygonOffsetUnits = 0.0f;
- mState.sampleAlphaToCoverageEnabled = false;
- mState.sampleCoverageEnabled = false;
- mState.sampleCoverageValue = 1.0f;
- mState.sampleCoverageInvert = false;
- mState.scissorTestEnabled = false;
- mState.ditherEnabled = true;
- mState.primitiveRestartFixedIndexEnabled = false;
- mState.rasterizerDiscardEnabled = false;
- mState.generateMipmapHint = GL_DONT_CARE;
- mState.fragmentShaderDerivativeHint = GL_DONT_CARE;
- mState.textureFilteringHint = GL_DONT_CARE;
-
- mState.lineWidth = 1.0f;
-
- mState.viewportX = 0;
- mState.viewportY = 0;
- mState.viewportWidth = 0;
- mState.viewportHeight = 0;
- mState.zNear = 0.0f;
- mState.zFar = 1.0f;
-
- mState.scissorX = 0;
- mState.scissorY = 0;
- mState.scissorWidth = 0;
- mState.scissorHeight = 0;
-
- mState.colorMaskRed = true;
- mState.colorMaskGreen = true;
- mState.colorMaskBlue = true;
- mState.colorMaskAlpha = true;
- mState.depthMask = true;
-
- if(shareContext)
- {
- mResourceManager = shareContext->mResourceManager;
- mResourceManager->addRef();
- }
- else
- {
- mResourceManager = new ResourceManager();
- }
-
- // [OpenGL ES 2.0.24] section 3.7 page 83:
- // In the initial state, TEXTURE_2D and TEXTURE_CUBE_MAP have twodimensional
- // 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.
-
- mTexture2DZero = new Texture2D(0);
- mTexture3DZero = new Texture3D(0);
- mTexture2DArrayZero = new Texture2DArray(0);
- mTextureCubeMapZero = new TextureCubeMap(0);
- mTexture2DRectZero = new Texture2DRect(0);
- mTextureExternalZero = new TextureExternal(0);
-
- mState.activeSampler = 0;
-
- for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)
- {
- bindTexture((TextureType)type, 0);
- }
-
- bindVertexArray(0);
- bindArrayBuffer(0);
- bindElementArrayBuffer(0);
- bindReadFramebuffer(0);
- bindDrawFramebuffer(0);
- bindRenderbuffer(0);
- bindGenericUniformBuffer(0);
- bindTransformFeedback(0);
-
- mState.currentProgram = 0;
-
- mVertexDataManager = nullptr;
- mIndexDataManager = nullptr;
-
- mInvalidEnum = false;
- mInvalidValue = false;
- mInvalidOperation = false;
- mOutOfMemory = false;
- mInvalidFramebufferOperation = false;
-
- mHasBeenCurrent = false;
-
- markAllStateDirty();
-}
-
-Context::~Context()
-{
- if(mState.currentProgram != 0)
- {
- Program *programObject = mResourceManager->getProgram(mState.currentProgram);
- if(programObject)
- {
- programObject->release();
- }
- mState.currentProgram = 0;
- }
-
- while(!mFramebufferNameSpace.empty())
- {
- deleteFramebuffer(mFramebufferNameSpace.firstName());
- }
-
- while(!mFenceNameSpace.empty())
- {
- deleteFence(mFenceNameSpace.firstName());
- }
-
- while(!mQueryNameSpace.empty())
- {
- deleteQuery(mQueryNameSpace.firstName());
- }
-
- while(!mVertexArrayNameSpace.empty())
- {
- deleteVertexArray(mVertexArrayNameSpace.lastName());
- }
-
- while(!mTransformFeedbackNameSpace.empty())
- {
- deleteTransformFeedback(mTransformFeedbackNameSpace.firstName());
- }
-
- for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)
- {
- for(int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)
- {
- mState.samplerTexture[type][sampler] = nullptr;
- }
- }
-
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- mState.vertexAttribute[i].mBoundBuffer = nullptr;
- }
-
- for(int i = 0; i < QUERY_TYPE_COUNT; i++)
- {
- mState.activeQuery[i] = nullptr;
- }
-
- mState.arrayBuffer = nullptr;
- mState.copyReadBuffer = nullptr;
- mState.copyWriteBuffer = nullptr;
- mState.pixelPackBuffer = nullptr;
- mState.pixelUnpackBuffer = nullptr;
- mState.genericUniformBuffer = nullptr;
- mState.genericTransformFeedbackBuffer = nullptr;
-
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; i++) {
- mState.uniformBuffers[i].set(nullptr, 0, 0);
- }
-
- mState.renderbuffer = nullptr;
-
- for(int i = 0; i < MAX_COMBINED_TEXTURE_IMAGE_UNITS; ++i)
- {
- mState.sampler[i] = nullptr;
- }
-
- mTexture2DZero = nullptr;
- mTexture3DZero = nullptr;
- mTexture2DArrayZero = nullptr;
- mTextureCubeMapZero = nullptr;
- mTexture2DRectZero = nullptr;
- mTextureExternalZero = nullptr;
-
- delete mVertexDataManager;
- delete mIndexDataManager;
-
- mResourceManager->release();
- delete device;
-}
-
-void Context::makeCurrent(gl::Surface *surface)
-{
- if(!mHasBeenCurrent)
- {
- mVertexDataManager = new VertexDataManager(this);
- mIndexDataManager = new IndexDataManager();
-
- mState.viewportX = 0;
- mState.viewportY = 0;
- mState.viewportWidth = surface ? surface->getWidth() : 0;
- mState.viewportHeight = surface ? surface->getHeight() : 0;
-
- mState.scissorX = 0;
- mState.scissorY = 0;
- mState.scissorWidth = surface ? surface->getWidth() : 0;
- mState.scissorHeight = surface ? surface->getHeight() : 0;
-
- mHasBeenCurrent = true;
- }
-
- if(surface)
- {
- // Wrap the existing resources into GL objects and assign them to the '0' names
- egl::Image *defaultRenderTarget = surface->getRenderTarget();
- egl::Image *depthStencil = surface->getDepthStencil();
-
- Colorbuffer *colorbufferZero = new Colorbuffer(defaultRenderTarget);
- DepthStencilbuffer *depthStencilbufferZero = new DepthStencilbuffer(depthStencil);
- Framebuffer *framebufferZero = new DefaultFramebuffer(colorbufferZero, depthStencilbufferZero);
-
- setFramebufferZero(framebufferZero);
-
- if(defaultRenderTarget)
- {
- defaultRenderTarget->release();
- }
-
- if(depthStencil)
- {
- depthStencil->release();
- }
- }
- else
- {
- setFramebufferZero(nullptr);
- }
-
- markAllStateDirty();
-}
-
-EGLint Context::getClientVersion() const
-{
- return 3;
-}
-
-EGLint Context::getConfigID() const
-{
- return config->mConfigID;
-}
-
-// This function will set all of the state-related dirty flags, so that all state is set during next pre-draw.
-void Context::markAllStateDirty()
-{
- mAppliedProgramSerial = 0;
-
- mDepthStateDirty = true;
- mMaskStateDirty = true;
- mBlendStateDirty = true;
- mStencilStateDirty = true;
- mPolygonOffsetStateDirty = true;
- mSampleStateDirty = true;
- mDitherStateDirty = true;
- mFrontFaceDirty = true;
-}
-
-void Context::setClearColor(float red, float green, float blue, float alpha)
-{
- mState.colorClearValue.red = red;
- mState.colorClearValue.green = green;
- mState.colorClearValue.blue = blue;
- mState.colorClearValue.alpha = alpha;
-}
-
-void Context::setClearDepth(float depth)
-{
- mState.depthClearValue = depth;
-}
-
-void Context::setClearStencil(int stencil)
-{
- mState.stencilClearValue = stencil;
-}
-
-void Context::setCullFaceEnabled(bool enabled)
-{
- mState.cullFaceEnabled = enabled;
-}
-
-bool Context::isCullFaceEnabled() const
-{
- return mState.cullFaceEnabled;
-}
-
-void Context::setCullMode(GLenum mode)
-{
- mState.cullMode = mode;
-}
-
-void Context::setFrontFace(GLenum front)
-{
- if(mState.frontFace != front)
- {
- mState.frontFace = front;
- mFrontFaceDirty = true;
- }
-}
-
-void Context::setDepthTestEnabled(bool enabled)
-{
- if(mState.depthTestEnabled != enabled)
- {
- mState.depthTestEnabled = enabled;
- mDepthStateDirty = true;
- }
-}
-
-bool Context::isDepthTestEnabled() const
-{
- return mState.depthTestEnabled;
-}
-
-void Context::setDepthFunc(GLenum depthFunc)
-{
- if(mState.depthFunc != depthFunc)
- {
- mState.depthFunc = depthFunc;
- mDepthStateDirty = true;
- }
-}
-
-void Context::setDepthRange(float zNear, float zFar)
-{
- mState.zNear = zNear;
- mState.zFar = zFar;
-}
-
-void Context::setBlendEnabled(bool enabled)
-{
- if(mState.blendEnabled != enabled)
- {
- mState.blendEnabled = enabled;
- mBlendStateDirty = true;
- }
-}
-
-bool Context::isBlendEnabled() const
-{
- return mState.blendEnabled;
-}
-
-void Context::setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha)
-{
- if(mState.sourceBlendRGB != sourceRGB ||
- mState.sourceBlendAlpha != sourceAlpha ||
- mState.destBlendRGB != destRGB ||
- mState.destBlendAlpha != destAlpha)
- {
- mState.sourceBlendRGB = sourceRGB;
- mState.destBlendRGB = destRGB;
- mState.sourceBlendAlpha = sourceAlpha;
- mState.destBlendAlpha = destAlpha;
- mBlendStateDirty = true;
- }
-}
-
-void Context::setBlendColor(float red, float green, float blue, float alpha)
-{
- if(mState.blendColor.red != red ||
- mState.blendColor.green != green ||
- mState.blendColor.blue != blue ||
- mState.blendColor.alpha != alpha)
- {
- mState.blendColor.red = red;
- mState.blendColor.green = green;
- mState.blendColor.blue = blue;
- mState.blendColor.alpha = alpha;
- mBlendStateDirty = true;
- }
-}
-
-void Context::setBlendEquation(GLenum rgbEquation, GLenum alphaEquation)
-{
- if(mState.blendEquationRGB != rgbEquation ||
- mState.blendEquationAlpha != alphaEquation)
- {
- mState.blendEquationRGB = rgbEquation;
- mState.blendEquationAlpha = alphaEquation;
- mBlendStateDirty = true;
- }
-}
-
-void Context::setStencilTestEnabled(bool enabled)
-{
- if(mState.stencilTestEnabled != enabled)
- {
- mState.stencilTestEnabled = enabled;
- mStencilStateDirty = true;
- }
-}
-
-bool Context::isStencilTestEnabled() const
-{
- return mState.stencilTestEnabled;
-}
-
-void Context::setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask)
-{
- if(mState.stencilFunc != stencilFunc ||
- mState.stencilRef != stencilRef ||
- mState.stencilMask != stencilMask)
- {
- mState.stencilFunc = stencilFunc;
- mState.stencilRef = (stencilRef > 0) ? stencilRef : 0;
- mState.stencilMask = stencilMask;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask)
-{
- if(mState.stencilBackFunc != stencilBackFunc ||
- mState.stencilBackRef != stencilBackRef ||
- mState.stencilBackMask != stencilBackMask)
- {
- mState.stencilBackFunc = stencilBackFunc;
- mState.stencilBackRef = (stencilBackRef > 0) ? stencilBackRef : 0;
- mState.stencilBackMask = stencilBackMask;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setStencilWritemask(GLuint stencilWritemask)
-{
- if(mState.stencilWritemask != stencilWritemask)
- {
- mState.stencilWritemask = stencilWritemask;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setStencilBackWritemask(GLuint stencilBackWritemask)
-{
- if(mState.stencilBackWritemask != stencilBackWritemask)
- {
- mState.stencilBackWritemask = stencilBackWritemask;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass)
-{
- if(mState.stencilFail != stencilFail ||
- mState.stencilPassDepthFail != stencilPassDepthFail ||
- mState.stencilPassDepthPass != stencilPassDepthPass)
- {
- mState.stencilFail = stencilFail;
- mState.stencilPassDepthFail = stencilPassDepthFail;
- mState.stencilPassDepthPass = stencilPassDepthPass;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass)
-{
- if(mState.stencilBackFail != stencilBackFail ||
- mState.stencilBackPassDepthFail != stencilBackPassDepthFail ||
- mState.stencilBackPassDepthPass != stencilBackPassDepthPass)
- {
- mState.stencilBackFail = stencilBackFail;
- mState.stencilBackPassDepthFail = stencilBackPassDepthFail;
- mState.stencilBackPassDepthPass = stencilBackPassDepthPass;
- mStencilStateDirty = true;
- }
-}
-
-void Context::setPolygonOffsetFillEnabled(bool enabled)
-{
- if(mState.polygonOffsetFillEnabled != enabled)
- {
- mState.polygonOffsetFillEnabled = enabled;
- mPolygonOffsetStateDirty = true;
- }
-}
-
-bool Context::isPolygonOffsetFillEnabled() const
-{
- return mState.polygonOffsetFillEnabled;
-}
-
-void Context::setPolygonOffsetParams(GLfloat factor, GLfloat units)
-{
- if(mState.polygonOffsetFactor != factor ||
- mState.polygonOffsetUnits != units)
- {
- mState.polygonOffsetFactor = factor;
- mState.polygonOffsetUnits = units;
- mPolygonOffsetStateDirty = true;
- }
-}
-
-void Context::setSampleAlphaToCoverageEnabled(bool enabled)
-{
- if(mState.sampleAlphaToCoverageEnabled != enabled)
- {
- mState.sampleAlphaToCoverageEnabled = enabled;
- mSampleStateDirty = true;
- }
-}
-
-bool Context::isSampleAlphaToCoverageEnabled() const
-{
- return mState.sampleAlphaToCoverageEnabled;
-}
-
-void Context::setSampleCoverageEnabled(bool enabled)
-{
- if(mState.sampleCoverageEnabled != enabled)
- {
- mState.sampleCoverageEnabled = enabled;
- mSampleStateDirty = true;
- }
-}
-
-bool Context::isSampleCoverageEnabled() const
-{
- return mState.sampleCoverageEnabled;
-}
-
-void Context::setSampleCoverageParams(GLclampf value, bool invert)
-{
- if(mState.sampleCoverageValue != value ||
- mState.sampleCoverageInvert != invert)
- {
- mState.sampleCoverageValue = value;
- mState.sampleCoverageInvert = invert;
- mSampleStateDirty = true;
- }
-}
-
-void Context::setScissorTestEnabled(bool enabled)
-{
- mState.scissorTestEnabled = enabled;
-}
-
-bool Context::isScissorTestEnabled() const
-{
- return mState.scissorTestEnabled;
-}
-
-void Context::setDitherEnabled(bool enabled)
-{
- if(mState.ditherEnabled != enabled)
- {
- mState.ditherEnabled = enabled;
- mDitherStateDirty = true;
- }
-}
-
-bool Context::isDitherEnabled() const
-{
- return mState.ditherEnabled;
-}
-
-void Context::setPrimitiveRestartFixedIndexEnabled(bool enabled)
-{
- mState.primitiveRestartFixedIndexEnabled = enabled;
-}
-
-bool Context::isPrimitiveRestartFixedIndexEnabled() const
-{
- return mState.primitiveRestartFixedIndexEnabled;
-}
-
-void Context::setRasterizerDiscardEnabled(bool enabled)
-{
- mState.rasterizerDiscardEnabled = enabled;
-}
-
-bool Context::isRasterizerDiscardEnabled() const
-{
- return mState.rasterizerDiscardEnabled;
-}
-
-void Context::setLineWidth(GLfloat width)
-{
- mState.lineWidth = width;
- device->setLineWidth(clamp(width, ALIASED_LINE_WIDTH_RANGE_MIN, ALIASED_LINE_WIDTH_RANGE_MAX));
-}
-
-void Context::setGenerateMipmapHint(GLenum hint)
-{
- mState.generateMipmapHint = hint;
-}
-
-void Context::setFragmentShaderDerivativeHint(GLenum hint)
-{
- mState.fragmentShaderDerivativeHint = hint;
- // TODO: Propagate the hint to shader translator so we can write
- // ddx, ddx_coarse, or ddx_fine depending on the hint.
- // Ignore for now. It is valid for implementations to ignore hint.
-}
-
-void Context::setTextureFilteringHint(GLenum hint)
-{
- mState.textureFilteringHint = hint;
-}
-
-void Context::setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mState.viewportX = x;
- mState.viewportY = y;
- mState.viewportWidth = std::min<GLsizei>(width, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE); // GL_MAX_VIEWPORT_DIMS[0]
- mState.viewportHeight = std::min<GLsizei>(height, IMPLEMENTATION_MAX_RENDERBUFFER_SIZE); // GL_MAX_VIEWPORT_DIMS[1]
-}
-
-void Context::setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- mState.scissorX = x;
- mState.scissorY = y;
-
- // An overflow happens when (infinite precision) X + Width > INT32_MAX. We
- // can change that formula to "X > INT32_MAX - Width". And when we bring it
- // down to 32-bit precision, we know it's safe because width is non-negative.
- if (x > INT32_MAX - width)
- {
- width = INT32_MAX - x;
- }
-
- if (y > INT32_MAX - height)
- {
- height = INT32_MAX - y;
- }
-
- mState.scissorWidth = width;
- mState.scissorHeight = height;
-}
-
-void Context::setColorMask(bool red, bool green, bool blue, bool alpha)
-{
- if(mState.colorMaskRed != red || mState.colorMaskGreen != green ||
- mState.colorMaskBlue != blue || mState.colorMaskAlpha != alpha)
- {
- mState.colorMaskRed = red;
- mState.colorMaskGreen = green;
- mState.colorMaskBlue = blue;
- mState.colorMaskAlpha = alpha;
- mMaskStateDirty = true;
- }
-}
-
-unsigned int Context::getColorMask() const
-{
- return (mState.colorMaskRed ? 0x1 : 0) |
- (mState.colorMaskGreen ? 0x2 : 0) |
- (mState.colorMaskBlue ? 0x4 : 0) |
- (mState.colorMaskAlpha ? 0x8 : 0);
-}
-
-void Context::setDepthMask(bool mask)
-{
- if(mState.depthMask != mask)
- {
- mState.depthMask = mask;
- mMaskStateDirty = true;
- }
-}
-
-void Context::setActiveSampler(unsigned int active)
-{
- mState.activeSampler = active;
-}
-
-GLuint Context::getReadFramebufferName() const
-{
- return mState.readFramebuffer;
-}
-
-GLuint Context::getDrawFramebufferName() const
-{
- return mState.drawFramebuffer;
-}
-
-GLuint Context::getRenderbufferName() const
-{
- return mState.renderbuffer.name();
-}
-
-void Context::setFramebufferReadBuffer(GLuint buf)
-{
- Framebuffer *framebuffer = getReadFramebuffer();
-
- if(framebuffer)
- {
- framebuffer->setReadBuffer(buf);
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
-}
-
-void Context::setFramebufferDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
- if(drawFramebuffer)
- {
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- drawFramebuffer->setDrawBuffer(i, (i < n) ? bufs[i] : GL_NONE);
- }
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
-}
-
-GLuint Context::getArrayBufferName() const
-{
- return mState.arrayBuffer.name();
-}
-
-GLuint Context::getElementArrayBufferName() const
-{
- Buffer* elementArrayBuffer = getCurrentVertexArray()->getElementArrayBuffer();
- return elementArrayBuffer ? elementArrayBuffer->name : 0;
-}
-
-GLuint Context::getActiveQuery(GLenum target) const
-{
- Query *queryObject = nullptr;
-
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED];
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- queryObject = mState.activeQuery[QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE];
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- queryObject = mState.activeQuery[QUERY_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN];
- break;
- default:
- ASSERT(false);
- }
-
- if(queryObject)
- {
- return queryObject->name;
- }
-
- return 0;
-}
-
-void Context::setVertexAttribArrayEnabled(unsigned int attribNum, bool enabled)
-{
- getCurrentVertexArray()->enableAttribute(attribNum, enabled);
-}
-
-void Context::setVertexAttribDivisor(unsigned int attribNum, GLuint divisor)
-{
- getCurrentVertexArray()->setVertexAttribDivisor(attribNum, divisor);
-}
-
-const VertexAttribute &Context::getVertexAttribState(unsigned int attribNum) const
-{
- return getCurrentVertexArray()->getVertexAttribute(attribNum);
-}
-
-void Context::setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
- bool normalized, bool pureInteger, GLsizei stride, const void *pointer)
-{
- getCurrentVertexArray()->setAttributeState(attribNum, boundBuffer, size, type, normalized, pureInteger, stride, pointer);
-}
-
-const void *Context::getVertexAttribPointer(unsigned int attribNum) const
-{
- return getCurrentVertexArray()->getVertexAttribute(attribNum).mPointer;
-}
-
-const VertexAttributeArray &Context::getVertexArrayAttributes()
-{
- return getCurrentVertexArray()->getVertexAttributes();
-}
-
-const VertexAttributeArray &Context::getCurrentVertexAttributes()
-{
- return mState.vertexAttribute;
-}
-
-void Context::setPackAlignment(GLint alignment)
-{
- mState.packParameters.alignment = alignment;
-}
-
-void Context::setUnpackAlignment(GLint alignment)
-{
- mState.unpackParameters.alignment = alignment;
-}
-
-const gl::PixelStorageModes &Context::getUnpackParameters() const
-{
- return mState.unpackParameters;
-}
-
-void Context::setPackRowLength(GLint rowLength)
-{
- mState.packParameters.rowLength = rowLength;
-}
-
-void Context::setPackSkipPixels(GLint skipPixels)
-{
- mState.packParameters.skipPixels = skipPixels;
-}
-
-void Context::setPackSkipRows(GLint skipRows)
-{
- mState.packParameters.skipRows = skipRows;
-}
-
-void Context::setUnpackRowLength(GLint rowLength)
-{
- mState.unpackParameters.rowLength = rowLength;
-}
-
-void Context::setUnpackImageHeight(GLint imageHeight)
-{
- mState.unpackParameters.imageHeight = imageHeight;
-}
-
-void Context::setUnpackSkipPixels(GLint skipPixels)
-{
- mState.unpackParameters.skipPixels = skipPixels;
-}
-
-void Context::setUnpackSkipRows(GLint skipRows)
-{
- mState.unpackParameters.skipRows = skipRows;
-}
-
-void Context::setUnpackSkipImages(GLint skipImages)
-{
- mState.unpackParameters.skipImages = skipImages;
-}
-
-GLuint Context::createBuffer()
-{
- return mResourceManager->createBuffer();
-}
-
-GLuint Context::createProgram()
-{
- return mResourceManager->createProgram();
-}
-
-GLuint Context::createShader(GLenum type)
-{
- return mResourceManager->createShader(type);
-}
-
-GLuint Context::createTexture()
-{
- return mResourceManager->createTexture();
-}
-
-GLuint Context::createRenderbuffer()
-{
- return mResourceManager->createRenderbuffer();
-}
-
-// Returns an unused framebuffer name
-GLuint Context::createFramebuffer()
-{
- return mFramebufferNameSpace.allocate();
-}
-
-GLuint Context::createFence()
-{
- return mFenceNameSpace.allocate(new Fence());
-}
-
-// Returns an unused query name
-GLuint Context::createQuery()
-{
- return mQueryNameSpace.allocate();
-}
-
-// Returns an unused vertex array name
-GLuint Context::createVertexArray()
-{
- return mVertexArrayNameSpace.allocate();
-}
-
-GLsync Context::createFenceSync(GLenum condition, GLbitfield flags)
-{
- GLuint handle = mResourceManager->createFenceSync(condition, flags);
-
- return reinterpret_cast<GLsync>(static_cast<uintptr_t>(handle));
-}
-
-// Returns an unused transform feedback name
-GLuint Context::createTransformFeedback()
-{
- return mTransformFeedbackNameSpace.allocate();
-}
-
-// Returns an unused sampler name
-GLuint Context::createSampler()
-{
- return mResourceManager->createSampler();
-}
-
-void Context::deleteBuffer(GLuint buffer)
-{
- detachBuffer(buffer);
-
- mResourceManager->deleteBuffer(buffer);
-}
-
-void Context::deleteShader(GLuint shader)
-{
- mResourceManager->deleteShader(shader);
-}
-
-void Context::deleteProgram(GLuint program)
-{
- mResourceManager->deleteProgram(program);
-}
-
-void Context::deleteTexture(GLuint texture)
-{
- detachTexture(texture);
-
- mResourceManager->deleteTexture(texture);
-}
-
-void Context::deleteRenderbuffer(GLuint renderbuffer)
-{
- if(mResourceManager->getRenderbuffer(renderbuffer))
- {
- detachRenderbuffer(renderbuffer);
- }
-
- mResourceManager->deleteRenderbuffer(renderbuffer);
-}
-
-void Context::deleteFramebuffer(GLuint framebuffer)
-{
- detachFramebuffer(framebuffer);
-
- Framebuffer *framebufferObject = mFramebufferNameSpace.remove(framebuffer);
-
- if(framebufferObject)
- {
- delete framebufferObject;
- }
-}
-
-void Context::deleteFence(GLuint fence)
-{
- Fence *fenceObject = mFenceNameSpace.remove(fence);
-
- if(fenceObject)
- {
- delete fenceObject;
- }
-}
-
-void Context::deleteQuery(GLuint query)
-{
- Query *queryObject = mQueryNameSpace.remove(query);
-
- if(queryObject)
- {
- queryObject->release();
- }
-}
-
-void Context::deleteVertexArray(GLuint vertexArray)
-{
- // [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(getCurrentVertexArray()->name == vertexArray)
- {
- bindVertexArray(0);
- }
-
- VertexArray *vertexArrayObject = mVertexArrayNameSpace.remove(vertexArray);
-
- if(vertexArrayObject)
- {
- delete vertexArrayObject;
- }
-}
-
-void Context::deleteFenceSync(GLsync fenceSync)
-{
- // 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.
- mResourceManager->deleteFenceSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(fenceSync)));
-}
-
-void Context::deleteTransformFeedback(GLuint transformFeedback)
-{
- TransformFeedback *transformFeedbackObject = mTransformFeedbackNameSpace.remove(transformFeedback);
-
- // Detach if currently bound.
- if(mState.transformFeedback == transformFeedback)
- {
- mState.transformFeedback = 0;
- }
-
- if(transformFeedbackObject)
- {
- delete transformFeedbackObject;
- }
-}
-
-void Context::deleteSampler(GLuint sampler)
-{
- detachSampler(sampler);
-
- mResourceManager->deleteSampler(sampler);
-}
-
-Buffer *Context::getBuffer(GLuint handle) const
-{
- return mResourceManager->getBuffer(handle);
-}
-
-Shader *Context::getShader(GLuint handle) const
-{
- return mResourceManager->getShader(handle);
-}
-
-Program *Context::getProgram(GLuint handle) const
-{
- return mResourceManager->getProgram(handle);
-}
-
-Texture *Context::getTexture(GLuint handle) const
-{
- return mResourceManager->getTexture(handle);
-}
-
-Renderbuffer *Context::getRenderbuffer(GLuint handle) const
-{
- return mResourceManager->getRenderbuffer(handle);
-}
-
-Framebuffer *Context::getReadFramebuffer() const
-{
- return getFramebuffer(mState.readFramebuffer);
-}
-
-Framebuffer *Context::getDrawFramebuffer() const
-{
- return getFramebuffer(mState.drawFramebuffer);
-}
-
-void Context::bindArrayBuffer(unsigned int buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.arrayBuffer = getBuffer(buffer);
-}
-
-void Context::bindElementArrayBuffer(unsigned int buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- getCurrentVertexArray()->setElementArrayBuffer(getBuffer(buffer));
-}
-
-void Context::bindCopyReadBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.copyReadBuffer = getBuffer(buffer);
-}
-
-void Context::bindCopyWriteBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.copyWriteBuffer = getBuffer(buffer);
-}
-
-void Context::bindPixelPackBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.pixelPackBuffer = getBuffer(buffer);
-}
-
-void Context::bindPixelUnpackBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.pixelUnpackBuffer = getBuffer(buffer);
-}
-
-void Context::bindTransformFeedbackBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.genericTransformFeedbackBuffer = getBuffer(buffer);
-}
-
-void Context::bindTexture(TextureType type, GLuint texture)
-{
- mResourceManager->checkTextureAllocation(texture, type);
-
- mState.samplerTexture[type][mState.activeSampler] = getTexture(texture);
-}
-
-void Context::bindReadFramebuffer(GLuint framebuffer)
-{
- if(!getFramebuffer(framebuffer))
- {
- if(framebuffer == 0)
- {
- mFramebufferNameSpace.insert(framebuffer, new DefaultFramebuffer());
- }
- else
- {
- mFramebufferNameSpace.insert(framebuffer, new Framebuffer());
- }
- }
-
- mState.readFramebuffer = framebuffer;
-}
-
-void Context::bindDrawFramebuffer(GLuint framebuffer)
-{
- if(!getFramebuffer(framebuffer))
- {
- if(framebuffer == 0)
- {
- mFramebufferNameSpace.insert(framebuffer, new DefaultFramebuffer());
- }
- else
- {
- mFramebufferNameSpace.insert(framebuffer, new Framebuffer());
- }
- }
-
- mState.drawFramebuffer = framebuffer;
-}
-
-void Context::bindRenderbuffer(GLuint renderbuffer)
-{
- mResourceManager->checkRenderbufferAllocation(renderbuffer);
-
- mState.renderbuffer = getRenderbuffer(renderbuffer);
-}
-
-void Context::bindVertexArray(GLuint array)
-{
- VertexArray *vertexArray = getVertexArray(array);
-
- if(!vertexArray)
- {
- vertexArray = new VertexArray(array);
- mVertexArrayNameSpace.insert(array, vertexArray);
- }
-
- mState.vertexArray = array;
-}
-
-void Context::bindGenericUniformBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.genericUniformBuffer = getBuffer(buffer);
-}
-
-void Context::bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- Buffer* bufferObject = getBuffer(buffer);
- mState.uniformBuffers[index].set(bufferObject, static_cast<int>(offset), static_cast<int>(size));
-}
-
-void Context::bindGenericTransformFeedbackBuffer(GLuint buffer)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- mState.genericTransformFeedbackBuffer = getBuffer(buffer);
-}
-
-void Context::bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size)
-{
- mResourceManager->checkBufferAllocation(buffer);
-
- Buffer* bufferObject = getBuffer(buffer);
- getTransformFeedback()->setBuffer(index, bufferObject, offset, size);
- mState.genericTransformFeedbackBuffer = bufferObject;
-}
-
-void Context::bindTransformFeedback(GLuint id)
-{
- if(!getTransformFeedback(id))
- {
- mTransformFeedbackNameSpace.insert(id, new TransformFeedback(id));
- }
-
- mState.transformFeedback = id;
-}
-
-bool Context::bindSampler(GLuint unit, GLuint sampler)
-{
- mResourceManager->checkSamplerAllocation(sampler);
-
- Sampler* samplerObject = getSampler(sampler);
-
- mState.sampler[unit] = samplerObject;
-
- return !!samplerObject;
-}
-
-void Context::useProgram(GLuint program)
-{
- GLuint priorProgram = mState.currentProgram;
- mState.currentProgram = program; // Must switch before trying to delete, otherwise it only gets flagged.
-
- if(priorProgram != program)
- {
- Program *newProgram = mResourceManager->getProgram(program);
- Program *oldProgram = mResourceManager->getProgram(priorProgram);
-
- if(newProgram)
- {
- newProgram->addRef();
- }
-
- if(oldProgram)
- {
- oldProgram->release();
- }
- }
-}
-
-void Context::beginQuery(GLenum target, GLuint query)
-{
- // From EXT_occlusion_query_boolean: If BeginQueryEXT is called with an <id>
- // of zero, if the active query object name for <target> is non-zero (for the
- // targets ANY_SAMPLES_PASSED_EXT and ANY_SAMPLES_PASSED_CONSERVATIVE_EXT, if
- // the active query for either target is non-zero), if <id> is the name of an
- // existing query object whose type does not match <target>, or if <id> is the
- // active query object name for any query type, the error INVALID_OPERATION is
- // generated.
-
- // Ensure no other queries are active
- // NOTE: If other queries than occlusion are supported, we will need to check
- // separately that:
- // a) The query ID passed is not the current active query for any target/type
- // b) There are no active queries for the requested target (and in the case
- // of GL_ANY_SAMPLES_PASSED_EXT and GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT,
- // no query may be active for either if glBeginQuery targets either.
- for(int i = 0; i < QUERY_TYPE_COUNT; i++)
- {
- if(mState.activeQuery[i])
- {
- switch(mState.activeQuery[i]->getType())
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- if((target == GL_ANY_SAMPLES_PASSED_EXT) ||
- (target == GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT))
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- if(target == GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- break;
- }
- }
- }
-
- QueryType qType;
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED;
- break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE;
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- qType = QUERY_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN;
- break;
- default:
- UNREACHABLE(target);
- return error(GL_INVALID_ENUM);
- }
-
- Query *queryObject = createQuery(query, target);
-
- // Check that name was obtained with glGenQueries
- if(!queryObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- // Check for type mismatch
- if(queryObject->getType() != target)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- // Set query as active for specified target
- mState.activeQuery[qType] = queryObject;
-
- // Begin query
- queryObject->begin();
-}
-
-void Context::endQuery(GLenum target)
-{
- QueryType qType;
-
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT: qType = QUERY_ANY_SAMPLES_PASSED; break;
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT: qType = QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE; break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: qType = QUERY_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN; break;
- default: UNREACHABLE(target); return;
- }
-
- Query *queryObject = mState.activeQuery[qType];
-
- if(!queryObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- queryObject->end();
-
- mState.activeQuery[qType] = nullptr;
-}
-
-void Context::setFramebufferZero(Framebuffer *buffer)
-{
- delete mFramebufferNameSpace.remove(0);
- mFramebufferNameSpace.insert(0, buffer);
-}
-
-void Context::setRenderbufferStorage(RenderbufferStorage *renderbuffer)
-{
- Renderbuffer *renderbufferObject = mState.renderbuffer;
- renderbufferObject->setStorage(renderbuffer);
-}
-
-Framebuffer *Context::getFramebuffer(unsigned int handle) const
-{
- return mFramebufferNameSpace.find(handle);
-}
-
-Fence *Context::getFence(unsigned int handle) const
-{
- return mFenceNameSpace.find(handle);
-}
-
-FenceSync *Context::getFenceSync(GLsync handle) const
-{
- return mResourceManager->getFenceSync(static_cast<GLuint>(reinterpret_cast<uintptr_t>(handle)));
-}
-
-Query *Context::getQuery(unsigned int handle) const
-{
- return mQueryNameSpace.find(handle);
-}
-
-Query *Context::createQuery(unsigned int handle, GLenum type)
-{
- if(!mQueryNameSpace.isReserved(handle))
- {
- return nullptr;
- }
- else
- {
- Query *query = mQueryNameSpace.find(handle);
- if(!query)
- {
- query = new Query(handle, type);
- query->addRef();
- mQueryNameSpace.insert(handle, query);
- }
-
- return query;
- }
-}
-
-VertexArray *Context::getVertexArray(GLuint array) const
-{
- return mVertexArrayNameSpace.find(array);
-}
-
-VertexArray *Context::getCurrentVertexArray() const
-{
- return getVertexArray(mState.vertexArray);
-}
-
-bool Context::isVertexArray(GLuint array) const
-{
- return mVertexArrayNameSpace.isReserved(array);
-}
-
-bool Context::hasZeroDivisor() const
-{
- // Verify there is at least one active attribute with a divisor of zero
- es2::Program *programObject = getCurrentProgram();
- for(int attributeIndex = 0; attributeIndex < MAX_VERTEX_ATTRIBS; attributeIndex++)
- {
- bool active = (programObject->getAttributeStream(attributeIndex) != -1);
- if(active && getCurrentVertexArray()->getVertexAttribute(attributeIndex).mDivisor == 0)
- {
- return true;
- }
- }
-
- return false;
-}
-
-TransformFeedback *Context::getTransformFeedback(GLuint transformFeedback) const
-{
- return mTransformFeedbackNameSpace.find(transformFeedback);
-}
-
-bool Context::isTransformFeedback(GLuint array) const
-{
- return mTransformFeedbackNameSpace.isReserved(array);
-}
-
-Sampler *Context::getSampler(GLuint sampler) const
-{
- return mResourceManager->getSampler(sampler);
-}
-
-bool Context::isSampler(GLuint sampler) const
-{
- return mResourceManager->isSampler(sampler);
-}
-
-Buffer *Context::getArrayBuffer() const
-{
- return mState.arrayBuffer;
-}
-
-Buffer *Context::getElementArrayBuffer() const
-{
- return getCurrentVertexArray()->getElementArrayBuffer();
-}
-
-Buffer *Context::getCopyReadBuffer() const
-{
- return mState.copyReadBuffer;
-}
-
-Buffer *Context::getCopyWriteBuffer() const
-{
- return mState.copyWriteBuffer;
-}
-
-Buffer *Context::getPixelPackBuffer() const
-{
- return mState.pixelPackBuffer;
-}
-
-Buffer *Context::getPixelUnpackBuffer() const
-{
- return mState.pixelUnpackBuffer;
-}
-
-Buffer *Context::getGenericUniformBuffer() const
-{
- return mState.genericUniformBuffer;
-}
-
-// The "required buffer size" is the number of bytes from the start of the
-// buffer to the last byte referenced within the buffer. If the caller of this
-// function has to worry about offsets within the buffer, it only needs to add
-// that byte offset to this function's return value to get its required buffer
-// size.
-size_t Context::getRequiredBufferSize(GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type) const
-{
- // 0-dimensional images have no bytes in them.
- if (width == 0 || height == 0 || depth == 0)
- {
- return 0;
- }
-
- GLint pixelsPerRow = (mState.unpackParameters.rowLength) > 0 ? mState.unpackParameters.rowLength : width;
- GLint rowsPerImage = (mState.unpackParameters.imageHeight) > 0 ? mState.unpackParameters.imageHeight : height;
-
- GLint bytesPerPixel = gl::ComputePixelSize(format, type);
- GLint bytesPerRow = gl::ComputePitch(pixelsPerRow, format, type, mState.unpackParameters.alignment);
- GLint bytesPerImage = rowsPerImage * bytesPerRow;
-
- // Depth and height are subtracted by 1, while width is not, because we're not
- // reading the full last row or image, but we are reading the full last pixel.
- return (mState.unpackParameters.skipImages + (depth - 1)) * bytesPerImage
- + (mState.unpackParameters.skipRows + (height - 1)) * bytesPerRow
- + (mState.unpackParameters.skipPixels + (width)) * bytesPerPixel;
-}
-
-GLenum Context::getPixels(const GLvoid **pixels, GLenum type, size_t imageSize) const
-{
- if(mState.pixelUnpackBuffer)
- {
- ASSERT(mState.pixelUnpackBuffer->name != 0);
-
- if(mState.pixelUnpackBuffer->isMapped())
- {
- return GL_INVALID_OPERATION;
- }
-
- size_t offset = static_cast<size_t>((ptrdiff_t)(*pixels));
-
- if(offset % GetTypeSize(type) != 0)
- {
- return GL_INVALID_OPERATION;
- }
-
- if(offset > mState.pixelUnpackBuffer->size())
- {
- return GL_INVALID_OPERATION;
- }
-
- if(mState.pixelUnpackBuffer->size() - offset < imageSize)
- {
- return GL_INVALID_OPERATION;
- }
-
- *pixels = static_cast<const unsigned char*>(mState.pixelUnpackBuffer->data()) + offset;
- }
-
- return GL_NO_ERROR;
-}
-
-bool Context::getBuffer(GLenum target, es2::Buffer **buffer) const
-{
- switch(target)
- {
- case GL_ARRAY_BUFFER:
- *buffer = getArrayBuffer();
- break;
- case GL_ELEMENT_ARRAY_BUFFER:
- *buffer = getElementArrayBuffer();
- break;
- case GL_COPY_READ_BUFFER:
- *buffer = getCopyReadBuffer();
- break;
- case GL_COPY_WRITE_BUFFER:
- *buffer = getCopyWriteBuffer();
- break;
- case GL_PIXEL_PACK_BUFFER:
- *buffer = getPixelPackBuffer();
- break;
- case GL_PIXEL_UNPACK_BUFFER:
- *buffer = getPixelUnpackBuffer();
- break;
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- *buffer = static_cast<es2::Buffer*>(mState.genericTransformFeedbackBuffer);
- break;
- case GL_UNIFORM_BUFFER:
- *buffer = getGenericUniformBuffer();
- break;
- default:
- return false;
- }
- return true;
-}
-
-TransformFeedback *Context::getTransformFeedback() const
-{
- return getTransformFeedback(mState.transformFeedback);
-}
-
-Program *Context::getCurrentProgram() const
-{
- return mResourceManager->getProgram(mState.currentProgram);
-}
-
-Texture *Context::getTargetTexture(GLenum target) const
-{
- Texture *texture = nullptr;
-
- switch(target)
- {
- case GL_TEXTURE_2D: texture = getTexture2D(); break;
- case GL_TEXTURE_2D_ARRAY: texture = getTexture2DArray(); break;
- case GL_TEXTURE_3D: texture = getTexture3D(); break;
- case GL_TEXTURE_CUBE_MAP: texture = getTextureCubeMap(); break;
- case GL_TEXTURE_EXTERNAL_OES: texture = getTextureExternal(); break;
- case GL_TEXTURE_RECTANGLE_ARB: texture = getTexture2DRect(); break;
- default:
- return error(GL_INVALID_ENUM, nullptr);
- }
-
- ASSERT(texture); // Must always have a default texture to fall back to.
-
- return texture;
-}
-
-Texture2D *Context::getTexture2D() const
-{
- return static_cast<Texture2D*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D));
-}
-
-Texture2D *Context::getTexture2D(GLenum target) const
-{
- switch(target)
- {
- case GL_TEXTURE_2D: return getTexture2D();
- case GL_TEXTURE_RECTANGLE_ARB: return getTexture2DRect();
- case GL_TEXTURE_EXTERNAL_OES: return getTextureExternal();
- default: UNREACHABLE(target);
- }
-
- return nullptr;
-}
-
-Texture3D *Context::getTexture3D() const
-{
- return static_cast<Texture3D*>(getSamplerTexture(mState.activeSampler, TEXTURE_3D));
-}
-
-Texture2DArray *Context::getTexture2DArray() const
-{
- return static_cast<Texture2DArray*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D_ARRAY));
-}
-
-TextureCubeMap *Context::getTextureCubeMap() const
-{
- return static_cast<TextureCubeMap*>(getSamplerTexture(mState.activeSampler, TEXTURE_CUBE));
-}
-
-Texture2DRect *Context::getTexture2DRect() const
-{
- return static_cast<Texture2DRect*>(getSamplerTexture(mState.activeSampler, TEXTURE_2D_RECT));
-}
-
-TextureExternal *Context::getTextureExternal() const
-{
- return static_cast<TextureExternal*>(getSamplerTexture(mState.activeSampler, TEXTURE_EXTERNAL));
-}
-
-Texture *Context::getSamplerTexture(unsigned int sampler, TextureType type) const
-{
- GLuint texid = mState.samplerTexture[type][sampler].name();
-
- if(texid == 0) // Special case: 0 refers to different initial textures based on the target
- {
- switch(type)
- {
- case TEXTURE_2D: return mTexture2DZero;
- case TEXTURE_3D: return mTexture3DZero;
- case TEXTURE_2D_ARRAY: return mTexture2DArrayZero;
- case TEXTURE_CUBE: return mTextureCubeMapZero;
- case TEXTURE_2D_RECT: return mTexture2DRectZero;
- case TEXTURE_EXTERNAL: return mTextureExternalZero;
- default: UNREACHABLE(type);
- }
- }
-
- return mState.samplerTexture[type][sampler];
-}
-
-void Context::samplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- mResourceManager->checkSamplerAllocation(sampler);
-
- Sampler *samplerObject = getSampler(sampler);
- ASSERT(samplerObject);
-
- switch(pname)
- {
- case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(static_cast<GLfloat>(param)); break;
- case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(static_cast<GLfloat>(param)); break;
- case GL_TEXTURE_COMPARE_MODE: samplerObject->setCompareMode(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_COMPARE_FUNC: samplerObject->setCompareFunc(static_cast<GLenum>(param)); break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: samplerObject->setMaxAnisotropy(static_cast<GLfloat>(param)); break;
- default: UNREACHABLE(pname); break;
- }
-}
-
-void Context::samplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- mResourceManager->checkSamplerAllocation(sampler);
-
- Sampler *samplerObject = getSampler(sampler);
- ASSERT(samplerObject);
-
- switch(pname)
- {
- case GL_TEXTURE_MIN_FILTER: samplerObject->setMinFilter(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_MAG_FILTER: samplerObject->setMagFilter(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_WRAP_S: samplerObject->setWrapS(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_WRAP_T: samplerObject->setWrapT(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_WRAP_R: samplerObject->setWrapR(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_MIN_LOD: samplerObject->setMinLod(param); break;
- case GL_TEXTURE_MAX_LOD: samplerObject->setMaxLod(param); break;
- case GL_TEXTURE_COMPARE_MODE: samplerObject->setCompareMode(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_COMPARE_FUNC: samplerObject->setCompareFunc(static_cast<GLenum>(roundf(param))); break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: samplerObject->setMaxAnisotropy(param); break;
- default: UNREACHABLE(pname); break;
- }
-}
-
-GLint Context::getSamplerParameteri(GLuint sampler, GLenum pname)
-{
- mResourceManager->checkSamplerAllocation(sampler);
-
- Sampler *samplerObject = getSampler(sampler);
- ASSERT(samplerObject);
-
- switch(pname)
- {
- case GL_TEXTURE_MIN_FILTER: return static_cast<GLint>(samplerObject->getMinFilter());
- case GL_TEXTURE_MAG_FILTER: return static_cast<GLint>(samplerObject->getMagFilter());
- case GL_TEXTURE_WRAP_S: return static_cast<GLint>(samplerObject->getWrapS());
- case GL_TEXTURE_WRAP_T: return static_cast<GLint>(samplerObject->getWrapT());
- case GL_TEXTURE_WRAP_R: return static_cast<GLint>(samplerObject->getWrapR());
- case GL_TEXTURE_MIN_LOD: return static_cast<GLint>(roundf(samplerObject->getMinLod()));
- case GL_TEXTURE_MAX_LOD: return static_cast<GLint>(roundf(samplerObject->getMaxLod()));
- case GL_TEXTURE_COMPARE_MODE: return static_cast<GLint>(samplerObject->getCompareMode());
- case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLint>(samplerObject->getCompareFunc());
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: return static_cast<GLint>(samplerObject->getMaxAnisotropy());
- default: UNREACHABLE(pname); return 0;
- }
-}
-
-GLfloat Context::getSamplerParameterf(GLuint sampler, GLenum pname)
-{
- mResourceManager->checkSamplerAllocation(sampler);
-
- Sampler *samplerObject = getSampler(sampler);
- ASSERT(samplerObject);
-
- switch(pname)
- {
- case GL_TEXTURE_MIN_FILTER: return static_cast<GLfloat>(samplerObject->getMinFilter());
- case GL_TEXTURE_MAG_FILTER: return static_cast<GLfloat>(samplerObject->getMagFilter());
- case GL_TEXTURE_WRAP_S: return static_cast<GLfloat>(samplerObject->getWrapS());
- case GL_TEXTURE_WRAP_T: return static_cast<GLfloat>(samplerObject->getWrapT());
- case GL_TEXTURE_WRAP_R: return static_cast<GLfloat>(samplerObject->getWrapR());
- case GL_TEXTURE_MIN_LOD: return samplerObject->getMinLod();
- case GL_TEXTURE_MAX_LOD: return samplerObject->getMaxLod();
- case GL_TEXTURE_COMPARE_MODE: return static_cast<GLfloat>(samplerObject->getCompareMode());
- case GL_TEXTURE_COMPARE_FUNC: return static_cast<GLfloat>(samplerObject->getCompareFunc());
- case GL_TEXTURE_MAX_ANISOTROPY_EXT: return samplerObject->getMaxAnisotropy();
- default: UNREACHABLE(pname); return 0;
- }
-}
-
-bool Context::getBooleanv(GLenum pname, GLboolean *params) const
-{
- switch(pname)
- {
- case GL_SHADER_COMPILER: *params = GL_TRUE; break;
- case GL_SAMPLE_COVERAGE_INVERT: *params = mState.sampleCoverageInvert; break;
- case GL_DEPTH_WRITEMASK: *params = mState.depthMask; break;
- case GL_COLOR_WRITEMASK:
- params[0] = mState.colorMaskRed;
- params[1] = mState.colorMaskGreen;
- params[2] = mState.colorMaskBlue;
- params[3] = mState.colorMaskAlpha;
- break;
- case GL_CULL_FACE: *params = mState.cullFaceEnabled; break;
- case GL_POLYGON_OFFSET_FILL: *params = mState.polygonOffsetFillEnabled; break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: *params = mState.sampleAlphaToCoverageEnabled; break;
- case GL_SAMPLE_COVERAGE: *params = mState.sampleCoverageEnabled; break;
- case GL_SCISSOR_TEST: *params = mState.scissorTestEnabled; break;
- case GL_STENCIL_TEST: *params = mState.stencilTestEnabled; break;
- case GL_DEPTH_TEST: *params = mState.depthTestEnabled; break;
- case GL_BLEND: *params = mState.blendEnabled; break;
- case GL_DITHER: *params = mState.ditherEnabled; break;
- case GL_PRIMITIVE_RESTART_FIXED_INDEX: *params = mState.primitiveRestartFixedIndexEnabled; break;
- case GL_RASTERIZER_DISCARD: *params = mState.rasterizerDiscardEnabled; break;
- case GL_TRANSFORM_FEEDBACK_ACTIVE:
- {
- TransformFeedback* transformFeedback = getTransformFeedback(mState.transformFeedback);
- if(transformFeedback)
- {
- *params = transformFeedback->isActive();
- break;
- }
- else return false;
- }
- case GL_TRANSFORM_FEEDBACK_PAUSED:
- {
- TransformFeedback* transformFeedback = getTransformFeedback(mState.transformFeedback);
- if(transformFeedback)
- {
- *params = transformFeedback->isPaused();
- break;
- }
- else return false;
- }
- default:
- return false;
- }
-
- return true;
-}
-
-bool Context::getFloatv(GLenum pname, GLfloat *params) const
-{
- // Please note: DEPTH_CLEAR_VALUE is included in our internal getFloatv implementation
- // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
- // GetIntegerv as its native query function. As it would require conversion in any
- // case, this should make no difference to the calling application.
- switch(pname)
- {
- case GL_LINE_WIDTH: *params = mState.lineWidth; break;
- case GL_SAMPLE_COVERAGE_VALUE: *params = mState.sampleCoverageValue; break;
- case GL_DEPTH_CLEAR_VALUE: *params = mState.depthClearValue; break;
- case GL_POLYGON_OFFSET_FACTOR: *params = mState.polygonOffsetFactor; break;
- case GL_POLYGON_OFFSET_UNITS: *params = mState.polygonOffsetUnits; break;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- params[0] = ALIASED_LINE_WIDTH_RANGE_MIN;
- params[1] = ALIASED_LINE_WIDTH_RANGE_MAX;
- break;
- case GL_ALIASED_POINT_SIZE_RANGE:
- params[0] = ALIASED_POINT_SIZE_RANGE_MIN;
- params[1] = ALIASED_POINT_SIZE_RANGE_MAX;
- break;
- case GL_DEPTH_RANGE:
- params[0] = mState.zNear;
- params[1] = mState.zFar;
- break;
- case GL_COLOR_CLEAR_VALUE:
- params[0] = mState.colorClearValue.red;
- params[1] = mState.colorClearValue.green;
- params[2] = mState.colorClearValue.blue;
- params[3] = mState.colorClearValue.alpha;
- break;
- case GL_BLEND_COLOR:
- params[0] = mState.blendColor.red;
- params[1] = mState.blendColor.green;
- params[2] = mState.blendColor.blue;
- params[3] = mState.blendColor.alpha;
- break;
- case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- *params = MAX_TEXTURE_MAX_ANISOTROPY;
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-template bool Context::getIntegerv<GLint>(GLenum pname, GLint *params) const;
-template bool Context::getIntegerv<GLint64>(GLenum pname, GLint64 *params) const;
-
-template<typename T> bool Context::getIntegerv(GLenum pname, T *params) const
-{
- // Please note: DEPTH_CLEAR_VALUE is not included in our internal getIntegerv implementation
- // because it is stored as a float, despite the fact that the GL ES 2.0 spec names
- // GetIntegerv as its native query function. As it would require conversion in any
- // case, this should make no difference to the calling application. You may find it in
- // Context::getFloatv.
- switch(pname)
- {
- case GL_MAX_VERTEX_ATTRIBS: *params = MAX_VERTEX_ATTRIBS; return true;
- case GL_MAX_VERTEX_UNIFORM_VECTORS: *params = MAX_VERTEX_UNIFORM_VECTORS; return true;
- case GL_MAX_VARYING_VECTORS: *params = MAX_VARYING_VECTORS; return true;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = MAX_COMBINED_TEXTURE_IMAGE_UNITS; return true;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = MAX_VERTEX_TEXTURE_IMAGE_UNITS; return true;
- case GL_MAX_TEXTURE_IMAGE_UNITS: *params = MAX_TEXTURE_IMAGE_UNITS; return true;
- case GL_MAX_FRAGMENT_UNIFORM_VECTORS: *params = MAX_FRAGMENT_UNIFORM_VECTORS; return true;
- case GL_MAX_RENDERBUFFER_SIZE: *params = IMPLEMENTATION_MAX_RENDERBUFFER_SIZE; return true;
- case GL_NUM_SHADER_BINARY_FORMATS: *params = 0; return true;
- case GL_SHADER_BINARY_FORMATS: /* no shader binary formats are supported */ return true;
- case GL_ARRAY_BUFFER_BINDING: *params = getArrayBufferName(); return true;
- case GL_ELEMENT_ARRAY_BUFFER_BINDING: *params = getElementArrayBufferName(); return true;
-// case GL_FRAMEBUFFER_BINDING: // now equivalent to GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_DRAW_FRAMEBUFFER_BINDING: *params = mState.drawFramebuffer; return true;
- case GL_READ_FRAMEBUFFER_BINDING: *params = mState.readFramebuffer; return true;
- case GL_RENDERBUFFER_BINDING: *params = mState.renderbuffer.name(); return true;
- case GL_CURRENT_PROGRAM: *params = mState.currentProgram; return true;
- case GL_PACK_ALIGNMENT: *params = mState.packParameters.alignment; return true;
- case GL_UNPACK_ALIGNMENT: *params = mState.unpackParameters.alignment; return true;
- case GL_GENERATE_MIPMAP_HINT: *params = mState.generateMipmapHint; return true;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: *params = mState.fragmentShaderDerivativeHint; return true;
- case GL_TEXTURE_FILTERING_HINT_CHROMIUM: *params = mState.textureFilteringHint; return true;
- case GL_ACTIVE_TEXTURE: *params = (mState.activeSampler + GL_TEXTURE0); return true;
- case GL_STENCIL_FUNC: *params = mState.stencilFunc; return true;
- case GL_STENCIL_REF: *params = mState.stencilRef; return true;
- case GL_STENCIL_VALUE_MASK: *params = sw::clampToSignedInt(mState.stencilMask); return true;
- case GL_STENCIL_BACK_FUNC: *params = mState.stencilBackFunc; return true;
- case GL_STENCIL_BACK_REF: *params = mState.stencilBackRef; return true;
- case GL_STENCIL_BACK_VALUE_MASK: *params = sw::clampToSignedInt(mState.stencilBackMask); return true;
- case GL_STENCIL_FAIL: *params = mState.stencilFail; return true;
- case GL_STENCIL_PASS_DEPTH_FAIL: *params = mState.stencilPassDepthFail; return true;
- case GL_STENCIL_PASS_DEPTH_PASS: *params = mState.stencilPassDepthPass; return true;
- case GL_STENCIL_BACK_FAIL: *params = mState.stencilBackFail; return true;
- case GL_STENCIL_BACK_PASS_DEPTH_FAIL: *params = mState.stencilBackPassDepthFail; return true;
- case GL_STENCIL_BACK_PASS_DEPTH_PASS: *params = mState.stencilBackPassDepthPass; return true;
- case GL_DEPTH_FUNC: *params = mState.depthFunc; return true;
- case GL_BLEND_SRC_RGB: *params = mState.sourceBlendRGB; return true;
- case GL_BLEND_SRC_ALPHA: *params = mState.sourceBlendAlpha; return true;
- case GL_BLEND_DST_RGB: *params = mState.destBlendRGB; return true;
- case GL_BLEND_DST_ALPHA: *params = mState.destBlendAlpha; return true;
- case GL_BLEND_EQUATION_RGB: *params = mState.blendEquationRGB; return true;
- case GL_BLEND_EQUATION_ALPHA: *params = mState.blendEquationAlpha; return true;
- case GL_STENCIL_WRITEMASK: *params = sw::clampToSignedInt(mState.stencilWritemask); return true;
- case GL_STENCIL_BACK_WRITEMASK: *params = sw::clampToSignedInt(mState.stencilBackWritemask); return true;
- case GL_STENCIL_CLEAR_VALUE: *params = mState.stencilClearValue; return true;
- case GL_SUBPIXEL_BITS: *params = 4; return true;
- case GL_MAX_RECTANGLE_TEXTURE_SIZE_ARB:
- case GL_MAX_TEXTURE_SIZE: *params = IMPLEMENTATION_MAX_TEXTURE_SIZE; return true;
- case GL_MAX_CUBE_MAP_TEXTURE_SIZE: *params = IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE; return true;
- case GL_NUM_COMPRESSED_TEXTURE_FORMATS: *params = NUM_COMPRESSED_TEXTURE_FORMATS; return true;
- case GL_MAX_SAMPLES: *params = IMPLEMENTATION_MAX_SAMPLES; return true;
- case GL_SAMPLE_BUFFERS:
- case GL_SAMPLES:
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- int width, height, samples;
-
- if(framebuffer && (framebuffer->completeness(width, height, samples) == GL_FRAMEBUFFER_COMPLETE))
- {
- switch(pname)
- {
- case GL_SAMPLE_BUFFERS:
- if(samples > 1)
- {
- *params = 1;
- }
- else
- {
- *params = 0;
- }
- break;
- case GL_SAMPLES:
- *params = samples;
- break;
- }
- }
- else
- {
- *params = 0;
- }
- }
- return true;
- case GL_IMPLEMENTATION_COLOR_READ_TYPE:
- {
- Framebuffer *framebuffer = getReadFramebuffer();
- if(framebuffer)
- {
- *params = framebuffer->getImplementationColorReadType();
- }
- else
- {
- return error(GL_INVALID_OPERATION, true);
- }
- }
- return true;
- case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
- {
- Framebuffer *framebuffer = getReadFramebuffer();
- if(framebuffer)
- {
- *params = framebuffer->getImplementationColorReadFormat();
- }
- else
- {
- return error(GL_INVALID_OPERATION, true);
- }
- }
- return true;
- case GL_MAX_VIEWPORT_DIMS:
- {
- int maxDimension = IMPLEMENTATION_MAX_RENDERBUFFER_SIZE;
- params[0] = maxDimension;
- params[1] = maxDimension;
- }
- return true;
- case GL_COMPRESSED_TEXTURE_FORMATS:
- {
- for(int i = 0; i < NUM_COMPRESSED_TEXTURE_FORMATS; i++)
- {
- params[i] = compressedTextureFormats[i];
- }
- }
- return true;
- case GL_VIEWPORT:
- params[0] = mState.viewportX;
- params[1] = mState.viewportY;
- params[2] = mState.viewportWidth;
- params[3] = mState.viewportHeight;
- return true;
- case GL_SCISSOR_BOX:
- params[0] = mState.scissorX;
- params[1] = mState.scissorY;
- params[2] = mState.scissorWidth;
- params[3] = mState.scissorHeight;
- return true;
- case GL_CULL_FACE_MODE: *params = mState.cullMode; return true;
- case GL_FRONT_FACE: *params = mState.frontFace; return true;
- case GL_RED_BITS:
- case GL_GREEN_BITS:
- case GL_BLUE_BITS:
- case GL_ALPHA_BITS:
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- Renderbuffer *colorbuffer = framebuffer ? framebuffer->getColorbuffer(0) : nullptr;
-
- if(colorbuffer)
- {
- switch(pname)
- {
- case GL_RED_BITS: *params = colorbuffer->getRedSize(); return true;
- case GL_GREEN_BITS: *params = colorbuffer->getGreenSize(); return true;
- case GL_BLUE_BITS: *params = colorbuffer->getBlueSize(); return true;
- case GL_ALPHA_BITS: *params = colorbuffer->getAlphaSize(); return true;
- }
- }
- else
- {
- *params = 0;
- }
- }
- return true;
- case GL_DEPTH_BITS:
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- Renderbuffer *depthbuffer = framebuffer ? framebuffer->getDepthbuffer() : nullptr;
-
- if(depthbuffer)
- {
- *params = depthbuffer->getDepthSize();
- }
- else
- {
- *params = 0;
- }
- }
- return true;
- case GL_STENCIL_BITS:
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- Renderbuffer *stencilbuffer = framebuffer ? framebuffer->getStencilbuffer() : nullptr;
-
- if(stencilbuffer)
- {
- *params = stencilbuffer->getStencilSize();
- }
- else
- {
- *params = 0;
- }
- }
- return true;
- case GL_TEXTURE_BINDING_2D:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_2D][mState.activeSampler].name();
- return true;
- case GL_TEXTURE_BINDING_CUBE_MAP:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_CUBE][mState.activeSampler].name();
- return true;
- case GL_TEXTURE_BINDING_RECTANGLE_ARB:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_2D_RECT][mState.activeSampler].name();
- return true;
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_EXTERNAL][mState.activeSampler].name();
- return true;
- case GL_TEXTURE_BINDING_3D_OES:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_3D][mState.activeSampler].name();
- return true;
- case GL_DRAW_BUFFER0:
- case GL_DRAW_BUFFER1:
- case GL_DRAW_BUFFER2:
- case GL_DRAW_BUFFER3:
- case GL_DRAW_BUFFER4:
- case GL_DRAW_BUFFER5:
- case GL_DRAW_BUFFER6:
- case GL_DRAW_BUFFER7:
- case GL_DRAW_BUFFER8:
- case GL_DRAW_BUFFER9:
- case GL_DRAW_BUFFER10:
- case GL_DRAW_BUFFER11:
- case GL_DRAW_BUFFER12:
- case GL_DRAW_BUFFER13:
- case GL_DRAW_BUFFER14:
- case GL_DRAW_BUFFER15:
- if((pname - GL_DRAW_BUFFER0) < MAX_DRAW_BUFFERS)
- {
- Framebuffer* framebuffer = getDrawFramebuffer();
- *params = framebuffer ? framebuffer->getDrawBuffer(pname - GL_DRAW_BUFFER0) : GL_NONE;
- }
- else
- {
- return false;
- }
- return true;
- case GL_MAX_DRAW_BUFFERS:
- *params = MAX_DRAW_BUFFERS;
- return true;
- case GL_MAX_COLOR_ATTACHMENTS: // Note: MAX_COLOR_ATTACHMENTS_EXT added by GL_EXT_draw_buffers
- *params = MAX_COLOR_ATTACHMENTS;
- return true;
- case GL_TEXTURE_BINDING_2D_ARRAY:
- if(mState.activeSampler > MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- error(GL_INVALID_OPERATION);
- return false;
- }
-
- *params = mState.samplerTexture[TEXTURE_2D_ARRAY][mState.activeSampler].name();
- return true;
- case GL_COPY_READ_BUFFER_BINDING:
- *params = mState.copyReadBuffer.name();
- return true;
- case GL_COPY_WRITE_BUFFER_BINDING:
- *params = mState.copyWriteBuffer.name();
- return true;
- case GL_MAJOR_VERSION:
- *params = 3;
- return true;
- case GL_MINOR_VERSION:
- *params = 0;
- return true;
- case GL_MAX_3D_TEXTURE_SIZE:
- *params = IMPLEMENTATION_MAX_3D_TEXTURE_SIZE;
- return true;
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- *params = IMPLEMENTATION_MAX_TEXTURE_SIZE;
- return true;
- case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- *params = MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS;
- return true;
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- *params = MAX_VERTEX_UNIFORM_BLOCKS + MAX_FRAGMENT_UNIFORM_BLOCKS;
- return true;
- case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- *params = MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS;
- return true;
- case GL_MAX_ELEMENT_INDEX:
- *params = MAX_ELEMENT_INDEX;
- return true;
- case GL_MAX_ELEMENTS_INDICES:
- *params = MAX_ELEMENTS_INDICES;
- return true;
- case GL_MAX_ELEMENTS_VERTICES:
- *params = MAX_ELEMENTS_VERTICES;
- return true;
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
- *params = MAX_FRAGMENT_INPUT_VECTORS * 4;
- return true;
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- *params = MAX_FRAGMENT_UNIFORM_BLOCKS;
- return true;
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
- *params = MAX_FRAGMENT_UNIFORM_COMPONENTS;
- return true;
- case GL_MAX_PROGRAM_TEXEL_OFFSET:
- // Note: SwiftShader has no actual texel offset limit, so this limit can be modified if required.
- // In any case, any behavior outside the specified range is valid since the spec mentions:
- // (see OpenGL ES 3.0.5, 3.8.10.1 Scale Factor and Level of Detail, p.153)
- // "If any of the offset values are outside the range of the implementation-defined values
- // MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, results of the texture lookup are
- // undefined."
- *params = MAX_PROGRAM_TEXEL_OFFSET;
- return true;
- case GL_MAX_SERVER_WAIT_TIMEOUT:
- *params = 0;
- return true;
- case GL_MAX_TEXTURE_LOD_BIAS:
- *params = MAX_TEXTURE_LOD_BIAS;
- return true;
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
- *params = sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS;
- return true;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
- *params = MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS;
- return true;
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
- *params = sw::MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS;
- return true;
- case GL_MAX_UNIFORM_BLOCK_SIZE:
- *params = MAX_UNIFORM_BLOCK_SIZE;
- return true;
- case GL_MAX_UNIFORM_BUFFER_BINDINGS:
- *params = MAX_UNIFORM_BUFFER_BINDINGS;
- return true;
- case GL_MAX_VARYING_COMPONENTS:
- *params = MAX_VARYING_VECTORS * 4;
- return true;
- case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
- *params = MAX_VERTEX_OUTPUT_VECTORS * 4;
- return true;
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- *params = MAX_VERTEX_UNIFORM_BLOCKS;
- return true;
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
- *params = MAX_VERTEX_UNIFORM_COMPONENTS;
- return true;
- case GL_MIN_PROGRAM_TEXEL_OFFSET:
- // Note: SwiftShader has no actual texel offset limit, so this limit can be modified if required.
- // In any case, any behavior outside the specified range is valid since the spec mentions:
- // (see OpenGL ES 3.0.5, 3.8.10.1 Scale Factor and Level of Detail, p.153)
- // "If any of the offset values are outside the range of the implementation-defined values
- // MIN_PROGRAM_TEXEL_OFFSET and MAX_PROGRAM_TEXEL_OFFSET, results of the texture lookup are
- // undefined."
- *params = MIN_PROGRAM_TEXEL_OFFSET;
- return true;
- case GL_NUM_EXTENSIONS:
- GLuint numExtensions;
- getExtensions(0, &numExtensions);
- *params = numExtensions;
- return true;
- case GL_NUM_PROGRAM_BINARY_FORMATS:
- *params = NUM_PROGRAM_BINARY_FORMATS;
- return true;
- case GL_PACK_ROW_LENGTH:
- *params = mState.packParameters.rowLength;
- return true;
- case GL_PACK_SKIP_PIXELS:
- *params = mState.packParameters.skipPixels;
- return true;
- case GL_PACK_SKIP_ROWS:
- *params = mState.packParameters.skipRows;
- return true;
- case GL_PIXEL_PACK_BUFFER_BINDING:
- *params = mState.pixelPackBuffer.name();
- return true;
- case GL_PIXEL_UNPACK_BUFFER_BINDING:
- *params = mState.pixelUnpackBuffer.name();
- return true;
- case GL_PROGRAM_BINARY_FORMATS:
- // Since NUM_PROGRAM_BINARY_FORMATS is 0, the input
- // should be a 0 sized array, so don't write to params
- return true;
- case GL_READ_BUFFER:
- {
- Framebuffer* framebuffer = getReadFramebuffer();
- *params = framebuffer ? framebuffer->getReadBuffer() : GL_NONE;
- }
- return true;
- case GL_SAMPLER_BINDING:
- *params = mState.sampler[mState.activeSampler].name();
- return true;
- case GL_UNIFORM_BUFFER_BINDING:
- *params = mState.genericUniformBuffer.name();
- return true;
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
- *params = UNIFORM_BUFFER_OFFSET_ALIGNMENT;
- return true;
- case GL_UNPACK_IMAGE_HEIGHT:
- *params = mState.unpackParameters.imageHeight;
- return true;
- case GL_UNPACK_ROW_LENGTH:
- *params = mState.unpackParameters.rowLength;
- return true;
- case GL_UNPACK_SKIP_IMAGES:
- *params = mState.unpackParameters.skipImages;
- return true;
- case GL_UNPACK_SKIP_PIXELS:
- *params = mState.unpackParameters.skipPixels;
- return true;
- case GL_UNPACK_SKIP_ROWS:
- *params = mState.unpackParameters.skipRows;
- return true;
- case GL_VERTEX_ARRAY_BINDING:
- *params = getCurrentVertexArray()->name;
- return true;
- case GL_TRANSFORM_FEEDBACK_BINDING:
- {
- TransformFeedback* transformFeedback = getTransformFeedback(mState.transformFeedback);
- if(transformFeedback)
- {
- *params = transformFeedback->name;
- }
- else
- {
- return false;
- }
- }
- return true;
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- {
- TransformFeedback* transformFeedback = getTransformFeedback(mState.transformFeedback);
- if(transformFeedback)
- {
- *params = mState.genericTransformFeedbackBuffer.name();
- }
- else
- {
- return false;
- }
- }
- return true;
- default:
- break;
- }
-
- return false;
-}
-
-template bool Context::getTransformFeedbackiv<GLint>(GLuint index, GLenum pname, GLint *param) const;
-template bool Context::getTransformFeedbackiv<GLint64>(GLuint index, GLenum pname, GLint64 *param) const;
-
-template<typename T> bool Context::getTransformFeedbackiv(GLuint index, GLenum pname, T *param) const
-{
- TransformFeedback* transformFeedback = getTransformFeedback(mState.transformFeedback);
- if(!transformFeedback)
- {
- return false;
- }
-
- switch(pname)
- {
- case GL_TRANSFORM_FEEDBACK_BINDING: // GLint, initially 0
- *param = transformFeedback->name;
- break;
- case GL_TRANSFORM_FEEDBACK_ACTIVE: // boolean, initially GL_FALSE
- *param = transformFeedback->isActive();
- break;
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: // name, initially 0
- *param = transformFeedback->getBufferName(index);
- break;
- case GL_TRANSFORM_FEEDBACK_PAUSED: // boolean, initially GL_FALSE
- *param = transformFeedback->isPaused();
- break;
- case GL_TRANSFORM_FEEDBACK_BUFFER_SIZE: // indexed[n] 64-bit integer, initially 0
- if(transformFeedback->getBuffer(index))
- {
- *param = transformFeedback->getSize(index);
- break;
- }
- else return false;
- case GL_TRANSFORM_FEEDBACK_BUFFER_START: // indexed[n] 64-bit integer, initially 0
- if(transformFeedback->getBuffer(index))
- {
- *param = transformFeedback->getOffset(index);
- break;
- }
- else return false;
- default:
- return false;
- }
-
- return true;
-}
-
-template bool Context::getUniformBufferiv<GLint>(GLuint index, GLenum pname, GLint *param) const;
-template bool Context::getUniformBufferiv<GLint64>(GLuint index, GLenum pname, GLint64 *param) const;
-
-template<typename T> bool Context::getUniformBufferiv(GLuint index, GLenum pname, T *param) const
-{
- switch(pname)
- {
- case GL_UNIFORM_BUFFER_BINDING:
- case GL_UNIFORM_BUFFER_SIZE:
- case GL_UNIFORM_BUFFER_START:
- break;
- default:
- return false;
- }
-
- if(index >= MAX_UNIFORM_BUFFER_BINDINGS)
- {
- return error(GL_INVALID_VALUE, true);
- }
-
- const BufferBinding& uniformBuffer = mState.uniformBuffers[index];
-
- switch(pname)
- {
- case GL_UNIFORM_BUFFER_BINDING: // name, initially 0
- *param = uniformBuffer.get().name();
- break;
- case GL_UNIFORM_BUFFER_SIZE: // indexed[n] 64-bit integer, initially 0
- *param = uniformBuffer.getSize();
- break;
- case GL_UNIFORM_BUFFER_START: // indexed[n] 64-bit integer, initially 0
- *param = uniformBuffer.getOffset();
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-bool Context::getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const
-{
- // 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 = NUM_COMPRESSED_TEXTURE_FORMATS;
- }
- break;
- case GL_SHADER_BINARY_FORMATS:
- {
- *type = GL_INT;
- *numParams = 0;
- }
- break;
- 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: // Same as GL_DRAW_FRAMEBUFFER_BINDING_ANGLE
- case GL_READ_FRAMEBUFFER_BINDING: // Same as GL_READ_FRAMEBUFFER_BINDING_ANGLE
- case GL_RENDERBUFFER_BINDING:
- case GL_CURRENT_PROGRAM:
- case GL_PACK_ALIGNMENT:
- case GL_UNPACK_ALIGNMENT:
- case GL_GENERATE_MIPMAP_HINT:
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- case GL_TEXTURE_FILTERING_HINT_CHROMIUM:
- 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_MAX_RECTANGLE_TEXTURE_SIZE_ARB:
- 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_TEXTURE_BINDING_RECTANGLE_ARB:
- case GL_TEXTURE_BINDING_EXTERNAL_OES:
- case GL_TEXTURE_BINDING_3D_OES:
- case GL_COPY_READ_BUFFER_BINDING:
- case GL_COPY_WRITE_BUFFER_BINDING:
- case GL_DRAW_BUFFER0:
- case GL_DRAW_BUFFER1:
- case GL_DRAW_BUFFER2:
- case GL_DRAW_BUFFER3:
- case GL_DRAW_BUFFER4:
- case GL_DRAW_BUFFER5:
- case GL_DRAW_BUFFER6:
- case GL_DRAW_BUFFER7:
- case GL_DRAW_BUFFER8:
- case GL_DRAW_BUFFER9:
- case GL_DRAW_BUFFER10:
- case GL_DRAW_BUFFER11:
- case GL_DRAW_BUFFER12:
- case GL_DRAW_BUFFER13:
- case GL_DRAW_BUFFER14:
- case GL_DRAW_BUFFER15:
- case GL_MAJOR_VERSION:
- case GL_MAX_3D_TEXTURE_SIZE:
- case GL_MAX_ARRAY_TEXTURE_LAYERS:
- case GL_MAX_COLOR_ATTACHMENTS:
- case GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS:
- case GL_MAX_COMBINED_UNIFORM_BLOCKS:
- case GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS:
- case GL_MAX_DRAW_BUFFERS:
- case GL_MAX_ELEMENT_INDEX:
- case GL_MAX_ELEMENTS_INDICES:
- case GL_MAX_ELEMENTS_VERTICES:
- case GL_MAX_FRAGMENT_INPUT_COMPONENTS:
- case GL_MAX_FRAGMENT_UNIFORM_BLOCKS:
- case GL_MAX_FRAGMENT_UNIFORM_COMPONENTS:
- case GL_MAX_PROGRAM_TEXEL_OFFSET:
- case GL_MAX_SERVER_WAIT_TIMEOUT:
- case GL_MAX_TEXTURE_LOD_BIAS:
- case GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS:
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS:
- case GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS:
- case GL_MAX_UNIFORM_BLOCK_SIZE:
- case GL_MAX_UNIFORM_BUFFER_BINDINGS:
- case GL_MAX_VARYING_COMPONENTS:
- case GL_MAX_VERTEX_OUTPUT_COMPONENTS:
- case GL_MAX_VERTEX_UNIFORM_BLOCKS:
- case GL_MAX_VERTEX_UNIFORM_COMPONENTS:
- case GL_MIN_PROGRAM_TEXEL_OFFSET:
- case GL_MINOR_VERSION:
- case GL_NUM_EXTENSIONS:
- case GL_NUM_PROGRAM_BINARY_FORMATS:
- case GL_PACK_ROW_LENGTH:
- case GL_PACK_SKIP_PIXELS:
- case GL_PACK_SKIP_ROWS:
- case GL_PIXEL_PACK_BUFFER_BINDING:
- case GL_PIXEL_UNPACK_BUFFER_BINDING:
- case GL_PROGRAM_BINARY_FORMATS:
- case GL_READ_BUFFER:
- case GL_SAMPLER_BINDING:
- case GL_TEXTURE_BINDING_2D_ARRAY:
- case GL_UNIFORM_BUFFER_BINDING:
- case GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT:
- case GL_UNPACK_IMAGE_HEIGHT:
- case GL_UNPACK_ROW_LENGTH:
- case GL_UNPACK_SKIP_IMAGES:
- case GL_UNPACK_SKIP_PIXELS:
- case GL_UNPACK_SKIP_ROWS:
- case GL_VERTEX_ARRAY_BINDING:
- case GL_TRANSFORM_FEEDBACK_BINDING:
- case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING:
- {
- *type = GL_INT;
- *numParams = 1;
- }
- break;
- case GL_MAX_SAMPLES:
- {
- *type = GL_INT;
- *numParams = 1;
- }
- break;
- case GL_MAX_VIEWPORT_DIMS:
- {
- *type = GL_INT;
- *numParams = 2;
- }
- break;
- case GL_VIEWPORT:
- case GL_SCISSOR_BOX:
- {
- *type = GL_INT;
- *numParams = 4;
- }
- break;
- 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_PRIMITIVE_RESTART_FIXED_INDEX:
- case GL_RASTERIZER_DISCARD:
- case GL_TRANSFORM_FEEDBACK_ACTIVE:
- case GL_TRANSFORM_FEEDBACK_PAUSED:
- {
- *type = GL_BOOL;
- *numParams = 1;
- }
- break;
- case GL_COLOR_WRITEMASK:
- {
- *type = GL_BOOL;
- *numParams = 4;
- }
- break;
- 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;
- }
- break;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- case GL_ALIASED_POINT_SIZE_RANGE:
- case GL_DEPTH_RANGE:
- {
- *type = GL_FLOAT;
- *numParams = 2;
- }
- break;
- case GL_COLOR_CLEAR_VALUE:
- case GL_BLEND_COLOR:
- {
- *type = GL_FLOAT;
- *numParams = 4;
- }
- break;
- case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT:
- *type = GL_FLOAT;
- *numParams = 1;
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-void Context::applyScissor(int width, int height)
-{
- if(mState.scissorTestEnabled)
- {
- sw::Rect scissor = { mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight };
- scissor.clip(0, 0, width, height);
-
- device->setScissorRect(scissor);
- device->setScissorEnable(true);
- }
- else
- {
- device->setScissorEnable(false);
- }
-}
-
-// Applies the render target surface, depth stencil surface, viewport rectangle and scissor rectangle
-bool Context::applyRenderTarget()
-{
- Framebuffer *framebuffer = getDrawFramebuffer();
- int width, height, samples;
-
- if(!framebuffer || (framebuffer->completeness(width, height, samples) != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION, false);
- }
-
- for(int i = 0; i < MAX_DRAW_BUFFERS; i++)
- {
- if(framebuffer->getDrawBuffer(i) != GL_NONE)
- {
- egl::Image *renderTarget = framebuffer->getRenderTarget(i);
- GLint layer = framebuffer->getColorbufferLayer(i);
- device->setRenderTarget(i, renderTarget, layer);
- if(renderTarget) renderTarget->release();
- }
- else
- {
- device->setRenderTarget(i, nullptr, 0);
- }
- }
-
- egl::Image *depthBuffer = framebuffer->getDepthBuffer();
- GLint dLayer = framebuffer->getDepthbufferLayer();
- device->setDepthBuffer(depthBuffer, dLayer);
- if(depthBuffer) depthBuffer->release();
-
- egl::Image *stencilBuffer = framebuffer->getStencilBuffer();
- GLint sLayer = framebuffer->getStencilbufferLayer();
- device->setStencilBuffer(stencilBuffer, sLayer);
- if(stencilBuffer) stencilBuffer->release();
-
- Viewport viewport;
- float zNear = clamp01(mState.zNear);
- float zFar = clamp01(mState.zFar);
-
- viewport.x0 = mState.viewportX;
- viewport.y0 = mState.viewportY;
- viewport.width = mState.viewportWidth;
- viewport.height = mState.viewportHeight;
- viewport.minZ = zNear;
- viewport.maxZ = zFar;
-
- if (viewport.x0 > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
- viewport.y0 > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)
- {
- TransformFeedback* transformFeedback = getTransformFeedback();
- if (!transformFeedback->isActive() || transformFeedback->isPaused())
- {
- return false;
- }
- else
- {
- viewport.x0 = 0;
- viewport.y0 = 0;
- viewport.width = 0;
- viewport.height = 0;
- }
- }
-
- device->setViewport(viewport);
-
- applyScissor(width, height);
-
- Program *program = getCurrentProgram();
-
- if(program)
- {
- GLfloat nearFarDiff[3] = {zNear, zFar, zFar - zNear};
- program->setUniform1fv(program->getUniformLocation("gl_DepthRange.near"), 1, &nearFarDiff[0]);
- program->setUniform1fv(program->getUniformLocation("gl_DepthRange.far"), 1, &nearFarDiff[1]);
- program->setUniform1fv(program->getUniformLocation("gl_DepthRange.diff"), 1, &nearFarDiff[2]);
- }
-
- return true;
-}
-
-// Applies the fixed-function state (culling, depth test, alpha blending, stenciling, etc)
-void Context::applyState(GLenum drawMode)
-{
- Framebuffer *framebuffer = getDrawFramebuffer();
- bool frontFaceCCW = (mState.frontFace == GL_CCW);
-
- if(mState.cullFaceEnabled)
- {
- device->setCullMode(es2sw::ConvertCullMode(mState.cullMode, mState.frontFace), frontFaceCCW);
- }
- else
- {
- device->setCullMode(sw::CULL_NONE, frontFaceCCW);
- }
-
- if(mDepthStateDirty)
- {
- if(mState.depthTestEnabled)
- {
- device->setDepthBufferEnable(true);
- device->setDepthCompare(es2sw::ConvertDepthComparison(mState.depthFunc));
- }
- else
- {
- device->setDepthBufferEnable(false);
- }
-
- mDepthStateDirty = false;
- }
-
- if(mBlendStateDirty)
- {
- if(mState.blendEnabled)
- {
- device->setAlphaBlendEnable(true);
- device->setSeparateAlphaBlendEnable(true);
-
- device->setBlendConstant(es2sw::ConvertColor(mState.blendColor));
-
- device->setSourceBlendFactor(es2sw::ConvertBlendFunc(mState.sourceBlendRGB));
- device->setDestBlendFactor(es2sw::ConvertBlendFunc(mState.destBlendRGB));
- device->setBlendOperation(es2sw::ConvertBlendOp(mState.blendEquationRGB));
-
- device->setSourceBlendFactorAlpha(es2sw::ConvertBlendFunc(mState.sourceBlendAlpha));
- device->setDestBlendFactorAlpha(es2sw::ConvertBlendFunc(mState.destBlendAlpha));
- device->setBlendOperationAlpha(es2sw::ConvertBlendOp(mState.blendEquationAlpha));
- }
- else
- {
- device->setAlphaBlendEnable(false);
- }
-
- mBlendStateDirty = false;
- }
-
- if(mStencilStateDirty || mFrontFaceDirty)
- {
- if(mState.stencilTestEnabled && framebuffer->hasStencil())
- {
- device->setStencilEnable(true);
- device->setTwoSidedStencil(true);
-
- // get the maximum size of the stencil ref
- Renderbuffer *stencilbuffer = framebuffer->getStencilbuffer();
- GLuint maxStencil = (1 << stencilbuffer->getStencilSize()) - 1;
-
- if(mState.frontFace == GL_CCW)
- {
- device->setStencilWriteMask(mState.stencilWritemask);
- device->setStencilCompare(es2sw::ConvertStencilComparison(mState.stencilFunc));
-
- device->setStencilReference((mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
- device->setStencilMask(mState.stencilMask);
-
- device->setStencilFailOperation(es2sw::ConvertStencilOp(mState.stencilFail));
- device->setStencilZFailOperation(es2sw::ConvertStencilOp(mState.stencilPassDepthFail));
- device->setStencilPassOperation(es2sw::ConvertStencilOp(mState.stencilPassDepthPass));
-
- device->setStencilWriteMaskCCW(mState.stencilBackWritemask);
- device->setStencilCompareCCW(es2sw::ConvertStencilComparison(mState.stencilBackFunc));
-
- device->setStencilReferenceCCW((mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
- device->setStencilMaskCCW(mState.stencilBackMask);
-
- device->setStencilFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackFail));
- device->setStencilZFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackPassDepthFail));
- device->setStencilPassOperationCCW(es2sw::ConvertStencilOp(mState.stencilBackPassDepthPass));
- }
- else
- {
- device->setStencilWriteMaskCCW(mState.stencilWritemask);
- device->setStencilCompareCCW(es2sw::ConvertStencilComparison(mState.stencilFunc));
-
- device->setStencilReferenceCCW((mState.stencilRef < (GLint)maxStencil) ? mState.stencilRef : maxStencil);
- device->setStencilMaskCCW(mState.stencilMask);
-
- device->setStencilFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilFail));
- device->setStencilZFailOperationCCW(es2sw::ConvertStencilOp(mState.stencilPassDepthFail));
- device->setStencilPassOperationCCW(es2sw::ConvertStencilOp(mState.stencilPassDepthPass));
-
- device->setStencilWriteMask(mState.stencilBackWritemask);
- device->setStencilCompare(es2sw::ConvertStencilComparison(mState.stencilBackFunc));
-
- device->setStencilReference((mState.stencilBackRef < (GLint)maxStencil) ? mState.stencilBackRef : maxStencil);
- device->setStencilMask(mState.stencilBackMask);
-
- device->setStencilFailOperation(es2sw::ConvertStencilOp(mState.stencilBackFail));
- device->setStencilZFailOperation(es2sw::ConvertStencilOp(mState.stencilBackPassDepthFail));
- device->setStencilPassOperation(es2sw::ConvertStencilOp(mState.stencilBackPassDepthPass));
- }
- }
- else
- {
- device->setStencilEnable(false);
- }
-
- mStencilStateDirty = false;
- mFrontFaceDirty = false;
- }
-
- if(mMaskStateDirty)
- {
- for(int i = 0; i < MAX_DRAW_BUFFERS; i++)
- {
- device->setColorWriteMask(i, es2sw::ConvertColorMask(mState.colorMaskRed, mState.colorMaskGreen, mState.colorMaskBlue, mState.colorMaskAlpha));
- }
-
- device->setDepthWriteEnable(mState.depthMask);
-
- mMaskStateDirty = false;
- }
-
- if(mPolygonOffsetStateDirty)
- {
- if(mState.polygonOffsetFillEnabled)
- {
- Renderbuffer *depthbuffer = framebuffer->getDepthbuffer();
- if(depthbuffer)
- {
- device->setSlopeDepthBias(mState.polygonOffsetFactor);
- float depthBias = ldexp(mState.polygonOffsetUnits, -23); // We use 32-bit floating-point for all depth formats, with 23 mantissa bits.
- device->setDepthBias(depthBias);
- }
- }
- else
- {
- device->setSlopeDepthBias(0);
- device->setDepthBias(0);
- }
-
- mPolygonOffsetStateDirty = false;
- }
-
- if(mSampleStateDirty)
- {
- if(mState.sampleAlphaToCoverageEnabled)
- {
- device->setTransparencyAntialiasing(sw::TRANSPARENCY_ALPHA_TO_COVERAGE);
- }
- else
- {
- device->setTransparencyAntialiasing(sw::TRANSPARENCY_NONE);
- }
-
- if(mState.sampleCoverageEnabled)
- {
- unsigned int mask = 0;
- if(mState.sampleCoverageValue != 0)
- {
- int width, height, samples;
- framebuffer->completeness(width, height, samples);
-
- float threshold = 0.5f;
-
- for(int i = 0; i < samples; i++)
- {
- mask <<= 1;
-
- if((i + 1) * mState.sampleCoverageValue >= threshold)
- {
- threshold += 1.0f;
- mask |= 1;
- }
- }
- }
-
- if(mState.sampleCoverageInvert)
- {
- mask = ~mask;
- }
-
- device->setMultiSampleMask(mask);
- }
- else
- {
- device->setMultiSampleMask(0xFFFFFFFF);
- }
-
- mSampleStateDirty = false;
- }
-
- if(mDitherStateDirty)
- {
- // UNIMPLEMENTED(); // FIXME
-
- mDitherStateDirty = false;
- }
-
- device->setRasterizerDiscard(mState.rasterizerDiscardEnabled);
-}
-
-GLenum Context::applyVertexBuffer(GLint base, GLint first, GLsizei count, GLsizei instanceId)
-{
- TranslatedAttribute attributes[MAX_VERTEX_ATTRIBS];
-
- GLenum err = mVertexDataManager->prepareVertexData(first, count, attributes, instanceId);
- if(err != GL_NO_ERROR)
- {
- return err;
- }
-
- Program *program = getCurrentProgram();
-
- device->resetInputStreams(false);
-
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- if(program->getAttributeStream(i) == -1)
- {
- continue;
- }
-
- sw::Resource *resource = attributes[i].vertexBuffer;
- const void *buffer = (char*)resource->data() + attributes[i].offset;
-
- int stride = attributes[i].stride;
-
- buffer = (char*)buffer + stride * base;
-
- sw::Stream attribute(resource, buffer, stride);
-
- attribute.type = attributes[i].type;
- attribute.count = attributes[i].count;
- attribute.normalized = attributes[i].normalized;
-
- int stream = program->getAttributeStream(i);
- device->setInputStream(stream, attribute);
- }
-
- return GL_NO_ERROR;
-}
-
-// Applies the indices and element array bindings
-GLenum Context::applyIndexBuffer(const void *indices, GLuint start, GLuint end, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo)
-{
- GLenum err = mIndexDataManager->prepareIndexData(mode, type, start, end, count, getCurrentVertexArray()->getElementArrayBuffer(), indices, indexInfo, isPrimitiveRestartFixedIndexEnabled());
-
- if(err == GL_NO_ERROR)
- {
- device->setIndexBuffer(indexInfo->indexBuffer);
- }
-
- return err;
-}
-
-// Applies the shaders and shader constants
-void Context::applyShaders()
-{
- Program *programObject = getCurrentProgram();
- sw::VertexShader *vertexShader = programObject->getVertexShader();
- sw::PixelShader *pixelShader = programObject->getPixelShader();
-
- device->setVertexShader(vertexShader);
- device->setPixelShader(pixelShader);
-
- if(programObject->getSerial() != mAppliedProgramSerial)
- {
- programObject->dirtyAllUniforms();
- mAppliedProgramSerial = programObject->getSerial();
- }
-
- programObject->applyTransformFeedback(device, getTransformFeedback());
- programObject->applyUniformBuffers(device, mState.uniformBuffers);
- programObject->applyUniforms(device);
-}
-
-void Context::applyTextures()
-{
- applyTextures(sw::SAMPLER_PIXEL);
- applyTextures(sw::SAMPLER_VERTEX);
-}
-
-void Context::applyTextures(sw::SamplerType samplerType)
-{
- Program *programObject = getCurrentProgram();
-
- int samplerCount = (samplerType == sw::SAMPLER_PIXEL) ? MAX_TEXTURE_IMAGE_UNITS : MAX_VERTEX_TEXTURE_IMAGE_UNITS; // Range of samplers of given sampler type
-
- for(int samplerIndex = 0; samplerIndex < samplerCount; samplerIndex++)
- {
- int textureUnit = programObject->getSamplerMapping(samplerType, samplerIndex); // OpenGL texture image unit index
-
- if(textureUnit != -1)
- {
- TextureType textureType = programObject->getSamplerTextureType(samplerType, samplerIndex);
-
- Texture *texture = getSamplerTexture(textureUnit, textureType);
- Sampler *samplerObject = mState.sampler[textureUnit];
-
- if(texture->isSamplerComplete(samplerObject))
- {
- GLenum wrapS, wrapT, wrapR, minFilter, magFilter, compFunc, compMode;
- GLfloat minLOD, maxLOD, maxAnisotropy;
-
- if(samplerObject)
- {
- wrapS = samplerObject->getWrapS();
- wrapT = samplerObject->getWrapT();
- wrapR = samplerObject->getWrapR();
- minFilter = samplerObject->getMinFilter();
- magFilter = samplerObject->getMagFilter();
- minLOD = samplerObject->getMinLod();
- maxLOD = samplerObject->getMaxLod();
- compFunc = samplerObject->getCompareFunc();
- compMode = samplerObject->getCompareMode();
- maxAnisotropy = samplerObject->getMaxAnisotropy();
- }
- else
- {
- wrapS = texture->getWrapS();
- wrapT = texture->getWrapT();
- wrapR = texture->getWrapR();
- minFilter = texture->getMinFilter();
- magFilter = texture->getMagFilter();
- minLOD = texture->getMinLOD();
- maxLOD = texture->getMaxLOD();
- compFunc = texture->getCompareFunc();
- compMode = texture->getCompareMode();
- maxAnisotropy = texture->getMaxAnisotropy();
- }
-
- GLint baseLevel = texture->getBaseLevel();
- GLint maxLevel = texture->getMaxLevel();
- GLenum swizzleR = texture->getSwizzleR();
- GLenum swizzleG = texture->getSwizzleG();
- GLenum swizzleB = texture->getSwizzleB();
- GLenum swizzleA = texture->getSwizzleA();
-
- device->setAddressingModeU(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapS));
- device->setAddressingModeV(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapT));
- device->setAddressingModeW(samplerType, samplerIndex, es2sw::ConvertTextureWrap(wrapR));
- device->setCompareFunc(samplerType, samplerIndex, es2sw::ConvertCompareFunc(compFunc, compMode));
- device->setSwizzleR(samplerType, samplerIndex, es2sw::ConvertSwizzleType(swizzleR));
- device->setSwizzleG(samplerType, samplerIndex, es2sw::ConvertSwizzleType(swizzleG));
- device->setSwizzleB(samplerType, samplerIndex, es2sw::ConvertSwizzleType(swizzleB));
- device->setSwizzleA(samplerType, samplerIndex, es2sw::ConvertSwizzleType(swizzleA));
- device->setMinLod(samplerType, samplerIndex, minLOD);
- device->setMaxLod(samplerType, samplerIndex, maxLOD);
- device->setBaseLevel(samplerType, samplerIndex, baseLevel);
- device->setMaxLevel(samplerType, samplerIndex, maxLevel);
- device->setTextureFilter(samplerType, samplerIndex, es2sw::ConvertTextureFilter(minFilter, magFilter, maxAnisotropy));
- device->setMipmapFilter(samplerType, samplerIndex, es2sw::ConvertMipMapFilter(minFilter));
- device->setMaxAnisotropy(samplerType, samplerIndex, maxAnisotropy);
- device->setHighPrecisionFiltering(samplerType, samplerIndex, mState.textureFilteringHint == GL_NICEST);
- device->setSyncRequired(samplerType, samplerIndex, texture->requiresSync());
-
- applyTexture(samplerType, samplerIndex, texture);
- }
- else
- {
- applyTexture(samplerType, samplerIndex, nullptr);
- }
- }
- else
- {
- applyTexture(samplerType, samplerIndex, nullptr);
- }
- }
-}
-
-void Context::applyTexture(sw::SamplerType type, int index, Texture *baseTexture)
-{
- Program *program = getCurrentProgram();
- int sampler = (type == sw::SAMPLER_PIXEL) ? index : 16 + index;
- bool textureUsed = false;
-
- if(type == sw::SAMPLER_PIXEL)
- {
- textureUsed = program->getPixelShader()->usesSampler(index);
- }
- else if(type == sw::SAMPLER_VERTEX)
- {
- textureUsed = program->getVertexShader()->usesSampler(index);
- }
- else UNREACHABLE(type);
-
- sw::Resource *resource = nullptr;
-
- if(baseTexture && textureUsed)
- {
- resource = baseTexture->getResource();
- }
-
- device->setTextureResource(sampler, resource);
-
- if(baseTexture && textureUsed)
- {
- int baseLevel = baseTexture->getBaseLevel();
- int maxLevel = std::min(baseTexture->getTopLevel(), baseTexture->getMaxLevel());
- GLenum target = baseTexture->getTarget();
-
- switch(target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_EXTERNAL_OES:
- case GL_TEXTURE_RECTANGLE_ARB:
- {
- Texture2D *texture = static_cast<Texture2D*>(baseTexture);
-
- for(int mipmapLevel = 0; mipmapLevel < sw::MIPMAP_LEVELS; mipmapLevel++)
- {
- int surfaceLevel = mipmapLevel + baseLevel;
-
- if(surfaceLevel > maxLevel)
- {
- surfaceLevel = maxLevel;
- }
-
- egl::Image *surface = texture->getImage(surfaceLevel);
- device->setTextureLevel(sampler, 0, mipmapLevel, surface,
- (target == GL_TEXTURE_RECTANGLE_ARB) ? sw::TEXTURE_RECTANGLE : sw::TEXTURE_2D);
- }
- }
- break;
- case GL_TEXTURE_3D:
- {
- Texture3D *texture = static_cast<Texture3D*>(baseTexture);
-
- for(int mipmapLevel = 0; mipmapLevel < sw::MIPMAP_LEVELS; mipmapLevel++)
- {
- int surfaceLevel = mipmapLevel + baseLevel;
-
- if(surfaceLevel > maxLevel)
- {
- surfaceLevel = maxLevel;
- }
-
- egl::Image *surface = texture->getImage(surfaceLevel);
- device->setTextureLevel(sampler, 0, mipmapLevel, surface, sw::TEXTURE_3D);
- }
- }
- break;
- case GL_TEXTURE_2D_ARRAY:
- {
- Texture2DArray *texture = static_cast<Texture2DArray*>(baseTexture);
-
- for(int mipmapLevel = 0; mipmapLevel < sw::MIPMAP_LEVELS; mipmapLevel++)
- {
- int surfaceLevel = mipmapLevel + baseLevel;
-
- if(surfaceLevel > maxLevel)
- {
- surfaceLevel = maxLevel;
- }
-
- egl::Image *surface = texture->getImage(surfaceLevel);
- device->setTextureLevel(sampler, 0, mipmapLevel, surface, sw::TEXTURE_2D_ARRAY);
- }
- }
- break;
- case GL_TEXTURE_CUBE_MAP:
- {
- TextureCubeMap *cubeTexture = static_cast<TextureCubeMap*>(baseTexture);
-
- for(int mipmapLevel = 0; mipmapLevel < sw::MIPMAP_LEVELS; mipmapLevel++)
- {
- cubeTexture->updateBorders(mipmapLevel);
-
- for(int face = 0; face < 6; face++)
- {
- int surfaceLevel = mipmapLevel + baseLevel;
-
- if(surfaceLevel > maxLevel)
- {
- surfaceLevel = maxLevel;
- }
-
- egl::Image *surface = cubeTexture->getImage(face, surfaceLevel);
- device->setTextureLevel(sampler, face, mipmapLevel, surface, sw::TEXTURE_CUBE);
- }
- }
- }
- break;
- default:
- UNIMPLEMENTED();
- break;
- }
- }
- else
- {
- device->setTextureLevel(sampler, 0, 0, 0, sw::TEXTURE_NULL);
- }
-}
-
-void Context::readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels)
-{
- Framebuffer *framebuffer = getReadFramebuffer();
- int framebufferWidth, framebufferHeight, framebufferSamples;
-
- if(!framebuffer || (framebuffer->completeness(framebufferWidth, framebufferHeight, framebufferSamples) != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if(getReadFramebufferName() != 0 && framebufferSamples != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!ValidateReadPixelsFormatType(framebuffer, format, type))
- {
- return;
- }
-
- GLsizei outputWidth = (mState.packParameters.rowLength > 0) ? mState.packParameters.rowLength : width;
- GLsizei outputPitch = gl::ComputePitch(outputWidth, format, type, mState.packParameters.alignment);
- GLsizei outputHeight = (mState.packParameters.imageHeight == 0) ? height : mState.packParameters.imageHeight;
- pixels = getPixelPackBuffer() ? (unsigned char*)getPixelPackBuffer()->data() + (ptrdiff_t)pixels : (unsigned char*)pixels;
- pixels = ((char*)pixels) + gl::ComputePackingOffset(format, type, outputWidth, outputHeight, mState.packParameters);
-
- // Sized query sanity check
- if(bufSize)
- {
- int requiredSize = outputPitch * height;
- if(requiredSize > *bufSize)
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- egl::Image *renderTarget = nullptr;
- switch(format)
- {
- case GL_DEPTH_COMPONENT: // GL_NV_read_depth
- renderTarget = framebuffer->getDepthBuffer();
- break;
- case GL_STENCIL_INDEX_OES: // GL_NV_read_stencil
- renderTarget = framebuffer->getStencilBuffer();
- break;
- default:
- renderTarget = framebuffer->getReadRenderTarget();
- break;
- }
-
- if(!renderTarget)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- sw::SliceRectF srcRect((float)x, (float)y, (float)(x + width), (float)(y + height), 0);
- sw::SliceRect dstRect(0, 0, width, height, 0);
- srcRect.clip(0.0f, 0.0f, (float)renderTarget->getWidth(), (float)renderTarget->getHeight());
-
- ASSERT(format != GL_DEPTH_STENCIL_OES); // The blitter only handles reading either depth or stencil.
- sw::Surface *externalSurface = sw::Surface::create(width, height, 1, es2::ConvertReadFormatType(format, type), pixels, outputPitch, outputPitch * outputHeight);
- device->blit(renderTarget, srcRect, externalSurface, dstRect, false, false, false);
- externalSurface->lockExternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
- externalSurface->unlockExternal();
- delete externalSurface;
-
- renderTarget->release();
-}
-
-void Context::clear(GLbitfield mask)
-{
- if(mState.rasterizerDiscardEnabled)
- {
- return;
- }
-
- Framebuffer *framebuffer = getDrawFramebuffer();
-
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if(!applyRenderTarget())
- {
- return;
- }
-
- if(mask & GL_COLOR_BUFFER_BIT)
- {
- unsigned int rgbaMask = getColorMask();
-
- if(rgbaMask != 0)
- {
- device->clearColor(mState.colorClearValue.red, mState.colorClearValue.green, mState.colorClearValue.blue, mState.colorClearValue.alpha, rgbaMask);
- }
- }
-
- if(mask & GL_DEPTH_BUFFER_BIT)
- {
- if(mState.depthMask != 0)
- {
- float depth = clamp01(mState.depthClearValue);
- device->clearDepth(depth);
- }
- }
-
- if(mask & GL_STENCIL_BUFFER_BIT)
- {
- if(mState.stencilWritemask != 0)
- {
- int stencil = mState.stencilClearValue & 0x000000FF;
- device->clearStencil(stencil, mState.stencilWritemask);
- }
- }
-}
-
-void Context::clearColorBuffer(GLint drawbuffer, void *value, sw::Format format)
-{
- unsigned int rgbaMask = getColorMask();
- if(rgbaMask && !mState.rasterizerDiscardEnabled)
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
- egl::Image *colorbuffer = framebuffer->getRenderTarget(drawbuffer);
-
- if(colorbuffer)
- {
- sw::Rect clearRect = colorbuffer->getRect();
-
- if(mState.scissorTestEnabled)
- {
- clearRect.clip(mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight);
- }
-
- device->clear(value, format, colorbuffer, clearRect, rgbaMask);
-
- colorbuffer->release();
- }
- }
-}
-
-void Context::clearColorBuffer(GLint drawbuffer, const GLint *value)
-{
- clearColorBuffer(drawbuffer, (void*)value, sw::FORMAT_A32B32G32R32I);
-}
-
-void Context::clearColorBuffer(GLint drawbuffer, const GLuint *value)
-{
- clearColorBuffer(drawbuffer, (void*)value, sw::FORMAT_A32B32G32R32UI);
-}
-
-void Context::clearColorBuffer(GLint drawbuffer, const GLfloat *value)
-{
- clearColorBuffer(drawbuffer, (void*)value, sw::FORMAT_A32B32G32R32F);
-}
-
-void Context::clearDepthBuffer(const GLfloat value)
-{
- if(mState.depthMask && !mState.rasterizerDiscardEnabled)
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
- egl::Image *depthbuffer = framebuffer->getDepthBuffer();
-
- if(depthbuffer)
- {
- float depth = clamp01(value);
- sw::Rect clearRect = depthbuffer->getRect();
-
- if(mState.scissorTestEnabled)
- {
- clearRect.clip(mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight);
- }
-
- depthbuffer->clearDepth(depth, clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
-
- depthbuffer->release();
- }
- }
-}
-
-void Context::clearStencilBuffer(const GLint value)
-{
- if(mState.stencilWritemask && !mState.rasterizerDiscardEnabled)
- {
- Framebuffer *framebuffer = getDrawFramebuffer();
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
- egl::Image *stencilbuffer = framebuffer->getStencilBuffer();
-
- if(stencilbuffer)
- {
- unsigned char stencil = value < 0 ? 0 : static_cast<unsigned char>(value & 0x000000FF);
- sw::Rect clearRect = stencilbuffer->getRect();
-
- if(mState.scissorTestEnabled)
- {
- clearRect.clip(mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight);
- }
-
- stencilbuffer->clearStencil(stencil, static_cast<unsigned char>(mState.stencilWritemask), clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
-
- stencilbuffer->release();
- }
- }
-}
-
-void Context::drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- if(!applyRenderTarget())
- {
- return;
- }
-
- if(mState.currentProgram == 0)
- {
- return; // Nothing to process.
- }
-
- sw::DrawType primitiveType;
- int primitiveCount;
- int verticesPerPrimitive;
-
- if(!es2sw::ConvertPrimitiveType(mode, count, GL_NONE, primitiveType, primitiveCount, verticesPerPrimitive))
- {
- return error(GL_INVALID_ENUM);
- }
-
- applyState(mode);
-
- for(int i = 0; i < instanceCount; ++i)
- {
- device->setInstanceID(i);
-
- GLenum err = applyVertexBuffer(0, first, count, i);
- if(err != GL_NO_ERROR)
- {
- return error(err);
- }
-
- applyShaders();
- applyTextures();
-
- if(!getCurrentProgram()->validateSamplers(false))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(primitiveCount <= 0)
- {
- return;
- }
-
- TransformFeedback* transformFeedback = getTransformFeedback();
- if(!cullSkipsDraw(mode) || (transformFeedback->isActive() && !transformFeedback->isPaused()))
- {
- device->drawPrimitive(primitiveType, primitiveCount);
- }
- if(transformFeedback)
- {
- transformFeedback->addVertexOffset(primitiveCount * verticesPerPrimitive);
- }
- }
-}
-
-void Context::drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- if(!applyRenderTarget())
- {
- return;
- }
-
- if(mState.currentProgram == 0)
- {
- return; // Nothing to process.
- }
-
- if(count == 0)
- {
- return;
- }
-
- if(!indices && !getCurrentVertexArray()->getElementArrayBuffer())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum internalMode = mode;
- if(isPrimitiveRestartFixedIndexEnabled())
- {
- switch(mode)
- {
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- internalMode = GL_TRIANGLES;
- break;
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- internalMode = GL_LINES;
- break;
- default:
- break;
- }
- }
-
- sw::DrawType primitiveType;
- int primitiveCount;
- int verticesPerPrimitive;
-
- if(!es2sw::ConvertPrimitiveType(internalMode, count, type, primitiveType, primitiveCount, verticesPerPrimitive))
- {
- return error(GL_INVALID_ENUM);
- }
-
- TranslatedIndexData indexInfo(primitiveCount);
- GLenum err = applyIndexBuffer(indices, start, end, count, mode, type, &indexInfo);
- if(err != GL_NO_ERROR)
- {
- return error(err);
- }
-
- applyState(internalMode);
-
- for(int i = 0; i < instanceCount; ++i)
- {
- device->setInstanceID(i);
-
- GLsizei vertexCount = indexInfo.maxIndex - indexInfo.minIndex + 1;
- err = applyVertexBuffer(-(int)indexInfo.minIndex, indexInfo.minIndex, vertexCount, i);
- if(err != GL_NO_ERROR)
- {
- return error(err);
- }
-
- applyShaders();
- applyTextures();
-
- if(!getCurrentProgram()->validateSamplers(false))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(primitiveCount <= 0)
- {
- return;
- }
-
- TransformFeedback* transformFeedback = getTransformFeedback();
- if(!cullSkipsDraw(internalMode) || (transformFeedback->isActive() && !transformFeedback->isPaused()))
- {
- device->drawIndexedPrimitive(primitiveType, indexInfo.indexOffset, indexInfo.primitiveCount);
- }
- if(transformFeedback)
- {
- transformFeedback->addVertexOffset(indexInfo.primitiveCount * verticesPerPrimitive);
- }
- }
-}
-
-void Context::blit(sw::Surface *source, const sw::SliceRect &sRect, sw::Surface *dest, const sw::SliceRect &dRect)
-{
- sw::SliceRectF sRectF((float)sRect.x0, (float)sRect.y0, (float)sRect.x1, (float)sRect.y1, sRect.slice);
- device->blit(source, sRectF, dest, dRect, false);
-}
-
-void Context::finish()
-{
- device->finish();
-}
-
-void Context::flush()
-{
- // We don't queue anything without processing it as fast as possible
-}
-
-void Context::recordInvalidEnum()
-{
- mInvalidEnum = true;
-}
-
-void Context::recordInvalidValue()
-{
- mInvalidValue = true;
-}
-
-void Context::recordInvalidOperation()
-{
- mInvalidOperation = true;
-}
-
-void Context::recordOutOfMemory()
-{
- mOutOfMemory = true;
-}
-
-void Context::recordInvalidFramebufferOperation()
-{
- mInvalidFramebufferOperation = true;
-}
-
-// 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(mInvalidEnum)
- {
- mInvalidEnum = false;
-
- return GL_INVALID_ENUM;
- }
-
- if(mInvalidValue)
- {
- mInvalidValue = false;
-
- return GL_INVALID_VALUE;
- }
-
- if(mInvalidOperation)
- {
- mInvalidOperation = false;
-
- return GL_INVALID_OPERATION;
- }
-
- if(mOutOfMemory)
- {
- mOutOfMemory = false;
-
- return GL_OUT_OF_MEMORY;
- }
-
- if(mInvalidFramebufferOperation)
- {
- mInvalidFramebufferOperation = false;
-
- return GL_INVALID_FRAMEBUFFER_OPERATION;
- }
-
- return GL_NO_ERROR;
-}
-
-int Context::getSupportedMultisampleCount(int requested)
-{
- int supported = 0;
-
- for(int i = NUM_MULTISAMPLE_COUNTS - 1; i >= 0; i--)
- {
- if(supported >= requested)
- {
- return supported;
- }
-
- supported = multisampleCount[i];
- }
-
- return supported;
-}
-
-void Context::detachBuffer(GLuint buffer)
-{
- // [OpenGL ES 2.0.24] section 2.9 page 22:
- // If a buffer object is deleted while it is bound, all bindings to that object in the current context
- // (i.e. in the thread that called Delete-Buffers) are reset to zero.
-
- if(mState.copyReadBuffer.name() == buffer)
- {
- mState.copyReadBuffer = nullptr;
- }
-
- if(mState.copyWriteBuffer.name() == buffer)
- {
- mState.copyWriteBuffer = nullptr;
- }
-
- if(mState.pixelPackBuffer.name() == buffer)
- {
- mState.pixelPackBuffer = nullptr;
- }
-
- if(mState.pixelUnpackBuffer.name() == buffer)
- {
- mState.pixelUnpackBuffer = nullptr;
- }
-
- if(mState.genericUniformBuffer.name() == buffer)
- {
- mState.genericUniformBuffer = nullptr;
- }
- if (mState.genericTransformFeedbackBuffer.name() == buffer)
- {
- mState.genericTransformFeedbackBuffer = nullptr;
- }
-
- if(getArrayBufferName() == buffer)
- {
- mState.arrayBuffer = nullptr;
- }
-
- // Only detach from the current transform feedback
- TransformFeedback* currentTransformFeedback = getTransformFeedback();
- if(currentTransformFeedback)
- {
- currentTransformFeedback->detachBuffer(buffer);
- }
-
- // Only detach from the current vertex array
- VertexArray* currentVertexArray = getCurrentVertexArray();
- if(currentVertexArray)
- {
- currentVertexArray->detachBuffer(buffer);
- }
-
- for(int attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
- {
- if(mState.vertexAttribute[attribute].mBoundBuffer.name() == buffer)
- {
- mState.vertexAttribute[attribute].mBoundBuffer = nullptr;
- }
- }
-}
-
-void Context::detachTexture(GLuint texture)
-{
- // [OpenGL ES 2.0.24] section 3.8 page 84:
- // If a texture object is deleted, it is as if all texture units which are bound to that texture object are
- // rebound to texture object zero
-
- for(int type = 0; type < TEXTURE_TYPE_COUNT; type++)
- {
- for(int sampler = 0; sampler < MAX_COMBINED_TEXTURE_IMAGE_UNITS; sampler++)
- {
- if(mState.samplerTexture[type][sampler].name() == texture)
- {
- mState.samplerTexture[type][sampler] = nullptr;
- }
- }
- }
-
- // [OpenGL ES 2.0.24] section 4.4 page 112:
- // If a texture object is deleted while its image is attached to the currently bound framebuffer, then it is
- // as if FramebufferTexture2D had been called, with a texture of 0, for each attachment point to which this
- // image was attached in the currently bound framebuffer.
-
- Framebuffer *readFramebuffer = getReadFramebuffer();
- Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
- if(readFramebuffer)
- {
- readFramebuffer->detachTexture(texture);
- }
-
- if(drawFramebuffer && drawFramebuffer != readFramebuffer)
- {
- drawFramebuffer->detachTexture(texture);
- }
-}
-
-void Context::detachFramebuffer(GLuint framebuffer)
-{
- // [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(mState.readFramebuffer == framebuffer)
- {
- bindReadFramebuffer(0);
- }
-
- if(mState.drawFramebuffer == framebuffer)
- {
- bindDrawFramebuffer(0);
- }
-}
-
-void Context::detachRenderbuffer(GLuint renderbuffer)
-{
- // [OpenGL ES 2.0.24] section 4.4 page 109:
- // If a renderbuffer that is currently bound to RENDERBUFFER is deleted, it is as though BindRenderbuffer
- // had been executed with the target RENDERBUFFER and name of zero.
-
- if(mState.renderbuffer.name() == renderbuffer)
- {
- bindRenderbuffer(0);
- }
-
- // [OpenGL ES 2.0.24] section 4.4 page 111:
- // If a renderbuffer object is deleted while its image is attached to the currently bound framebuffer,
- // then it is as if FramebufferRenderbuffer had been called, with a renderbuffer of 0, for each attachment
- // point to which this image was attached in the currently bound framebuffer.
-
- Framebuffer *readFramebuffer = getReadFramebuffer();
- Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
- if(readFramebuffer)
- {
- readFramebuffer->detachRenderbuffer(renderbuffer);
- }
-
- if(drawFramebuffer && drawFramebuffer != readFramebuffer)
- {
- drawFramebuffer->detachRenderbuffer(renderbuffer);
- }
-}
-
-void Context::detachSampler(GLuint sampler)
-{
- // [OpenGL ES 3.0.2] section 3.8.2 pages 123-124:
- // If a sampler object that is currently bound to one or more texture units is
- // deleted, it is as though BindSampler is called once for each texture unit to
- // which the sampler is bound, with unit set to the texture unit and sampler set to zero.
- for(size_t textureUnit = 0; textureUnit < MAX_COMBINED_TEXTURE_IMAGE_UNITS; ++textureUnit)
- {
- gl::BindingPointer<Sampler> &samplerBinding = mState.sampler[textureUnit];
- if(samplerBinding.name() == sampler)
- {
- samplerBinding = nullptr;
- }
- }
-}
-
-bool Context::cullSkipsDraw(GLenum drawMode)
-{
- return mState.cullFaceEnabled && mState.cullMode == GL_FRONT_AND_BACK && isTriangleMode(drawMode);
-}
-
-bool Context::isTriangleMode(GLenum drawMode)
-{
- switch(drawMode)
- {
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- return true;
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- return false;
- default: UNREACHABLE(drawMode);
- }
-
- return false;
-}
-
-void Context::setVertexAttrib(GLuint index, const GLfloat *values)
-{
- ASSERT(index < MAX_VERTEX_ATTRIBS);
-
- mState.vertexAttribute[index].setCurrentValue(values);
-
- mVertexDataManager->dirtyCurrentValue(index);
-}
-
-void Context::setVertexAttrib(GLuint index, const GLint *values)
-{
- ASSERT(index < MAX_VERTEX_ATTRIBS);
-
- mState.vertexAttribute[index].setCurrentValue(values);
-
- mVertexDataManager->dirtyCurrentValue(index);
-}
-
-void Context::setVertexAttrib(GLuint index, const GLuint *values)
-{
- ASSERT(index < MAX_VERTEX_ATTRIBS);
-
- mState.vertexAttribute[index].setCurrentValue(values);
-
- mVertexDataManager->dirtyCurrentValue(index);
-}
-
-void Context::blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, bool filter, bool allowPartialDepthStencilBlit)
-{
- Framebuffer *readFramebuffer = getReadFramebuffer();
- Framebuffer *drawFramebuffer = getDrawFramebuffer();
-
- int readBufferWidth, readBufferHeight, readBufferSamples;
- int drawBufferWidth, drawBufferHeight, drawBufferSamples;
-
- if(!readFramebuffer || (readFramebuffer->completeness(readBufferWidth, readBufferHeight, readBufferSamples) != GL_FRAMEBUFFER_COMPLETE) ||
- !drawFramebuffer || (drawFramebuffer->completeness(drawBufferWidth, drawBufferHeight, drawBufferSamples) != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- if(drawBufferSamples > 1)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- sw::SliceRect sourceRect;
- sw::SliceRect destRect;
- bool flipX = (srcX0 < srcX1) ^ (dstX0 < dstX1);
- bool flipY = (srcY0 < srcY1) ^ (dstY0 < dstY1);
-
- if(srcX0 < srcX1)
- {
- sourceRect.x0 = srcX0;
- sourceRect.x1 = srcX1;
- }
- else
- {
- sourceRect.x0 = srcX1;
- sourceRect.x1 = srcX0;
- }
-
- if(dstX0 < dstX1)
- {
- destRect.x0 = dstX0;
- destRect.x1 = dstX1;
- }
- else
- {
- destRect.x0 = dstX1;
- destRect.x1 = dstX0;
- }
-
- if(srcY0 < srcY1)
- {
- sourceRect.y0 = srcY0;
- sourceRect.y1 = srcY1;
- }
- else
- {
- sourceRect.y0 = srcY1;
- sourceRect.y1 = srcY0;
- }
-
- if(dstY0 < dstY1)
- {
- destRect.y0 = dstY0;
- destRect.y1 = dstY1;
- }
- else
- {
- destRect.y0 = dstY1;
- destRect.y1 = dstY0;
- }
-
- sw::RectF sourceScissoredRect(static_cast<float>(sourceRect.x0), static_cast<float>(sourceRect.y0),
- static_cast<float>(sourceRect.x1), static_cast<float>(sourceRect.y1));
- sw::Rect destScissoredRect = destRect;
-
- if(mState.scissorTestEnabled) // Only write to parts of the destination framebuffer which pass the scissor test
- {
- sw::Rect scissorRect(mState.scissorX, mState.scissorY, mState.scissorX + mState.scissorWidth, mState.scissorY + mState.scissorHeight);
- if (!Device::ClipDstRect(sourceScissoredRect, destScissoredRect, scissorRect, flipX, flipY))
- {
- // Failed to clip, blitting can't happen.
- return error(GL_INVALID_OPERATION);
- }
- }
-
- sw::SliceRectF sourceTrimmedRect = sourceScissoredRect;
- sw::SliceRect destTrimmedRect = destScissoredRect;
-
- // The source & destination rectangles also may need to be trimmed if
- // they fall out of the bounds of the actual draw and read surfaces.
- sw::Rect sourceTrimRect(0, 0, readBufferWidth, readBufferHeight);
- if (!Device::ClipSrcRect(sourceTrimmedRect, destTrimmedRect, sourceTrimRect, flipX, flipY))
- {
- // Failed to clip, blitting can't happen.
- return error(GL_INVALID_OPERATION);
- }
-
- sw::Rect destTrimRect(0, 0, drawBufferWidth, drawBufferHeight);
- if (!Device::ClipDstRect(sourceTrimmedRect, destTrimmedRect, destTrimRect, flipX, flipY))
- {
- // Failed to clip, blitting can't happen.
- return error(GL_INVALID_OPERATION);
- }
-
- bool partialBufferCopy = false;
-
- if(sourceTrimmedRect.y1 - sourceTrimmedRect.y0 < readBufferHeight ||
- sourceTrimmedRect.x1 - sourceTrimmedRect.x0 < readBufferWidth ||
- destTrimmedRect.y1 - destTrimmedRect.y0 < drawBufferHeight ||
- destTrimmedRect.x1 - destTrimmedRect.x0 < drawBufferWidth ||
- sourceTrimmedRect.y0 != 0 || destTrimmedRect.y0 != 0 || sourceTrimmedRect.x0 != 0 || destTrimmedRect.x0 != 0)
- {
- partialBufferCopy = true;
- }
-
- bool sameBounds = (srcX0 == dstX0 && srcY0 == dstY0 && srcX1 == dstX1 && srcY1 == dstY1);
- bool blitRenderTarget = false;
- bool blitDepth = false;
- bool blitStencil = false;
-
- if(mask & GL_COLOR_BUFFER_BIT)
- {
- GLenum readColorbufferType = readFramebuffer->getReadBufferType();
- GLenum drawColorbufferType = drawFramebuffer->getColorbufferType(0);
- const bool validReadType = readColorbufferType == GL_TEXTURE_2D || readColorbufferType == GL_TEXTURE_RECTANGLE_ARB || readColorbufferType == GL_TEXTURE_2D_ARRAY || readColorbufferType == GL_TEXTURE_3D || Framebuffer::IsRenderbuffer(readColorbufferType);
- const bool validDrawType = drawColorbufferType == GL_TEXTURE_2D || drawColorbufferType == GL_TEXTURE_RECTANGLE_ARB || readColorbufferType == GL_TEXTURE_2D_ARRAY || readColorbufferType == GL_TEXTURE_3D || Framebuffer::IsRenderbuffer(drawColorbufferType);
- if(!validReadType || !validDrawType)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(partialBufferCopy && readBufferSamples > 1 && !sameBounds)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- // The GL ES 3.0.2 spec (pg 193) states that:
- // 1) If the read buffer is fixed point format, the draw buffer must be as well
- // 2) If the read buffer is an unsigned integer format, the draw buffer must be
- // as well
- // 3) If the read buffer is a signed integer format, the draw buffer must be as
- // well
- es2::Renderbuffer *readRenderbuffer = readFramebuffer->getReadColorbuffer();
- es2::Renderbuffer *drawRenderbuffer = drawFramebuffer->getColorbuffer(0);
- GLint readFormat = readRenderbuffer->getFormat();
- GLint drawFormat = drawRenderbuffer->getFormat();
- GLenum readComponentType = GetComponentType(readFormat, GL_COLOR_ATTACHMENT0);
- GLenum drawComponentType = GetComponentType(drawFormat, GL_COLOR_ATTACHMENT0);
- bool readFixedPoint = ((readComponentType == GL_UNSIGNED_NORMALIZED) ||
- (readComponentType == GL_SIGNED_NORMALIZED));
- bool drawFixedPoint = ((drawComponentType == GL_UNSIGNED_NORMALIZED) ||
- (drawComponentType == GL_SIGNED_NORMALIZED));
- bool readFixedOrFloat = (readFixedPoint || (readComponentType == GL_FLOAT));
- bool drawFixedOrFloat = (drawFixedPoint || (drawComponentType == GL_FLOAT));
-
- if(readFixedOrFloat != drawFixedOrFloat)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if((readComponentType == GL_UNSIGNED_INT) && (drawComponentType != GL_UNSIGNED_INT))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if((readComponentType == GL_INT) && (drawComponentType != GL_INT))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- // Cannot filter integer data
- if(((readComponentType == GL_UNSIGNED_INT) || (readComponentType == GL_INT)) && filter)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if((readRenderbuffer->getSamples() > 0) && (readFormat != drawFormat))
- {
- // RGBA8 and BGRA8 should be interchangeable here
- if(!(((readFormat == GL_RGBA8) && (drawFormat == GL_BGRA8_EXT)) ||
- ((readFormat == GL_BGRA8_EXT) && (drawFormat == GL_RGBA8))))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- blitRenderTarget = true;
- }
-
- if(mask & (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT))
- {
- Renderbuffer *readDSBuffer = nullptr;
- Renderbuffer *drawDSBuffer = nullptr;
-
- if(mask & GL_DEPTH_BUFFER_BIT)
- {
- if(readFramebuffer->getDepthbuffer() && drawFramebuffer->getDepthbuffer())
- {
- GLenum readDepthBufferType = readFramebuffer->getDepthbufferType();
- GLenum drawDepthBufferType = drawFramebuffer->getDepthbufferType();
- if((readDepthBufferType != drawDepthBufferType) &&
- !(Framebuffer::IsRenderbuffer(readDepthBufferType) && Framebuffer::IsRenderbuffer(drawDepthBufferType)))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- blitDepth = true;
- readDSBuffer = readFramebuffer->getDepthbuffer();
- drawDSBuffer = drawFramebuffer->getDepthbuffer();
-
- if(readDSBuffer->getFormat() != drawDSBuffer->getFormat())
- {
- return error(GL_INVALID_OPERATION);
- }
- }
- }
-
- if(mask & GL_STENCIL_BUFFER_BIT)
- {
- if(readFramebuffer->getStencilbuffer() && drawFramebuffer->getStencilbuffer())
- {
- GLenum readStencilBufferType = readFramebuffer->getStencilbufferType();
- GLenum drawStencilBufferType = drawFramebuffer->getStencilbufferType();
- if((readStencilBufferType != drawStencilBufferType) &&
- !(Framebuffer::IsRenderbuffer(readStencilBufferType) && Framebuffer::IsRenderbuffer(drawStencilBufferType)))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- blitStencil = true;
- readDSBuffer = readFramebuffer->getStencilbuffer();
- drawDSBuffer = drawFramebuffer->getStencilbuffer();
-
- if(readDSBuffer->getFormat() != drawDSBuffer->getFormat())
- {
- return error(GL_INVALID_OPERATION);
- }
- }
- }
-
- if(partialBufferCopy && !allowPartialDepthStencilBlit)
- {
- ERR("Only whole-buffer depth and stencil blits are supported by ANGLE_framebuffer_blit.");
- return error(GL_INVALID_OPERATION); // Only whole-buffer copies are permitted
- }
-
- // OpenGL ES 3.0.4 spec, p.199:
- // ...an INVALID_OPERATION error is generated if the formats of the read
- // and draw framebuffers are not identical or if the source and destination
- // rectangles are not defined with the same(X0, Y 0) and (X1, Y 1) bounds.
- // If SAMPLE_BUFFERS for the draw framebuffer is greater than zero, an
- // INVALID_OPERATION error is generated.
- if((drawDSBuffer && drawDSBuffer->getSamples() > 1) ||
- ((readDSBuffer && readDSBuffer->getSamples() > 1) &&
- (!sameBounds || (drawDSBuffer->getFormat() != readDSBuffer->getFormat()))))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- if(blitRenderTarget || blitDepth || blitStencil)
- {
- if(flipX)
- {
- swap(destTrimmedRect.x0, destTrimmedRect.x1);
- }
- if(flipY)
- {
- swap(destTrimmedRect.y0, destTrimmedRect.y1);
- }
-
- if(blitRenderTarget)
- {
- egl::Image *readRenderTarget = readFramebuffer->getReadRenderTarget();
- egl::Image *drawRenderTarget = drawFramebuffer->getRenderTarget(0);
-
- bool success = device->stretchRect(readRenderTarget, &sourceTrimmedRect, drawRenderTarget, &destTrimmedRect, (filter ? Device::USE_FILTER : 0) | Device::COLOR_BUFFER);
-
- readRenderTarget->release();
- drawRenderTarget->release();
-
- if(!success)
- {
- ERR("BlitFramebuffer failed.");
- return;
- }
- }
-
- if(blitDepth)
- {
- egl::Image *readRenderTarget = readFramebuffer->getDepthBuffer();
- egl::Image *drawRenderTarget = drawFramebuffer->getDepthBuffer();
-
- bool success = device->stretchRect(readRenderTarget, &sourceTrimmedRect, drawRenderTarget, &destTrimmedRect, (filter ? Device::USE_FILTER : 0) | Device::DEPTH_BUFFER);
-
- readRenderTarget->release();
- drawRenderTarget->release();
-
- if(!success)
- {
- ERR("BlitFramebuffer failed.");
- return;
- }
- }
-
- if(blitStencil)
- {
- egl::Image *readRenderTarget = readFramebuffer->getStencilBuffer();
- egl::Image *drawRenderTarget = drawFramebuffer->getStencilBuffer();
-
- bool success = device->stretchRect(readRenderTarget, &sourceTrimmedRect, drawRenderTarget, &destTrimmedRect, (filter ? Device::USE_FILTER : 0) | Device::STENCIL_BUFFER);
-
- readRenderTarget->release();
- drawRenderTarget->release();
-
- if(!success)
- {
- ERR("BlitFramebuffer failed.");
- return;
- }
- }
- }
-}
-
-void Context::bindTexImage(gl::Surface *surface)
-{
- bool isRect = (surface->getTextureTarget() == EGL_TEXTURE_RECTANGLE_ANGLE);
- es2::Texture2D *textureObject = isRect ? getTexture2DRect() : getTexture2D();
-
- if(textureObject)
- {
- textureObject->bindTexImage(surface);
- }
-}
-
-EGLenum Context::validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel)
-{
- GLenum textureTarget = GL_NONE;
-
- switch(target)
- {
- case EGL_GL_TEXTURE_2D_KHR: textureTarget = GL_TEXTURE_2D; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_X; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_Y; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_Z; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; break;
- case EGL_GL_RENDERBUFFER_KHR:
- break;
- default:
- return EGL_BAD_PARAMETER;
- }
-
- if(textureLevel >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return EGL_BAD_MATCH;
- }
-
- if(textureTarget != GL_NONE)
- {
- es2::Texture *texture = getTexture(name);
-
- if(!texture)
- {
- return EGL_BAD_PARAMETER;
- }
-
- if (texture->getTarget() != GL_TEXTURE_CUBE_MAP && texture->getTarget() != textureTarget)
- {
- return EGL_BAD_PARAMETER;
- }
-
- if (texture->getTarget() == GL_TEXTURE_CUBE_MAP && !IsCubemapTextureTarget(textureTarget))
- {
- return EGL_BAD_PARAMETER;
- }
-
- if(texture->isShared(textureTarget, textureLevel)) // Bound to an EGLSurface or already an EGLImage sibling
- {
- return EGL_BAD_ACCESS;
- }
-
- if(textureLevel != 0 && !texture->isSamplerComplete(nullptr))
- {
- return EGL_BAD_PARAMETER;
- }
-
- if(textureLevel == 0 && !texture->isSamplerComplete(nullptr) && texture->hasNonBaseLevels())
- {
- return EGL_BAD_PARAMETER;
- }
- }
- else if(target == EGL_GL_RENDERBUFFER_KHR)
- {
- es2::Renderbuffer *renderbuffer = getRenderbuffer(name);
-
- if(!renderbuffer)
- {
- return EGL_BAD_PARAMETER;
- }
-
- if(renderbuffer->isShared()) // Already an EGLImage sibling
- {
- return EGL_BAD_ACCESS;
- }
- }
- else UNREACHABLE(target);
-
- return EGL_SUCCESS;
-}
-
-egl::Image *Context::createSharedImage(EGLenum target, GLuint name, GLuint textureLevel)
-{
- GLenum textureTarget = GL_NONE;
-
- switch(target)
- {
- case EGL_GL_TEXTURE_2D_KHR: textureTarget = GL_TEXTURE_2D; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_X; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_X; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_Y; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Y; break;
- case EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_POSITIVE_Z; break;
- case EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR: textureTarget = GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; break;
- }
-
- if(textureTarget != GL_NONE)
- {
- es2::Texture *texture = getTexture(name);
-
- return texture->createSharedImage(textureTarget, textureLevel);
- }
- else if(target == EGL_GL_RENDERBUFFER_KHR)
- {
- es2::Renderbuffer *renderbuffer = getRenderbuffer(name);
-
- return renderbuffer->createSharedImage();
- }
- else UNREACHABLE(target);
-
- return nullptr;
-}
-
-egl::Image *Context::getSharedImage(GLeglImageOES image)
-{
- return display->getSharedImage(image);
-}
-
-Device *Context::getDevice()
-{
- return device;
-}
-
-const GLubyte *Context::getExtensions(GLuint index, GLuint *numExt) const
-{
- // Keep list sorted in following order:
- // OES extensions
- // EXT extensions
- // Vendor extensions
- static const char *extensions[] =
- {
- "GL_OES_compressed_ETC1_RGB8_texture",
- "GL_OES_depth24",
- "GL_OES_depth32",
- "GL_OES_depth_texture",
- "GL_OES_depth_texture_cube_map",
- "GL_OES_EGL_image",
- "GL_OES_EGL_image_external",
- "GL_OES_EGL_image_external_essl3", // client version is always 3, so this is fine
- "GL_OES_EGL_sync",
- "GL_OES_element_index_uint",
- "GL_OES_fbo_render_mipmap",
- "GL_OES_framebuffer_object",
- "GL_OES_packed_depth_stencil",
- "GL_OES_rgb8_rgba8",
- "GL_OES_standard_derivatives",
- "GL_OES_surfaceless_context",
- "GL_OES_texture_float",
- "GL_OES_texture_float_linear",
- "GL_OES_texture_half_float",
- "GL_OES_texture_half_float_linear",
- "GL_OES_texture_npot",
- "GL_OES_texture_3D",
- "GL_OES_vertex_array_object",
- "GL_OES_vertex_half_float",
- "GL_EXT_blend_minmax",
- "GL_EXT_color_buffer_float", // OpenGL ES 3.0 specific.
- "GL_EXT_color_buffer_half_float",
- "GL_EXT_draw_buffers",
- "GL_EXT_float_blend",
- "GL_EXT_instanced_arrays",
- "GL_EXT_occlusion_query_boolean",
- "GL_EXT_read_format_bgra",
- "GL_EXT_texture_compression_dxt1",
- "GL_EXT_texture_filter_anisotropic",
- "GL_EXT_texture_format_BGRA8888",
- "GL_EXT_texture_rg",
- "GL_ARB_texture_rectangle",
- "GL_ANGLE_framebuffer_blit",
- "GL_ANGLE_framebuffer_multisample",
- "GL_ANGLE_instanced_arrays",
- "GL_ANGLE_texture_compression_dxt3",
- "GL_ANGLE_texture_compression_dxt5",
- // "GL_APPLE_texture_format_BGRA8888", // b/147536183
- "GL_CHROMIUM_color_buffer_float_rgba", // A subset of EXT_color_buffer_float on top of OpenGL ES 2.0
- "GL_CHROMIUM_texture_filtering_hint",
- "GL_NV_depth_buffer_float2",
- "GL_NV_fence",
- // "GL_NV_framebuffer_blit", // b/147536183
- "GL_NV_read_depth",
- "GL_NV_read_stencil",
- };
-
- GLuint numExtensions = sizeof(extensions) / sizeof(extensions[0]);
-
- if(numExt)
- {
- *numExt = numExtensions;
-
- return nullptr;
- }
-
- if(index == GL_INVALID_INDEX)
- {
- static std::string extensionsCat;
-
- if(extensionsCat.empty() && (numExtensions > 0))
- {
- for(const char *extension : extensions)
- {
- extensionsCat += std::string(extension) + " ";
- }
- }
-
- return (const GLubyte*)extensionsCat.c_str();
- }
-
- if(index >= numExtensions)
- {
- return nullptr;
- }
-
- return (const GLubyte*)extensions[index];
-}
-
-}
-
-NO_SANITIZE_FUNCTION egl::Context *es2CreateContext(egl::Display *display, const egl::Context *shareContext, const egl::Config *config)
-{
- return new es2::Context(display, static_cast<const es2::Context*>(shareContext), config);
-}
diff --git a/src/OpenGL/libGLESv2/Context.h b/src/OpenGL/libGLESv2/Context.h
deleted file mode 100644
index 1bb5e49e6..000000000
--- a/src/OpenGL/libGLESv2/Context.h
+++ /dev/null
@@ -1,773 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Context.h: Defines the Context class, managing all GL state and performing
-// rendering operations. It is the GLES2 specific implementation of EGLContext.
-
-#ifndef LIBGLESV2_CONTEXT_H_
-#define LIBGLESV2_CONTEXT_H_
-
-#include "ResourceManager.h"
-#include "Buffer.h"
-#include "libEGL/Context.hpp"
-#include "common/NameSpace.hpp"
-#include "common/Object.hpp"
-#include "common/Image.hpp"
-#include "Renderer/Sampler.hpp"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-#include <EGL/egl.h>
-
-#include <map>
-#include <string>
-
-namespace egl
-{
-class Display;
-class Config;
-}
-
-namespace es2
-{
-struct TranslatedAttribute;
-struct TranslatedIndexData;
-
-class Device;
-class Shader;
-class Program;
-class Texture;
-class Texture2D;
-class Texture3D;
-class Texture2DArray;
-class TextureCubeMap;
-class Texture2DRect;
-class TextureExternal;
-class Framebuffer;
-class Renderbuffer;
-class RenderbufferStorage;
-class Colorbuffer;
-class Depthbuffer;
-class StreamingIndexBuffer;
-class Stencilbuffer;
-class DepthStencilbuffer;
-class VertexDataManager;
-class IndexDataManager;
-class Fence;
-class FenceSync;
-class Query;
-class Sampler;
-class VertexArray;
-class TransformFeedback;
-
-enum
-{
- MAX_VERTEX_ATTRIBS = sw::MAX_VERTEX_INPUTS,
- MAX_UNIFORM_VECTORS = 256, // Device limit
- MAX_VERTEX_UNIFORM_VECTORS = sw::VERTEX_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange
- MAX_VARYING_VECTORS = MIN(sw::MAX_FRAGMENT_INPUTS, sw::MAX_VERTEX_OUTPUTS),
- MAX_TEXTURE_IMAGE_UNITS = sw::TEXTURE_IMAGE_UNITS,
- MAX_VERTEX_TEXTURE_IMAGE_UNITS = sw::VERTEX_TEXTURE_IMAGE_UNITS,
- MAX_COMBINED_TEXTURE_IMAGE_UNITS = MAX_TEXTURE_IMAGE_UNITS + MAX_VERTEX_TEXTURE_IMAGE_UNITS,
- MAX_FRAGMENT_UNIFORM_VECTORS = sw::FRAGMENT_UNIFORM_VECTORS - 3, // Reserve space for gl_DepthRange
- MAX_ELEMENT_INDEX = 0x7FFFFFFF,
- MAX_ELEMENTS_INDICES = 0x7FFFFFFF,
- MAX_ELEMENTS_VERTICES = 0x7FFFFFFF,
- MAX_VERTEX_OUTPUT_VECTORS = 16,
- MAX_FRAGMENT_INPUT_VECTORS = 15,
- MIN_PROGRAM_TEXEL_OFFSET = sw::MIN_PROGRAM_TEXEL_OFFSET,
- MAX_PROGRAM_TEXEL_OFFSET = sw::MAX_PROGRAM_TEXEL_OFFSET,
- MAX_TEXTURE_LOD_BIAS = sw::MAX_TEXTURE_LOD,
- MAX_DRAW_BUFFERS = sw::RENDERTARGETS,
- MAX_COLOR_ATTACHMENTS = MAX(MAX_DRAW_BUFFERS, 8),
- MAX_FRAGMENT_UNIFORM_BLOCKS = sw::MAX_FRAGMENT_UNIFORM_BLOCKS,
- MAX_VERTEX_UNIFORM_BLOCKS = sw::MAX_VERTEX_UNIFORM_BLOCKS,
- MAX_FRAGMENT_UNIFORM_COMPONENTS = sw::FRAGMENT_UNIFORM_VECTORS * 4,
- MAX_VERTEX_UNIFORM_COMPONENTS = sw::VERTEX_UNIFORM_VECTORS * 4,
- MAX_UNIFORM_BLOCK_SIZE = sw::MAX_UNIFORM_BLOCK_SIZE,
- MAX_FRAGMENT_UNIFORM_BLOCKS_COMPONENTS = sw::MAX_FRAGMENT_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE / 4,
- MAX_VERTEX_UNIFORM_BLOCKS_COMPONENTS = MAX_VERTEX_UNIFORM_BLOCKS * MAX_UNIFORM_BLOCK_SIZE / 4,
- MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = MAX_FRAGMENT_UNIFORM_BLOCKS_COMPONENTS + MAX_FRAGMENT_UNIFORM_COMPONENTS,
- MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = MAX_VERTEX_UNIFORM_BLOCKS_COMPONENTS + MAX_VERTEX_UNIFORM_COMPONENTS,
- MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 4,
- MAX_UNIFORM_BUFFER_BINDINGS = sw::MAX_UNIFORM_BUFFER_BINDINGS,
- UNIFORM_BUFFER_OFFSET_ALIGNMENT = 4,
- NUM_PROGRAM_BINARY_FORMATS = 0,
- MAX_SHADER_CALL_STACK_SIZE = sw::MAX_SHADER_CALL_STACK_SIZE,
-};
-
-const GLenum compressedTextureFormats[] =
-{
- GL_ETC1_RGB8_OES,
- GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
- GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
- GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE,
- GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE,
-#if (GL_ES_VERSION_3_0)
- GL_COMPRESSED_R11_EAC,
- GL_COMPRESSED_SIGNED_R11_EAC,
- GL_COMPRESSED_RG11_EAC,
- GL_COMPRESSED_SIGNED_RG11_EAC,
- GL_COMPRESSED_RGB8_ETC2,
- GL_COMPRESSED_SRGB8_ETC2,
- GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- GL_COMPRESSED_RGBA8_ETC2_EAC,
- GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
-#endif // GL_ES_VERSION_3_0
-};
-
-const GLenum GL_TEXTURE_FILTERING_HINT_CHROMIUM = 0x8AF0;
-
-const GLint NUM_COMPRESSED_TEXTURE_FORMATS = sizeof(compressedTextureFormats) / sizeof(compressedTextureFormats[0]);
-
-const GLint multisampleCount[] = {4, 2, 1};
-const GLint NUM_MULTISAMPLE_COUNTS = sizeof(multisampleCount) / sizeof(multisampleCount[0]);
-const GLint IMPLEMENTATION_MAX_SAMPLES = multisampleCount[0];
-
-const float ALIASED_LINE_WIDTH_RANGE_MIN = 1.0f;
-const float ALIASED_LINE_WIDTH_RANGE_MAX = 1.0f;
-const float ALIASED_POINT_SIZE_RANGE_MIN = 0.125f;
-const float ALIASED_POINT_SIZE_RANGE_MAX = 8192.0f;
-const float MAX_TEXTURE_MAX_ANISOTROPY = 16.0f;
-
-enum QueryType
-{
- QUERY_ANY_SAMPLES_PASSED,
- QUERY_ANY_SAMPLES_PASSED_CONSERVATIVE,
- QUERY_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
-
- QUERY_TYPE_COUNT
-};
-
-struct Color
-{
- float red;
- float green;
- float blue;
- float alpha;
-};
-
-// Helper structure describing a single vertex attribute
-class VertexAttribute
-{
-public:
- VertexAttribute() : mType(GL_FLOAT), mSize(4), mNormalized(false), mPureInteger(false), mStride(0), mDivisor(0), mPointer(nullptr), mArrayEnabled(false)
- {
- mCurrentValue[0].f = 0.0f;
- mCurrentValue[1].f = 0.0f;
- mCurrentValue[2].f = 0.0f;
- mCurrentValue[3].f = 1.0f;
- mCurrentValueType = GL_FLOAT;
- }
-
- int typeSize() const
- {
- switch(mType)
- {
- case GL_BYTE: return mSize * sizeof(GLbyte);
- case GL_UNSIGNED_BYTE: return mSize * sizeof(GLubyte);
- case GL_SHORT: return mSize * sizeof(GLshort);
- case GL_UNSIGNED_SHORT: return mSize * sizeof(GLushort);
- case GL_INT: return mSize * sizeof(GLint);
- case GL_UNSIGNED_INT: return mSize * sizeof(GLuint);
- case GL_FIXED: return mSize * sizeof(GLfixed);
- case GL_FLOAT: return mSize * sizeof(GLfloat);
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: return mSize * sizeof(GLhalf);
- case GL_INT_2_10_10_10_REV: return sizeof(GLint);
- case GL_UNSIGNED_INT_2_10_10_10_REV: return sizeof(GLuint);
- default: UNREACHABLE(mType); return mSize * sizeof(GLfloat);
- }
- }
-
- GLenum currentValueType() const
- {
- return mCurrentValueType;
- }
-
- GLsizei stride() const
- {
- return mStride ? mStride : typeSize();
- }
-
- inline float getCurrentValueBitsAsFloat(int i) const
- {
- return mCurrentValue[i].f;
- }
-
- inline float getCurrentValueF(int i) const
- {
- switch(mCurrentValueType)
- {
- case GL_FLOAT: return mCurrentValue[i].f;
- case GL_INT: return static_cast<float>(mCurrentValue[i].i);
- case GL_UNSIGNED_INT: return static_cast<float>(mCurrentValue[i].ui);
- default: UNREACHABLE(mCurrentValueType); return mCurrentValue[i].f;
- }
- }
-
- inline GLint getCurrentValueI(int i) const
- {
- switch(mCurrentValueType)
- {
- case GL_FLOAT: return static_cast<GLint>(mCurrentValue[i].f);
- case GL_INT: return mCurrentValue[i].i;
- case GL_UNSIGNED_INT: return static_cast<GLint>(mCurrentValue[i].ui);
- default: UNREACHABLE(mCurrentValueType); return mCurrentValue[i].i;
- }
- }
-
- inline GLuint getCurrentValueUI(int i) const
- {
- switch(mCurrentValueType)
- {
- case GL_FLOAT: return static_cast<GLuint>(mCurrentValue[i].f);
- case GL_INT: return static_cast<GLuint>(mCurrentValue[i].i);
- case GL_UNSIGNED_INT: return mCurrentValue[i].ui;
- default: UNREACHABLE(mCurrentValueType); return mCurrentValue[i].ui;
- }
- }
-
- inline void setCurrentValue(const GLfloat *values)
- {
- mCurrentValue[0].f = values[0];
- mCurrentValue[1].f = values[1];
- mCurrentValue[2].f = values[2];
- mCurrentValue[3].f = values[3];
- mCurrentValueType = GL_FLOAT;
- }
-
- inline void setCurrentValue(const GLint *values)
- {
- mCurrentValue[0].i = values[0];
- mCurrentValue[1].i = values[1];
- mCurrentValue[2].i = values[2];
- mCurrentValue[3].i = values[3];
- mCurrentValueType = GL_INT;
- }
-
- inline void setCurrentValue(const GLuint *values)
- {
- mCurrentValue[0].ui = values[0];
- mCurrentValue[1].ui = values[1];
- mCurrentValue[2].ui = values[2];
- mCurrentValue[3].ui = values[3];
- mCurrentValueType = GL_UNSIGNED_INT;
- }
-
- // From glVertexAttribPointer
- GLenum mType;
- GLint mSize;
- bool mNormalized;
- bool mPureInteger;
- GLsizei mStride; // 0 means natural stride
- GLuint mDivisor; // From glVertexAttribDivisor
-
- union
- {
- const void *mPointer;
- intptr_t mOffset;
- };
-
- gl::BindingPointer<Buffer> mBoundBuffer; // Captured when glVertexAttribPointer is called.
-
- bool mArrayEnabled; // From glEnable/DisableVertexAttribArray
-
-private:
- union ValueUnion
- {
- float f;
- GLint i;
- GLuint ui;
- };
-
- ValueUnion mCurrentValue[4]; // From glVertexAttrib
- GLenum mCurrentValueType;
-};
-
-typedef VertexAttribute VertexAttributeArray[MAX_VERTEX_ATTRIBS];
-
-// Helper structure to store all raw state
-struct State
-{
- Color colorClearValue;
- GLclampf depthClearValue;
- int stencilClearValue;
-
- bool cullFaceEnabled;
- GLenum cullMode;
- GLenum frontFace;
- bool depthTestEnabled;
- GLenum depthFunc;
- bool blendEnabled;
- GLenum sourceBlendRGB;
- GLenum destBlendRGB;
- GLenum sourceBlendAlpha;
- GLenum destBlendAlpha;
- GLenum blendEquationRGB;
- GLenum blendEquationAlpha;
- Color blendColor;
- bool stencilTestEnabled;
- GLenum stencilFunc;
- GLint stencilRef;
- GLuint stencilMask;
- GLenum stencilFail;
- GLenum stencilPassDepthFail;
- GLenum stencilPassDepthPass;
- GLuint stencilWritemask;
- GLenum stencilBackFunc;
- GLint stencilBackRef;
- GLuint stencilBackMask;
- GLenum stencilBackFail;
- GLenum stencilBackPassDepthFail;
- GLenum stencilBackPassDepthPass;
- GLuint stencilBackWritemask;
- bool polygonOffsetFillEnabled;
- GLfloat polygonOffsetFactor;
- GLfloat polygonOffsetUnits;
- bool sampleAlphaToCoverageEnabled;
- bool sampleCoverageEnabled;
- GLclampf sampleCoverageValue;
- bool sampleCoverageInvert;
- bool scissorTestEnabled;
- bool ditherEnabled;
- bool primitiveRestartFixedIndexEnabled;
- bool rasterizerDiscardEnabled;
- bool colorLogicOpEnabled;
- GLenum logicalOperation;
-
- GLfloat lineWidth;
-
- GLenum generateMipmapHint;
- GLenum fragmentShaderDerivativeHint;
- GLenum textureFilteringHint;
-
- GLint viewportX;
- GLint viewportY;
- GLsizei viewportWidth;
- GLsizei viewportHeight;
- float zNear;
- float zFar;
-
- GLint scissorX;
- GLint scissorY;
- GLsizei scissorWidth;
- GLsizei scissorHeight;
-
- bool colorMaskRed;
- bool colorMaskGreen;
- bool colorMaskBlue;
- bool colorMaskAlpha;
- bool depthMask;
-
- unsigned int activeSampler; // Active texture unit selector - GL_TEXTURE0
- gl::BindingPointer<Buffer> arrayBuffer;
- gl::BindingPointer<Buffer> copyReadBuffer;
- gl::BindingPointer<Buffer> copyWriteBuffer;
- gl::BindingPointer<Buffer> pixelPackBuffer;
- gl::BindingPointer<Buffer> pixelUnpackBuffer;
- gl::BindingPointer<Buffer> genericUniformBuffer;
- gl::BindingPointer<Buffer> genericTransformFeedbackBuffer;
- BufferBinding uniformBuffers[MAX_UNIFORM_BUFFER_BINDINGS];
-
- GLuint readFramebuffer;
- GLuint drawFramebuffer;
- gl::BindingPointer<Renderbuffer> renderbuffer;
- GLuint currentProgram;
- GLuint vertexArray;
- GLuint transformFeedback;
- gl::BindingPointer<Sampler> sampler[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
- VertexAttribute vertexAttribute[MAX_VERTEX_ATTRIBS];
- gl::BindingPointer<Texture> samplerTexture[TEXTURE_TYPE_COUNT][MAX_COMBINED_TEXTURE_IMAGE_UNITS];
- gl::BindingPointer<Query> activeQuery[QUERY_TYPE_COUNT];
-
- gl::PixelStorageModes unpackParameters;
- gl::PixelStorageModes packParameters;
-};
-
-class [[clang::lto_visibility_public]] Context : public egl::Context
-{
-public:
- Context(egl::Display *display, const Context *shareContext, const egl::Config *config);
-
- void makeCurrent(gl::Surface *surface) override;
- EGLint getClientVersion() const override;
- EGLint getConfigID() const override;
-
- void markAllStateDirty();
-
- // State manipulation
- void setClearColor(float red, float green, float blue, float alpha);
- void setClearDepth(float depth);
- void setClearStencil(int stencil);
-
- void setCullFaceEnabled(bool enabled);
- bool isCullFaceEnabled() const;
- void setCullMode(GLenum mode);
- void setFrontFace(GLenum front);
-
- void setDepthTestEnabled(bool enabled);
- bool isDepthTestEnabled() const;
- void setDepthFunc(GLenum depthFunc);
- void setDepthRange(float zNear, float zFar);
-
- void setBlendEnabled(bool enabled);
- bool isBlendEnabled() const;
- void setBlendFactors(GLenum sourceRGB, GLenum destRGB, GLenum sourceAlpha, GLenum destAlpha);
- void setBlendColor(float red, float green, float blue, float alpha);
- void setBlendEquation(GLenum rgbEquation, GLenum alphaEquation);
-
- void setStencilTestEnabled(bool enabled);
- bool isStencilTestEnabled() const;
- void setStencilParams(GLenum stencilFunc, GLint stencilRef, GLuint stencilMask);
- void setStencilBackParams(GLenum stencilBackFunc, GLint stencilBackRef, GLuint stencilBackMask);
- void setStencilWritemask(GLuint stencilWritemask);
- void setStencilBackWritemask(GLuint stencilBackWritemask);
- void setStencilOperations(GLenum stencilFail, GLenum stencilPassDepthFail, GLenum stencilPassDepthPass);
- void setStencilBackOperations(GLenum stencilBackFail, GLenum stencilBackPassDepthFail, GLenum stencilBackPassDepthPass);
-
- void setPolygonOffsetFillEnabled(bool enabled);
- bool isPolygonOffsetFillEnabled() const;
- void setPolygonOffsetParams(GLfloat factor, GLfloat units);
-
- void setSampleAlphaToCoverageEnabled(bool enabled);
- bool isSampleAlphaToCoverageEnabled() const;
- void setSampleCoverageEnabled(bool enabled);
- bool isSampleCoverageEnabled() const;
- void setSampleCoverageParams(GLclampf value, bool invert);
-
- void setDitherEnabled(bool enabled);
- bool isDitherEnabled() const;
-
- void setPrimitiveRestartFixedIndexEnabled(bool enabled);
- bool isPrimitiveRestartFixedIndexEnabled() const;
-
- void setRasterizerDiscardEnabled(bool enabled);
- bool isRasterizerDiscardEnabled() const;
-
- void setLineWidth(GLfloat width);
-
- void setGenerateMipmapHint(GLenum hint);
- void setFragmentShaderDerivativeHint(GLenum hint);
- void setTextureFilteringHint(GLenum hint);
-
- void setViewportParams(GLint x, GLint y, GLsizei width, GLsizei height);
-
- void setScissorTestEnabled(bool enabled);
- bool isScissorTestEnabled() const;
- void setScissorParams(GLint x, GLint y, GLsizei width, GLsizei height);
-
- void setColorMask(bool red, bool green, bool blue, bool alpha);
- unsigned int getColorMask() const;
- void setDepthMask(bool mask);
-
- void setActiveSampler(unsigned int active);
-
- GLuint getReadFramebufferName() const;
- GLuint getDrawFramebufferName() const;
- GLuint getRenderbufferName() const;
-
- void setFramebufferReadBuffer(GLenum buf);
- void setFramebufferDrawBuffers(GLsizei n, const GLenum *bufs);
-
- GLuint getActiveQuery(GLenum target) const;
-
- GLuint getArrayBufferName() const;
- GLuint getElementArrayBufferName() const;
-
- void setVertexAttribArrayEnabled(unsigned int attribNum, bool enabled);
- void setVertexAttribDivisor(unsigned int attribNum, GLuint divisor);
- const VertexAttribute &getVertexAttribState(unsigned int attribNum) const;
- void setVertexAttribState(unsigned int attribNum, Buffer *boundBuffer, GLint size, GLenum type,
- bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
- const void *getVertexAttribPointer(unsigned int attribNum) const;
-
- const VertexAttributeArray &getVertexArrayAttributes();
- // Context attribute current values can be queried independently from VAO current values
- const VertexAttributeArray &getCurrentVertexAttributes();
-
- void setUnpackAlignment(GLint alignment);
- void setUnpackRowLength(GLint rowLength);
- void setUnpackImageHeight(GLint imageHeight);
- void setUnpackSkipPixels(GLint skipPixels);
- void setUnpackSkipRows(GLint skipRows);
- void setUnpackSkipImages(GLint skipImages);
- const gl::PixelStorageModes &getUnpackParameters() const;
-
- void setPackAlignment(GLint alignment);
- void setPackRowLength(GLint rowLength);
- void setPackSkipPixels(GLint skipPixels);
- void setPackSkipRows(GLint skipRows);
-
- // 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 createSampler();
- GLsync createFenceSync(GLenum condition, GLbitfield flags);
-
- void deleteBuffer(GLuint buffer);
- void deleteShader(GLuint shader);
- void deleteProgram(GLuint program);
- void deleteTexture(GLuint texture);
- void deleteRenderbuffer(GLuint renderbuffer);
- void deleteSampler(GLuint sampler);
- void deleteFenceSync(GLsync fenceSync);
-
- // Framebuffers are owned by the Context, so these methods do not pass through
- GLuint createFramebuffer();
- void deleteFramebuffer(GLuint framebuffer);
-
- // Fences are owned by the Context
- GLuint createFence();
- void deleteFence(GLuint fence);
-
- // Queries are owned by the Context
- GLuint createQuery();
- void deleteQuery(GLuint query);
-
- // Vertex arrays are owned by the Context
- GLuint createVertexArray();
- void deleteVertexArray(GLuint array);
-
- // Transform feedbacks are owned by the Context
- GLuint createTransformFeedback();
- void deleteTransformFeedback(GLuint transformFeedback);
-
- void bindArrayBuffer(GLuint buffer);
- void bindElementArrayBuffer(GLuint buffer);
- void bindCopyReadBuffer(GLuint buffer);
- void bindCopyWriteBuffer(GLuint buffer);
- void bindPixelPackBuffer(GLuint buffer);
- void bindPixelUnpackBuffer(GLuint buffer);
- void bindTransformFeedbackBuffer(GLuint buffer);
- void bindTexture(TextureType type, GLuint texture);
- void bindReadFramebuffer(GLuint framebuffer);
- void bindDrawFramebuffer(GLuint framebuffer);
- void bindRenderbuffer(GLuint renderbuffer);
- void bindVertexArray(GLuint array);
- void bindGenericUniformBuffer(GLuint buffer);
- void bindIndexedUniformBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
- void bindGenericTransformFeedbackBuffer(GLuint buffer);
- void bindIndexedTransformFeedbackBuffer(GLuint buffer, GLuint index, GLintptr offset, GLsizeiptr size);
- void bindTransformFeedback(GLuint transformFeedback);
- bool bindSampler(GLuint unit, GLuint sampler);
- void useProgram(GLuint program);
-
- void beginQuery(GLenum target, GLuint query);
- void endQuery(GLenum target);
-
- void setFramebufferZero(Framebuffer *framebuffer);
-
- void setRenderbufferStorage(RenderbufferStorage *renderbuffer);
-
- void setVertexAttrib(GLuint index, const GLfloat *values);
- void setVertexAttrib(GLuint index, const GLint *values);
- void setVertexAttrib(GLuint index, const GLuint *values);
-
- Buffer *getBuffer(GLuint handle) const;
- Fence *getFence(GLuint handle) const;
- FenceSync *getFenceSync(GLsync handle) const;
- Shader *getShader(GLuint handle) const;
- Program *getProgram(GLuint handle) const;
- virtual Texture *getTexture(GLuint handle) const;
- Framebuffer *getFramebuffer(GLuint handle) const;
- virtual Renderbuffer *getRenderbuffer(GLuint handle) const;
- Query *getQuery(GLuint handle) const;
- VertexArray *getVertexArray(GLuint array) const;
- VertexArray *getCurrentVertexArray() const;
- bool isVertexArray(GLuint array) const;
- TransformFeedback *getTransformFeedback(GLuint transformFeedback) const;
- bool isTransformFeedback(GLuint transformFeedback) const;
- TransformFeedback *getTransformFeedback() const;
- Sampler *getSampler(GLuint sampler) const;
- bool isSampler(GLuint sampler) const;
-
- Buffer *getArrayBuffer() const;
- Buffer *getElementArrayBuffer() const;
- Buffer *getCopyReadBuffer() const;
- Buffer *getCopyWriteBuffer() const;
- Buffer *getPixelPackBuffer() const;
- Buffer *getPixelUnpackBuffer() const;
- Buffer *getGenericUniformBuffer() const;
- size_t getRequiredBufferSize(GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type) const;
- GLenum getPixels(const GLvoid **data, GLenum type, size_t imageSize) const;
- bool getBuffer(GLenum target, es2::Buffer **buffer) const;
- Program *getCurrentProgram() const;
- Texture *getTargetTexture(GLenum target) const;
- Texture2D *getTexture2D() const;
- Texture2D *getTexture2D(GLenum target) const;
- Texture3D *getTexture3D() const;
- Texture2DArray *getTexture2DArray() const;
- TextureCubeMap *getTextureCubeMap() const;
- Texture2DRect *getTexture2DRect() const;
- TextureExternal *getTextureExternal() const;
- Texture *getSamplerTexture(unsigned int sampler, TextureType type) const;
- Framebuffer *getReadFramebuffer() const;
- Framebuffer *getDrawFramebuffer() const;
-
- bool getFloatv(GLenum pname, GLfloat *params) const;
- template<typename T> bool getIntegerv(GLenum pname, T *params) const;
- bool getBooleanv(GLenum pname, GLboolean *params) const;
- template<typename T> bool getTransformFeedbackiv(GLuint index, GLenum pname, T *param) const;
- template<typename T> bool getUniformBufferiv(GLuint index, GLenum pname, T *param) const;
- void samplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void samplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- GLint getSamplerParameteri(GLuint sampler, GLenum pname);
- GLfloat getSamplerParameterf(GLuint sampler, GLenum pname);
-
- bool getQueryParameterInfo(GLenum pname, GLenum *type, unsigned int *numParams) const;
-
- bool hasZeroDivisor() const;
-
- void drawArrays(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount = 1);
- void drawElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount = 1);
- void blit(sw::Surface *source, const sw::SliceRect &sRect, sw::Surface *dest, const sw::SliceRect &dRect) override;
- void readPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei *bufSize, void* pixels);
- void clear(GLbitfield mask);
- void clearColorBuffer(GLint drawbuffer, const GLint *value);
- void clearColorBuffer(GLint drawbuffer, const GLuint *value);
- void clearColorBuffer(GLint drawbuffer, const GLfloat *value);
- void clearDepthBuffer(const GLfloat value);
- void clearStencilBuffer(const GLint value);
- void finish() override;
- void flush();
-
- void recordInvalidEnum();
- void recordInvalidValue();
- void recordInvalidOperation();
- void recordOutOfMemory();
- void recordInvalidFramebufferOperation();
-
- GLenum getError();
-
- static int getSupportedMultisampleCount(int requested);
-
- void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1,
- GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, bool filter, bool allowPartialDepthStencilBlit);
-
- void bindTexImage(gl::Surface *surface) override;
- EGLenum validateSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
- egl::Image *createSharedImage(EGLenum target, GLuint name, GLuint textureLevel) override;
- egl::Image *getSharedImage(GLeglImageOES image);
-
- Device *getDevice();
-
- const GLubyte *getExtensions(GLuint index, GLuint *numExt = nullptr) const;
- sw::MutexLock *getResourceLock() { return mResourceManager->getLock(); }
-
-private:
- ~Context() override;
-
- void applyScissor(int width, int height);
- bool applyRenderTarget();
- void applyState(GLenum drawMode);
- GLenum applyVertexBuffer(GLint base, GLint first, GLsizei count, GLsizei instanceId);
- GLenum applyIndexBuffer(const void *indices, GLuint start, GLuint end, GLsizei count, GLenum mode, GLenum type, TranslatedIndexData *indexInfo);
- void applyShaders();
- void applyTextures();
- void applyTextures(sw::SamplerType type);
- void applyTexture(sw::SamplerType type, int sampler, Texture *texture);
- void clearColorBuffer(GLint drawbuffer, void *value, sw::Format format);
-
- void detachBuffer(GLuint buffer);
- void detachTexture(GLuint texture);
- void detachFramebuffer(GLuint framebuffer);
- void detachRenderbuffer(GLuint renderbuffer);
- void detachSampler(GLuint sampler);
-
- bool cullSkipsDraw(GLenum drawMode);
- bool isTriangleMode(GLenum drawMode);
-
- Query *createQuery(GLuint handle, GLenum type);
-
- const egl::Config *const config;
-
- State mState;
-
- gl::BindingPointer<Texture2D> mTexture2DZero;
- gl::BindingPointer<Texture3D> mTexture3DZero;
- gl::BindingPointer<Texture2DArray> mTexture2DArrayZero;
- gl::BindingPointer<TextureCubeMap> mTextureCubeMapZero;
- gl::BindingPointer<Texture2DRect> mTexture2DRectZero;
- gl::BindingPointer<TextureExternal> mTextureExternalZero;
-
- gl::NameSpace<Framebuffer> mFramebufferNameSpace;
- gl::NameSpace<Fence, 0> mFenceNameSpace;
- gl::NameSpace<Query> mQueryNameSpace;
- gl::NameSpace<VertexArray> mVertexArrayNameSpace;
- gl::NameSpace<TransformFeedback> mTransformFeedbackNameSpace;
-
- VertexDataManager *mVertexDataManager;
- IndexDataManager *mIndexDataManager;
-
- // Recorded errors
- bool mInvalidEnum;
- bool mInvalidValue;
- bool mInvalidOperation;
- bool mOutOfMemory;
- bool mInvalidFramebufferOperation;
-
- bool mHasBeenCurrent;
-
- unsigned int mAppliedProgramSerial;
-
- // state caching flags
- bool mDepthStateDirty;
- bool mMaskStateDirty;
- bool mBlendStateDirty;
- bool mStencilStateDirty;
- bool mPolygonOffsetStateDirty;
- bool mSampleStateDirty;
- bool mFrontFaceDirty;
- bool mDitherStateDirty;
-
- Device *device;
- ResourceManager *mResourceManager;
-};
-
-// ptr to a context, which also holds the context's resource manager's lock.
-class ContextPtr {
-public:
- explicit ContextPtr(Context *context) : ptr(context)
- {
- if (ptr) { ptr->getResourceLock()->lock(); }
- }
-
- ~ContextPtr() {
- if (ptr) { ptr->getResourceLock()->unlock(); }
- }
-
- ContextPtr(ContextPtr const &) = delete;
- ContextPtr & operator=(ContextPtr const &) = delete;
- ContextPtr(ContextPtr && other) : ptr(other.ptr) { other.ptr = nullptr; }
- ContextPtr & operator=(ContextPtr && other) { ptr = other.ptr; other.ptr = nullptr; return *this; }
-
- Context *operator ->() { return ptr; }
- operator bool() const { return ptr != nullptr; }
-
-private:
- Context *ptr;
-};
-
-}
-
-#endif // INCLUDE_CONTEXT_H_
diff --git a/src/OpenGL/libGLESv2/Device.cpp b/src/OpenGL/libGLESv2/Device.cpp
deleted file mode 100644
index 8d80db73d..000000000
--- a/src/OpenGL/libGLESv2/Device.cpp
+++ /dev/null
@@ -1,1061 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Device.hpp"
-
-#include "common/Image.hpp"
-#include "Texture.h"
-
-#include "Renderer/Renderer.hpp"
-#include "Renderer/Clipper.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Shader/VertexShader.hpp"
-#include "Main/Config.hpp"
-#include "Main/FrameBuffer.hpp"
-#include "Common/Math.hpp"
-#include "Common/Configurator.hpp"
-#include "Common/Memory.hpp"
-#include "Common/Timer.hpp"
-#include "../common/debug.h"
-
-namespace es2
-{
- using namespace sw;
-
- Device::Device(Context *context) : Renderer(context, OpenGL, true), context(context)
- {
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- renderTarget[i] = nullptr;
- }
-
- depthBuffer = nullptr;
- stencilBuffer = nullptr;
-
- setDepthBufferEnable(true);
- setFillMode(FILL_SOLID);
- setShadingMode(SHADING_GOURAUD);
- setDepthWriteEnable(true);
- setAlphaTestEnable(false);
- setSourceBlendFactor(BLEND_ONE);
- setDestBlendFactor(BLEND_ZERO);
- setCullMode(CULL_COUNTERCLOCKWISE, true);
- setDepthCompare(DEPTH_LESSEQUAL);
- setAlphaReference(127.5f);
- setAlphaCompare(ALPHA_ALWAYS);
- setAlphaBlendEnable(false);
- setFogEnable(false);
- setSpecularEnable(false);
- setFogColor(0);
- setPixelFogMode(FOG_NONE);
- setFogStart(0.0f);
- setFogEnd(1.0f);
- setFogDensity(1.0f);
- setRangeFogEnable(false);
- setStencilEnable(false);
- setStencilFailOperation(OPERATION_KEEP);
- setStencilZFailOperation(OPERATION_KEEP);
- setStencilPassOperation(OPERATION_KEEP);
- setStencilCompare(STENCIL_ALWAYS);
- setStencilReference(0);
- setStencilMask(0xFFFFFFFF);
- setStencilWriteMask(0xFFFFFFFF);
- setVertexFogMode(FOG_NONE);
- setClipFlags(0);
- setPointSize(1.0f);
- setPointSizeMin(0.125f);
- setPointSizeMax(8192.0f);
- setBlendOperation(BLENDOP_ADD);
- scissorEnable = false;
- setSlopeDepthBias(0.0f);
- setTwoSidedStencil(false);
- setStencilFailOperationCCW(OPERATION_KEEP);
- setStencilZFailOperationCCW(OPERATION_KEEP);
- setStencilPassOperationCCW(OPERATION_KEEP);
- setStencilCompareCCW(STENCIL_ALWAYS);
- setBlendConstant(0xFFFFFFFF);
- setWriteSRGB(false);
- setDepthBias(0.0f);
- setSeparateAlphaBlendEnable(false);
- setSourceBlendFactorAlpha(BLEND_ONE);
- setDestBlendFactorAlpha(BLEND_ZERO);
- setBlendOperationAlpha(BLENDOP_ADD);
- setPointSpriteEnable(true);
- setColorLogicOpEnabled(false);
- setLogicalOperation(LOGICALOP_COPY);
-
- for(int i = 0; i < 16; i++)
- {
- setAddressingModeU(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
- setAddressingModeV(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
- setAddressingModeW(sw::SAMPLER_PIXEL, i, ADDRESSING_WRAP);
- setBorderColor(sw::SAMPLER_PIXEL, i, 0x00000000);
- setTextureFilter(sw::SAMPLER_PIXEL, i, FILTER_POINT);
- setMipmapFilter(sw::SAMPLER_PIXEL, i, MIPMAP_NONE);
- setMipmapLOD(sw::SAMPLER_PIXEL, i, 0.0f);
- }
-
- for(int i = 0; i < 4; i++)
- {
- setAddressingModeU(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
- setAddressingModeV(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
- setAddressingModeW(sw::SAMPLER_VERTEX, i, ADDRESSING_WRAP);
- setBorderColor(sw::SAMPLER_VERTEX, i, 0x00000000);
- setTextureFilter(sw::SAMPLER_VERTEX, i, FILTER_POINT);
- setMipmapFilter(sw::SAMPLER_VERTEX, i, MIPMAP_NONE);
- setMipmapLOD(sw::SAMPLER_VERTEX, i, 0.0f);
- }
-
- for(int i = 0; i < 6; i++)
- {
- float plane[4] = {0, 0, 0, 0};
-
- setClipPlane(i, plane);
- }
-
- pixelShader = nullptr;
- vertexShader = nullptr;
-
- pixelShaderDirty = true;
- pixelShaderConstantsFDirty = 0;
- vertexShaderDirty = true;
- vertexShaderConstantsFDirty = 0;
-
- for(int i = 0; i < FRAGMENT_UNIFORM_VECTORS; i++)
- {
- float zero[4] = {0, 0, 0, 0};
-
- setPixelShaderConstantF(i, zero, 1);
- }
-
- for(int i = 0; i < VERTEX_UNIFORM_VECTORS; i++)
- {
- float zero[4] = {0, 0, 0, 0};
-
- setVertexShaderConstantF(i, zero, 1);
- }
- }
-
- Device::~Device()
- {
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- if(renderTarget[i])
- {
- renderTarget[i]->release();
- renderTarget[i] = nullptr;
- }
- }
-
- if(depthBuffer)
- {
- depthBuffer->release();
- depthBuffer = nullptr;
- }
-
- if(stencilBuffer)
- {
- stencilBuffer->release();
- stencilBuffer = nullptr;
- }
-
- delete context;
- }
-
- // This object has to be mem aligned
- void* Device::operator new(size_t size)
- {
- ASSERT(size == sizeof(Device)); // This operator can't be called from a derived class
- return sw::allocate(sizeof(Device), 16);
- }
-
- void Device::operator delete(void * mem)
- {
- sw::deallocate(mem);
- }
-
- void Device::clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask)
- {
- if(!rgbaMask)
- {
- return;
- }
-
- float rgba[4];
- rgba[0] = red;
- rgba[1] = green;
- rgba[2] = blue;
- rgba[3] = alpha;
-
- for(int i = 0; i < RENDERTARGETS; ++i)
- {
- if(renderTarget[i])
- {
- sw::Rect clearRect = renderTarget[i]->getRect();
-
- if(scissorEnable)
- {
- clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
- }
-
- clear(rgba, FORMAT_A32B32G32R32F, renderTarget[i], clearRect, rgbaMask);
- }
- }
- }
-
- void Device::clearDepth(float z)
- {
- if(!depthBuffer)
- {
- return;
- }
-
- z = clamp01(z);
- sw::Rect clearRect = depthBuffer->getRect();
-
- if(scissorEnable)
- {
- clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
- }
-
- depthBuffer->clearDepth(z, clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
- }
-
- void Device::clearStencil(unsigned int stencil, unsigned int mask)
- {
- if(!stencilBuffer)
- {
- return;
- }
-
- sw::Rect clearRect = stencilBuffer->getRect();
-
- if(scissorEnable)
- {
- clearRect.clip(scissorRect.x0, scissorRect.y0, scissorRect.x1, scissorRect.y1);
- }
-
- stencilBuffer->clearStencil(stencil, mask, clearRect.x0, clearRect.y0, clearRect.width(), clearRect.height());
- }
-
- void Device::drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount)
- {
- if(!bindResources() || !primitiveCount)
- {
- return;
- }
-
- draw(type, indexOffset, primitiveCount);
- }
-
- void Device::drawPrimitive(sw::DrawType type, unsigned int primitiveCount)
- {
- if(!bindResources() || !primitiveCount)
- {
- return;
- }
-
- setIndexBuffer(nullptr);
-
- draw(type, 0, primitiveCount);
- }
-
- void Device::setPixelShader(const PixelShader *pixelShader)
- {
- this->pixelShader = pixelShader;
- pixelShaderDirty = true;
- }
-
- void Device::setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count)
- {
- for(unsigned int i = 0; i < count && startRegister + i < FRAGMENT_UNIFORM_VECTORS; i++)
- {
- pixelShaderConstantF[startRegister + i][0] = constantData[i * 4 + 0];
- pixelShaderConstantF[startRegister + i][1] = constantData[i * 4 + 1];
- pixelShaderConstantF[startRegister + i][2] = constantData[i * 4 + 2];
- pixelShaderConstantF[startRegister + i][3] = constantData[i * 4 + 3];
- }
-
- pixelShaderConstantsFDirty = max(startRegister + count, pixelShaderConstantsFDirty);
- pixelShaderDirty = true; // Reload DEF constants
- }
-
- void Device::setScissorEnable(bool enable)
- {
- scissorEnable = enable;
- }
-
- void Device::setRenderTarget(int index, egl::Image *renderTarget, unsigned int layer)
- {
- if(renderTarget)
- {
- renderTarget->addRef();
- }
-
- if(this->renderTarget[index])
- {
- this->renderTarget[index]->release();
- }
-
- this->renderTarget[index] = renderTarget;
-
- Renderer::setRenderTarget(index, renderTarget, layer);
- }
-
- void Device::setDepthBuffer(egl::Image *depthBuffer, unsigned int layer)
- {
- if(this->depthBuffer == depthBuffer)
- {
- return;
- }
-
- if(depthBuffer)
- {
- depthBuffer->addRef();
- }
-
- if(this->depthBuffer)
- {
- this->depthBuffer->release();
- }
-
- this->depthBuffer = depthBuffer;
-
- Renderer::setDepthBuffer(depthBuffer, layer);
- }
-
- void Device::setStencilBuffer(egl::Image *stencilBuffer, unsigned int layer)
- {
- if(this->stencilBuffer == stencilBuffer)
- {
- return;
- }
-
- if(stencilBuffer)
- {
- stencilBuffer->addRef();
- }
-
- if(this->stencilBuffer)
- {
- this->stencilBuffer->release();
- }
-
- this->stencilBuffer = stencilBuffer;
-
- Renderer::setStencilBuffer(stencilBuffer, layer);
- }
-
- void Device::setScissorRect(const sw::Rect &rect)
- {
- scissorRect = rect;
- }
-
- void Device::setVertexShader(const VertexShader *vertexShader)
- {
- this->vertexShader = vertexShader;
- vertexShaderDirty = true;
- }
-
- void Device::setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count)
- {
- for(unsigned int i = 0; i < count && startRegister + i < VERTEX_UNIFORM_VECTORS; i++)
- {
- vertexShaderConstantF[startRegister + i][0] = constantData[i * 4 + 0];
- vertexShaderConstantF[startRegister + i][1] = constantData[i * 4 + 1];
- vertexShaderConstantF[startRegister + i][2] = constantData[i * 4 + 2];
- vertexShaderConstantF[startRegister + i][3] = constantData[i * 4 + 3];
- }
-
- vertexShaderConstantsFDirty = max(startRegister + count, vertexShaderConstantsFDirty);
- vertexShaderDirty = true; // Reload DEF constants
- }
-
- void Device::setViewport(const Viewport &viewport)
- {
- this->viewport = viewport;
- }
-
- void Device::copyBuffer(byte *sourceBuffer, byte *destBuffer, unsigned int width, unsigned int height, unsigned int sourcePitch, unsigned int destPitch, unsigned int bytes, bool flipX, bool flipY)
- {
- if(flipX)
- {
- if(flipY)
- {
- sourceBuffer += (height - 1) * sourcePitch;
- for(unsigned int y = 0; y < height; ++y, sourceBuffer -= sourcePitch, destBuffer += destPitch)
- {
- byte *srcX = sourceBuffer + (width - 1) * bytes;
- byte *dstX = destBuffer;
- for(unsigned int x = 0; x < width; ++x, dstX += bytes, srcX -= bytes)
- {
- memcpy(dstX, srcX, bytes);
- }
- }
- }
- else
- {
- for(unsigned int y = 0; y < height; ++y, sourceBuffer += sourcePitch, destBuffer += destPitch)
- {
- byte *srcX = sourceBuffer + (width - 1) * bytes;
- byte *dstX = destBuffer;
- for(unsigned int x = 0; x < width; ++x, dstX += bytes, srcX -= bytes)
- {
- memcpy(dstX, srcX, bytes);
- }
- }
- }
- }
- else
- {
- unsigned int widthB = width * bytes;
-
- if(flipY)
- {
- sourceBuffer += (height - 1) * sourcePitch;
- for(unsigned int y = 0; y < height; ++y, sourceBuffer -= sourcePitch, destBuffer += destPitch)
- {
- memcpy(destBuffer, sourceBuffer, widthB);
- }
- }
- else
- {
- for(unsigned int y = 0; y < height; ++y, sourceBuffer += sourcePitch, destBuffer += destPitch)
- {
- memcpy(destBuffer, sourceBuffer, widthB);
- }
- }
- }
- }
-
- bool Device::stretchRect(sw::Surface *source, const sw::SliceRectF *sourceRect, sw::Surface *dest, const sw::SliceRect *destRect, unsigned char flags)
- {
- if(!source || !dest)
- {
- ERR("Invalid parameters");
- return false;
- }
-
- int sWidth = source->getWidth();
- int sHeight = source->getHeight();
- int dWidth = dest->getWidth();
- int dHeight = dest->getHeight();
-
- if(sourceRect && destRect &&
- (sourceRect->width() == 0.0f || !std::isfinite(sourceRect->width()) ||
- sourceRect->height() == 0.0f || !std::isfinite(sourceRect->height()) ||
- destRect->width() == 0.0f || destRect->height() == 0.0f))
- {
- return true; // No work to do.
- }
-
- bool flipX = false;
- bool flipY = false;
- if(sourceRect && destRect)
- {
- flipX = (sourceRect->x0 < sourceRect->x1) ^ (destRect->x0 < destRect->x1);
- flipY = (sourceRect->y0 < sourceRect->y1) ^ (destRect->y0 < destRect->y1);
- }
- else if(sourceRect)
- {
- flipX = (sourceRect->x0 > sourceRect->x1);
- flipY = (sourceRect->y0 > sourceRect->y1);
- }
- else if(destRect)
- {
- flipX = (destRect->x0 > destRect->x1);
- flipY = (destRect->y0 > destRect->y1);
- }
-
- SliceRectF sRect;
- SliceRect dRect;
-
- if(sourceRect)
- {
- sRect.x0 = sourceRect->x0;
- sRect.x1 = sourceRect->x1;
- sRect.y0 = sourceRect->y0;
- sRect.y1 = sourceRect->y1;
- sRect.slice = sourceRect->slice;
-
- if(sRect.x0 > sRect.x1)
- {
- swap(sRect.x0, sRect.x1);
- }
-
- if(sRect.y0 > sRect.y1)
- {
- swap(sRect.y0, sRect.y1);
- }
- }
- else
- {
- sRect.y0 = 0.0f;
- sRect.x0 = 0.0f;
- sRect.y1 = (float)sHeight;
- sRect.x1 = (float)sWidth;
- }
-
- if(destRect)
- {
- dRect = *destRect;
-
- if(dRect.x0 > dRect.x1)
- {
- swap(dRect.x0, dRect.x1);
- }
-
- if(dRect.y0 > dRect.y1)
- {
- swap(dRect.y0, dRect.y1);
- }
- }
- else
- {
- dRect.y0 = 0;
- dRect.x0 = 0;
- dRect.y1 = dHeight;
- dRect.x1 = dWidth;
- }
-
- sw::Rect srcClipRect(0, 0, sWidth, sHeight);
- if (!ClipSrcRect(sRect, dRect, srcClipRect, flipX, flipY))
- {
- return true;
- }
-
- sw::Rect dstClipRect(0, 0, dWidth, dHeight);
- if (!ClipDstRect(sRect, dRect, dstClipRect, flipX, flipY))
- {
- return true;
- }
-
- if((sRect.width() == 0) || (sRect.height() == 0) ||
- (dRect.width() == 0) || (dRect.height() == 0) ||
- !std::isfinite(sRect.width()) || !std::isfinite(sRect.height()))
- {
- return true; // no work to do
- }
-
- if(!validRectangle(&sRect, source) || !validRectangle(&dRect, dest))
- {
- ERR("Invalid parameters");
- return false;
- }
-
- bool isDepth = (flags & Device::DEPTH_BUFFER) && Surface::isDepth(source->getInternalFormat());
- bool isStencil = (flags & Device::STENCIL_BUFFER) && Surface::isStencil(source->getInternalFormat());
- bool isColor = (flags & Device::COLOR_BUFFER) == Device::COLOR_BUFFER;
-
- if(!isColor && !isDepth && !isStencil)
- {
- return true;
- }
-
- int sourceSliceB = isStencil ? source->getStencilSliceB() : source->getInternalSliceB();
- int destSliceB = isStencil ? dest->getStencilSliceB() : dest->getInternalSliceB();
- int sourcePitchB = isStencil ? source->getStencilPitchB() : source->getInternalPitchB();
- int destPitchB = isStencil ? dest->getStencilPitchB() : dest->getInternalPitchB();
-
- bool isOutOfBounds = (sRect.x0 < 0.0f) || (sRect.y0 < 0.0f) || (sRect.x1 > (float)sWidth) || (sRect.y1 > (float)sHeight);
- bool scaling = (sRect.width() != (float)dRect.width()) || (sRect.height() != (float)dRect.height());
- bool equalFormats = source->getInternalFormat() == dest->getInternalFormat();
- bool hasQuadLayout = Surface::hasQuadLayout(source->getInternalFormat()) || Surface::hasQuadLayout(dest->getInternalFormat());
- bool fullCopy = (sRect.x0 == 0.0f) && (sRect.y0 == 0.0f) && (dRect.x0 == 0) && (dRect.y0 == 0) &&
- (sRect.x1 == (float)sWidth) && (sRect.y1 == (float)sHeight) && (dRect.x1 == dWidth) && (dRect.y1 == dHeight);
- bool alpha0xFF = false;
- bool equalSlice = (sourceSliceB == destSliceB) && (source->getBorder() == 0) && (dest->getBorder() == 0);
- bool smallMargin = sourcePitchB <= source->getWidth() * Surface::bytes(source->getInternalFormat()) + 16;
-
- if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) ||
- (source->getInternalFormat() == FORMAT_X8R8G8B8 && dest->getInternalFormat() == FORMAT_A8R8G8B8))
- {
- equalFormats = true;
- alpha0xFF = true;
- }
-
- if(fullCopy && !scaling && !isOutOfBounds && equalFormats && !alpha0xFF && equalSlice && smallMargin && !flipX && !flipY)
- {
- byte *sourceBuffer = isStencil ? (byte*)source->lockStencil(0, 0, 0, PUBLIC) : (byte*)source->lockInternal(0, 0, 0, LOCK_READONLY, PUBLIC);
- byte *destBuffer = isStencil ? (byte*)dest->lockStencil(0, 0, 0, PUBLIC) : (byte*)dest->lockInternal(0, 0, 0, LOCK_DISCARD, PUBLIC);
-
- memcpy(destBuffer, sourceBuffer, sourceSliceB);
-
- isStencil ? source->unlockStencil() : source->unlockInternal();
- isStencil ? dest->unlockStencil() : dest->unlockInternal();
- }
- else if(isDepth && !scaling && !isOutOfBounds && equalFormats && !hasQuadLayout)
- {
- byte *sourceBuffer = (byte*)source->lockInternal((int)sRect.x0, (int)sRect.y0, 0, LOCK_READONLY, PUBLIC);
- byte *destBuffer = (byte*)dest->lockInternal(dRect.x0, dRect.y0, 0, fullCopy ? LOCK_DISCARD : LOCK_WRITEONLY, PUBLIC);
-
- copyBuffer(sourceBuffer, destBuffer, dRect.width(), dRect.height(), sourcePitchB, destPitchB, Surface::bytes(source->getInternalFormat()), flipX, flipY);
-
- source->unlockInternal();
- dest->unlockInternal();
- }
- else if((flags & Device::COLOR_BUFFER) && !scaling && !isOutOfBounds && equalFormats && !hasQuadLayout)
- {
- byte *sourceBytes = (byte*)source->lockInternal((int)sRect.x0, (int)sRect.y0, sourceRect->slice, LOCK_READONLY, PUBLIC);
- byte *destBytes = (byte*)dest->lockInternal(dRect.x0, dRect.y0, destRect->slice, fullCopy ? LOCK_DISCARD : LOCK_WRITEONLY, PUBLIC);
-
- unsigned int width = dRect.x1 - dRect.x0;
- unsigned int height = dRect.y1 - dRect.y0;
-
- copyBuffer(sourceBytes, destBytes, width, height, sourcePitchB, destPitchB, Surface::bytes(source->getInternalFormat()), flipX, flipY);
-
- if(alpha0xFF)
- {
- for(unsigned int y = 0; y < height; y++)
- {
- for(unsigned int x = 0; x < width; x++)
- {
- destBytes[4 * x + 3] = 0xFF;
- }
-
- destBytes += destPitchB;
- }
- }
-
- source->unlockInternal();
- dest->unlockInternal();
- }
- else if(isColor || isDepth || isStencil)
- {
- if(flipX)
- {
- swap(dRect.x0, dRect.x1);
- }
- if(flipY)
- {
- swap(dRect.y0, dRect.y1);
- }
-
- blit(source, sRect, dest, dRect, scaling && (flags & Device::USE_FILTER), isStencil);
- }
- else UNREACHABLE(false);
-
- return true;
- }
-
- bool Device::stretchCube(sw::Surface *source, sw::Surface *dest)
- {
- if(!source || !dest || Surface::isDepth(source->getInternalFormat()) || Surface::isStencil(source->getInternalFormat()))
- {
- ERR("Invalid parameters");
- return false;
- }
-
- int sWidth = source->getWidth();
- int sHeight = source->getHeight();
- int sDepth = source->getDepth();
- int dWidth = dest->getWidth();
- int dHeight = dest->getHeight();
- int dDepth = dest->getDepth();
-
- if((sWidth == 0) || (sHeight == 0) || (sDepth == 0) ||
- (dWidth == 0) || (dHeight == 0) || (dDepth == 0))
- {
- return true; // no work to do
- }
-
- bool scaling = (sWidth != dWidth) || (sHeight != dHeight) || (sDepth != dDepth);
- bool equalFormats = source->getInternalFormat() == dest->getInternalFormat();
- bool alpha0xFF = false;
-
- if((source->getInternalFormat() == FORMAT_A8R8G8B8 && dest->getInternalFormat() == FORMAT_X8R8G8B8) ||
- (source->getInternalFormat() == FORMAT_X8R8G8B8 && dest->getInternalFormat() == FORMAT_A8R8G8B8))
- {
- equalFormats = true;
- alpha0xFF = true;
- }
-
- if(!scaling && equalFormats)
- {
- unsigned int sourcePitch = source->getInternalPitchB();
- unsigned int destPitch = dest->getInternalPitchB();
- unsigned int bytes = dWidth * Surface::bytes(source->getInternalFormat());
-
- for(int z = 0; z < dDepth; z++)
- {
- unsigned char *sourceBytes = (unsigned char*)source->lockInternal(0, 0, z, LOCK_READONLY, PUBLIC);
- unsigned char *destBytes = (unsigned char*)dest->lockInternal(0, 0, z, LOCK_READWRITE, PUBLIC);
-
- for(int y = 0; y < dHeight; y++)
- {
- memcpy(destBytes, sourceBytes, bytes);
-
- if(alpha0xFF)
- {
- for(int x = 0; x < dWidth; x++)
- {
- destBytes[4 * x + 3] = 0xFF;
- }
- }
-
- sourceBytes += sourcePitch;
- destBytes += destPitch;
- }
-
- source->unlockInternal();
- dest->unlockInternal();
- }
- }
- else
- {
- blit3D(source, dest);
- }
-
- return true;
- }
-
- bool Device::bindResources()
- {
- if(!bindViewport() && !context->transformFeedbackEnabled)
- {
- return false; // Zero-area target region
- }
-
- bindShaderConstants();
-
- return true;
- }
-
- void Device::bindShaderConstants()
- {
- if(pixelShaderDirty)
- {
- if(pixelShader)
- {
- if(pixelShaderConstantsFDirty)
- {
- Renderer::setPixelShaderConstantF(0, pixelShaderConstantF[0], pixelShaderConstantsFDirty);
- }
-
- Renderer::setPixelShader(pixelShader); // Loads shader constants set with DEF
- pixelShaderConstantsFDirty = pixelShader->dirtyConstantsF; // Shader DEF'ed constants are dirty
- }
- else
- {
- setPixelShader(0);
- }
-
- pixelShaderDirty = false;
- }
-
- if(vertexShaderDirty)
- {
- if(vertexShader)
- {
- if(vertexShaderConstantsFDirty)
- {
- Renderer::setVertexShaderConstantF(0, vertexShaderConstantF[0], vertexShaderConstantsFDirty);
- }
-
- Renderer::setVertexShader(vertexShader); // Loads shader constants set with DEF
- vertexShaderConstantsFDirty = vertexShader->dirtyConstantsF; // Shader DEF'ed constants are dirty
- }
- else
- {
- setVertexShader(0);
- }
-
- vertexShaderDirty = false;
- }
- }
-
- bool Device::bindViewport()
- {
- if(viewport.width <= 0 || viewport.height <= 0)
- {
- return false;
- }
-
- if(scissorEnable)
- {
- if(scissorRect.x0 >= scissorRect.x1 || scissorRect.y0 >= scissorRect.y1)
- {
- return false;
- }
-
- sw::Rect scissor;
- scissor.x0 = scissorRect.x0;
- scissor.x1 = scissorRect.x1;
- scissor.y0 = scissorRect.y0;
- scissor.y1 = scissorRect.y1;
-
- setScissor(scissor);
- }
- else
- {
- sw::Rect scissor;
- scissor.x0 = viewport.x0;
- scissor.x1 = viewport.x0 + viewport.width;
- scissor.y0 = viewport.y0;
- scissor.y1 = viewport.y0 + viewport.height;
-
- for(int i = 0; i < RENDERTARGETS; ++i)
- {
- if(renderTarget[i])
- {
- scissor.x0 = max(scissor.x0, 0);
- scissor.x1 = min(scissor.x1, renderTarget[i]->getWidth());
- scissor.y0 = max(scissor.y0, 0);
- scissor.y1 = min(scissor.y1, renderTarget[i]->getHeight());
- }
- }
-
- if(depthBuffer)
- {
- scissor.x0 = max(scissor.x0, 0);
- scissor.x1 = min(scissor.x1, depthBuffer->getWidth());
- scissor.y0 = max(scissor.y0, 0);
- scissor.y1 = min(scissor.y1, depthBuffer->getHeight());
- }
-
- if(stencilBuffer)
- {
- scissor.x0 = max(scissor.x0, 0);
- scissor.x1 = min(scissor.x1, stencilBuffer->getWidth());
- scissor.y0 = max(scissor.y0, 0);
- scissor.y1 = min(scissor.y1, stencilBuffer->getHeight());
- }
-
- // Ensure scissor range is positive
- scissor.x0 = max(scissor.x0, 0);
- scissor.x1 = max(scissor.x1, 0);
- scissor.y0 = max(scissor.y0, 0);
- scissor.y1 = max(scissor.y1, 0);
-
- setScissor(scissor);
- }
-
- sw::Viewport view;
- view.x0 = (float)viewport.x0;
- view.y0 = (float)viewport.y0;
- view.width = (float)viewport.width;
- view.height = (float)viewport.height;
- view.minZ = viewport.minZ;
- view.maxZ = viewport.maxZ;
-
- Renderer::setViewport(view);
-
- return true;
- }
-
- bool Device::validRectangle(const sw::Rect *rect, sw::Surface *surface)
- {
- if(!rect)
- {
- return true;
- }
-
- if(rect->x1 <= rect->x0 || rect->y1 <= rect->y0)
- {
- return false;
- }
-
- if(rect->x0 < 0 || rect->y0 < 0)
- {
- return false;
- }
-
- if(rect->x1 >(int)surface->getWidth() || rect->y1 >(int)surface->getHeight())
- {
- return false;
- }
-
- return true;
- }
-
- bool Device::validRectangle(const sw::RectF *rect, sw::Surface *surface)
- {
- if(!rect)
- {
- return true;
- }
-
- if(rect->x1 <= rect->x0 || rect->y1 <= rect->y0)
- {
- return false;
- }
-
- if (!std::isfinite(rect->x0) || !std::isfinite(rect->x1) ||
- !std::isfinite(rect->y0) || !std::isfinite(rect->y1))
- {
- return false;
- }
-
- return true;
- }
-
- bool Device::ClipDstRect(sw::RectF &srcRect, sw::Rect &dstRect, sw::Rect &clipRect, bool flipX, bool flipY)
- {
- if(dstRect.x0 < clipRect.x0)
- {
- float offset = (static_cast<float>(clipRect.x0 - dstRect.x0) / static_cast<float>(dstRect.width())) * srcRect.width();
- if (!std::isfinite(offset))
- {
- return false;
- }
- if(flipX)
- {
- srcRect.x1 -= offset;
- }
- else
- {
- srcRect.x0 += offset;
- }
- dstRect.x0 = clipRect.x0;
- }
- if(dstRect.x1 > clipRect.x1)
- {
- float offset = (static_cast<float>(dstRect.x1 - clipRect.x1) / static_cast<float>(dstRect.width())) * srcRect.width();
- if (!std::isfinite(offset))
- {
- return false;
- }
- if(flipX)
- {
- srcRect.x0 += offset;
- }
- else
- {
- srcRect.x1 -= offset;
- }
- dstRect.x1 = clipRect.x1;
- }
- if(dstRect.y0 < clipRect.y0)
- {
- float offset = (static_cast<float>(clipRect.y0 - dstRect.y0) / static_cast<float>(dstRect.height())) * srcRect.height();
- if (!std::isfinite(offset))
- {
- return false;
- }
- if(flipY)
- {
- srcRect.y1 -= offset;
- }
- else
- {
- srcRect.y0 += offset;
- }
- dstRect.y0 = clipRect.y0;
- }
- if(dstRect.y1 > clipRect.y1)
- {
- float offset = (static_cast<float>(dstRect.y1 - clipRect.y1) / static_cast<float>(dstRect.height())) * srcRect.height();
- if (!std::isfinite(offset))
- {
- return false;
- }
- if(flipY)
- {
- srcRect.y0 += offset;
- }
- else
- {
- srcRect.y1 -= offset;
- }
- dstRect.y1 = clipRect.y1;
- }
- return true;
- }
-
- bool Device::ClipSrcRect(sw::RectF &srcRect, sw::Rect &dstRect, sw::Rect &clipRect, bool flipX, bool flipY)
- {
- if(srcRect.x0 < static_cast<float>(clipRect.x0))
- {
- float ratio = static_cast<float>(dstRect.width()) / srcRect.width();
- float offsetf = roundf((static_cast<float>(clipRect.x0) - srcRect.x0) * ratio);
- if (!FloatFitsInInt(offsetf) || !std::isfinite(ratio))
- {
- return false;
- }
- int offset = static_cast<int>(offsetf);
- if(flipX)
- {
- dstRect.x1 -= offset;
- }
- else
- {
- dstRect.x0 += offset;
- }
- srcRect.x0 += offsetf / ratio;
- }
- if(srcRect.x1 > static_cast<float>(clipRect.x1))
- {
- float ratio = static_cast<float>(dstRect.width()) / srcRect.width();
- float offsetf = roundf((srcRect.x1 - static_cast<float>(clipRect.x1)) * ratio);
- if (!FloatFitsInInt(offsetf) || !std::isfinite(ratio))
- {
- return false;
- }
- int offset = static_cast<int>(offsetf);
- if(flipX)
- {
- dstRect.x0 += offset;
- }
- else
- {
- dstRect.x1 -= offset;
- }
- srcRect.x1 -= offsetf / ratio;
- }
- if(srcRect.y0 < static_cast<float>(clipRect.y0))
- {
- float ratio = static_cast<float>(dstRect.height()) / srcRect.height();
- float offsetf = roundf((static_cast<float>(clipRect.y0) - srcRect.y0) * ratio);
- if (!FloatFitsInInt(offsetf) || !std::isfinite(ratio))
- {
- return false;
- }
- int offset = static_cast<int>(offsetf);
- if(flipY)
- {
- dstRect.y1 -= offset;
- }
- else
- {
- dstRect.y0 += offset;
- }
- srcRect.y0 += offsetf / ratio;
- }
- if(srcRect.y1 > static_cast<float>(clipRect.y1))
- {
- float ratio = static_cast<float>(dstRect.height()) / srcRect.height();
- float offsetf = roundf((srcRect.y1 - static_cast<float>(clipRect.y1)) * ratio);
- if (!FloatFitsInInt(offsetf) || !std::isfinite(ratio))
- {
- return false;
- }
- int offset = static_cast<int>(offsetf);
- if(flipY)
- {
- dstRect.y0 += offset;
- }
- else
- {
- dstRect.y1 -= offset;
- }
- srcRect.y1 -= offsetf / ratio;
- }
- return true;
- }
-
- void Device::finish()
- {
- synchronize();
- }
-}
diff --git a/src/OpenGL/libGLESv2/Device.hpp b/src/OpenGL/libGLESv2/Device.hpp
deleted file mode 100644
index 9b34e298a..000000000
--- a/src/OpenGL/libGLESv2/Device.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef gl_Device_hpp
-#define gl_Device_hpp
-
-#include "Renderer/Renderer.hpp"
-
-namespace egl
-{
- class Image;
-}
-
-namespace es2
-{
- class Texture;
-
- struct Viewport
- {
- int x0;
- int y0;
- unsigned int width;
- unsigned int height;
- float minZ;
- float maxZ;
- };
-
- class Device : public sw::Renderer
- {
- public:
- enum : unsigned char
- {
- USE_FILTER = 0x01,
- COLOR_BUFFER = 0x02,
- DEPTH_BUFFER = 0x04,
- STENCIL_BUFFER = 0x08,
- ALL_BUFFERS = COLOR_BUFFER | DEPTH_BUFFER | STENCIL_BUFFER,
- };
-
- explicit Device(sw::Context *context);
-
- virtual ~Device();
-
- void *operator new(size_t size);
- void operator delete(void * mem);
-
- void clearColor(float red, float green, float blue, float alpha, unsigned int rgbaMask);
- void clearDepth(float z);
- void clearStencil(unsigned int stencil, unsigned int mask);
- void drawIndexedPrimitive(sw::DrawType type, unsigned int indexOffset, unsigned int primitiveCount);
- void drawPrimitive(sw::DrawType type, unsigned int primiveCount);
- void setPixelShader(const sw::PixelShader *shader);
- void setPixelShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
- void setScissorEnable(bool enable);
- void setRenderTarget(int index, egl::Image *renderTarget, unsigned int layer);
- void setDepthBuffer(egl::Image *depthBuffer, unsigned int layer);
- void setStencilBuffer(egl::Image *stencilBuffer, unsigned int layer);
- void setScissorRect(const sw::Rect &rect);
- void setVertexShader(const sw::VertexShader *shader);
- void setVertexShaderConstantF(unsigned int startRegister, const float *constantData, unsigned int count);
- void setViewport(const Viewport &viewport);
-
- bool stretchRect(sw::Surface *sourceSurface, const sw::SliceRectF *sourceRect, sw::Surface *destSurface, const sw::SliceRect *destRect, unsigned char flags);
- bool stretchCube(sw::Surface *sourceSurface, sw::Surface *destSurface);
- void finish();
-
- static bool ClipDstRect(sw::RectF &srcRect, sw::Rect &dstRect, sw::Rect &clipRect, bool flipX = false, bool flipY = false);
- static bool ClipSrcRect(sw::RectF &srcRect, sw::Rect &dstRect, sw::Rect &clipRect, bool flipX = false, bool flipY = false);
-
- private:
- sw::Context *const context;
-
- bool bindResources();
- void bindShaderConstants();
- bool bindViewport(); // Also adjusts for scissoring
-
- bool validRectangle(const sw::Rect *rect, sw::Surface *surface);
- bool validRectangle(const sw::RectF *rect, sw::Surface *surface);
-
- void copyBuffer(sw::byte *sourceBuffer, sw::byte *destBuffer, unsigned int width, unsigned int height, unsigned int sourcePitch, unsigned int destPitch, unsigned int bytes, bool flipX, bool flipY);
-
- Viewport viewport;
- sw::Rect scissorRect;
- bool scissorEnable;
-
- const sw::PixelShader *pixelShader;
- const sw::VertexShader *vertexShader;
-
- bool pixelShaderDirty;
- unsigned int pixelShaderConstantsFDirty;
- bool vertexShaderDirty;
- unsigned int vertexShaderConstantsFDirty;
-
- float pixelShaderConstantF[sw::FRAGMENT_UNIFORM_VECTORS][4];
- float vertexShaderConstantF[sw::VERTEX_UNIFORM_VECTORS][4];
-
- egl::Image *renderTarget[sw::RENDERTARGETS];
- egl::Image *depthBuffer;
- egl::Image *stencilBuffer;
- };
-}
-
-#endif // gl_Device_hpp
diff --git a/src/OpenGL/libGLESv2/Fence.cpp b/src/OpenGL/libGLESv2/Fence.cpp
deleted file mode 100644
index fce4c5249..000000000
--- a/src/OpenGL/libGLESv2/Fence.cpp
+++ /dev/null
@@ -1,173 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Fence.cpp: Implements the Fence class, which supports the GL_NV_fence extension.
-
-#include "Fence.h"
-
-#include "main.h"
-#include "Common/Thread.hpp"
-
-namespace es2
-{
-
-Fence::Fence()
-{
- mQuery = false;
- mCondition = GL_NONE;
- mStatus = GL_FALSE;
-}
-
-Fence::~Fence()
-{
- mQuery = false;
-}
-
-GLboolean Fence::isFence()
-{
- // GL_NV_fence spec:
- // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence.
- return mQuery;
-}
-
-void Fence::setFence(GLenum condition)
-{
- if(condition != GL_ALL_COMPLETED_NV)
- {
- return error(GL_INVALID_VALUE);
- }
-
- mQuery = true;
- mCondition = condition;
- mStatus = GL_FALSE;
-}
-
-GLboolean Fence::testFence()
-{
- if(!mQuery)
- {
- return error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- // The current assumtion is that no matter where the fence is placed, it is
- // done by the time it is tested, which is similar to Context::flush(), since
- // we don't queue anything without processing it as fast as possible.
- mStatus = GL_TRUE;
-
- return mStatus;
-}
-
-void Fence::finishFence()
-{
- if(!mQuery)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- while(!testFence())
- {
- sw::Thread::yield();
- }
-}
-
-void Fence::getFenceiv(GLenum pname, GLint *params)
-{
- if(!mQuery)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_FENCE_STATUS_NV:
- {
- // GL_NV_fence spec:
- // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV
- // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence.
- if(mStatus)
- {
- params[0] = GL_TRUE;
- return;
- }
-
- mStatus = testFence();
-
- params[0] = mStatus;
- break;
- }
- case GL_FENCE_CONDITION_NV:
- params[0] = mCondition;
- break;
- default:
- return error(GL_INVALID_ENUM);
- break;
- }
-}
-
-FenceSync::FenceSync(GLuint name, GLenum condition, GLbitfield flags) : NamedObject(name), mCondition(condition), mFlags(flags)
-{
-}
-
-FenceSync::~FenceSync()
-{
-}
-
-GLenum FenceSync::clientWait(GLbitfield flags, GLuint64 timeout)
-{
- // The current assumtion is that no matter where the fence is placed, it is
- // done by the time it is tested, which is similar to Context::flush(), since
- // we don't queue anything without processing it as fast as possible.
- return GL_ALREADY_SIGNALED;
-}
-
-void FenceSync::serverWait(GLbitfield flags, GLuint64 timeout)
-{
-}
-
-void FenceSync::getSynciv(GLenum pname, GLsizei *length, GLint *values)
-{
- switch(pname)
- {
- case GL_OBJECT_TYPE:
- values[0] = GL_SYNC_FENCE;
- if(length) {
- *length = 1;
- }
- break;
- case GL_SYNC_STATUS:
- // The current assumtion is that no matter where the fence is placed, it is
- // done by the time it is tested, which is similar to Context::flush(), since
- // we don't queue anything without processing it as fast as possible.
- values[0] = GL_SIGNALED;
- if(length) {
- *length = 1;
- }
- break;
- case GL_SYNC_CONDITION:
- values[0] = GL_SYNC_GPU_COMMANDS_COMPLETE;
- if(length) {
- *length = 1;
- }
- break;
- case GL_SYNC_FLAGS:
- if(length) {
- *length = 0;
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/Fence.h b/src/OpenGL/libGLESv2/Fence.h
deleted file mode 100644
index 6ccb7d098..000000000
--- a/src/OpenGL/libGLESv2/Fence.h
+++ /dev/null
@@ -1,64 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Fence.h: Defines the Fence class, which supports the GL_NV_fence extension.
-
-#ifndef LIBGLESV2_FENCE_H_
-#define LIBGLESV2_FENCE_H_
-
-#include "common/Object.hpp"
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class Fence
-{
-public:
- Fence();
- virtual ~Fence();
-
- GLboolean isFence();
- void setFence(GLenum condition);
- GLboolean testFence();
- void finishFence();
- void getFenceiv(GLenum pname, GLint *params);
-
-private:
- bool mQuery;
- GLenum mCondition;
- GLboolean mStatus;
-};
-
-class FenceSync : public gl::NamedObject
-{
-public:
- FenceSync(GLuint name, GLenum condition, GLbitfield flags);
- virtual ~FenceSync();
-
- GLenum clientWait(GLbitfield flags, GLuint64 timeout);
- void serverWait(GLbitfield flags, GLuint64 timeout);
- void getSynciv(GLenum pname, GLsizei *length, GLint *values);
-
- GLenum getCondition() const { return mCondition; }
- GLbitfield getFlags() const { return mFlags; }
-
-private:
- GLenum mCondition;
- GLbitfield mFlags;
-};
-
-}
-
-#endif // LIBGLESV2_FENCE_H_
diff --git a/src/OpenGL/libGLESv2/Framebuffer.cpp b/src/OpenGL/libGLESv2/Framebuffer.cpp
deleted file mode 100644
index 88adb8e4c..000000000
--- a/src/OpenGL/libGLESv2/Framebuffer.cpp
+++ /dev/null
@@ -1,722 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Framebuffer.cpp: Implements the Framebuffer class. Implements GL framebuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
-
-#include "Framebuffer.h"
-
-#include "main.h"
-#include "Renderbuffer.h"
-#include "Texture.h"
-#include "utilities.h"
-
-#include <algorithm>
-
-namespace es2
-{
-
-bool Framebuffer::IsRenderbuffer(GLenum type)
-{
- return type == GL_RENDERBUFFER || type == GL_FRAMEBUFFER_DEFAULT;
-}
-
-Framebuffer::Framebuffer()
-{
- readBuffer = GL_COLOR_ATTACHMENT0;
- drawBuffer[0] = GL_COLOR_ATTACHMENT0;
- for(int i = 1; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- drawBuffer[i] = GL_NONE;
- }
-
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- mColorbufferType[i] = GL_NONE;
- mColorbufferLayer[i] = 0;
- }
-
- mDepthbufferType = GL_NONE;
- mDepthbufferLayer = 0;
- mStencilbufferType = GL_NONE;
- mStencilbufferLayer = 0;
-}
-
-Framebuffer::~Framebuffer()
-{
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- mColorbufferPointer[i] = nullptr;
- }
- mDepthbufferPointer = nullptr;
- mStencilbufferPointer = nullptr;
-}
-
-Renderbuffer *Framebuffer::lookupRenderbuffer(GLenum type, GLuint handle, GLint level) const
-{
- Context *context = getContextLocked();
- Renderbuffer *buffer = nullptr;
-
- if(type == GL_NONE)
- {
- buffer = nullptr;
- }
- else if(IsRenderbuffer(type))
- {
- buffer = context->getRenderbuffer(handle);
- }
- else if(IsTextureTarget(type))
- {
- buffer = context->getTexture(handle)->getRenderbuffer(type, level);
- }
- else UNREACHABLE(type);
-
- return buffer;
-}
-
-void Framebuffer::setColorbuffer(GLenum type, GLuint colorbuffer, GLuint index, GLint level, GLint layer)
-{
- mColorbufferType[index] = (colorbuffer != 0) ? type : GL_NONE;
- mColorbufferPointer[index] = lookupRenderbuffer(type, colorbuffer, level);
- mColorbufferLayer[index] = layer;
-}
-
-void Framebuffer::setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level, GLint layer)
-{
- mDepthbufferType = (depthbuffer != 0) ? type : GL_NONE;
- mDepthbufferPointer = lookupRenderbuffer(type, depthbuffer, level);
- mDepthbufferLayer = layer;
-}
-
-void Framebuffer::setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level, GLint layer)
-{
- mStencilbufferType = (stencilbuffer != 0) ? type : GL_NONE;
- mStencilbufferPointer = lookupRenderbuffer(type, stencilbuffer, level);
- mStencilbufferLayer = layer;
-}
-
-void Framebuffer::setReadBuffer(GLenum buf)
-{
- readBuffer = buf;
-}
-
-void Framebuffer::setDrawBuffer(GLuint index, GLenum buf)
-{
- drawBuffer[index] = buf;
-}
-
-GLenum Framebuffer::getReadBuffer() const
-{
- return readBuffer;
-}
-
-GLenum Framebuffer::getDrawBuffer(GLuint index) const
-{
- return drawBuffer[index];
-}
-
-void Framebuffer::detachTexture(GLuint texture)
-{
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- if(mColorbufferPointer[i].name() == texture && IsTextureTarget(mColorbufferType[i]))
- {
- mColorbufferType[i] = GL_NONE;
- mColorbufferPointer[i] = nullptr;
- }
- }
-
- if(mDepthbufferPointer.name() == texture && IsTextureTarget(mDepthbufferType))
- {
- mDepthbufferType = GL_NONE;
- mDepthbufferPointer = nullptr;
- }
-
- if(mStencilbufferPointer.name() == texture && IsTextureTarget(mStencilbufferType))
- {
- mStencilbufferType = GL_NONE;
- mStencilbufferPointer = nullptr;
- }
-}
-
-void Framebuffer::detachRenderbuffer(GLuint renderbuffer)
-{
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- if(mColorbufferPointer[i].name() == renderbuffer && IsRenderbuffer(mColorbufferType[i]))
- {
- mColorbufferType[i] = GL_NONE;
- mColorbufferPointer[i] = nullptr;
- }
- }
-
- if(mDepthbufferPointer.name() == renderbuffer && IsRenderbuffer(mDepthbufferType))
- {
- mDepthbufferType = GL_NONE;
- mDepthbufferPointer = nullptr;
- }
-
- if(mStencilbufferPointer.name() == renderbuffer && IsRenderbuffer(mStencilbufferType))
- {
- mStencilbufferType = GL_NONE;
- mStencilbufferPointer = nullptr;
- }
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-egl::Image *Framebuffer::getRenderTarget(GLuint index)
-{
- if(index < MAX_COLOR_ATTACHMENTS)
- {
- Renderbuffer *colorbuffer = mColorbufferPointer[index];
-
- if(colorbuffer)
- {
- return colorbuffer->getRenderTarget();
- }
- }
-
- return nullptr;
-}
-
-egl::Image *Framebuffer::getReadRenderTarget()
-{
- return getRenderTarget(getReadBufferIndex());
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-egl::Image *Framebuffer::getDepthBuffer()
-{
- Renderbuffer *depthbuffer = mDepthbufferPointer;
-
- if(depthbuffer)
- {
- return depthbuffer->getRenderTarget();
- }
-
- return nullptr;
-}
-
-// Increments refcount on surface.
-// caller must Release() the returned surface
-egl::Image *Framebuffer::getStencilBuffer()
-{
- Renderbuffer *stencilbuffer = mStencilbufferPointer;
-
- if(stencilbuffer)
- {
- return stencilbuffer->getRenderTarget();
- }
-
- return nullptr;
-}
-
-Renderbuffer *Framebuffer::getColorbuffer(GLuint index) const
-{
- return (index < MAX_COLOR_ATTACHMENTS) ? mColorbufferPointer[index] : (Renderbuffer*)nullptr;
-}
-
-Renderbuffer *Framebuffer::getReadColorbuffer() const
-{
- return getColorbuffer(getReadBufferIndex());
-}
-
-Renderbuffer *Framebuffer::getDepthbuffer() const
-{
- return mDepthbufferPointer;
-}
-
-Renderbuffer *Framebuffer::getStencilbuffer() const
-{
- return mStencilbufferPointer;
-}
-
-GLenum Framebuffer::getReadBufferType()
-{
- if(readBuffer == GL_NONE)
- {
- return GL_NONE;
- }
-
- return mColorbufferType[getReadBufferIndex()];
-}
-
-GLenum Framebuffer::getColorbufferType(GLuint index)
-{
- return mColorbufferType[index];
-}
-
-GLenum Framebuffer::getDepthbufferType()
-{
- return mDepthbufferType;
-}
-
-GLenum Framebuffer::getStencilbufferType()
-{
- return mStencilbufferType;
-}
-
-GLuint Framebuffer::getColorbufferName(GLuint index)
-{
- return mColorbufferPointer[index].name();
-}
-
-GLuint Framebuffer::getDepthbufferName()
-{
- return mDepthbufferPointer.name();
-}
-
-GLuint Framebuffer::getStencilbufferName()
-{
- return mStencilbufferPointer.name();
-}
-
-GLint Framebuffer::getColorbufferLayer(GLuint index)
-{
- return mColorbufferLayer[index];
-}
-
-GLint Framebuffer::getDepthbufferLayer()
-{
- return mDepthbufferLayer;
-}
-
-GLint Framebuffer::getStencilbufferLayer()
-{
- return mStencilbufferLayer;
-}
-
-bool Framebuffer::hasStencil()
-{
- if(mStencilbufferType != GL_NONE)
- {
- Renderbuffer *stencilbufferObject = getStencilbuffer();
-
- if(stencilbufferObject)
- {
- return stencilbufferObject->getStencilSize() > 0;
- }
- }
-
- return false;
-}
-
-GLenum Framebuffer::completeness()
-{
- int width;
- int height;
- int samples;
-
- return completeness(width, height, samples);
-}
-
-GLenum Framebuffer::completeness(int &width, int &height, int &samples)
-{
- width = -1;
- height = -1;
- samples = -1;
-
- for(int i = 0; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- if(mColorbufferType[i] != GL_NONE)
- {
- Renderbuffer *colorbuffer = getColorbuffer(i);
-
- if(!colorbuffer)
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(colorbuffer->getWidth() == 0 || colorbuffer->getHeight() == 0 || (colorbuffer->getDepth() <= mColorbufferLayer[i]))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(IsRenderbuffer(mColorbufferType[i]))
- {
- if(!IsColorRenderable(colorbuffer->getFormat()))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else if(IsTextureTarget(mColorbufferType[i]))
- {
- GLint format = colorbuffer->getFormat();
-
- if(!IsColorRenderable(format))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(IsDepthTexture(format) || IsStencilTexture(format))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else
- {
- UNREACHABLE(mColorbufferType[i]);
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(width == -1 || height == -1)
- {
- width = colorbuffer->getWidth();
- height = colorbuffer->getHeight();
- samples = colorbuffer->getSamples();
- }
- else
- {
- if(samples != colorbuffer->getSamples())
- {
- return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
- }
-
- width = std::min(width, colorbuffer->getWidth());
- height = std::min(height, colorbuffer->getHeight());
- }
- }
- }
-
- Renderbuffer *depthbuffer = nullptr;
- Renderbuffer *stencilbuffer = nullptr;
-
- if(mDepthbufferType != GL_NONE)
- {
- depthbuffer = getDepthbuffer();
-
- if(!depthbuffer)
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(depthbuffer->getWidth() == 0 || depthbuffer->getHeight() == 0 || (depthbuffer->getDepth() <= mDepthbufferLayer))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(IsRenderbuffer(mDepthbufferType))
- {
- if(!es2::IsDepthRenderable(depthbuffer->getFormat()))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else if(IsTextureTarget(mDepthbufferType))
- {
- if(!es2::IsDepthTexture(depthbuffer->getFormat()))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else
- {
- UNREACHABLE(mDepthbufferType);
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(width == -1 || height == -1)
- {
- width = depthbuffer->getWidth();
- height = depthbuffer->getHeight();
- samples = depthbuffer->getSamples();
- }
- else
- {
- if(samples != depthbuffer->getSamples())
- {
- return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
- }
-
- width = std::min(width, depthbuffer->getWidth());
- height = std::min(height, depthbuffer->getHeight());
- }
- }
-
- if(mStencilbufferType != GL_NONE)
- {
- stencilbuffer = getStencilbuffer();
-
- if(!stencilbuffer)
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(stencilbuffer->getWidth() == 0 || stencilbuffer->getHeight() == 0 || (stencilbuffer->getDepth() <= mStencilbufferLayer))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(IsRenderbuffer(mStencilbufferType))
- {
- if(!es2::IsStencilRenderable(stencilbuffer->getFormat()))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else if(IsTextureTarget(mStencilbufferType))
- {
- GLenum internalformat = stencilbuffer->getFormat();
-
- if(!es2::IsStencilTexture(internalformat))
- {
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
- }
- else
- {
- UNREACHABLE(mStencilbufferType);
- return GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT;
- }
-
- if(width == -1 || height == -1)
- {
- width = stencilbuffer->getWidth();
- height = stencilbuffer->getHeight();
- samples = stencilbuffer->getSamples();
- }
- else
- {
- if(samples != stencilbuffer->getSamples())
- {
- return GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE;
- }
-
- width = std::min(width, stencilbuffer->getWidth());
- height = std::min(height, stencilbuffer->getHeight());
- }
- }
-
- if(depthbuffer && stencilbuffer && (depthbuffer != stencilbuffer))
- {
- // In the GLES 3.0 spec, section 4.4.4, Framebuffer Completeness:
- // "The framebuffer object target is said to be framebuffer complete if all the following conditions are true:
- // [...]
- // Depth and stencil attachments, if present, are the same image.
- // { FRAMEBUFFER_UNSUPPORTED }"
- return GL_FRAMEBUFFER_UNSUPPORTED;
- }
-
- // We need to have at least one attachment to be complete
- if(width == -1 || height == -1)
- {
- return GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT;
- }
-
- return GL_FRAMEBUFFER_COMPLETE;
-}
-
-GLenum Framebuffer::getImplementationColorReadFormat() const
-{
- Renderbuffer *colorbuffer = getReadColorbuffer();
-
- if(colorbuffer)
- {
- switch(colorbuffer->getFormat())
- {
- case GL_BGRA8_EXT: return GL_BGRA_EXT;
- case GL_RGBA4: return GL_RGBA;
- case GL_RGB5_A1: return GL_RGBA;
- case GL_RGBA8: return GL_RGBA;
- case GL_RGB565: return GL_RGB;
- case GL_RGB8: return GL_RGB;
- case GL_R8: return GL_RED;
- case GL_RG8: return GL_RG;
- case GL_R8I: return GL_RED_INTEGER;
- case GL_RG8I: return GL_RG_INTEGER;
- case GL_RGB8I: return GL_RGB_INTEGER;
- case GL_RGBA8I: return GL_RGBA_INTEGER;
- case GL_R8UI: return GL_RED_INTEGER;
- case GL_RG8UI: return GL_RG_INTEGER;
- case GL_RGB8UI: return GL_RGB_INTEGER;
- case GL_RGBA8UI: return GL_RGBA_INTEGER;
- case GL_R16I: return GL_RED_INTEGER;
- case GL_RG16I: return GL_RG_INTEGER;
- case GL_RGB16I: return GL_RGB_INTEGER;
- case GL_RGBA16I: return GL_RGBA_INTEGER;
- case GL_R16UI: return GL_RED_INTEGER;
- case GL_RG16UI: return GL_RG_INTEGER;
- case GL_RGB16UI: return GL_RGB_INTEGER;
- case GL_RGB10_A2UI: return GL_RGBA_INTEGER;
- case GL_RGBA16UI: return GL_RGBA_INTEGER;
- case GL_R32I: return GL_RED_INTEGER;
- case GL_RG32I: return GL_RG_INTEGER;
- case GL_RGB32I: return GL_RGB_INTEGER;
- case GL_RGBA32I: return GL_RGBA_INTEGER;
- case GL_R32UI: return GL_RED_INTEGER;
- case GL_RG32UI: return GL_RG_INTEGER;
- case GL_RGB32UI: return GL_RGB_INTEGER;
- case GL_RGBA32UI: return GL_RGBA_INTEGER;
- case GL_R16F: return GL_RED;
- case GL_RG16F: return GL_RG;
- case GL_R11F_G11F_B10F: return GL_RGB;
- case GL_RGB16F: return GL_RGB;
- case GL_RGBA16F: return GL_RGBA;
- case GL_R32F: return GL_RED;
- case GL_RG32F: return GL_RG;
- case GL_RGB32F: return GL_RGB;
- case GL_RGBA32F: return GL_RGBA;
- case GL_RGB10_A2: return GL_RGBA;
- case GL_SRGB8: return GL_RGB;
- case GL_SRGB8_ALPHA8: return GL_RGBA;
- default:
- UNREACHABLE(colorbuffer->getFormat());
- }
- }
-
- return GL_RGBA;
-}
-
-GLenum Framebuffer::getImplementationColorReadType() const
-{
- Renderbuffer *colorbuffer = getReadColorbuffer();
-
- if(colorbuffer)
- {
- switch(colorbuffer->getFormat())
- {
- case GL_BGRA8_EXT: return GL_UNSIGNED_BYTE;
- case GL_RGBA4: return GL_UNSIGNED_SHORT_4_4_4_4;
- case GL_RGB5_A1: return GL_UNSIGNED_SHORT_5_5_5_1;
- case GL_RGBA8: return GL_UNSIGNED_BYTE;
- case GL_RGB565: return GL_UNSIGNED_SHORT_5_6_5;
- case GL_RGB8: return GL_UNSIGNED_BYTE;
- case GL_R8: return GL_UNSIGNED_BYTE;
- case GL_RG8: return GL_UNSIGNED_BYTE;
- case GL_R8I: return GL_INT;
- case GL_RG8I: return GL_INT;
- case GL_RGB8I: return GL_INT;
- case GL_RGBA8I: return GL_INT;
- case GL_R8UI: return GL_UNSIGNED_BYTE;
- case GL_RG8UI: return GL_UNSIGNED_BYTE;
- case GL_RGB8UI: return GL_UNSIGNED_BYTE;
- case GL_RGBA8UI: return GL_UNSIGNED_BYTE;
- case GL_R16I: return GL_INT;
- case GL_RG16I: return GL_INT;
- case GL_RGB16I: return GL_INT;
- case GL_RGBA16I: return GL_INT;
- case GL_R16UI: return GL_UNSIGNED_INT;
- case GL_RG16UI: return GL_UNSIGNED_INT;
- case GL_RGB16UI: return GL_UNSIGNED_INT;
- case GL_RGB10_A2UI: return GL_UNSIGNED_INT_2_10_10_10_REV;
- case GL_RGBA16UI: return GL_UNSIGNED_INT;
- case GL_R32I: return GL_INT;
- case GL_RG32I: return GL_INT;
- case GL_RGB32I: return GL_INT;
- case GL_RGBA32I: return GL_INT;
- case GL_R32UI: return GL_UNSIGNED_INT;
- case GL_RG32UI: return GL_UNSIGNED_INT;
- case GL_RGB32UI: return GL_UNSIGNED_INT;
- case GL_RGBA32UI: return GL_UNSIGNED_INT;
- case GL_R16F: return GL_HALF_FLOAT;
- case GL_RG16F: return GL_HALF_FLOAT;
- case GL_R11F_G11F_B10F: return GL_HALF_FLOAT;
- case GL_RGB16F: return GL_HALF_FLOAT;
- case GL_RGBA16F: return GL_HALF_FLOAT;
- case GL_R32F: return GL_FLOAT;
- case GL_RG32F: return GL_FLOAT;
- case GL_RGB32F: return GL_FLOAT;
- case GL_RGBA32F: return GL_FLOAT;
- case GL_RGB10_A2: return GL_UNSIGNED_INT_2_10_10_10_REV;
- case GL_SRGB8: return GL_UNSIGNED_BYTE;
- case GL_SRGB8_ALPHA8: return GL_UNSIGNED_BYTE;
- default:
- UNREACHABLE(colorbuffer->getFormat());
- }
- }
-
- return GL_UNSIGNED_BYTE;
-}
-
-GLenum Framebuffer::getDepthReadFormat() const
-{
- Renderbuffer *depthbuffer = getDepthbuffer();
-
- if(depthbuffer)
- {
- // There is only one depth read format.
- return GL_DEPTH_COMPONENT;
- }
-
- // If there is no depth buffer, GL_INVALID_OPERATION occurs.
- return GL_NONE;
-}
-
-GLenum Framebuffer::getDepthReadType() const
-{
- Renderbuffer *depthbuffer = getDepthbuffer();
-
- if(depthbuffer)
- {
- switch(depthbuffer->getFormat())
- {
- case GL_DEPTH_COMPONENT16: return GL_UNSIGNED_SHORT;
- case GL_DEPTH_COMPONENT24: return GL_UNSIGNED_INT;
- case GL_DEPTH_COMPONENT32_OES: return GL_UNSIGNED_INT;
- case GL_DEPTH_COMPONENT32F: return GL_FLOAT;
- case GL_DEPTH24_STENCIL8: return GL_UNSIGNED_INT_24_8_OES;
- case GL_DEPTH32F_STENCIL8: return GL_FLOAT_32_UNSIGNED_INT_24_8_REV;
- default:
- UNREACHABLE(depthbuffer->getFormat());
- }
- }
-
- // If there is no depth buffer, GL_INVALID_OPERATION occurs.
- return GL_NONE;
-}
-
-GLuint Framebuffer::getReadBufferIndex() const
-{
- switch(readBuffer)
- {
- case GL_BACK:
- return 0;
- case GL_NONE:
- return GL_INVALID_INDEX;
- default:
- return readBuffer - GL_COLOR_ATTACHMENT0;
- }
-}
-
-DefaultFramebuffer::DefaultFramebuffer()
-{
- readBuffer = GL_BACK;
- drawBuffer[0] = GL_BACK;
-}
-
-DefaultFramebuffer::DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil)
-{
- GLenum defaultRenderbufferType = GL_FRAMEBUFFER_DEFAULT;
- mColorbufferPointer[0] = new Renderbuffer(0, colorbuffer);
- mColorbufferType[0] = defaultRenderbufferType;
-
- readBuffer = GL_BACK;
- drawBuffer[0] = GL_BACK;
- for(int i = 1; i < MAX_COLOR_ATTACHMENTS; i++)
- {
- mColorbufferPointer[i] = nullptr;
- mColorbufferType[i] = GL_NONE;
- }
-
- Renderbuffer *depthStencilRenderbuffer = new Renderbuffer(0, depthStencil);
- mDepthbufferPointer = depthStencilRenderbuffer;
- mStencilbufferPointer = depthStencilRenderbuffer;
-
- mDepthbufferType = (depthStencilRenderbuffer->getDepthSize() != 0) ? GL_FRAMEBUFFER_DEFAULT : GL_NONE;
- mStencilbufferType = (depthStencilRenderbuffer->getStencilSize() != 0) ? GL_FRAMEBUFFER_DEFAULT : GL_NONE;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/Framebuffer.h b/src/OpenGL/libGLESv2/Framebuffer.h
deleted file mode 100644
index e1a3611d5..000000000
--- a/src/OpenGL/libGLESv2/Framebuffer.h
+++ /dev/null
@@ -1,124 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Framebuffer.h: Defines the Framebuffer class. Implements GL framebuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4 page 105.
-
-#ifndef LIBGLESV2_FRAMEBUFFER_H_
-#define LIBGLESV2_FRAMEBUFFER_H_
-
-#include "Context.h"
-#include "common/Object.hpp"
-#include "common/Image.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-class Renderbuffer;
-class Colorbuffer;
-class Depthbuffer;
-class Stencilbuffer;
-class DepthStencilbuffer;
-
-class Framebuffer
-{
-public:
- Framebuffer();
-
- virtual ~Framebuffer();
-
- void setColorbuffer(GLenum type, GLuint colorbuffer, GLuint index, GLint level = 0, GLint layer = 0);
- void setDepthbuffer(GLenum type, GLuint depthbuffer, GLint level = 0, GLint layer = 0);
- void setStencilbuffer(GLenum type, GLuint stencilbuffer, GLint level = 0, GLint layer = 0);
-
- void setReadBuffer(GLenum buf);
- void setDrawBuffer(GLuint index, GLenum buf);
- GLenum getReadBuffer() const;
- GLenum getDrawBuffer(GLuint index) const;
-
- void detachTexture(GLuint texture);
- void detachRenderbuffer(GLuint renderbuffer);
-
- egl::Image *getRenderTarget(GLuint index);
- egl::Image *getReadRenderTarget();
- egl::Image *getDepthBuffer();
- egl::Image *getStencilBuffer();
-
- Renderbuffer *getColorbuffer(GLuint index) const;
- Renderbuffer *getReadColorbuffer() const;
- Renderbuffer *getDepthbuffer() const;
- Renderbuffer *getStencilbuffer() const;
-
- GLenum getReadBufferType();
- GLenum getColorbufferType(GLuint index);
- GLenum getDepthbufferType();
- GLenum getStencilbufferType();
-
- GLuint getColorbufferName(GLuint index);
- GLuint getDepthbufferName();
- GLuint getStencilbufferName();
-
- GLint getColorbufferLayer(GLuint index);
- GLint getDepthbufferLayer();
- GLint getStencilbufferLayer();
-
- bool hasStencil();
-
- GLenum completeness();
- GLenum completeness(int &width, int &height, int &samples);
-
- GLenum getImplementationColorReadFormat() const;
- GLenum getImplementationColorReadType() const;
- GLenum getDepthReadFormat() const;
- GLenum getDepthReadType() const;
-
- virtual bool isDefaultFramebuffer() const { return false; }
-
- static bool IsRenderbuffer(GLenum type);
-
-protected:
- GLuint getReadBufferIndex() const;
-
- GLenum readBuffer;
- GLenum drawBuffer[MAX_COLOR_ATTACHMENTS];
-
- GLenum mColorbufferType[MAX_COLOR_ATTACHMENTS];
- gl::BindingPointer<Renderbuffer> mColorbufferPointer[MAX_COLOR_ATTACHMENTS];
- GLint mColorbufferLayer[MAX_COLOR_ATTACHMENTS];
-
- GLenum mDepthbufferType;
- gl::BindingPointer<Renderbuffer> mDepthbufferPointer;
- GLint mDepthbufferLayer;
-
- GLenum mStencilbufferType;
- gl::BindingPointer<Renderbuffer> mStencilbufferPointer;
- GLint mStencilbufferLayer;
-
-private:
- Renderbuffer *lookupRenderbuffer(GLenum type, GLuint handle, GLint level) const;
-};
-
-class DefaultFramebuffer : public Framebuffer
-{
-public:
- DefaultFramebuffer();
- DefaultFramebuffer(Colorbuffer *colorbuffer, DepthStencilbuffer *depthStencil);
-
- bool isDefaultFramebuffer() const override { return true; }
-};
-
-}
-
-#endif // LIBGLESV2_FRAMEBUFFER_H_
diff --git a/src/OpenGL/libGLESv2/IndexDataManager.cpp b/src/OpenGL/libGLESv2/IndexDataManager.cpp
deleted file mode 100644
index 0467d02df..000000000
--- a/src/OpenGL/libGLESv2/IndexDataManager.cpp
+++ /dev/null
@@ -1,463 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// IndexDataManager.cpp: Defines the IndexDataManager, a class that
-// runs the Buffer translation process for index buffers.
-
-#include "IndexDataManager.h"
-
-#include "Buffer.h"
-#include "common/debug.h"
-
-#include <string.h>
-#include <algorithm>
-
-namespace
-{
- enum { INITIAL_INDEX_BUFFER_SIZE = 4096 * sizeof(GLuint) };
-}
-
-namespace es2
-{
-
-IndexDataManager::IndexDataManager()
-{
- mStreamingBuffer = new StreamingIndexBuffer(INITIAL_INDEX_BUFFER_SIZE);
-
- if(!mStreamingBuffer)
- {
- ERR("Failed to allocate the streaming index buffer.");
- }
-}
-
-IndexDataManager::~IndexDataManager()
-{
- delete mStreamingBuffer;
-}
-
-void copyIndices(GLenum type, const void *input, GLsizei count, void *output)
-{
- if(type == GL_UNSIGNED_BYTE)
- {
- memcpy(output, input, count * sizeof(GLubyte));
- }
- else if(type == GL_UNSIGNED_INT)
- {
- memcpy(output, input, count * sizeof(GLuint));
- }
- else if(type == GL_UNSIGNED_SHORT)
- {
- memcpy(output, input, count * sizeof(GLushort));
- }
- else UNREACHABLE(type);
-}
-
-inline GLsizei getNumIndices(const std::vector<GLsizei>& restartIndices, size_t i, GLsizei count)
-{
- return restartIndices.empty() ? count :
- ((i == 0) ? restartIndices[0] : ((i == restartIndices.size()) ? (count - restartIndices[i - 1] - 1) : (restartIndices[i] - restartIndices[i - 1] - 1)));
-}
-
-void copyIndices(GLenum mode, GLenum type, const std::vector<GLsizei>& restartIndices, const void *input, GLsizei count, void* output)
-{
- size_t bytesPerIndex = 0;
- const unsigned char* inPtr = static_cast<const unsigned char*>(input);
- unsigned char* outPtr = static_cast<unsigned char*>(output);
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- bytesPerIndex = sizeof(GLubyte);
- break;
- case GL_UNSIGNED_INT:
- bytesPerIndex = sizeof(GLuint);
- break;
- case GL_UNSIGNED_SHORT:
- bytesPerIndex = sizeof(GLushort);
- break;
- default:
- UNREACHABLE(type);
- }
-
- size_t numRestarts = restartIndices.size();
- switch(mode)
- {
- case GL_TRIANGLES:
- case GL_LINES:
- case GL_POINTS:
- {
- GLsizei verticesPerPrimitive = (mode == GL_TRIANGLES) ? 3 : ((mode == GL_LINES) ? 2 : 1);
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- GLsizei numIndices = getNumIndices(restartIndices, i, count);
- size_t numBytes = (numIndices / verticesPerPrimitive) * verticesPerPrimitive * bytesPerIndex;
- if(numBytes > 0)
- {
- memcpy(outPtr, inPtr, numBytes);
- outPtr += numBytes;
- }
- inPtr += (numIndices + 1) * bytesPerIndex;
- }
- }
- break;
- case GL_TRIANGLE_FAN:
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- GLsizei numIndices = getNumIndices(restartIndices, i, count);
- GLsizei numTriangles = (numIndices - 2);
- for(GLsizei tri = 0; tri < numTriangles; ++tri)
- {
- memcpy(outPtr, inPtr, bytesPerIndex);
- outPtr += bytesPerIndex;
- memcpy(outPtr, inPtr + ((tri + 1) * bytesPerIndex), bytesPerIndex + bytesPerIndex);
- outPtr += bytesPerIndex + bytesPerIndex;
- }
- inPtr += (numIndices + 1) * bytesPerIndex;
- }
- break;
- case GL_TRIANGLE_STRIP:
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- GLsizei numIndices = getNumIndices(restartIndices, i, count);
- GLsizei numTriangles = (numIndices - 2);
- for(GLsizei tri = 0; tri < numTriangles; ++tri)
- {
- if(tri & 1) // Reverse odd triangles
- {
- memcpy(outPtr, inPtr + ((tri + 1) * bytesPerIndex), bytesPerIndex);
- outPtr += bytesPerIndex;
- memcpy(outPtr, inPtr + ((tri + 0) * bytesPerIndex), bytesPerIndex);
- outPtr += bytesPerIndex;
- memcpy(outPtr, inPtr + ((tri + 2) * bytesPerIndex), bytesPerIndex);
- outPtr += bytesPerIndex;
- }
- else
- {
- size_t numBytes = 3 * bytesPerIndex;
- memcpy(outPtr, inPtr + (tri * bytesPerIndex), numBytes);
- outPtr += numBytes;
- }
- }
- inPtr += (numIndices + 1) * bytesPerIndex;
- }
- break;
- case GL_LINE_LOOP:
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- GLsizei numIndices = getNumIndices(restartIndices, i, count);
- if(numIndices >= 2)
- {
- GLsizei numLines = numIndices;
- memcpy(outPtr, inPtr + (numIndices - 1) * bytesPerIndex, bytesPerIndex); // Last vertex
- outPtr += bytesPerIndex;
- memcpy(outPtr, inPtr, bytesPerIndex); // First vertex
- outPtr += bytesPerIndex;
- size_t bytesPerLine = 2 * bytesPerIndex;
- for(GLsizei tri = 0; tri < (numLines - 1); ++tri)
- {
- memcpy(outPtr, inPtr + tri * bytesPerIndex, bytesPerLine);
- outPtr += bytesPerLine;
- }
- }
- inPtr += (numIndices + 1) * bytesPerIndex;
- }
- break;
- case GL_LINE_STRIP:
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- GLsizei numIndices = getNumIndices(restartIndices, i, count);
- GLsizei numLines = numIndices - 1;
- size_t bytesPerLine = 2 * bytesPerIndex;
- for(GLsizei tri = 0; tri < numLines; ++tri)
- {
- memcpy(outPtr, inPtr + tri * bytesPerIndex, bytesPerLine);
- outPtr += bytesPerLine;
- }
- inPtr += (numIndices + 1) * bytesPerIndex;
- }
- break;
- default:
- UNREACHABLE(mode);
- break;
- }
-}
-
-template<class IndexType>
-void computeRange(const IndexType *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex, std::vector<GLsizei>* restartIndices)
-{
- *maxIndex = 0;
- *minIndex = MAX_ELEMENTS_INDICES;
-
- for(GLsizei i = 0; i < count; i++)
- {
- if(restartIndices && indices[i] == IndexType(-1))
- {
- restartIndices->push_back(i);
- continue;
- }
- if(*minIndex > indices[i]) *minIndex = indices[i];
- if(*maxIndex < indices[i]) *maxIndex = indices[i];
- }
-}
-
-void computeRange(GLenum type, const void *indices, GLsizei count, GLuint *minIndex, GLuint *maxIndex, std::vector<GLsizei>* restartIndices)
-{
- if(type == GL_UNSIGNED_BYTE)
- {
- computeRange(static_cast<const GLubyte*>(indices), count, minIndex, maxIndex, restartIndices);
- }
- else if(type == GL_UNSIGNED_INT)
- {
- computeRange(static_cast<const GLuint*>(indices), count, minIndex, maxIndex, restartIndices);
- }
- else if(type == GL_UNSIGNED_SHORT)
- {
- computeRange(static_cast<const GLushort*>(indices), count, minIndex, maxIndex, restartIndices);
- }
- else UNREACHABLE(type);
-}
-
-int recomputePrimitiveCount(GLenum mode, GLsizei count, const std::vector<GLsizei>& restartIndices, unsigned int* primitiveCount)
-{
- size_t numRestarts = restartIndices.size();
- *primitiveCount = 0;
-
- unsigned int countOffset = 0;
- unsigned int vertexPerPrimitive = 0;
-
- switch(mode)
- {
- case GL_TRIANGLES: // 3 vertex per primitive
- ++vertexPerPrimitive;
- case GL_LINES: // 2 vertex per primitive
- vertexPerPrimitive += 2;
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- unsigned int nbIndices = getNumIndices(restartIndices, i, count);
- *primitiveCount += nbIndices / vertexPerPrimitive;
- }
- return vertexPerPrimitive;
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP: // (N - 2) polygons, 3 vertex per primitive
- ++vertexPerPrimitive;
- --countOffset;
- case GL_LINE_STRIP: // (N - 1) polygons, 2 vertex per primitive
- --countOffset;
- case GL_LINE_LOOP: // N polygons, 2 vertex per primitive
- vertexPerPrimitive += 2;
- for(size_t i = 0; i <= numRestarts; ++i)
- {
- unsigned int nbIndices = getNumIndices(restartIndices, i, count);
- *primitiveCount += (nbIndices >= vertexPerPrimitive) ? (nbIndices + countOffset) : 0;
- }
- return vertexPerPrimitive;
- case GL_POINTS:
- *primitiveCount = static_cast<unsigned int>(count - restartIndices.size());
- return 1;
- default:
- UNREACHABLE(mode);
- return -1;
- }
-}
-
-GLenum IndexDataManager::prepareIndexData(GLenum mode, GLenum type, GLuint start, GLuint end, GLsizei count, Buffer *buffer, const void *indices, TranslatedIndexData *translated, bool primitiveRestart)
-{
- if(!mStreamingBuffer)
- {
- return GL_OUT_OF_MEMORY;
- }
-
- intptr_t offset = reinterpret_cast<intptr_t>(indices);
-
- if(buffer != NULL)
- {
- if(typeSize(type) * count + offset > static_cast<std::size_t>(buffer->size()))
- {
- return GL_INVALID_OPERATION;
- }
-
- indices = static_cast<const GLubyte*>(buffer->data()) + offset;
- }
-
- std::vector<GLsizei>* restartIndices = primitiveRestart ? new std::vector<GLsizei>() : nullptr;
- computeRange(type, indices, count, &translated->minIndex, &translated->maxIndex, restartIndices);
-
- StreamingIndexBuffer *streamingBuffer = mStreamingBuffer;
-
- sw::Resource *staticBuffer = buffer ? buffer->getResource() : NULL;
-
- if(restartIndices)
- {
- int vertexPerPrimitive = recomputePrimitiveCount(mode, count, *restartIndices, &translated->primitiveCount);
- if(vertexPerPrimitive == -1)
- {
- delete restartIndices;
- return GL_INVALID_ENUM;
- }
-
- size_t streamOffset = 0;
- int convertCount = translated->primitiveCount * vertexPerPrimitive;
-
- streamingBuffer->reserveSpace(convertCount * typeSize(type), type);
- void *output = streamingBuffer->map(typeSize(type) * convertCount, &streamOffset);
-
- if(output == NULL)
- {
- delete restartIndices;
- ERR("Failed to map index buffer.");
- return GL_OUT_OF_MEMORY;
- }
-
- copyIndices(mode, type, *restartIndices, indices, count, output);
- streamingBuffer->unmap();
-
- translated->indexBuffer = streamingBuffer->getResource();
- translated->indexOffset = static_cast<unsigned int>(streamOffset);
- delete restartIndices;
- }
- else if(staticBuffer)
- {
- translated->indexBuffer = staticBuffer;
- translated->indexOffset = static_cast<unsigned int>(offset);
- }
- else
- {
- size_t streamOffset = 0;
- int convertCount = count;
-
- streamingBuffer->reserveSpace(convertCount * typeSize(type), type);
- void *output = streamingBuffer->map(typeSize(type) * convertCount, &streamOffset);
-
- if(output == NULL)
- {
- ERR("Failed to map index buffer.");
- return GL_OUT_OF_MEMORY;
- }
-
- copyIndices(type, indices, convertCount, output);
- streamingBuffer->unmap();
-
- translated->indexBuffer = streamingBuffer->getResource();
- translated->indexOffset = static_cast<unsigned int>(streamOffset);
- }
-
- if(translated->minIndex < start || translated->maxIndex > end)
- {
- ERR("glDrawRangeElements: out of range access. Range provided: [%d -> %d]. Range used: [%d -> %d].", start, end, translated->minIndex, translated->maxIndex);
- }
-
- return GL_NO_ERROR;
-}
-
-std::size_t IndexDataManager::typeSize(GLenum type)
-{
- switch(type)
- {
- case GL_UNSIGNED_INT: return sizeof(GLuint);
- case GL_UNSIGNED_SHORT: return sizeof(GLushort);
- case GL_UNSIGNED_BYTE: return sizeof(GLubyte);
- default: UNREACHABLE(type); return sizeof(GLushort);
- }
-}
-
-StreamingIndexBuffer::StreamingIndexBuffer(size_t initialSize) : mIndexBuffer(NULL), mBufferSize(initialSize)
-{
- if(initialSize > 0)
- {
- mIndexBuffer = new sw::Resource(initialSize + 16);
-
- if(!mIndexBuffer)
- {
- ERR("Out of memory allocating an index buffer of size %u.", initialSize);
- }
- }
-
- mWritePosition = 0;
-}
-
-StreamingIndexBuffer::~StreamingIndexBuffer()
-{
- if(mIndexBuffer)
- {
- mIndexBuffer->destruct();
- }
-}
-
-void *StreamingIndexBuffer::map(size_t requiredSpace, size_t *offset)
-{
- void *mapPtr = NULL;
-
- if(mIndexBuffer)
- {
- mapPtr = (char*)mIndexBuffer->lock(sw::PUBLIC) + mWritePosition;
-
- if(!mapPtr)
- {
- ERR(" Lock failed");
- return NULL;
- }
-
- *offset = mWritePosition;
- mWritePosition += requiredSpace;
- }
-
- return mapPtr;
-}
-
-void StreamingIndexBuffer::unmap()
-{
- if(mIndexBuffer)
- {
- mIndexBuffer->unlock();
- }
-}
-
-void StreamingIndexBuffer::reserveSpace(size_t requiredSpace, GLenum type)
-{
- if(requiredSpace > mBufferSize)
- {
- if(mIndexBuffer)
- {
- mIndexBuffer->destruct();
- mIndexBuffer = 0;
- }
-
- mBufferSize = std::max(requiredSpace, 2 * mBufferSize);
-
- mIndexBuffer = new sw::Resource(mBufferSize + 16);
-
- if(!mIndexBuffer)
- {
- ERR("Out of memory allocating an index buffer of size %u.", mBufferSize);
- }
-
- mWritePosition = 0;
- }
- else if(mWritePosition + requiredSpace > mBufferSize) // Recycle
- {
- if(mIndexBuffer)
- {
- mIndexBuffer->destruct();
- mIndexBuffer = new sw::Resource(mBufferSize + 16);
- }
-
- mWritePosition = 0;
- }
-}
-
-sw::Resource *StreamingIndexBuffer::getResource() const
-{
- return mIndexBuffer;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/IndexDataManager.h b/src/OpenGL/libGLESv2/IndexDataManager.h
deleted file mode 100644
index 1834fbc3f..000000000
--- a/src/OpenGL/libGLESv2/IndexDataManager.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// IndexDataManager.h: Defines the IndexDataManager, a class that
-// runs the Buffer translation process for index buffers.
-
-#ifndef LIBGLESV2_INDEXDATAMANAGER_H_
-#define LIBGLESV2_INDEXDATAMANAGER_H_
-
-#include "Context.h"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-struct TranslatedIndexData
-{
- TranslatedIndexData(unsigned int primitiveCount) : primitiveCount(primitiveCount) {}
-
- unsigned int minIndex;
- unsigned int maxIndex;
- unsigned int indexOffset;
- unsigned int primitiveCount;
-
- sw::Resource *indexBuffer;
-};
-
-class StreamingIndexBuffer
-{
-public:
- StreamingIndexBuffer(size_t initialSize);
- virtual ~StreamingIndexBuffer();
-
- void *map(size_t requiredSpace, size_t *offset);
- void unmap();
- void reserveSpace(size_t requiredSpace, GLenum type);
-
- sw::Resource *getResource() const;
-
-private:
- sw::Resource *mIndexBuffer;
- size_t mBufferSize;
- size_t mWritePosition;
-};
-
-class IndexDataManager
-{
-public:
- IndexDataManager();
- virtual ~IndexDataManager();
-
- GLenum prepareIndexData(GLenum mode, GLenum type, GLuint start, GLuint end, GLsizei count, Buffer *arrayElementBuffer, const void *indices, TranslatedIndexData *translated, bool primitiveRestart);
-
- static std::size_t typeSize(GLenum type);
-
-private:
- StreamingIndexBuffer *mStreamingBuffer;
-};
-
-}
-
-#endif // LIBGLESV2_INDEXDATAMANAGER_H_
diff --git a/src/OpenGL/libGLESv2/Program.cpp b/src/OpenGL/libGLESv2/Program.cpp
deleted file mode 100644
index eb1070ec4..000000000
--- a/src/OpenGL/libGLESv2/Program.cpp
+++ /dev/null
@@ -1,3134 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Program.cpp: Implements the Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#include "Program.h"
-
-#include "main.h"
-#include "Buffer.h"
-#include "Shader.h"
-#include "TransformFeedback.h"
-#include "utilities.h"
-#include "common/debug.h"
-#include "Shader/PixelShader.hpp"
-#include "Shader/VertexShader.hpp"
-
-#include <algorithm>
-#include <string>
-#include <stdlib.h>
-
-namespace es2
-{
- unsigned int Program::currentSerial = 1;
-
- std::string str(int i)
- {
- char buffer[20];
- sprintf(buffer, "%d", i);
- return buffer;
- }
-
- Uniform::BlockInfo::BlockInfo(const glsl::Uniform& uniform, int blockIndex)
- {
- if(blockIndex >= 0)
- {
- index = blockIndex;
- offset = uniform.blockInfo.offset;
- arrayStride = uniform.blockInfo.arrayStride;
- matrixStride = uniform.blockInfo.matrixStride;
- isRowMajorMatrix = uniform.blockInfo.isRowMajorMatrix;
- }
- }
-
- Uniform::Uniform(const glsl::Uniform &uniform, const BlockInfo &blockInfo)
- : type(uniform.type), precision(uniform.precision), name(uniform.name),
- arraySize(uniform.arraySize), blockInfo(blockInfo), fields(uniform.fields)
- {
- if((blockInfo.index == -1) && uniform.fields.empty())
- {
- size_t bytes = UniformTypeSize(type) * size();
- data = new unsigned char[bytes];
- memset(data, 0, bytes);
- }
- }
-
- Uniform::~Uniform()
- {
- delete[] data;
- }
-
- bool Uniform::isArray() const
- {
- return arraySize >= 1;
- }
-
- int Uniform::size() const
- {
- return arraySize > 0 ? arraySize : 1;
- }
-
- int Uniform::registerCount() const
- {
- return size() * VariableRegisterCount(type);
- }
-
- UniformBlock::UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize, std::vector<unsigned int> memberUniformIndexes) :
- name(name), elementIndex(elementIndex), dataSize(dataSize), memberUniformIndexes(memberUniformIndexes), psRegisterIndex(GL_INVALID_INDEX), vsRegisterIndex(GL_INVALID_INDEX)
- {
- }
-
- void UniformBlock::setRegisterIndex(GLenum shader, unsigned int registerIndex)
- {
- switch(shader)
- {
- case GL_VERTEX_SHADER:
- vsRegisterIndex = registerIndex;
- break;
- case GL_FRAGMENT_SHADER:
- psRegisterIndex = registerIndex;
- break;
- default:
- UNREACHABLE(shader);
- }
- }
-
- bool UniformBlock::isArrayElement() const
- {
- return elementIndex != GL_INVALID_INDEX;
- }
-
- bool UniformBlock::isReferencedByVertexShader() const
- {
- return vsRegisterIndex != GL_INVALID_INDEX;
- }
-
- bool UniformBlock::isReferencedByFragmentShader() const
- {
- return psRegisterIndex != GL_INVALID_INDEX;
- }
-
- UniformLocation::UniformLocation(const std::string &name, unsigned int element, unsigned int index) : name(name), element(element), index(index)
- {
- }
-
- LinkedVarying::LinkedVarying()
- {
- }
-
- LinkedVarying::LinkedVarying(const std::string &name, GLenum type, GLsizei size, int reg, int col)
- : name(name), type(type), size(size), reg(reg), col(col)
- {
- }
-
- Program::Program(ResourceManager *manager, GLuint handle) : serial(issueSerial()), resourceManager(manager), handle(handle)
- {
- fragmentShader = 0;
- vertexShader = 0;
- pixelBinary = 0;
- vertexBinary = 0;
-
- transformFeedbackBufferMode = GL_INTERLEAVED_ATTRIBS;
- totalLinkedVaryingsComponents = 0;
-
- infoLog = 0;
- validated = false;
-
- resetUniformBlockBindings();
- unlink();
-
- orphaned = false;
- retrievableBinary = false;
- referenceCount = 0;
- }
-
- Program::~Program()
- {
- unlink();
-
- if(vertexShader)
- {
- vertexShader->release();
- }
-
- if(fragmentShader)
- {
- fragmentShader->release();
- }
- }
-
- bool Program::attachShader(Shader *shader)
- {
- if(shader->getType() == GL_VERTEX_SHADER)
- {
- if(vertexShader)
- {
- return false;
- }
-
- vertexShader = (VertexShader*)shader;
- vertexShader->addRef();
- }
- else if(shader->getType() == GL_FRAGMENT_SHADER)
- {
- if(fragmentShader)
- {
- return false;
- }
-
- fragmentShader = (FragmentShader*)shader;
- fragmentShader->addRef();
- }
- else UNREACHABLE(shader->getType());
-
- return true;
- }
-
- bool Program::detachShader(Shader *shader)
- {
- if(shader->getType() == GL_VERTEX_SHADER)
- {
- if(vertexShader != shader)
- {
- return false;
- }
-
- vertexShader->release();
- vertexShader = 0;
- }
- else if(shader->getType() == GL_FRAGMENT_SHADER)
- {
- if(fragmentShader != shader)
- {
- return false;
- }
-
- fragmentShader->release();
- fragmentShader = 0;
- }
- else UNREACHABLE(shader->getType());
-
- return true;
- }
-
- int Program::getAttachedShadersCount() const
- {
- return (vertexShader ? 1 : 0) + (fragmentShader ? 1 : 0);
- }
-
- sw::PixelShader *Program::getPixelShader()
- {
- return pixelBinary;
- }
-
- sw::VertexShader *Program::getVertexShader()
- {
- return vertexBinary;
- }
-
- GLint Program::getFragDataLocation(const GLchar *name)
- {
- if(name && linked)
- {
- std::string baseName(name);
- unsigned int subscript = GL_INVALID_INDEX;
- baseName = ParseUniformName(baseName, &subscript);
- for(auto const &varying : fragmentShader->varyings)
- {
- if(varying.qualifier == EvqFragmentOut)
- {
- if(varying.name == baseName)
- {
- ASSERT(varying.registerIndex >= 0);
-
- if(subscript == GL_INVALID_INDEX) // No subscript
- {
- return varying.registerIndex;
- }
-
- int rowCount = VariableRowCount(varying.type);
- int colCount = VariableColumnCount(varying.type);
-
- return varying.registerIndex + (rowCount > 1 ? colCount * subscript : subscript);
- }
- }
- }
- }
-
- return -1;
- }
-
- void Program::bindAttributeLocation(GLuint index, const char *name)
- {
- attributeBinding[name] = index;
- }
-
- GLint Program::getAttributeLocation(const char *name)
- {
- return name ? getAttributeLocation(std::string(name)) : -1;
- }
-
- int Program::getAttributeStream(int attributeIndex)
- {
- ASSERT(attributeIndex >= 0 && attributeIndex < MAX_VERTEX_ATTRIBS);
-
- return attributeStream[attributeIndex];
- }
-
- // Returns the index of the texture image unit (0-19) corresponding to a sampler index (0-15 for the pixel shader and 0-3 for the vertex shader)
- GLint Program::getSamplerMapping(sw::SamplerType type, unsigned int samplerIndex)
- {
- GLint logicalTextureUnit = -1;
-
- switch(type)
- {
- case sw::SAMPLER_PIXEL:
- ASSERT(samplerIndex < sizeof(samplersPS) / sizeof(samplersPS[0]));
-
- if(samplersPS[samplerIndex].active)
- {
- logicalTextureUnit = samplersPS[samplerIndex].logicalTextureUnit;
- }
- break;
- case sw::SAMPLER_VERTEX:
- ASSERT(samplerIndex < sizeof(samplersVS) / sizeof(samplersVS[0]));
-
- if(samplersVS[samplerIndex].active)
- {
- logicalTextureUnit = samplersVS[samplerIndex].logicalTextureUnit;
- }
- break;
- default: UNREACHABLE(type);
- }
-
- if(logicalTextureUnit < MAX_COMBINED_TEXTURE_IMAGE_UNITS)
- {
- return logicalTextureUnit;
- }
-
- return -1;
- }
-
- // Returns the texture type for a given sampler type and index (0-15 for the pixel shader and 0-3 for the vertex shader)
- TextureType Program::getSamplerTextureType(sw::SamplerType type, unsigned int samplerIndex)
- {
- switch(type)
- {
- case sw::SAMPLER_PIXEL:
- ASSERT(samplerIndex < sizeof(samplersPS)/sizeof(samplersPS[0]));
- ASSERT(samplersPS[samplerIndex].active);
- return samplersPS[samplerIndex].textureType;
- case sw::SAMPLER_VERTEX:
- ASSERT(samplerIndex < sizeof(samplersVS)/sizeof(samplersVS[0]));
- ASSERT(samplersVS[samplerIndex].active);
- return samplersVS[samplerIndex].textureType;
- default: UNREACHABLE(type);
- }
-
- return TEXTURE_2D;
- }
-
- Uniform *Program::getUniform(const std::string &name) const
- {
- unsigned int subscript = GL_INVALID_INDEX;
- std::string baseName = es2::ParseUniformName(name, &subscript);
-
- for(size_t index = 0; index < uniforms.size(); index++)
- {
- if(uniforms[index]->name == baseName)
- {
- return uniforms[index];
- }
- }
-
- return nullptr;
- }
-
- GLint Program::getUniformLocation(const std::string &name) const
- {
- unsigned int subscript = GL_INVALID_INDEX;
- std::string baseName = es2::ParseUniformName(name, &subscript);
-
- for(size_t location = 0; location < uniformIndex.size(); location++)
- {
- if(uniformIndex[location].name == baseName)
- {
- const unsigned int index = uniformIndex[location].index;
-
- if(index != GL_INVALID_INDEX)
- {
- if(subscript == GL_INVALID_INDEX)
- {
- return (GLint)location;
- }
- else if(uniforms[index]->isArray())
- {
- if(uniformIndex[location].element == subscript)
- {
- return (GLint)location;
- }
- }
- }
- }
- }
-
- return -1;
- }
-
- GLuint Program::getUniformIndex(const std::string &name) const
- {
- unsigned int subscript = GL_INVALID_INDEX;
- std::string baseName = es2::ParseUniformName(name, &subscript);
-
- // The app is not allowed to specify array indices other than 0 for arrays of basic types
- if(subscript != 0 && subscript != GL_INVALID_INDEX)
- {
- return GL_INVALID_INDEX;
- }
-
- size_t numUniforms = uniforms.size();
- for(GLuint index = 0; index < numUniforms; index++)
- {
- if(uniforms[index]->name == baseName)
- {
- if(uniforms[index]->isArray() || subscript == GL_INVALID_INDEX)
- {
- return index;
- }
- }
- }
-
- return GL_INVALID_INDEX;
- }
-
- void Program::getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const
- {
- ASSERT(uniformBlockIndex < getActiveUniformBlockCount());
-
- const UniformBlock &uniformBlock = *uniformBlocks[uniformBlockIndex];
-
- switch(pname)
- {
- case GL_UNIFORM_BLOCK_DATA_SIZE:
- *params = static_cast<GLint>(uniformBlock.dataSize);
- break;
- case GL_UNIFORM_BLOCK_NAME_LENGTH:
- *params = static_cast<GLint>(uniformBlock.name.size() + 1 + (uniformBlock.isArrayElement() ? 3 : 0));
- break;
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
- *params = static_cast<GLint>(uniformBlock.memberUniformIndexes.size());
- break;
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
- {
- for(unsigned int blockMemberIndex = 0; blockMemberIndex < uniformBlock.memberUniformIndexes.size(); blockMemberIndex++)
- {
- params[blockMemberIndex] = static_cast<GLint>(uniformBlock.memberUniformIndexes[blockMemberIndex]);
- }
- }
- break;
- case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
- *params = static_cast<GLint>(uniformBlock.isReferencedByVertexShader());
- break;
- case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
- *params = static_cast<GLint>(uniformBlock.isReferencedByFragmentShader());
- break;
- default: UNREACHABLE(pname);
- }
- }
-
- GLuint Program::getUniformBlockIndex(const std::string &name) const
- {
- unsigned int subscript = GL_INVALID_INDEX;
- std::string baseName = es2::ParseUniformName(name, &subscript);
-
- size_t numUniformBlocks = getActiveUniformBlockCount();
- for(GLuint blockIndex = 0; blockIndex < numUniformBlocks; blockIndex++)
- {
- const UniformBlock &uniformBlock = *uniformBlocks[blockIndex];
- if(uniformBlock.name == baseName)
- {
- const bool arrayElementZero = (subscript == GL_INVALID_INDEX && uniformBlock.elementIndex == 0);
- if(subscript == uniformBlock.elementIndex || arrayElementZero)
- {
- return blockIndex;
- }
- }
- }
-
- return GL_INVALID_INDEX;
- }
-
- void Program::bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding)
- {
- ASSERT(uniformBlockIndex < getActiveUniformBlockCount());
-
- uniformBlockBindings[uniformBlockIndex] = uniformBlockBinding;
- }
-
- GLuint Program::getUniformBlockBinding(GLuint uniformBlockIndex) const
- {
- ASSERT(uniformBlockIndex < getActiveUniformBlockCount());
-
- return uniformBlockBindings[uniformBlockIndex];
- }
-
- void Program::resetUniformBlockBindings()
- {
- for(unsigned int blockId = 0; blockId < MAX_UNIFORM_BUFFER_BINDINGS; blockId++)
- {
- uniformBlockBindings[blockId] = 0;
- }
- }
-
- bool Program::setUniformfv(GLint location, GLsizei count, const GLfloat *v, int numElements)
- {
- ASSERT(numElements >= 1 && numElements <= 4);
-
- static GLenum floatType[] = { GL_FLOAT, GL_FLOAT_VEC2, GL_FLOAT_VEC3, GL_FLOAT_VEC4 };
- static GLenum boolType[] = { GL_BOOL, GL_BOOL_VEC2, GL_BOOL_VEC3, GL_BOOL_VEC4 };
-
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- int index = numElements - 1;
- if(targetUniform->type == floatType[index])
- {
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLfloat)* numElements,
- v, numElements * sizeof(GLfloat) * count);
- }
- else if(targetUniform->type == boolType[index])
- {
- GLboolean *boolParams = (GLboolean*)targetUniform->data + uniformIndex[location].element * numElements;
-
- for(int i = 0; i < count * numElements; i++)
- {
- boolParams[i] = (v[i] == 0.0f) ? GL_FALSE : GL_TRUE;
- }
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
- bool Program::setUniform1fv(GLint location, GLsizei count, const GLfloat* v)
- {
- return setUniformfv(location, count, v, 1);
- }
-
- bool Program::setUniform2fv(GLint location, GLsizei count, const GLfloat *v)
- {
- return setUniformfv(location, count, v, 2);
- }
-
- bool Program::setUniform3fv(GLint location, GLsizei count, const GLfloat *v)
- {
- return setUniformfv(location, count, v, 3);
- }
-
- bool Program::setUniform4fv(GLint location, GLsizei count, const GLfloat *v)
- {
- return setUniformfv(location, count, v, 4);
- }
-
- bool Program::setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum type)
- {
- int numElements;
- switch(type)
- {
- case GL_FLOAT_MAT2:
- numElements = 4;
- break;
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT3x2:
- numElements = 6;
- break;
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT4x2:
- numElements = 8;
- break;
- case GL_FLOAT_MAT3:
- numElements = 9;
- break;
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4x3:
- numElements = 12;
- break;
- case GL_FLOAT_MAT4:
- numElements = 16;
- break;
- default:
- return false;
- }
-
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- if(targetUniform->type != type)
- {
- return false;
- }
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- GLfloat* dst = reinterpret_cast<GLfloat*>(targetUniform->data + uniformIndex[location].element * sizeof(GLfloat) * numElements);
-
- if(transpose == GL_FALSE)
- {
- memcpy(dst, value, numElements * sizeof(GLfloat) * count);
- }
- else
- {
- const int rowSize = VariableRowCount(type);
- const int colSize = VariableColumnCount(type);
- for(int n = 0; n < count; ++n)
- {
- for(int i = 0; i < colSize; ++i)
- {
- for(int j = 0; j < rowSize; ++j)
- {
- dst[i * rowSize + j] = value[j * colSize + i];
- }
- }
- dst += numElements;
- value += numElements;
- }
- }
-
-
- return true;
- }
-
- bool Program::setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT2);
- }
-
- bool Program::setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT2x3);
- }
-
- bool Program::setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT2x4);
- }
-
- bool Program::setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT3);
- }
-
- bool Program::setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT3x2);
- }
-
- bool Program::setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT3x4);
- }
-
- bool Program::setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT4);
- }
-
- bool Program::setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT4x2);
- }
-
- bool Program::setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
- {
- return setUniformMatrixfv(location, count, transpose, value, GL_FLOAT_MAT4x3);
- }
-
- bool Program::setUniform1iv(GLint location, GLsizei count, const GLint *v)
- {
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- if(targetUniform->type == GL_INT || IsSamplerUniform(targetUniform->type))
- {
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLint),
- v, sizeof(GLint) * count);
- }
- else if(targetUniform->type == GL_BOOL)
- {
- GLboolean *boolParams = new GLboolean[count];
-
- for(int i = 0; i < count; i++)
- {
- if(v[i] == 0)
- {
- boolParams[i] = GL_FALSE;
- }
- else
- {
- boolParams[i] = GL_TRUE;
- }
- }
-
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLboolean),
- boolParams, sizeof(GLboolean) * count);
-
- delete[] boolParams;
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
- bool Program::setUniformiv(GLint location, GLsizei count, const GLint *v, int numElements)
- {
- static GLenum intType[] = { GL_INT, GL_INT_VEC2, GL_INT_VEC3, GL_INT_VEC4 };
- static GLenum boolType[] = { GL_BOOL, GL_BOOL_VEC2, GL_BOOL_VEC3, GL_BOOL_VEC4 };
-
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- int index = numElements - 1;
- if(targetUniform->type == intType[index])
- {
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLint)* numElements,
- v, numElements * sizeof(GLint)* count);
- }
- else if(targetUniform->type == boolType[index])
- {
- GLboolean *boolParams = new GLboolean[count * numElements];
-
- for(int i = 0; i < count * numElements; i++)
- {
- boolParams[i] = (v[i] == 0) ? GL_FALSE : GL_TRUE;
- }
-
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLboolean)* numElements,
- boolParams, numElements * sizeof(GLboolean)* count);
-
- delete[] boolParams;
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
- bool Program::setUniform2iv(GLint location, GLsizei count, const GLint *v)
- {
- return setUniformiv(location, count, v, 2);
- }
-
- bool Program::setUniform3iv(GLint location, GLsizei count, const GLint *v)
- {
- return setUniformiv(location, count, v, 3);
- }
-
- bool Program::setUniform4iv(GLint location, GLsizei count, const GLint *v)
- {
- return setUniformiv(location, count, v, 4);
- }
-
- bool Program::setUniform1uiv(GLint location, GLsizei count, const GLuint *v)
- {
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- if(targetUniform->type == GL_UNSIGNED_INT)
- {
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLuint),
- v, sizeof(GLuint)* count);
- }
- else if(targetUniform->type == GL_BOOL)
- {
- GLboolean *boolParams = new GLboolean[count];
-
- for(int i = 0; i < count; i++)
- {
- if(v[i] == 0)
- {
- boolParams[i] = GL_FALSE;
- }
- else
- {
- boolParams[i] = GL_TRUE;
- }
- }
-
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLboolean),
- boolParams, sizeof(GLboolean)* count);
-
- delete[] boolParams;
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
- bool Program::setUniformuiv(GLint location, GLsizei count, const GLuint *v, int numElements)
- {
- static GLenum uintType[] = { GL_UNSIGNED_INT, GL_UNSIGNED_INT_VEC2, GL_UNSIGNED_INT_VEC3, GL_UNSIGNED_INT_VEC4 };
- static GLenum boolType[] = { GL_BOOL, GL_BOOL_VEC2, GL_BOOL_VEC3, GL_BOOL_VEC4 };
-
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- targetUniform->dirty = true;
-
- int size = targetUniform->size();
-
- if(size == 1 && count > 1)
- {
- return false; // Attempting to write an array to a non-array uniform is an INVALID_OPERATION
- }
-
- count = std::min(size - (int)uniformIndex[location].element, count);
-
- int index = numElements - 1;
- if(targetUniform->type == uintType[index])
- {
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLuint)* numElements,
- v, numElements * sizeof(GLuint)* count);
- }
- else if(targetUniform->type == boolType[index])
- {
- GLboolean *boolParams = new GLboolean[count * numElements];
-
- for(int i = 0; i < count * numElements; i++)
- {
- boolParams[i] = (v[i] == 0) ? GL_FALSE : GL_TRUE;
- }
-
- memcpy(targetUniform->data + uniformIndex[location].element * sizeof(GLboolean)* numElements,
- boolParams, numElements * sizeof(GLboolean)* count);
-
- delete[] boolParams;
- }
- else
- {
- return false;
- }
-
- return true;
- }
-
- bool Program::setUniform2uiv(GLint location, GLsizei count, const GLuint *v)
- {
- return setUniformuiv(location, count, v, 2);
- }
-
- bool Program::setUniform3uiv(GLint location, GLsizei count, const GLuint *v)
- {
- return setUniformuiv(location, count, v, 3);
- }
-
- bool Program::setUniform4uiv(GLint location, GLsizei count, const GLuint *v)
- {
- return setUniformuiv(location, count, v, 4);
- }
-
- bool Program::getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params)
- {
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- unsigned int count = UniformComponentCount(targetUniform->type);
-
- // Sized query - ensure the provided buffer is large enough
- if(bufSize && static_cast<unsigned int>(*bufSize) < count * sizeof(GLfloat))
- {
- return false;
- }
-
- switch(UniformComponentType(targetUniform->type))
- {
- case GL_BOOL:
- {
- GLboolean *boolParams = (GLboolean*)targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (boolParams[i] == GL_FALSE) ? 0.0f : 1.0f;
- }
- }
- break;
- case GL_FLOAT:
- memcpy(params, targetUniform->data + uniformIndex[location].element * count * sizeof(GLfloat),
- count * sizeof(GLfloat));
- break;
- case GL_INT:
- {
- GLint *intParams = (GLint*)targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (float)intParams[i];
- }
- }
- break;
- case GL_UNSIGNED_INT:
- {
- GLuint *uintParams = (GLuint*)targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (float)uintParams[i];
- }
- }
- break;
- default: UNREACHABLE(targetUniform->type);
- }
-
- return true;
- }
-
- bool Program::getUniformiv(GLint location, GLsizei *bufSize, GLint *params)
- {
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- unsigned int count = UniformComponentCount(targetUniform->type);
-
- // Sized query - ensure the provided buffer is large enough
- if(bufSize && static_cast<unsigned int>(*bufSize) < count * sizeof(GLint))
- {
- return false;
- }
-
- switch(UniformComponentType(targetUniform->type))
- {
- case GL_BOOL:
- {
- GLboolean *boolParams = targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (GLint)boolParams[i];
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *floatParams = (GLfloat*)targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (GLint)floatParams[i];
- }
- }
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- memcpy(params, targetUniform->data + uniformIndex[location].element * count * sizeof(GLint),
- count * sizeof(GLint));
- break;
- default: UNREACHABLE(targetUniform->type);
- }
-
- return true;
- }
-
- bool Program::getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params)
- {
- if(location < 0 || location >= (int)uniformIndex.size() || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- return false;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- unsigned int count = UniformComponentCount(targetUniform->type);
-
- // Sized query - ensure the provided buffer is large enough
- if(bufSize && static_cast<unsigned int>(*bufSize) < count * sizeof(GLuint))
- {
- return false;
- }
-
- switch(UniformComponentType(targetUniform->type))
- {
- case GL_BOOL:
- {
- GLboolean *boolParams = targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (GLuint)boolParams[i];
- }
- }
- break;
- case GL_FLOAT:
- {
- GLfloat *floatParams = (GLfloat*)targetUniform->data + uniformIndex[location].element * count;
-
- for(unsigned int i = 0; i < count; i++)
- {
- params[i] = (GLuint)floatParams[i];
- }
- }
- break;
- case GL_INT:
- case GL_UNSIGNED_INT:
- memcpy(params, targetUniform->data + uniformIndex[location].element * count * sizeof(GLuint),
- count * sizeof(GLuint));
- break;
- default: UNREACHABLE(targetUniform->type);
- }
-
- return true;
- }
-
- void Program::dirtyAllUniforms()
- {
- size_t numUniforms = uniforms.size();
- for(size_t index = 0; index < numUniforms; index++)
- {
- uniforms[index]->dirty = true;
- }
- }
-
- // Applies all the uniforms set for this program object to the device
- void Program::applyUniforms(Device *device)
- {
- GLint numUniforms = static_cast<GLint>(uniformIndex.size());
- for(GLint location = 0; location < numUniforms; location++)
- {
- if((uniformIndex[location].element != 0) || (uniformIndex[location].index == GL_INVALID_INDEX))
- {
- continue;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
-
- if(targetUniform->dirty && (targetUniform->blockInfo.index == -1))
- {
- GLsizei size = targetUniform->size();
- GLfloat *f = (GLfloat*)targetUniform->data;
- GLint *i = (GLint*)targetUniform->data;
- GLuint *ui = (GLuint*)targetUniform->data;
- GLboolean *b = (GLboolean*)targetUniform->data;
-
- switch(targetUniform->type)
- {
- case GL_BOOL: applyUniform1bv(device, location, size, b); break;
- case GL_BOOL_VEC2: applyUniform2bv(device, location, size, b); break;
- case GL_BOOL_VEC3: applyUniform3bv(device, location, size, b); break;
- case GL_BOOL_VEC4: applyUniform4bv(device, location, size, b); break;
- case GL_FLOAT: applyUniform1fv(device, location, size, f); break;
- case GL_FLOAT_VEC2: applyUniform2fv(device, location, size, f); break;
- case GL_FLOAT_VEC3: applyUniform3fv(device, location, size, f); break;
- case GL_FLOAT_VEC4: applyUniform4fv(device, location, size, f); break;
- case GL_FLOAT_MAT2: applyUniformMatrix2fv(device, location, size, f); break;
- case GL_FLOAT_MAT2x3: applyUniformMatrix2x3fv(device, location, size, f); break;
- case GL_FLOAT_MAT2x4: applyUniformMatrix2x4fv(device, location, size, f); break;
- case GL_FLOAT_MAT3x2: applyUniformMatrix3x2fv(device, location, size, f); break;
- case GL_FLOAT_MAT3: applyUniformMatrix3fv(device, location, size, f); break;
- case GL_FLOAT_MAT3x4: applyUniformMatrix3x4fv(device, location, size, f); break;
- case GL_FLOAT_MAT4x2: applyUniformMatrix4x2fv(device, location, size, f); break;
- case GL_FLOAT_MAT4x3: applyUniformMatrix4x3fv(device, location, size, f); break;
- case GL_FLOAT_MAT4: applyUniformMatrix4fv(device, location, size, f); break;
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_3D_OES:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_INT: applyUniform1iv(device, location, size, i); break;
- case GL_INT_VEC2: applyUniform2iv(device, location, size, i); break;
- case GL_INT_VEC3: applyUniform3iv(device, location, size, i); break;
- case GL_INT_VEC4: applyUniform4iv(device, location, size, i); break;
- case GL_UNSIGNED_INT: applyUniform1uiv(device, location, size, ui); break;
- case GL_UNSIGNED_INT_VEC2: applyUniform2uiv(device, location, size, ui); break;
- case GL_UNSIGNED_INT_VEC3: applyUniform3uiv(device, location, size, ui); break;
- case GL_UNSIGNED_INT_VEC4: applyUniform4uiv(device, location, size, ui); break;
- default:
- UNREACHABLE(targetUniform->type);
- }
-
- targetUniform->dirty = false;
- }
- }
- }
-
- void Program::applyUniformBuffers(Device *device, BufferBinding* uniformBuffers)
- {
- GLint vertexUniformBuffers[MAX_UNIFORM_BUFFER_BINDINGS];
- GLint fragmentUniformBuffers[MAX_UNIFORM_BUFFER_BINDINGS];
-
- for(unsigned int bufferBindingIndex = 0; bufferBindingIndex < MAX_UNIFORM_BUFFER_BINDINGS; bufferBindingIndex++)
- {
- vertexUniformBuffers[bufferBindingIndex] = -1;
- }
-
- for(unsigned int bufferBindingIndex = 0; bufferBindingIndex < MAX_UNIFORM_BUFFER_BINDINGS; bufferBindingIndex++)
- {
- fragmentUniformBuffers[bufferBindingIndex] = -1;
- }
-
- int vertexUniformBufferIndex = 0;
- int fragmentUniformBufferIndex = 0;
- for(unsigned int uniformBlockIndex = 0; uniformBlockIndex < uniformBlocks.size(); uniformBlockIndex++)
- {
- UniformBlock &uniformBlock = *uniformBlocks[uniformBlockIndex];
-
- // Unnecessary to apply an unreferenced standard or shared UBO
- if(!uniformBlock.isReferencedByVertexShader() && !uniformBlock.isReferencedByFragmentShader())
- {
- continue;
- }
-
- GLuint blockBinding = uniformBlockBindings[uniformBlockIndex];
-
- if(uniformBlock.isReferencedByVertexShader())
- {
- vertexUniformBuffers[vertexUniformBufferIndex++] = blockBinding;
- }
-
- if(uniformBlock.isReferencedByFragmentShader())
- {
- fragmentUniformBuffers[fragmentUniformBufferIndex++] = blockBinding;
- }
- }
-
- for(unsigned int bufferBindingIndex = 0; bufferBindingIndex < MAX_UNIFORM_BUFFER_BINDINGS; bufferBindingIndex++)
- {
- int index = vertexUniformBuffers[bufferBindingIndex];
- Buffer* vsBuffer = (index != -1) ? (Buffer*)uniformBuffers[index].get() : nullptr;
- device->VertexProcessor::setUniformBuffer(bufferBindingIndex,
- vsBuffer ? vsBuffer->getResource() : nullptr, (index != -1) ? uniformBuffers[index].getOffset() : 0);
- index = fragmentUniformBuffers[bufferBindingIndex];
- Buffer* psBuffer = (index != -1) ? (Buffer*)uniformBuffers[index].get() : nullptr;
- device->PixelProcessor::setUniformBuffer(bufferBindingIndex,
- psBuffer ? psBuffer->getResource() : nullptr, (index != -1) ? uniformBuffers[index].getOffset() : 0);
- }
- }
-
- void Program::applyTransformFeedback(Device *device, TransformFeedback* transformFeedback)
- {
- // Make sure the flags will fit in a 64 bit unsigned int variable
- ASSERT(sw::max<int>(MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS, sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS) <= 64);
-
- BufferBinding* transformFeedbackBuffers = (transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused()) ? transformFeedback->getBuffers() : nullptr;
-
- uint64_t enableTransformFeedback = 0;
- if(!transformFeedbackBuffers)
- {
- for(unsigned int index = 0; index < sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; ++index)
- {
- device->VertexProcessor::setTransformFeedbackBuffer(index, nullptr, 0, 0, 0, 0, 0);
- }
- device->VertexProcessor::enableTransformFeedback(enableTransformFeedback);
- return;
- }
-
- unsigned int maxVaryings = static_cast<unsigned int>(transformFeedbackLinkedVaryings.size());
- switch(transformFeedbackBufferMode)
- {
- case GL_SEPARATE_ATTRIBS:
- {
- maxVaryings = sw::min(maxVaryings, (unsigned int)MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS);
- // Attribs go to separate buffers
- for(unsigned int index = 0; index < maxVaryings; ++index)
- {
- int size = transformFeedbackLinkedVaryings[index].size;
- int rowCount = VariableRowCount(transformFeedbackLinkedVaryings[index].type);
- int colCount = VariableColumnCount(transformFeedbackLinkedVaryings[index].type);
- int nbRegs = rowCount > 1 ? colCount * size : size;
- int nbComponentsPerReg = rowCount > 1 ? rowCount : colCount;
- int componentStride = rowCount * colCount * size;
- int baseOffset = transformFeedback->vertexOffset() * componentStride * sizeof(float);
- device->VertexProcessor::setTransformFeedbackBuffer(index,
- transformFeedbackBuffers[index].get()->getResource(),
- transformFeedbackBuffers[index].getOffset() + baseOffset,
- transformFeedbackLinkedVaryings[index].reg * 4 + transformFeedbackLinkedVaryings[index].col,
- nbRegs, nbComponentsPerReg, componentStride);
- enableTransformFeedback |= 1ULL << index;
- }
- }
- break;
- case GL_INTERLEAVED_ATTRIBS:
- {
- // OpenGL ES 3.0.4 spec, section 2.15.2:
- // In INTERLEAVED_ATTRIBS mode, the values of one or more output variables
- // written by a vertex shader are written, interleaved, into the buffer object
- // bound to the first transform feedback binding point (index = 0).
- sw::Resource* resource = transformFeedbackBuffers[0].get() ?
- transformFeedbackBuffers[0].get()->getResource() :
- nullptr;
- int componentStride = static_cast<int>(totalLinkedVaryingsComponents);
- int baseOffset = transformFeedbackBuffers[0].getOffset() + (transformFeedback->vertexOffset() * componentStride * sizeof(float));
- maxVaryings = sw::min(maxVaryings, (unsigned int)sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS);
- ASSERT(resource || (maxVaryings == 0));
-
- int totalComponents = 0;
- for(unsigned int index = 0; index < maxVaryings; ++index)
- {
- int size = transformFeedbackLinkedVaryings[index].size;
- int rowCount = VariableRowCount(transformFeedbackLinkedVaryings[index].type);
- int colCount = VariableColumnCount(transformFeedbackLinkedVaryings[index].type);
- int nbRegs = rowCount > 1 ? colCount * size : size;
- int nbComponentsPerReg = rowCount > 1 ? rowCount : colCount;
- device->VertexProcessor::setTransformFeedbackBuffer(index, resource,
- baseOffset + (totalComponents * sizeof(float)),
- transformFeedbackLinkedVaryings[index].reg * 4 + transformFeedbackLinkedVaryings[index].col,
- nbRegs, nbComponentsPerReg, componentStride);
- totalComponents += rowCount * colCount * size;
- enableTransformFeedback |= 1ULL << index;
- }
- }
- break;
- default:
- UNREACHABLE(transformFeedbackBufferMode);
- break;
- }
-
- // Unset all other transform feedback buffers
- for(unsigned int index = maxVaryings; index < sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; ++index)
- {
- device->VertexProcessor::setTransformFeedbackBuffer(index, nullptr, 0, 0, 0, 0, 0);
- }
-
- device->VertexProcessor::enableTransformFeedback(enableTransformFeedback);
- }
-
- bool Program::linkVaryings()
- {
- glsl::VaryingList &psVaryings = fragmentShader->varyings;
- glsl::VaryingList &vsVaryings = vertexShader->varyings;
-
- for(auto const &input : psVaryings)
- {
- bool matched = false;
-
- for(auto const &output : vsVaryings)
- {
- if(output.name == input.name)
- {
- if(output.type != input.type || output.size() != input.size())
- {
- appendToInfoLog("Type of vertex varying %s does not match that of the fragment varying", output.name.c_str());
-
- return false;
- }
-
- if((output.qualifier == EvqFlatOut) ^ (input.qualifier == EvqFlatIn))
- {
- appendToInfoLog("Interpolation qualifiers for %s differ between vertex and fragment shaders", output.name.c_str());
-
- return false;
- }
-
- if(!areMatchingFields(input.fields, output.fields, input.name))
- {
- return false;
- }
-
- matched = true;
- break;
- }
- }
-
- if(!matched)
- {
- // If a fragment varying is declared but not statically used, it's not an error to not have a matching vertex varying.
- if(input.registerIndex >= 0)
- {
- appendToInfoLog("Fragment varying %s does not match any vertex varying", input.name.c_str());
-
- return false;
- }
- }
- }
-
- for(auto const &output : vsVaryings)
- {
- bool matched = false;
-
- for(auto const &input : psVaryings)
- {
- if(output.name == input.name)
- {
- int in = input.registerIndex;
- int out = output.registerIndex;
- int components = VariableRegisterSize(output.type);
- int registers = VariableRegisterCount(output.type) * output.size();
-
- if(in < 0) // Fragment varying declared but not used
- {
- continue;
- }
-
- if(in + registers >= MAX_VARYING_VECTORS)
- {
- appendToInfoLog("Too many varyings");
- return false;
- }
-
- if(out >= 0)
- {
- if(out + registers >= MAX_VARYING_VECTORS)
- {
- appendToInfoLog("Too many varyings");
- return false;
- }
-
- for(int i = 0; i < registers; i++)
- {
- vertexBinary->setOutput(out + i, components, sw::Shader::Semantic(sw::Shader::USAGE_COLOR, in + i, pixelBinary->getInput(in + i, 0).flat));
- }
- }
- else // Vertex varying is declared but not written to
- {
- for(int i = 0; i < registers; i++)
- {
- pixelBinary->setInput(in + i, components, sw::Shader::Semantic());
- }
- }
-
- matched = true;
- break;
- }
- }
-
- if(!matched)
- {
- // For openGL ES 3.0, we need to still add the vertex shader outputs for unmatched varyings, for transform feedback.
- for(const std::string &indexedTfVaryingName : transformFeedbackVaryings)
- {
- std::string tfVaryingName = es2::ParseUniformName(indexedTfVaryingName, nullptr);
-
- if(tfVaryingName == output.name)
- {
- int out = output.registerIndex;
- int components = VariableRegisterSize(output.type);
- int registers = VariableRegisterCount(output.type) * output.size();
-
- if(out >= 0)
- {
- if(out + registers >= MAX_VARYING_VECTORS)
- {
- appendToInfoLog("Too many varyings");
- return false;
- }
-
- for(int i = 0; i < registers; i++)
- {
- vertexBinary->setOutput(out + i, components, sw::Shader::Semantic(sw::Shader::USAGE_COLOR));
- }
- }
- break;
- }
- }
- }
- }
-
- return true;
- }
-
- bool Program::linkTransformFeedback()
- {
- size_t totalComponents = 0;
- totalLinkedVaryingsComponents = 0;
-
- std::set<std::string> uniqueNames;
-
- for(const std::string &indexedTfVaryingName : transformFeedbackVaryings)
- {
- unsigned int subscript = GL_INVALID_INDEX;
- std::string tfVaryingName = es2::ParseUniformName(indexedTfVaryingName, &subscript);
- bool hasSubscript = (subscript != GL_INVALID_INDEX);
-
- if(tfVaryingName.find('[') != std::string::npos)
- {
- appendToInfoLog("Capture of array sub-elements is undefined and not supported.");
- return false;
- }
-
- bool found = false;
- for(const glsl::Varying& varying : vertexShader->varyings)
- {
- if(tfVaryingName == varying.name)
- {
- if(uniqueNames.count(indexedTfVaryingName) > 0)
- {
- appendToInfoLog("Two transform feedback varyings specify the same output variable (%s)", indexedTfVaryingName.c_str());
- return false;
- }
- uniqueNames.insert(indexedTfVaryingName);
-
- if(hasSubscript && ((static_cast<int>(subscript)) >= varying.size()))
- {
- appendToInfoLog("Specified transform feedback varying index out of bounds (%s)", indexedTfVaryingName.c_str());
- return false;
- }
-
- int size = hasSubscript ? 1 : varying.size();
-
- int rowCount = VariableRowCount(varying.type);
- int colCount = VariableColumnCount(varying.type);
- int componentCount = rowCount * colCount * size;
- if(transformFeedbackBufferMode == GL_SEPARATE_ATTRIBS &&
- componentCount > sw::MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS)
- {
- appendToInfoLog("Transform feedback varying's %s components (%d) exceed the maximum separate components (%d).",
- varying.name.c_str(), componentCount, sw::MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS);
- return false;
- }
-
- totalComponents += componentCount;
-
- int reg = varying.registerIndex;
- if(hasSubscript)
- {
- reg += rowCount > 1 ? colCount * subscript : subscript;
- }
- int col = varying.column;
- if(tfVaryingName == "gl_PointSize")
- {
- // Point size is stored in the y element of the vector, not the x element
- col = 1; // FIXME: varying.col could already contain this information
- }
- transformFeedbackLinkedVaryings.push_back(LinkedVarying(varying.name, varying.type, size, reg, col));
-
- found = true;
- break;
- }
- }
-
- if(!found)
- {
- appendToInfoLog("Transform feedback varying %s does not exist in the vertex shader.", tfVaryingName.c_str());
- return false;
- }
- }
-
- if(transformFeedbackBufferMode == GL_INTERLEAVED_ATTRIBS &&
- totalComponents > sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS)
- {
- appendToInfoLog("Transform feedback varying total components (%d) exceed the maximum separate components (%d).",
- totalComponents, sw::MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS);
- return false;
- }
-
- totalLinkedVaryingsComponents = totalComponents;
-
- return true;
- }
-
- // Links the code of the vertex and pixel shader by matching up their varyings,
- // compiling them into binaries, determining the attribute mappings, and collecting
- // a list of uniforms
- void Program::link()
- {
- unlink();
-
- resetUniformBlockBindings();
-
- if(!fragmentShader || !fragmentShader->isCompiled())
- {
- return;
- }
-
- if(!vertexShader || !vertexShader->isCompiled())
- {
- return;
- }
-
- vertexBinary = new sw::VertexShader(vertexShader->getVertexShader());
- pixelBinary = new sw::PixelShader(fragmentShader->getPixelShader());
-
- if(!linkVaryings())
- {
- return;
- }
-
- if(!linkAttributes())
- {
- return;
- }
-
- // Link uniform blocks before uniforms to make it easy to assign block indices to fields
- if(!linkUniformBlocks(vertexShader, fragmentShader))
- {
- return;
- }
-
- if(!linkUniforms(fragmentShader))
- {
- return;
- }
-
- if(!linkUniforms(vertexShader))
- {
- return;
- }
-
- if(!linkTransformFeedback())
- {
- return;
- }
-
- linked = true; // Success
- }
-
- // Determines the mapping between GL attributes and vertex stream usage indices
- bool Program::linkAttributes()
- {
- static_assert(MAX_VERTEX_ATTRIBS <= 32, "attribute count exceeds bitfield count");
- unsigned int usedLocations = 0;
-
- // Link attributes that have a GLSL layout location qualifier
- for(auto const &attribute : vertexShader->activeAttributes)
- {
- if(attribute.layoutLocation != -1)
- {
- if(!linkAttribute(attribute, attribute.layoutLocation, usedLocations))
- {
- return false;
- }
- }
- }
-
- // Link attributes that have an API provided binding location but no GLSL layout location
- for(auto const &attribute : vertexShader->activeAttributes)
- {
- int bindingLocation = (attributeBinding.find(attribute.name) != attributeBinding.end()) ? attributeBinding[attribute.name] : -1;
-
- if(attribute.layoutLocation == -1 && bindingLocation != -1)
- {
- if(!linkAttribute(attribute, bindingLocation, usedLocations))
- {
- return false;
- }
- }
- }
-
- // Link attributes that don't have a binding location nor a layout location
- for(auto const &attribute : vertexShader->activeAttributes)
- {
- if(attribute.layoutLocation == -1 && attributeBinding.find(attribute.name) == attributeBinding.end())
- {
- if(!linkAttribute(attribute, -1, usedLocations))
- {
- return false;
- }
- }
- }
-
- ASSERT(linkedAttribute.size() == vertexShader->activeAttributes.size());
-
- for(auto const &attribute : linkedAttribute)
- {
- int location = getAttributeLocation(attribute.name);
- ASSERT(location >= 0);
- int index = vertexShader->getSemanticIndex(attribute.name);
- int rows = VariableRegisterCount(attribute.type);
-
- for(int r = 0; r < rows; r++)
- {
- attributeStream[r + location] = index++;
- }
- }
-
- return true;
- }
-
- bool Program::linkAttribute(const glsl::Attribute &attribute, int location, unsigned int &usedLocations)
- {
- int rows = VariableRegisterCount(attribute.type);
-
- if(location == -1)
- {
- location = AllocateFirstFreeBits(&usedLocations, rows, MAX_VERTEX_ATTRIBS);
-
- if(location == -1 || location + rows > MAX_VERTEX_ATTRIBS)
- {
- appendToInfoLog("Too many active attributes (%s)", attribute.name.c_str());
- return false; // Fail to link
- }
- }
- else
- {
- if(rows + location > MAX_VERTEX_ATTRIBS)
- {
- appendToInfoLog("Active attribute (%s) at location %d is too big to fit", attribute.name.c_str(), location);
- return false;
- }
-
- // In GLSL 3.00, attribute aliasing produces a link error
- // In GLSL 1.00, attribute aliasing is allowed
- if(vertexShader->getShaderVersion() >= 300)
- {
- for(auto const &previousAttrib : linkedAttribute)
- {
- int previousLocation = getAttributeLocation(previousAttrib.name);
- int previousRows = VariableRegisterCount(previousAttrib.type);
-
- if(location >= previousLocation && location < previousLocation + previousRows)
- {
- appendToInfoLog("Attribute '%s' aliases attribute '%s' at location %d", attribute.name.c_str(), previousAttrib.name.c_str(), location);
- return false;
- }
-
- if(location <= previousLocation && location + rows > previousLocation)
- {
- appendToInfoLog("Attribute '%s' aliases attribute '%s' at location %d", attribute.name.c_str(), previousAttrib.name.c_str(), previousLocation);
- return false;
- }
- }
- }
-
- for(int i = 0; i < rows; i++)
- {
- usedLocations |= 1 << (location + i);
- }
- }
-
- linkedAttributeLocation[attribute.name] = location;
- linkedAttribute.push_back(attribute);
-
- return true;
- }
-
- int Program::getAttributeLocation(const std::string &name)
- {
- std::map<std::string, GLuint>::const_iterator attribute = linkedAttributeLocation.find(name);
- if(attribute != linkedAttributeLocation.end())
- {
- return attribute->second;
- }
-
- return -1;
- }
-
- bool Program::linkUniforms(const Shader *shader)
- {
- for(const auto &uniform : shader->activeUniforms)
- {
- unsigned int blockIndex = GL_INVALID_INDEX;
- if(uniform.blockId >= 0)
- {
- const glsl::ActiveUniformBlocks &activeUniformBlocks = shader->activeUniformBlocks;
- ASSERT(static_cast<size_t>(uniform.blockId) < activeUniformBlocks.size());
- const std::string &uniformBlockName = activeUniformBlocks[uniform.blockId].name;
- blockIndex = getUniformBlockIndex(uniformBlockName);
- ASSERT(blockIndex != GL_INVALID_INDEX);
-
- if(activeUniformBlocks[uniform.blockId].dataSize > MAX_UNIFORM_BLOCK_SIZE)
- {
- if(shader->getType() == GL_VERTEX_SHADER)
- {
- appendToInfoLog("Vertex shader active uniform block (%s) exceeds GL_MAX_UNIFORM_BLOCK_SIZE (%d)", uniformBlockName.c_str(), MAX_UNIFORM_BLOCK_SIZE);
- return false;
- }
- else if(shader->getType() == GL_FRAGMENT_SHADER)
- {
- appendToInfoLog("Fragment shader active uniform block (%s) exceeds GL_MAX_UNIFORM_BLOCK_SIZE (%d)", uniformBlockName.c_str(), MAX_UNIFORM_BLOCK_SIZE);
- return false;
- }
- else UNREACHABLE(shader->getType());
- }
- }
-
- if(!defineUniform(shader->getType(), uniform, Uniform::BlockInfo(uniform, blockIndex)))
- {
- return false;
- }
- }
-
- for(const auto &uniformStruct : shader->activeUniformStructs)
- {
- if(!validateUniformStruct(shader->getType(), uniformStruct))
- {
- return false;
- }
- }
-
- return true;
- }
-
- bool Program::defineUniform(GLenum shader, const glsl::Uniform &glslUniform, const Uniform::BlockInfo& blockInfo)
- {
- if(IsSamplerUniform(glslUniform.type))
- {
- int index = glslUniform.registerIndex;
-
- do
- {
- if(shader == GL_VERTEX_SHADER)
- {
- if(index < MAX_VERTEX_TEXTURE_IMAGE_UNITS)
- {
- samplersVS[index].active = true;
-
- switch(glslUniform.type)
- {
- default: UNREACHABLE(glslUniform.type);
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_2D: samplersVS[index].textureType = TEXTURE_2D; break;
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_CUBE: samplersVS[index].textureType = TEXTURE_CUBE; break;
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_SAMPLER_3D_OES: samplersVS[index].textureType = TEXTURE_3D; break;
- case GL_SAMPLER_2D_RECT_ARB: samplersVS[index].textureType = TEXTURE_2D_RECT; break;
- case GL_SAMPLER_EXTERNAL_OES: samplersVS[index].textureType = TEXTURE_EXTERNAL; break;
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_ARRAY: samplersVS[index].textureType = TEXTURE_2D_ARRAY; break;
- }
-
- samplersVS[index].logicalTextureUnit = 0;
- }
- else
- {
- appendToInfoLog("Vertex shader sampler count exceeds MAX_VERTEX_TEXTURE_IMAGE_UNITS (%d).", MAX_VERTEX_TEXTURE_IMAGE_UNITS);
- return false;
- }
- }
- else if(shader == GL_FRAGMENT_SHADER)
- {
- if(index < MAX_TEXTURE_IMAGE_UNITS)
- {
- samplersPS[index].active = true;
-
- switch(glslUniform.type)
- {
- default: UNREACHABLE(glslUniform.type);
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_2D: samplersPS[index].textureType = TEXTURE_2D; break;
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_CUBE: samplersPS[index].textureType = TEXTURE_CUBE; break;
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_SAMPLER_3D_OES: samplersPS[index].textureType = TEXTURE_3D; break;
- case GL_SAMPLER_2D_RECT_ARB: samplersPS[index].textureType = TEXTURE_2D_RECT; break;
- case GL_SAMPLER_EXTERNAL_OES: samplersPS[index].textureType = TEXTURE_EXTERNAL; break;
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_SAMPLER_2D_ARRAY: samplersPS[index].textureType = TEXTURE_2D_ARRAY; break;
- }
-
- samplersPS[index].logicalTextureUnit = 0;
- }
- else
- {
- appendToInfoLog("Pixel shader sampler count exceeds MAX_TEXTURE_IMAGE_UNITS (%d).", MAX_TEXTURE_IMAGE_UNITS);
- return false;
- }
- }
- else UNREACHABLE(shader);
-
- index++;
- }
- while(index < glslUniform.registerIndex + static_cast<int>(glslUniform.arraySize));
- }
-
- Uniform *uniform = getUniform(glslUniform.name);
-
- if(!uniform)
- {
- uniform = new Uniform(glslUniform, blockInfo);
- uniforms.push_back(uniform);
-
- unsigned int index = (blockInfo.index == -1) ? static_cast<unsigned int>(uniforms.size() - 1) : GL_INVALID_INDEX;
-
- for(int i = 0; i < uniform->size(); i++)
- {
- uniformIndex.push_back(UniformLocation(glslUniform.name, i, index));
- }
- }
- else // Previously defined, types must match
- {
- if(uniform->type != glslUniform.type)
- {
- appendToInfoLog("Types for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
-
- if(uniform->precision != glslUniform.precision)
- {
- appendToInfoLog("Precisions for uniform %s do not match between the vertex and fragment shader", uniform->name.c_str());
- return false;
- }
-
- if(!areMatchingFields(uniform->fields, glslUniform.fields, uniform->name))
- {
- return false;
- }
- }
-
- if(shader == GL_VERTEX_SHADER)
- {
- uniform->vsRegisterIndex = glslUniform.registerIndex;
- }
- else if(shader == GL_FRAGMENT_SHADER)
- {
- uniform->psRegisterIndex = glslUniform.registerIndex;
- }
- else UNREACHABLE(shader);
-
- if(uniform->blockInfo.index < 0)
- {
- if(shader == GL_VERTEX_SHADER)
- {
- if(glslUniform.registerIndex + uniform->registerCount() > MAX_VERTEX_UNIFORM_VECTORS)
- {
- appendToInfoLog("Vertex shader active uniforms exceed GL_MAX_VERTEX_UNIFORM_VECTORS (%d)", MAX_VERTEX_UNIFORM_VECTORS);
- return false;
- }
- }
- else if(shader == GL_FRAGMENT_SHADER)
- {
- if(glslUniform.registerIndex + uniform->registerCount() > MAX_FRAGMENT_UNIFORM_VECTORS)
- {
- appendToInfoLog("Fragment shader active uniforms exceed GL_MAX_FRAGMENT_UNIFORM_VECTORS (%d)", MAX_FRAGMENT_UNIFORM_VECTORS);
- return false;
- }
- }
- else UNREACHABLE(shader);
- }
-
- return true;
- }
-
- bool Program::validateUniformStruct(GLenum shader, const glsl::Uniform &newUniformStruct)
- {
- for(const auto &uniformStruct : uniformStructs)
- {
- if(uniformStruct.name == newUniformStruct.name)
- {
- return areMatchingFields(uniformStruct.fields, newUniformStruct.fields, newUniformStruct.name);
- }
- }
-
- uniformStructs.push_back(Uniform(newUniformStruct, Uniform::BlockInfo(newUniformStruct, -1)));
-
- return true;
- }
-
- bool Program::areMatchingUniformBlocks(const glsl::UniformBlock &block1, const glsl::UniformBlock &block2, const Shader *shader1, const Shader *shader2)
- {
- // validate blocks for the same member types
- if(block1.fields.size() != block2.fields.size())
- {
- appendToInfoLog("Types for interface block '%s' differ between vertex and fragment shaders", block1.name.c_str());
- return false;
- }
- if(block1.arraySize != block2.arraySize)
- {
- appendToInfoLog("Array sizes differ for interface block '%s' between vertex and fragment shaders", block1.name.c_str());
- return false;
- }
- if(block1.layout != block2.layout || block1.isRowMajorLayout != block2.isRowMajorLayout)
- {
- appendToInfoLog("Layout qualifiers differ for interface block '%s' between vertex and fragment shaders", block1.name.c_str());
- return false;
- }
- const size_t numBlockMembers = block1.fields.size();
- for(size_t blockMemberIndex = 0; blockMemberIndex < numBlockMembers; blockMemberIndex++)
- {
- const glsl::Uniform& member1 = shader1->activeUniforms[block1.fields[blockMemberIndex]];
- const glsl::Uniform& member2 = shader2->activeUniforms[block2.fields[blockMemberIndex]];
- if(member1.name != member2.name)
- {
- appendToInfoLog("Name mismatch for field %d of interface block '%s': (in vertex: '%s', in fragment: '%s')",
- blockMemberIndex, block1.name.c_str(), member1.name.c_str(), member2.name.c_str());
- return false;
- }
- if(member1.arraySize != member2.arraySize)
- {
- appendToInfoLog("Array sizes for %s differ between vertex and fragment shaders", member1.name.c_str());
- return false;
- }
- if(member1.precision != member2.precision)
- {
- appendToInfoLog("Precisions for %s differ between vertex and fragment shaders", member1.name.c_str());
- return false;
- }
- if(member1.type != member2.type)
- {
- appendToInfoLog("Types for %s differ between vertex and fragment shaders", member1.name.c_str());
- return false;
- }
- if(member1.blockInfo.isRowMajorMatrix != member2.blockInfo.isRowMajorMatrix)
- {
- appendToInfoLog("Matrix packings for %s differ between vertex and fragment shaders", member1.name.c_str());
- return false;
- }
- }
- return true;
- }
-
- bool Program::areMatchingFields(const std::vector<glsl::ShaderVariable>& fields1, const std::vector<glsl::ShaderVariable>& fields2, const std::string& name)
- {
- if(fields1.size() != fields2.size())
- {
- appendToInfoLog("Structure lengths for %s differ between vertex and fragment shaders", name.c_str());
- return false;
- }
-
- for(size_t i = 0; i < fields1.size(); ++i)
- {
- if(fields1[i].name != fields2[i].name)
- {
- appendToInfoLog("Name mismatch for field '%d' of %s: ('%s', '%s')",
- i, name.c_str(), fields1[i].name.c_str(), fields2[i].name.c_str());
- return false;
- }
- if(fields1[i].type != fields2[i].type)
- {
- appendToInfoLog("Type for %s.%s differ between vertex and fragment shaders", name.c_str(), fields1[i].name.c_str());
- return false;
- }
- if(fields1[i].arraySize != fields2[i].arraySize)
- {
- appendToInfoLog("Array size for %s.%s differ between vertex and fragment shaders", name.c_str(), fields1[i].name.c_str());
- return false;
- }
- if(!areMatchingFields(fields1[i].fields, fields2[i].fields, fields1[i].name))
- {
- return false;
- }
- }
-
- return true;
- }
-
- bool Program::linkUniformBlocks(const Shader *vertexShader, const Shader *fragmentShader)
- {
- const glsl::ActiveUniformBlocks &vertexUniformBlocks = vertexShader->activeUniformBlocks;
- const glsl::ActiveUniformBlocks &fragmentUniformBlocks = fragmentShader->activeUniformBlocks;
- // Check that interface blocks defined in the vertex and fragment shaders are identical
- typedef std::map<std::string, const glsl::UniformBlock*> UniformBlockMap;
- UniformBlockMap linkedUniformBlocks;
- for(unsigned int blockIndex = 0; blockIndex < vertexUniformBlocks.size(); blockIndex++)
- {
- const glsl::UniformBlock &vertexUniformBlock = vertexUniformBlocks[blockIndex];
- linkedUniformBlocks[vertexUniformBlock.name] = &vertexUniformBlock;
- }
- for(unsigned int blockIndex = 0; blockIndex < fragmentUniformBlocks.size(); blockIndex++)
- {
- const glsl::UniformBlock &fragmentUniformBlock = fragmentUniformBlocks[blockIndex];
- UniformBlockMap::const_iterator entry = linkedUniformBlocks.find(fragmentUniformBlock.name);
- if(entry != linkedUniformBlocks.end())
- {
- const glsl::UniformBlock &vertexUniformBlock = *entry->second;
- if(!areMatchingUniformBlocks(vertexUniformBlock, fragmentUniformBlock, vertexShader, fragmentShader))
- {
- return false;
- }
- }
- }
- for(unsigned int blockIndex = 0; blockIndex < vertexUniformBlocks.size(); blockIndex++)
- {
- const glsl::UniformBlock &uniformBlock = vertexUniformBlocks[blockIndex];
- if(!defineUniformBlock(vertexShader, uniformBlock))
- {
- return false;
- }
- }
- for(unsigned int blockIndex = 0; blockIndex < fragmentUniformBlocks.size(); blockIndex++)
- {
- const glsl::UniformBlock &uniformBlock = fragmentUniformBlocks[blockIndex];
- if(!defineUniformBlock(fragmentShader, uniformBlock))
- {
- return false;
- }
- }
- return true;
- }
-
- bool Program::defineUniformBlock(const Shader *shader, const glsl::UniformBlock &block)
- {
- GLuint blockIndex = getUniformBlockIndex(block.name);
-
- if(blockIndex == GL_INVALID_INDEX)
- {
- const std::vector<int>& fields = block.fields;
- std::vector<unsigned int> memberUniformIndexes;
- for(size_t i = 0; i < fields.size(); ++i)
- {
- memberUniformIndexes.push_back(fields[i]);
- }
-
- if(block.arraySize > 0)
- {
- int regIndex = block.registerIndex;
- int regInc = block.dataSize / (glsl::BlockLayoutEncoder::BytesPerComponent * glsl::BlockLayoutEncoder::ComponentsPerRegister);
- for(unsigned int i = 0; i < block.arraySize; ++i, regIndex += regInc)
- {
- uniformBlocks.push_back(new UniformBlock(block.name, i, block.dataSize, memberUniformIndexes));
- uniformBlocks[uniformBlocks.size() - 1]->setRegisterIndex(shader->getType(), regIndex);
- }
- }
- else
- {
- uniformBlocks.push_back(new UniformBlock(block.name, GL_INVALID_INDEX, block.dataSize, memberUniformIndexes));
- uniformBlocks[uniformBlocks.size() - 1]->setRegisterIndex(shader->getType(), block.registerIndex);
- }
- }
- else
- {
- int regIndex = block.registerIndex;
- int regInc = block.dataSize / (glsl::BlockLayoutEncoder::BytesPerComponent * glsl::BlockLayoutEncoder::ComponentsPerRegister);
- int nbBlocks = (block.arraySize > 0) ? block.arraySize : 1;
- for(int i = 0; i < nbBlocks; ++i, regIndex += regInc)
- {
- uniformBlocks[blockIndex + i]->setRegisterIndex(shader->getType(), regIndex);
- }
- }
-
- return true;
- }
-
- bool Program::applyUniform(Device *device, GLint location, float* data)
- {
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
-
- if(targetUniform->psRegisterIndex != -1)
- {
- device->setPixelShaderConstantF(targetUniform->psRegisterIndex, data, targetUniform->registerCount());
- }
-
- if(targetUniform->vsRegisterIndex != -1)
- {
- device->setVertexShaderConstantF(targetUniform->vsRegisterIndex, data, targetUniform->registerCount());
- }
-
- return true;
- }
-
- bool Program::applyUniform1bv(Device *device, GLint location, GLsizei count, const GLboolean *v)
- {
- int vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = (v[0] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][1] = 0;
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 1;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform2bv(Device *device, GLint location, GLsizei count, const GLboolean *v)
- {
- int vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = (v[0] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][1] = (v[1] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 2;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform3bv(Device *device, GLint location, GLsizei count, const GLboolean *v)
- {
- int vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = (v[0] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][1] = (v[1] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][2] = (v[2] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][3] = 0;
-
- v += 3;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform4bv(Device *device, GLint location, GLsizei count, const GLboolean *v)
- {
- int vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = (v[0] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][1] = (v[1] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][2] = (v[2] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
- vector[i][3] = (v[3] == GL_FALSE ? 0x00000000 : 0xFFFFFFFF);
-
- v += 4;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform1fv(Device *device, GLint location, GLsizei count, const GLfloat *v)
- {
- float vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = 0;
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 1;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform2fv(Device *device, GLint location, GLsizei count, const GLfloat *v)
- {
- float vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 2;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform3fv(Device *device, GLint location, GLsizei count, const GLfloat *v)
- {
- float vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = v[2];
- vector[i][3] = 0;
-
- v += 3;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform4fv(Device *device, GLint location, GLsizei count, const GLfloat *v)
- {
- return applyUniform(device, location, (float*)v);
- }
-
- bool Program::applyUniformMatrix2fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 1) / 2][2][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = 0; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[2]; matrix[i][1][1] = value[3]; matrix[i][1][2] = 0; matrix[i][1][3] = 0;
-
- value += 4;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix2x3fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 1) / 2][2][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = value[2]; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[3]; matrix[i][1][1] = value[4]; matrix[i][1][2] = value[5]; matrix[i][1][3] = 0;
-
- value += 6;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix2x4fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 1) / 2][2][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = value[2]; matrix[i][0][3] = value[3];
- matrix[i][1][0] = value[4]; matrix[i][1][1] = value[5]; matrix[i][1][2] = value[6]; matrix[i][1][3] = value[7];
-
- value += 8;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix3fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 2) / 3][3][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = value[2]; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[3]; matrix[i][1][1] = value[4]; matrix[i][1][2] = value[5]; matrix[i][1][3] = 0;
- matrix[i][2][0] = value[6]; matrix[i][2][1] = value[7]; matrix[i][2][2] = value[8]; matrix[i][2][3] = 0;
-
- value += 9;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix3x2fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 2) / 3][3][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = 0; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[2]; matrix[i][1][1] = value[3]; matrix[i][1][2] = 0; matrix[i][1][3] = 0;
- matrix[i][2][0] = value[4]; matrix[i][2][1] = value[5]; matrix[i][2][2] = 0; matrix[i][2][3] = 0;
-
- value += 6;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix3x4fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 2) / 3][3][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = value[2]; matrix[i][0][3] = value[3];
- matrix[i][1][0] = value[4]; matrix[i][1][1] = value[5]; matrix[i][1][2] = value[6]; matrix[i][1][3] = value[7];
- matrix[i][2][0] = value[8]; matrix[i][2][1] = value[9]; matrix[i][2][2] = value[10]; matrix[i][2][3] = value[11];
-
- value += 12;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix4fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- return applyUniform(device, location, (float*)value);
- }
-
- bool Program::applyUniformMatrix4x2fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 3) / 4][4][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = 0; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[2]; matrix[i][1][1] = value[3]; matrix[i][1][2] = 0; matrix[i][1][3] = 0;
- matrix[i][2][0] = value[4]; matrix[i][2][1] = value[5]; matrix[i][2][2] = 0; matrix[i][2][3] = 0;
- matrix[i][3][0] = value[6]; matrix[i][3][1] = value[7]; matrix[i][3][2] = 0; matrix[i][3][3] = 0;
-
- value += 8;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniformMatrix4x3fv(Device *device, GLint location, GLsizei count, const GLfloat *value)
- {
- float matrix[(MAX_UNIFORM_VECTORS + 3) / 4][4][4];
-
- for(int i = 0; i < count; i++)
- {
- matrix[i][0][0] = value[0]; matrix[i][0][1] = value[1]; matrix[i][0][2] = value[2]; matrix[i][0][3] = 0;
- matrix[i][1][0] = value[3]; matrix[i][1][1] = value[4]; matrix[i][1][2] = value[5]; matrix[i][1][3] = 0;
- matrix[i][2][0] = value[6]; matrix[i][2][1] = value[7]; matrix[i][2][2] = value[8]; matrix[i][2][3] = 0;
- matrix[i][3][0] = value[9]; matrix[i][3][1] = value[10]; matrix[i][3][2] = value[11]; matrix[i][3][3] = 0;
-
- value += 12;
- }
-
- return applyUniform(device, location, (float*)matrix);
- }
-
- bool Program::applyUniform1iv(Device *device, GLint location, GLsizei count, const GLint *v)
- {
- GLint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[i];
- vector[i][1] = 0;
- vector[i][2] = 0;
- vector[i][3] = 0;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- if(IsSamplerUniform(targetUniform->type))
- {
- if(targetUniform->psRegisterIndex != -1)
- {
- for(int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = targetUniform->psRegisterIndex + i;
-
- if(samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
- {
- ASSERT(samplersPS[samplerIndex].active);
- samplersPS[samplerIndex].logicalTextureUnit = v[i];
- }
- }
- }
-
- if(targetUniform->vsRegisterIndex != -1)
- {
- for(int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = targetUniform->vsRegisterIndex + i;
-
- if(samplerIndex < MAX_VERTEX_TEXTURE_IMAGE_UNITS)
- {
- ASSERT(samplersVS[samplerIndex].active);
- samplersVS[samplerIndex].logicalTextureUnit = v[i];
- }
- }
- }
- }
- else
- {
- return applyUniform(device, location, (float*)vector);
- }
-
- return true;
- }
-
- bool Program::applyUniform2iv(Device *device, GLint location, GLsizei count, const GLint *v)
- {
- GLint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 2;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform3iv(Device *device, GLint location, GLsizei count, const GLint *v)
- {
- GLint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = v[2];
- vector[i][3] = 0;
-
- v += 3;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform4iv(Device *device, GLint location, GLsizei count, const GLint *v)
- {
- GLint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = v[2];
- vector[i][3] = v[3];
-
- v += 4;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform1uiv(Device *device, GLint location, GLsizei count, const GLuint *v)
- {
- GLuint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[i];
- vector[i][1] = 0;
- vector[i][2] = 0;
- vector[i][3] = 0;
- }
-
- Uniform *targetUniform = uniforms[uniformIndex[location].index];
- if(IsSamplerUniform(targetUniform->type))
- {
- if(targetUniform->psRegisterIndex != -1)
- {
- for(int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = targetUniform->psRegisterIndex + i;
-
- if(samplerIndex < MAX_TEXTURE_IMAGE_UNITS)
- {
- ASSERT(samplersPS[samplerIndex].active);
- samplersPS[samplerIndex].logicalTextureUnit = v[i];
- }
- }
- }
-
- if(targetUniform->vsRegisterIndex != -1)
- {
- for(int i = 0; i < count; i++)
- {
- unsigned int samplerIndex = targetUniform->vsRegisterIndex + i;
-
- if(samplerIndex < MAX_VERTEX_TEXTURE_IMAGE_UNITS)
- {
- ASSERT(samplersVS[samplerIndex].active);
- samplersVS[samplerIndex].logicalTextureUnit = v[i];
- }
- }
- }
- }
- else
- {
- return applyUniform(device, location, (float*)vector);
- }
-
- return true;
- }
-
- bool Program::applyUniform2uiv(Device *device, GLint location, GLsizei count, const GLuint *v)
- {
- GLuint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = 0;
- vector[i][3] = 0;
-
- v += 2;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform3uiv(Device *device, GLint location, GLsizei count, const GLuint *v)
- {
- GLuint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = v[2];
- vector[i][3] = 0;
-
- v += 3;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- bool Program::applyUniform4uiv(Device *device, GLint location, GLsizei count, const GLuint *v)
- {
- GLuint vector[MAX_UNIFORM_VECTORS][4];
-
- for(int i = 0; i < count; i++)
- {
- vector[i][0] = v[0];
- vector[i][1] = v[1];
- vector[i][2] = v[2];
- vector[i][3] = v[3];
-
- v += 4;
- }
-
- return applyUniform(device, location, (float*)vector);
- }
-
- void Program::appendToInfoLog(const char *format, ...)
- {
- if(!format)
- {
- return;
- }
-
- char info[1024];
-
- va_list vararg;
- va_start(vararg, format);
- vsnprintf(info, sizeof(info), format, vararg);
- va_end(vararg);
-
- size_t infoLength = strlen(info);
-
- if(!infoLog)
- {
- infoLog = new char[infoLength + 2];
- strcpy(infoLog, info);
- strcpy(infoLog + infoLength, "\n");
- }
- else
- {
- size_t logLength = strlen(infoLog);
- char *newLog = new char[logLength + infoLength + 2];
- strcpy(newLog, infoLog);
- strcpy(newLog + logLength, info);
- strcpy(newLog + logLength + infoLength, "\n");
-
- delete[] infoLog;
- infoLog = newLog;
- }
- }
-
- void Program::resetInfoLog()
- {
- if(infoLog)
- {
- delete[] infoLog;
- infoLog = 0;
- }
- }
-
- // Returns the program object to an unlinked state, before re-linking, or at destruction
- void Program::unlink()
- {
- delete vertexBinary;
- vertexBinary = 0;
- delete pixelBinary;
- pixelBinary = 0;
-
- linkedAttribute.clear();
- linkedAttributeLocation.clear();
-
- for(int index = 0; index < MAX_VERTEX_ATTRIBS; index++)
- {
- attributeStream[index] = -1;
- }
-
- for(int index = 0; index < MAX_TEXTURE_IMAGE_UNITS; index++)
- {
- samplersPS[index].active = false;
- }
-
- for(int index = 0; index < MAX_VERTEX_TEXTURE_IMAGE_UNITS; index++)
- {
- samplersVS[index].active = false;
- }
-
- while(!uniforms.empty())
- {
- delete uniforms.back();
- uniforms.pop_back();
- }
-
- while(!uniformBlocks.empty())
- {
- delete uniformBlocks.back();
- uniformBlocks.pop_back();
- }
-
- uniformIndex.clear();
- transformFeedbackLinkedVaryings.clear();
-
- delete[] infoLog;
- infoLog = 0;
-
- linked = false;
- }
-
- bool Program::isLinked() const
- {
- return linked;
- }
-
- bool Program::isValidated() const
- {
- return validated;
- }
-
- GLint Program::getBinaryLength() const
- {
- UNIMPLEMENTED();
- return 0;
- }
-
- void Program::release()
- {
- referenceCount--;
-
- if(referenceCount == 0 && orphaned)
- {
- resourceManager->deleteProgram(handle);
- }
- }
-
- void Program::addRef()
- {
- referenceCount++;
- }
-
- unsigned int Program::getRefCount() const
- {
- return referenceCount;
- }
-
- unsigned int Program::getSerial() const
- {
- return serial;
- }
-
- unsigned int Program::issueSerial()
- {
- return currentSerial++;
- }
-
- size_t Program::getInfoLogLength() const
- {
- if(!infoLog)
- {
- return 0;
- }
- else
- {
- return strlen(infoLog) + 1;
- }
- }
-
- void Program::getInfoLog(GLsizei bufSize, GLsizei *length, char *buffer)
- {
- int index = 0;
-
- if(bufSize > 0)
- {
- if(infoLog)
- {
- index = std::min(bufSize - 1, (int)strlen(infoLog));
- memcpy(buffer, infoLog, index);
- }
-
- buffer[index] = '\0';
- }
-
- if(length)
- {
- *length = index;
- }
- }
-
- void Program::getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders)
- {
- int total = 0;
-
- if(vertexShader && (total < maxCount))
- {
- shaders[total++] = vertexShader->getName();
- }
-
- if(fragmentShader && (total < maxCount))
- {
- shaders[total++] = fragmentShader->getName();
- }
-
- if(count)
- {
- *count = total;
- }
- }
-
- void Program::getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const
- {
- ASSERT(index < linkedAttribute.size());
-
- std::vector<glsl::Attribute>::const_iterator it = linkedAttribute.begin() + index;
-
- if(bufsize > 0)
- {
- const char *string = it->name.c_str();
-
- strncpy(name, string, bufsize);
- name[bufsize - 1] = '\0';
-
- if(length)
- {
- *length = static_cast<GLsizei>(strlen(name));
- }
- }
-
- *size = 1; // Always a single 'type' instance
-
- *type = it->type;
- }
-
- size_t Program::getActiveAttributeCount() const
- {
- return linkedAttribute.size();
- }
-
- GLint Program::getActiveAttributeMaxLength() const
- {
- int maxLength = 0;
-
- std::vector<glsl::Attribute>::const_iterator it = linkedAttribute.begin();
- std::vector<glsl::Attribute>::const_iterator itEnd = linkedAttribute.end();
- for(; it != itEnd; ++it)
- {
- maxLength = std::max((int)(it->name.length() + 1), maxLength);
- }
-
- return maxLength;
- }
-
- void Program::getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const
- {
- if(bufsize > 0)
- {
- std::string string = uniforms[index]->name;
-
- if(uniforms[index]->isArray())
- {
- string += "[0]";
- }
-
- strncpy(name, string.c_str(), bufsize);
- name[bufsize - 1] = '\0';
-
- if(length)
- {
- *length = static_cast<GLsizei>(strlen(name));
- }
- }
-
- *size = uniforms[index]->size();
-
- *type = uniforms[index]->type;
- }
-
- size_t Program::getActiveUniformCount() const
- {
- return uniforms.size();
- }
-
- GLint Program::getActiveUniformMaxLength() const
- {
- int maxLength = 0;
-
- size_t numUniforms = uniforms.size();
- for(size_t uniformIndex = 0; uniformIndex < numUniforms; uniformIndex++)
- {
- if(!uniforms[uniformIndex]->name.empty())
- {
- int length = (int)(uniforms[uniformIndex]->name.length() + 1);
- if(uniforms[uniformIndex]->isArray())
- {
- length += 3; // Counting in "[0]".
- }
- maxLength = std::max(length, maxLength);
- }
- }
-
- return maxLength;
- }
-
- GLint Program::getActiveUniformi(GLuint index, GLenum pname) const
- {
- const Uniform& uniform = *uniforms[index];
- switch(pname)
- {
- case GL_UNIFORM_TYPE: return static_cast<GLint>(uniform.type);
- case GL_UNIFORM_SIZE: return static_cast<GLint>(uniform.size());
- case GL_UNIFORM_NAME_LENGTH: return static_cast<GLint>(uniform.name.size() + 1 + (uniform.isArray() ? 3 : 0));
- case GL_UNIFORM_BLOCK_INDEX: return uniform.blockInfo.index;
- case GL_UNIFORM_OFFSET: return uniform.blockInfo.offset;
- case GL_UNIFORM_ARRAY_STRIDE: return uniform.blockInfo.arrayStride;
- case GL_UNIFORM_MATRIX_STRIDE: return uniform.blockInfo.matrixStride;
- case GL_UNIFORM_IS_ROW_MAJOR: return static_cast<GLint>(uniform.blockInfo.isRowMajorMatrix);
- default:
- UNREACHABLE(pname);
- break;
- }
- return 0;
- }
-
- void Program::getActiveUniformBlockName(GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name) const
- {
- ASSERT(index < getActiveUniformBlockCount());
-
- const UniformBlock &uniformBlock = *uniformBlocks[index];
-
- if(bufSize > 0)
- {
- std::string string = uniformBlock.name;
-
- if(uniformBlock.isArrayElement())
- {
- std::ostringstream elementIndex;
- elementIndex << uniformBlock.elementIndex;
- string += "[" + elementIndex.str() + "]";
- }
-
- strncpy(name, string.c_str(), bufSize);
- name[bufSize - 1] = '\0';
-
- if(length)
- {
- *length = static_cast<GLsizei>(strlen(name));
- }
- }
- }
-
- size_t Program::getActiveUniformBlockCount() const
- {
- return uniformBlocks.size();
- }
-
- GLint Program::getActiveUniformBlockMaxLength() const
- {
- GLint maxLength = 0;
-
- if(isLinked())
- {
- size_t numUniformBlocks = getActiveUniformBlockCount();
- for(size_t uniformBlockIndex = 0; uniformBlockIndex < numUniformBlocks; uniformBlockIndex++)
- {
- const UniformBlock &uniformBlock = *uniformBlocks[uniformBlockIndex];
- if(!uniformBlock.name.empty())
- {
- GLint length = static_cast<GLint>(uniformBlock.name.length() + 1);
-
- // Counting in "[0]".
- const GLint arrayLength = (uniformBlock.isArrayElement() ? 3 : 0);
-
- maxLength = std::max(length + arrayLength, maxLength);
- }
- }
- }
-
- return maxLength;
- }
-
- void Program::setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
- {
- transformFeedbackVaryings.resize(count);
- for(GLsizei i = 0; i < count; i++)
- {
- transformFeedbackVaryings[i] = varyings[i];
- }
-
- transformFeedbackBufferMode = bufferMode;
- }
-
- void Program::getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const
- {
- if(linked)
- {
- ASSERT(index < transformFeedbackLinkedVaryings.size());
- const LinkedVarying &varying = transformFeedbackLinkedVaryings[index];
- GLsizei lastNameIdx = std::min(bufSize - 1, static_cast<GLsizei>(varying.name.length()));
- if(length)
- {
- *length = lastNameIdx;
- }
- if(size)
- {
- *size = varying.size;
- }
- if(type)
- {
- *type = varying.type;
- }
- if(name)
- {
- memcpy(name, varying.name.c_str(), lastNameIdx);
- name[lastNameIdx] = '\0';
- }
- }
- }
-
- GLsizei Program::getTransformFeedbackVaryingCount() const
- {
- if(linked)
- {
- return static_cast<GLsizei>(transformFeedbackLinkedVaryings.size());
- }
- else
- {
- return 0;
- }
- }
-
- GLsizei Program::getTransformFeedbackVaryingMaxLength() const
- {
- if(linked)
- {
- GLsizei maxSize = 0;
- for(size_t i = 0; i < transformFeedbackLinkedVaryings.size(); i++)
- {
- const LinkedVarying &varying = transformFeedbackLinkedVaryings[i];
- maxSize = std::max(maxSize, static_cast<GLsizei>(varying.name.length() + 1));
- }
-
- return maxSize;
- }
- else
- {
- return 0;
- }
- }
-
- GLenum Program::getTransformFeedbackBufferMode() const
- {
- return transformFeedbackBufferMode;
- }
-
- void Program::flagForDeletion()
- {
- orphaned = true;
- }
-
- bool Program::isFlaggedForDeletion() const
- {
- return orphaned;
- }
-
- void Program::validate(Device* device)
- {
- resetInfoLog();
-
- if(!isLinked())
- {
- appendToInfoLog("Program has not been successfully linked.");
- validated = false;
- }
- else
- {
- applyUniforms(device);
- if(!validateSamplers(true))
- {
- validated = false;
- }
- else
- {
- validated = true;
- }
- }
- }
-
- bool Program::validateSamplers(bool logErrors)
- {
- // if any two active samplers in a program are of different types, but refer to the same
- // texture image unit, and this is the current program, then ValidateProgram will fail, and
- // DrawArrays and DrawElements will issue the INVALID_OPERATION error.
-
- TextureType textureUnitType[MAX_COMBINED_TEXTURE_IMAGE_UNITS];
-
- for(unsigned int i = 0; i < MAX_COMBINED_TEXTURE_IMAGE_UNITS; i++)
- {
- textureUnitType[i] = TEXTURE_UNKNOWN;
- }
-
- for(unsigned int i = 0; i < MAX_TEXTURE_IMAGE_UNITS; i++)
- {
- if(samplersPS[i].active)
- {
- unsigned int unit = samplersPS[i].logicalTextureUnit;
-
- if(unit >= MAX_COMBINED_TEXTURE_IMAGE_UNITS)
- {
- if(logErrors)
- {
- appendToInfoLog("Sampler uniform (%d) exceeds MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)", unit, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
- }
-
- return false;
- }
-
- if(textureUnitType[unit] != TEXTURE_UNKNOWN)
- {
- if(samplersPS[i].textureType != textureUnitType[unit])
- {
- if(logErrors)
- {
- appendToInfoLog("Samplers of conflicting types refer to the same texture image unit (%d).", unit);
- }
-
- return false;
- }
- }
- else
- {
- textureUnitType[unit] = samplersPS[i].textureType;
- }
- }
- }
-
- for(unsigned int i = 0; i < MAX_VERTEX_TEXTURE_IMAGE_UNITS; i++)
- {
- if(samplersVS[i].active)
- {
- unsigned int unit = samplersVS[i].logicalTextureUnit;
-
- if(unit >= MAX_COMBINED_TEXTURE_IMAGE_UNITS)
- {
- if(logErrors)
- {
- appendToInfoLog("Sampler uniform (%d) exceeds MAX_COMBINED_TEXTURE_IMAGE_UNITS (%d)", unit, MAX_COMBINED_TEXTURE_IMAGE_UNITS);
- }
-
- return false;
- }
-
- if(textureUnitType[unit] != TEXTURE_UNKNOWN)
- {
- if(samplersVS[i].textureType != textureUnitType[unit])
- {
- if(logErrors)
- {
- appendToInfoLog("Samplers of conflicting types refer to the same texture image unit (%d).", unit);
- }
-
- return false;
- }
- }
- else
- {
- textureUnitType[unit] = samplersVS[i].textureType;
- }
- }
- }
-
- return true;
- }
-}
diff --git a/src/OpenGL/libGLESv2/Program.h b/src/OpenGL/libGLESv2/Program.h
deleted file mode 100644
index a23292610..000000000
--- a/src/OpenGL/libGLESv2/Program.h
+++ /dev/null
@@ -1,333 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Program.h: Defines the Program class. Implements GL program objects
-// and related functionality. [OpenGL ES 2.0.24] section 2.10.3 page 28.
-
-#ifndef LIBGLESV2_PROGRAM_H_
-#define LIBGLESV2_PROGRAM_H_
-
-#include "Shader.h"
-#include "Context.h"
-#include "Shader/PixelShader.hpp"
-#include "Shader/VertexShader.hpp"
-
-#include <string>
-#include <vector>
-#include <set>
-#include <map>
-
-namespace es2
-{
- class Device;
- class ResourceManager;
- class FragmentShader;
- class VertexShader;
-
- // Helper struct representing a single shader uniform
- struct Uniform
- {
- struct BlockInfo
- {
- BlockInfo(const glsl::Uniform& uniform, int blockIndex);
-
- int index = -1;
- int offset = -1;
- int arrayStride = -1;
- int matrixStride = -1;
- bool isRowMajorMatrix = false;
- };
-
- Uniform(const glsl::Uniform &uniform, const BlockInfo &blockInfo);
-
- ~Uniform();
-
- bool isArray() const;
- int size() const;
- int registerCount() const;
-
- const GLenum type;
- const GLenum precision;
- const std::string name;
- const unsigned int arraySize;
- const BlockInfo blockInfo;
- std::vector<glsl::ShaderVariable> fields;
-
- unsigned char *data = nullptr;
- bool dirty = true;
-
- short psRegisterIndex = -1;
- short vsRegisterIndex = -1;
- };
-
- // Helper struct representing a single shader uniform block
- struct UniformBlock
- {
- // use GL_INVALID_INDEX for non-array elements
- UniformBlock(const std::string &name, unsigned int elementIndex, unsigned int dataSize, std::vector<unsigned int> memberUniformIndexes);
-
- void setRegisterIndex(GLenum shader, unsigned int registerIndex);
-
- bool isArrayElement() const;
- bool isReferencedByVertexShader() const;
- bool isReferencedByFragmentShader() const;
-
- const std::string name;
- const unsigned int elementIndex;
- const unsigned int dataSize;
-
- std::vector<unsigned int> memberUniformIndexes;
-
- unsigned int psRegisterIndex;
- unsigned int vsRegisterIndex;
- };
-
- // Struct used for correlating uniforms/elements of uniform arrays to handles
- struct UniformLocation
- {
- UniformLocation(const std::string &name, unsigned int element, unsigned int index);
-
- std::string name;
- unsigned int element;
- unsigned int index;
- };
-
- struct LinkedVarying
- {
- LinkedVarying();
- LinkedVarying(const std::string &name, GLenum type, GLsizei size, int reg, int col);
-
- // Original GL name
- std::string name;
-
- GLenum type;
- GLsizei size;
-
- int reg; // First varying register, assigned during link
- int col; // First register element, assigned during link
- };
-
- class Program
- {
- public:
- Program(ResourceManager *manager, GLuint handle);
-
- ~Program();
-
- bool attachShader(Shader *shader);
- bool detachShader(Shader *shader);
- int getAttachedShadersCount() const;
-
- sw::PixelShader *getPixelShader();
- sw::VertexShader *getVertexShader();
-
- void bindAttributeLocation(GLuint index, const char *name);
- GLint getAttributeLocation(const char *name);
- int getAttributeStream(int attributeIndex);
-
- GLint getSamplerMapping(sw::SamplerType type, unsigned int samplerIndex);
- TextureType getSamplerTextureType(sw::SamplerType type, unsigned int samplerIndex);
-
- GLuint getUniformIndex(const std::string &name) const;
- GLuint getUniformBlockIndex(const std::string &name) const;
- void bindUniformBlock(GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- GLuint getUniformBlockBinding(GLuint uniformBlockIndex) const;
- void getActiveUniformBlockiv(GLuint uniformBlockIndex, GLenum pname, GLint *params) const;
-
- GLint getUniformLocation(const std::string &name) const;
- bool setUniform1fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform2fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform3fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniform4fv(GLint location, GLsizei count, const GLfloat *v);
- bool setUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- bool setUniform1iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform2iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform3iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform4iv(GLint location, GLsizei count, const GLint *v);
- bool setUniform1uiv(GLint location, GLsizei count, const GLuint *v);
- bool setUniform2uiv(GLint location, GLsizei count, const GLuint *v);
- bool setUniform3uiv(GLint location, GLsizei count, const GLuint *v);
- bool setUniform4uiv(GLint location, GLsizei count, const GLuint *v);
-
- bool getUniformfv(GLint location, GLsizei *bufSize, GLfloat *params);
- bool getUniformiv(GLint location, GLsizei *bufSize, GLint *params);
- bool getUniformuiv(GLint location, GLsizei *bufSize, GLuint *params);
-
- void dirtyAllUniforms();
- void applyUniforms(Device *device);
- void applyUniformBuffers(Device *device, BufferBinding* uniformBuffers);
- void applyTransformFeedback(Device *device, TransformFeedback* transformFeedback);
-
- void link();
- bool isLinked() const;
- size_t getInfoLogLength() const;
- void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
- void getAttachedShaders(GLsizei maxCount, GLsizei *count, GLuint *shaders);
-
- GLint getFragDataLocation(const GLchar *name);
-
- void getActiveAttribute(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
- size_t getActiveAttributeCount() const;
- GLint getActiveAttributeMaxLength() const;
-
- void getActiveUniform(GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) const;
- size_t getActiveUniformCount() const;
- GLint getActiveUniformMaxLength() const;
- GLint getActiveUniformi(GLuint index, GLenum pname) const;
-
- void getActiveUniformBlockName(GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name) const;
- size_t getActiveUniformBlockCount() const;
- GLint getActiveUniformBlockMaxLength() const;
-
- void setTransformFeedbackVaryings(GLsizei count, const GLchar *const *varyings, GLenum bufferMode);
- void getTransformFeedbackVarying(GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name) const;
- GLsizei getTransformFeedbackVaryingCount() const;
- GLsizei getTransformFeedbackVaryingMaxLength() const;
- GLenum getTransformFeedbackBufferMode() const;
-
- void addRef();
- void release();
- unsigned int getRefCount() const;
- void flagForDeletion();
- bool isFlaggedForDeletion() const;
-
- void validate(Device* device);
- bool validateSamplers(bool logErrors);
- bool isValidated() const;
-
- unsigned int getSerial() const;
-
- bool getBinaryRetrievableHint() const { return retrievableBinary; }
- void setBinaryRetrievable(bool retrievable) { retrievableBinary = retrievable; }
- GLint getBinaryLength() const;
-
- private:
- void unlink();
- void resetUniformBlockBindings();
-
- bool linkVaryings();
- bool linkTransformFeedback();
-
- bool linkAttributes();
- bool linkAttribute(const glsl::Attribute &attribute, int location, unsigned int &usedLocations);
- int getAttributeLocation(const std::string &name);
-
- Uniform *getUniform(const std::string &name) const;
- bool linkUniforms(const Shader *shader);
- bool linkUniformBlocks(const Shader *vertexShader, const Shader *fragmentShader);
- bool areMatchingUniformBlocks(const glsl::UniformBlock &block1, const glsl::UniformBlock &block2, const Shader *shader1, const Shader *shader2);
- bool areMatchingFields(const std::vector<glsl::ShaderVariable>& fields1, const std::vector<glsl::ShaderVariable>& fields2, const std::string& name);
- bool validateUniformStruct(GLenum shader, const glsl::Uniform &newUniformStruct);
- bool defineUniform(GLenum shader, const glsl::Uniform &uniform, const Uniform::BlockInfo& blockInfo);
- bool defineUniformBlock(const Shader *shader, const glsl::UniformBlock &block);
- bool applyUniform(Device *device, GLint location, float* data);
- bool applyUniform1bv(Device *device, GLint location, GLsizei count, const GLboolean *v);
- bool applyUniform2bv(Device *device, GLint location, GLsizei count, const GLboolean *v);
- bool applyUniform3bv(Device *device, GLint location, GLsizei count, const GLboolean *v);
- bool applyUniform4bv(Device *device, GLint location, GLsizei count, const GLboolean *v);
- bool applyUniform1fv(Device *device, GLint location, GLsizei count, const GLfloat *v);
- bool applyUniform2fv(Device *device, GLint location, GLsizei count, const GLfloat *v);
- bool applyUniform3fv(Device *device, GLint location, GLsizei count, const GLfloat *v);
- bool applyUniform4fv(Device *device, GLint location, GLsizei count, const GLfloat *v);
- bool applyUniformMatrix2fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix2x3fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix2x4fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix3fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix3x2fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix3x4fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix4fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix4x2fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniformMatrix4x3fv(Device *device, GLint location, GLsizei count, const GLfloat *value);
- bool applyUniform1iv(Device *device, GLint location, GLsizei count, const GLint *v);
- bool applyUniform2iv(Device *device, GLint location, GLsizei count, const GLint *v);
- bool applyUniform3iv(Device *device, GLint location, GLsizei count, const GLint *v);
- bool applyUniform4iv(Device *device, GLint location, GLsizei count, const GLint *v);
- bool applyUniform1uiv(Device *device, GLint location, GLsizei count, const GLuint *v);
- bool applyUniform2uiv(Device *device, GLint location, GLsizei count, const GLuint *v);
- bool applyUniform3uiv(Device *device, GLint location, GLsizei count, const GLuint *v);
- bool applyUniform4uiv(Device *device, GLint location, GLsizei count, const GLuint *v);
-
- bool setUniformfv(GLint location, GLsizei count, const GLfloat *v, int numElements);
- bool setUniformMatrixfv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value, GLenum type);
- bool setUniformiv(GLint location, GLsizei count, const GLint *v, int numElements);
- bool setUniformuiv(GLint location, GLsizei count, const GLuint *v, int numElements);
-
- void appendToInfoLog(const char *info, ...);
- void resetInfoLog();
-
- static unsigned int issueSerial();
-
- FragmentShader *fragmentShader;
- VertexShader *vertexShader;
-
- sw::PixelShader *pixelBinary;
- sw::VertexShader *vertexBinary;
-
- std::map<std::string, GLuint> attributeBinding;
- std::map<std::string, GLuint> linkedAttributeLocation;
- std::vector<glsl::Attribute> linkedAttribute;
- int attributeStream[MAX_VERTEX_ATTRIBS];
-
- GLuint uniformBlockBindings[MAX_UNIFORM_BUFFER_BINDINGS];
-
- std::vector<std::string> transformFeedbackVaryings;
- GLenum transformFeedbackBufferMode;
- size_t totalLinkedVaryingsComponents;
-
- struct Sampler
- {
- bool active;
- GLint logicalTextureUnit;
- TextureType textureType;
- };
-
- Sampler samplersPS[MAX_TEXTURE_IMAGE_UNITS];
- Sampler samplersVS[MAX_VERTEX_TEXTURE_IMAGE_UNITS];
-
- typedef std::vector<Uniform*> UniformArray;
- UniformArray uniforms;
- typedef std::vector<Uniform> UniformStructArray;
- UniformStructArray uniformStructs;
- typedef std::vector<UniformLocation> UniformIndex;
- UniformIndex uniformIndex;
- typedef std::vector<UniformBlock*> UniformBlockArray;
- UniformBlockArray uniformBlocks;
- typedef std::vector<LinkedVarying> LinkedVaryingArray;
- LinkedVaryingArray transformFeedbackLinkedVaryings;
-
- bool linked;
- bool orphaned; // Flag to indicate that the program can be deleted when no longer in use
- char *infoLog;
- bool validated;
- bool retrievableBinary;
-
- unsigned int referenceCount;
- const unsigned int serial;
-
- static unsigned int currentSerial;
-
- ResourceManager *resourceManager;
- const GLuint handle;
- };
-}
-
-#endif // LIBGLESV2_PROGRAM_H_
diff --git a/src/OpenGL/libGLESv2/Query.cpp b/src/OpenGL/libGLESv2/Query.cpp
deleted file mode 100644
index 87286210f..000000000
--- a/src/OpenGL/libGLESv2/Query.cpp
+++ /dev/null
@@ -1,167 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Query.cpp: Implements the es2::Query class
-
-#include "Query.h"
-
-#include "main.h"
-#include "Common/Thread.hpp"
-
-namespace es2
-{
-
-Query::Query(GLuint name, GLenum type) : NamedObject(name)
-{
- mQuery = nullptr;
- mStatus = GL_FALSE;
- mResult = GL_FALSE;
- mType = type;
-}
-
-Query::~Query()
-{
- mQuery->release();
-}
-
-void Query::begin()
-{
- if(!mQuery)
- {
- sw::Query::Type type;
- switch(mType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- type = sw::Query::FRAGMENTS_PASSED;
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- type = sw::Query::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN;
- break;
- default:
- UNREACHABLE(mType);
- return;
- }
-
- mQuery = new sw::Query(type);
-
- if(!mQuery)
- {
- return error(GL_OUT_OF_MEMORY);
- }
- }
-
- Device *device = getDevice();
-
- mQuery->begin();
- device->addQuery(mQuery);
- switch(mType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- device->setOcclusionEnabled(true);
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- device->setTransformFeedbackQueryEnabled(true);
- break;
- default:
- ASSERT(false);
- }
-}
-
-void Query::end()
-{
- if(!mQuery)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- Device *device = getDevice();
-
- mQuery->end();
- device->removeQuery(mQuery);
- switch(mType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- device->setOcclusionEnabled(false);
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- device->setTransformFeedbackQueryEnabled(false);
- break;
- default:
- ASSERT(false);
- }
-
- mStatus = GL_FALSE;
- mResult = GL_FALSE;
-}
-
-GLuint Query::getResult()
-{
- if(mQuery)
- {
- while(!testQuery())
- {
- sw::Thread::yield();
- }
- }
-
- return (GLuint)mResult;
-}
-
-GLboolean Query::isResultAvailable()
-{
- if(mQuery)
- {
- testQuery();
- }
-
- return mStatus;
-}
-
-GLenum Query::getType() const
-{
- return mType;
-}
-
-GLboolean Query::testQuery()
-{
- if(mQuery != nullptr && mStatus != GL_TRUE)
- {
- if(!mQuery->building && mQuery->isReady())
- {
- unsigned int resultSum = mQuery->data;
- mStatus = GL_TRUE;
-
- switch(mType)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- mResult = (resultSum > 0) ? GL_TRUE : GL_FALSE;
- break;
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- mResult = resultSum;
- break;
- default:
- ASSERT(false);
- }
- }
-
- return mStatus;
- }
-
- return GL_TRUE; // Prevent blocking when query is nullptr
-}
-}
diff --git a/src/OpenGL/libGLESv2/Query.h b/src/OpenGL/libGLESv2/Query.h
deleted file mode 100644
index b9e0c5295..000000000
--- a/src/OpenGL/libGLESv2/Query.h
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Query.h: Defines the es2::Query class
-
-#ifndef LIBGLESV2_QUERY_H_
-#define LIBGLESV2_QUERY_H_
-
-#include "common/Object.hpp"
-#include "Renderer/Renderer.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class Query : public gl::NamedObject
-{
-public:
- Query(GLuint name, GLenum type);
- virtual ~Query();
-
- void begin();
- void end();
- GLuint getResult();
- GLboolean isResultAvailable();
-
- GLenum getType() const;
-
-private:
- GLboolean testQuery();
-
- sw::Query* mQuery;
- GLenum mType;
- GLboolean mStatus;
- GLint mResult;
-};
-
-}
-
-#endif // LIBGLESV2_QUERY_H_
diff --git a/src/OpenGL/libGLESv2/Renderbuffer.cpp b/src/OpenGL/libGLESv2/Renderbuffer.cpp
deleted file mode 100644
index fdbb61717..000000000
--- a/src/OpenGL/libGLESv2/Renderbuffer.cpp
+++ /dev/null
@@ -1,662 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Renderbuffer.cpp: the Renderbuffer class and its derived classes
-// Colorbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
-
-#include "Renderbuffer.h"
-
-#include "main.h"
-#include "Texture.h"
-#include "utilities.h"
-
-namespace es2
-{
-RenderbufferInterface::RenderbufferInterface()
-{
-}
-
-// The default case for classes inherited from RenderbufferInterface is not to
-// need to do anything upon the reference count to the parent Renderbuffer incrementing
-// or decrementing.
-void RenderbufferInterface::addProxyRef(const Renderbuffer *proxy)
-{
-}
-
-void RenderbufferInterface::releaseProxy(const Renderbuffer *proxy)
-{
-}
-
-GLuint RenderbufferInterface::getRedSize() const
-{
- return GetRedSize(getFormat());
-}
-
-GLuint RenderbufferInterface::getGreenSize() const
-{
- return GetGreenSize(getFormat());
-}
-
-GLuint RenderbufferInterface::getBlueSize() const
-{
- return GetBlueSize(getFormat());
-}
-
-GLuint RenderbufferInterface::getAlphaSize() const
-{
- return GetAlphaSize(getFormat());
-}
-
-GLuint RenderbufferInterface::getDepthSize() const
-{
- return GetDepthSize(getFormat());
-}
-
-GLuint RenderbufferInterface::getStencilSize() const
-{
- return GetStencilSize(getFormat());
-}
-
-///// RenderbufferTexture2D Implementation ////////
-
-RenderbufferTexture2D::RenderbufferTexture2D(Texture2D *texture, GLint level) : mLevel(level)
-{
- mTexture2D = texture;
-}
-
-RenderbufferTexture2D::~RenderbufferTexture2D()
-{
- mTexture2D = nullptr;
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTexture2D::addProxyRef(const Renderbuffer *proxy)
-{
- mTexture2D->addProxyRef(proxy);
-}
-
-void RenderbufferTexture2D::releaseProxy(const Renderbuffer *proxy)
-{
- mTexture2D->releaseProxy(proxy);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture2D::getRenderTarget()
-{
- return mTexture2D->getRenderTarget(GL_TEXTURE_2D, mLevel);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture2D::createSharedImage()
-{
- return mTexture2D->createSharedImage(GL_TEXTURE_2D, mLevel);
-}
-
-bool RenderbufferTexture2D::isShared() const
-{
- return mTexture2D->isShared(GL_TEXTURE_2D, mLevel);
-}
-
-GLsizei RenderbufferTexture2D::getWidth() const
-{
- return mTexture2D->getWidth(GL_TEXTURE_2D, mLevel);
-}
-
-GLsizei RenderbufferTexture2D::getHeight() const
-{
- return mTexture2D->getHeight(GL_TEXTURE_2D, mLevel);
-}
-
-GLint RenderbufferTexture2D::getFormat() const
-{
- return mTexture2D->getFormat(GL_TEXTURE_2D, mLevel);
-}
-
-GLsizei RenderbufferTexture2D::getSamples() const
-{
- return 0; // Core OpenGL ES 3.0 does not support multisample textures.
-}
-
-///// RenderbufferTexture2DRect Implementation ////////
-
-RenderbufferTexture2DRect::RenderbufferTexture2DRect(Texture2DRect *texture)
-{
- mTexture2DRect = texture;
-}
-
-RenderbufferTexture2DRect::~RenderbufferTexture2DRect()
-{
- mTexture2DRect = NULL;
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTexture2DRect::addProxyRef(const Renderbuffer *proxy)
-{
- mTexture2DRect->addProxyRef(proxy);
-}
-
-void RenderbufferTexture2DRect::releaseProxy(const Renderbuffer *proxy)
-{
- mTexture2DRect->releaseProxy(proxy);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture2DRect::getRenderTarget()
-{
- return mTexture2DRect->getRenderTarget(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture2DRect::createSharedImage()
-{
- return mTexture2DRect->createSharedImage(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-bool RenderbufferTexture2DRect::isShared() const
-{
- return mTexture2DRect->isShared(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-GLsizei RenderbufferTexture2DRect::getWidth() const
-{
- return mTexture2DRect->getWidth(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-GLsizei RenderbufferTexture2DRect::getHeight() const
-{
- return mTexture2DRect->getHeight(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-GLint RenderbufferTexture2DRect::getFormat() const
-{
- return mTexture2DRect->getFormat(GL_TEXTURE_RECTANGLE_ARB, 0);
-}
-
-GLsizei RenderbufferTexture2DRect::getSamples() const
-{
- return 0; // Core OpenGL ES 3.0 does not support multisample textures.
-}
-
-///// RenderbufferTexture3D Implementation ////////
-
-RenderbufferTexture3D::RenderbufferTexture3D(Texture3D *texture, GLint level) : mLevel(level)
-{
- mTexture3D = texture;
-}
-
-RenderbufferTexture3D::~RenderbufferTexture3D()
-{
- mTexture3D = NULL;
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTexture3D::addProxyRef(const Renderbuffer *proxy)
-{
- mTexture3D->addProxyRef(proxy);
-}
-
-void RenderbufferTexture3D::releaseProxy(const Renderbuffer *proxy)
-{
- mTexture3D->releaseProxy(proxy);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture3D::getRenderTarget()
-{
- return mTexture3D->getRenderTarget(mTexture3D->getTarget(), mLevel);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTexture3D::createSharedImage()
-{
- return mTexture3D->createSharedImage(mTexture3D->getTarget(), mLevel);
-}
-
-bool RenderbufferTexture3D::isShared() const
-{
- return mTexture3D->isShared(mTexture3D->getTarget(), mLevel);
-}
-
-GLsizei RenderbufferTexture3D::getWidth() const
-{
- return mTexture3D->getWidth(mTexture3D->getTarget(), mLevel);
-}
-
-GLsizei RenderbufferTexture3D::getHeight() const
-{
- return mTexture3D->getHeight(mTexture3D->getTarget(), mLevel);
-}
-
-GLsizei RenderbufferTexture3D::getDepth() const
-{
- return mTexture3D->getDepth(mTexture3D->getTarget(), mLevel);
-}
-
-GLint RenderbufferTexture3D::getFormat() const
-{
- return mTexture3D->getFormat(mTexture3D->getTarget(), mLevel);
-}
-
-GLsizei RenderbufferTexture3D::getSamples() const
-{
- return 0; // Core OpenGL ES 3.0 does not support multisample textures.
-}
-
-///// RenderbufferTextureCubeMap Implementation ////////
-
-RenderbufferTextureCubeMap::RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target, GLint level) : mTarget(target), mLevel(level)
-{
- mTextureCubeMap = texture;
-}
-
-RenderbufferTextureCubeMap::~RenderbufferTextureCubeMap()
-{
- mTextureCubeMap = NULL;
-}
-
-// Textures need to maintain their own reference count for references via
-// Renderbuffers acting as proxies. Here, we notify the texture of a reference.
-void RenderbufferTextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
- mTextureCubeMap->addProxyRef(proxy);
-}
-
-void RenderbufferTextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
- mTextureCubeMap->releaseProxy(proxy);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTextureCubeMap::getRenderTarget()
-{
- return mTextureCubeMap->getRenderTarget(mTarget, mLevel);
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *RenderbufferTextureCubeMap::createSharedImage()
-{
- return mTextureCubeMap->createSharedImage(mTarget, mLevel);
-}
-
-bool RenderbufferTextureCubeMap::isShared() const
-{
- return mTextureCubeMap->isShared(mTarget, mLevel);
-}
-
-GLsizei RenderbufferTextureCubeMap::getWidth() const
-{
- return mTextureCubeMap->getWidth(mTarget, mLevel);
-}
-
-GLsizei RenderbufferTextureCubeMap::getHeight() const
-{
- return mTextureCubeMap->getHeight(mTarget, mLevel);
-}
-
-GLint RenderbufferTextureCubeMap::getFormat() const
-{
- return mTextureCubeMap->getFormat(mTarget, mLevel);
-}
-
-GLsizei RenderbufferTextureCubeMap::getSamples() const
-{
- return 0; // Core OpenGL ES 3.0 does not support multisample textures.
-}
-
-////// Renderbuffer Implementation //////
-
-Renderbuffer::Renderbuffer(GLuint name, RenderbufferInterface *instance) : NamedObject(name)
-{
- ASSERT(instance);
- mInstance = instance;
-}
-
-Renderbuffer::~Renderbuffer()
-{
- delete mInstance;
-}
-
-// The RenderbufferInterface contained in this Renderbuffer may need to maintain
-// its own reference count, so we pass it on here.
-void Renderbuffer::addRef()
-{
- mInstance->addProxyRef(this);
-
- Object::addRef();
-}
-
-void Renderbuffer::release()
-{
- mInstance->releaseProxy(this);
-
- Object::release();
-}
-
-// Increments refcount on image.
-// caller must Release() the returned image
-egl::Image *Renderbuffer::getRenderTarget()
-{
- return mInstance->getRenderTarget();
-}
-
-// Increments refcount on image.
-// caller must Release() the returned image
-egl::Image *Renderbuffer::createSharedImage()
-{
- return mInstance->createSharedImage();
-}
-
-bool Renderbuffer::isShared() const
-{
- return mInstance->isShared();
-}
-
-GLsizei Renderbuffer::getWidth() const
-{
- return mInstance->getWidth();
-}
-
-GLsizei Renderbuffer::getHeight() const
-{
- return mInstance->getHeight();
-}
-
-GLsizei Renderbuffer::getDepth() const
-{
- return mInstance->getDepth();
-}
-
-GLint Renderbuffer::getLevel() const
-{
- return mInstance->getLevel();
-}
-
-GLint Renderbuffer::getFormat() const
-{
- return mInstance->getFormat();
-}
-
-GLuint Renderbuffer::getRedSize() const
-{
- return mInstance->getRedSize();
-}
-
-GLuint Renderbuffer::getGreenSize() const
-{
- return mInstance->getGreenSize();
-}
-
-GLuint Renderbuffer::getBlueSize() const
-{
- return mInstance->getBlueSize();
-}
-
-GLuint Renderbuffer::getAlphaSize() const
-{
- return mInstance->getAlphaSize();
-}
-
-GLuint Renderbuffer::getDepthSize() const
-{
- return mInstance->getDepthSize();
-}
-
-GLuint Renderbuffer::getStencilSize() const
-{
- return mInstance->getStencilSize();
-}
-
-GLsizei Renderbuffer::getSamples() const
-{
- return mInstance->getSamples();
-}
-
-void Renderbuffer::setLevel(GLint level)
-{
- return mInstance->setLevel(level);
-}
-
-void Renderbuffer::setStorage(RenderbufferStorage *newStorage)
-{
- ASSERT(newStorage);
-
- delete mInstance;
- mInstance = newStorage;
-}
-
-RenderbufferStorage::RenderbufferStorage()
-{
- mWidth = 0;
- mHeight = 0;
- format = GL_NONE;
- mSamples = 0;
-}
-
-RenderbufferStorage::~RenderbufferStorage()
-{
-}
-
-GLsizei RenderbufferStorage::getWidth() const
-{
- return mWidth;
-}
-
-GLsizei RenderbufferStorage::getHeight() const
-{
- return mHeight;
-}
-
-GLint RenderbufferStorage::getFormat() const
-{
- return format;
-}
-
-GLsizei RenderbufferStorage::getSamples() const
-{
- return mSamples;
-}
-
-Colorbuffer::Colorbuffer(egl::Image *renderTarget) : mRenderTarget(renderTarget)
-{
- if(renderTarget)
- {
- renderTarget->addRef();
-
- mWidth = renderTarget->getWidth();
- mHeight = renderTarget->getHeight();
- format = renderTarget->getFormat();
- mSamples = renderTarget->getDepth() & ~1;
- }
-}
-
-Colorbuffer::Colorbuffer(int width, int height, GLenum internalformat, GLsizei samples) : mRenderTarget(nullptr)
-{
- int supportedSamples = Context::getSupportedMultisampleCount(samples);
-
- if(width > 0 && height > 0)
- {
- if(height > sw::OUTLINE_RESOLUTION)
- {
- error(GL_OUT_OF_MEMORY);
- return;
- }
-
- mRenderTarget = egl::Image::create(width, height, internalformat, supportedSamples, false);
-
- if(!mRenderTarget)
- {
- error(GL_OUT_OF_MEMORY);
- return;
- }
- }
-
- mWidth = width;
- mHeight = height;
- format = internalformat;
- mSamples = supportedSamples;
-}
-
-Colorbuffer::~Colorbuffer()
-{
- if(mRenderTarget)
- {
- mRenderTarget->release();
- }
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *Colorbuffer::getRenderTarget()
-{
- if(mRenderTarget)
- {
- mRenderTarget->addRef();
- }
-
- return mRenderTarget;
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *Colorbuffer::createSharedImage()
-{
- if(mRenderTarget)
- {
- mRenderTarget->addRef();
- mRenderTarget->markShared();
- }
-
- return mRenderTarget;
-}
-
-bool Colorbuffer::isShared() const
-{
- return mRenderTarget->isShared();
-}
-
-DepthStencilbuffer::DepthStencilbuffer(egl::Image *depthStencil) : mDepthStencil(depthStencil)
-{
- if(depthStencil)
- {
- depthStencil->addRef();
-
- mWidth = depthStencil->getWidth();
- mHeight = depthStencil->getHeight();
- format = depthStencil->getFormat();
- mSamples = depthStencil->getDepth() & ~1;
- }
-}
-
-DepthStencilbuffer::DepthStencilbuffer(int width, int height, GLenum internalformat, GLsizei samples) : mDepthStencil(nullptr)
-{
- int supportedSamples = Context::getSupportedMultisampleCount(samples);
-
- if(width > 0 && height > 0)
- {
- if(height > sw::OUTLINE_RESOLUTION)
- {
- error(GL_OUT_OF_MEMORY);
- return;
- }
-
- mDepthStencil = egl::Image::create(width, height, internalformat, supportedSamples, false);
-
- if(!mDepthStencil)
- {
- error(GL_OUT_OF_MEMORY);
- return;
- }
- }
-
- mWidth = width;
- mHeight = height;
- format = internalformat;
- mSamples = supportedSamples;
-}
-
-DepthStencilbuffer::~DepthStencilbuffer()
-{
- if(mDepthStencil)
- {
- mDepthStencil->release();
- }
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *DepthStencilbuffer::getRenderTarget()
-{
- if(mDepthStencil)
- {
- mDepthStencil->addRef();
- }
-
- return mDepthStencil;
-}
-
-// Increments refcount on image.
-// caller must release() the returned image
-egl::Image *DepthStencilbuffer::createSharedImage()
-{
- if(mDepthStencil)
- {
- mDepthStencil->addRef();
- mDepthStencil->markShared();
- }
-
- return mDepthStencil;
-}
-
-bool DepthStencilbuffer::isShared() const
-{
- return mDepthStencil->isShared();
-}
-
-Depthbuffer::Depthbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-}
-
-Depthbuffer::Depthbuffer(int width, int height, GLenum internalformat, GLsizei samples) : DepthStencilbuffer(width, height, internalformat, samples)
-{
-}
-
-Depthbuffer::~Depthbuffer()
-{
-}
-
-Stencilbuffer::Stencilbuffer(egl::Image *depthStencil) : DepthStencilbuffer(depthStencil)
-{
-}
-
-Stencilbuffer::Stencilbuffer(int width, int height, GLsizei samples) : DepthStencilbuffer(width, height, GL_STENCIL_INDEX8, samples)
-{
-}
-
-Stencilbuffer::~Stencilbuffer()
-{
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/Renderbuffer.h b/src/OpenGL/libGLESv2/Renderbuffer.h
deleted file mode 100644
index 0841a8a5e..000000000
--- a/src/OpenGL/libGLESv2/Renderbuffer.h
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Renderbuffer.h: Defines the wrapper class Renderbuffer, as well as the
-// class hierarchy used to store its contents: RenderbufferStorage, Colorbuffer,
-// DepthStencilbuffer, Depthbuffer and Stencilbuffer. Implements GL renderbuffer
-// objects and related functionality. [OpenGL ES 2.0.24] section 4.4.3 page 108.
-
-#ifndef LIBGLESV2_RENDERBUFFER_H_
-#define LIBGLESV2_RENDERBUFFER_H_
-
-#include "common/Object.hpp"
-#include "common/Image.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class Texture2D;
-class Texture3D;
-class TextureCubeMap;
-class Texture2DRect;
-class Renderbuffer;
-class Colorbuffer;
-class DepthStencilbuffer;
-
-class RenderbufferInterface
-{
-public:
- RenderbufferInterface();
-
- virtual ~RenderbufferInterface() {}
-
- virtual void addProxyRef(const Renderbuffer *proxy);
- virtual void releaseProxy(const Renderbuffer *proxy);
-
- virtual egl::Image *getRenderTarget() = 0;
- virtual egl::Image *createSharedImage() = 0;
- virtual bool isShared() const = 0;
-
- virtual GLsizei getWidth() const = 0;
- virtual GLsizei getHeight() const = 0;
- virtual GLsizei getDepth() const { return 1; }
- virtual GLint getLevel() const { return 0; }
- virtual GLint getFormat() const = 0;
- virtual GLsizei getSamples() const = 0;
-
- virtual void setLevel(GLint) {}
-
- GLuint getRedSize() const;
- GLuint getGreenSize() const;
- GLuint getBlueSize() const;
- GLuint getAlphaSize() const;
- GLuint getDepthSize() const;
- GLuint getStencilSize() const;
-};
-
-class RenderbufferTexture2D : public RenderbufferInterface
-{
-public:
- RenderbufferTexture2D(Texture2D *texture, GLint level);
-
- ~RenderbufferTexture2D() override;
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
- GLsizei getWidth() const override;
- GLsizei getHeight() const override;
- GLint getLevel() const override { return mLevel; }
- GLint getFormat() const override;
- GLsizei getSamples() const override;
-
- void setLevel(GLint level) override { mLevel = level; }
-
-private:
- gl::BindingPointer<Texture2D> mTexture2D;
- GLint mLevel;
-};
-
-class RenderbufferTexture2DRect : public RenderbufferInterface
-{
-public:
- RenderbufferTexture2DRect(Texture2DRect *texture);
-
- ~RenderbufferTexture2DRect() override;
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
- GLsizei getWidth() const override;
- GLsizei getHeight() const override;
- GLint getFormat() const override;
- GLsizei getSamples() const override;
-
-private:
- gl::BindingPointer<Texture2DRect> mTexture2DRect;
-};
-
-class RenderbufferTexture3D : public RenderbufferInterface
-{
-public:
- RenderbufferTexture3D(Texture3D *texture, GLint level);
-
- ~RenderbufferTexture3D() override;
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
- GLsizei getWidth() const override;
- GLsizei getHeight() const override;
- GLsizei getDepth() const override;
- GLint getLevel() const override { return mLevel; }
- GLint getFormat() const override;
- GLsizei getSamples() const override;
-
- void setLevel(GLint level) override { mLevel = level; }
-
-private:
- gl::BindingPointer<Texture3D> mTexture3D;
- GLint mLevel;
-};
-
-class RenderbufferTextureCubeMap : public RenderbufferInterface
-{
-public:
- RenderbufferTextureCubeMap(TextureCubeMap *texture, GLenum target, GLint level);
-
- ~RenderbufferTextureCubeMap() override;
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
- GLsizei getWidth() const override;
- GLsizei getHeight() const override;
- GLint getLevel() const override { return mLevel; }
- GLint getFormat() const override;
- GLsizei getSamples() const override;
-
- void setLevel(GLint level) override { mLevel = level; }
-
-private:
- gl::BindingPointer<TextureCubeMap> mTextureCubeMap;
- GLenum mTarget;
- GLint mLevel;
-};
-
-// A class derived from RenderbufferStorage is created whenever glRenderbufferStorage
-// is called. The specific concrete type depends on whether the internal format is
-// colour depth, stencil or packed depth/stencil.
-class RenderbufferStorage : public RenderbufferInterface
-{
-public:
- RenderbufferStorage();
-
- ~RenderbufferStorage() override = 0;
-
- egl::Image *getRenderTarget() override = 0;
- egl::Image *createSharedImage() override = 0;
- bool isShared() const override = 0;
-
- GLsizei getWidth() const override;
- GLsizei getHeight() const override;
- GLint getFormat() const override;
- GLsizei getSamples() const override;
-
-protected:
- GLsizei mWidth;
- GLsizei mHeight;
- GLenum format;
- GLsizei mSamples;
-};
-
-// Renderbuffer implements the GL renderbuffer object.
-// It's only a proxy for a RenderbufferInterface instance; the internal object
-// can change whenever glRenderbufferStorage is called.
-class Renderbuffer : public gl::NamedObject
-{
-public:
- Renderbuffer(GLuint name, RenderbufferInterface *storage);
-
- ~Renderbuffer() override;
-
- // These functions from Object are overloaded here because
- // Textures need to maintain their own count of references to them via
- // Renderbuffers/RenderbufferTextures. These functions invoke those
- // reference counting functions on the RenderbufferInterface.
- void addRef() override;
- void release() override;
-
- egl::Image *getRenderTarget();
- virtual egl::Image *createSharedImage();
- virtual bool isShared() const;
-
- GLsizei getWidth() const;
- GLsizei getHeight() const;
- GLsizei getDepth() const;
- GLint getLevel() const;
- GLint getFormat() const;
- GLuint getRedSize() const;
- GLuint getGreenSize() const;
- GLuint getBlueSize() const;
- GLuint getAlphaSize() const;
- GLuint getDepthSize() const;
- GLuint getStencilSize() const;
- GLsizei getSamples() const;
-
- void setLevel(GLint level);
- void setStorage(RenderbufferStorage *newStorage);
-
-private:
- RenderbufferInterface *mInstance;
-};
-
-class Colorbuffer : public RenderbufferStorage
-{
-public:
- explicit Colorbuffer(egl::Image *renderTarget);
- Colorbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
-
- ~Colorbuffer() override;
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
-private:
- egl::Image *mRenderTarget;
-};
-
-class DepthStencilbuffer : public RenderbufferStorage
-{
-public:
- explicit DepthStencilbuffer(egl::Image *depthStencil);
- DepthStencilbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
-
- ~DepthStencilbuffer();
-
- egl::Image *getRenderTarget() override;
- egl::Image *createSharedImage() override;
- bool isShared() const override;
-
-protected:
- egl::Image *mDepthStencil;
-};
-
-class Depthbuffer : public DepthStencilbuffer
-{
-public:
- explicit Depthbuffer(egl::Image *depthStencil);
- Depthbuffer(GLsizei width, GLsizei height, GLenum internalformat, GLsizei samples);
-
- ~Depthbuffer() override;
-};
-
-class Stencilbuffer : public DepthStencilbuffer
-{
-public:
- explicit Stencilbuffer(egl::Image *depthStencil);
- Stencilbuffer(GLsizei width, GLsizei height, GLsizei samples);
-
- ~Stencilbuffer() override;
-};
-}
-
-#endif // LIBGLESV2_RENDERBUFFER_H_
diff --git a/src/OpenGL/libGLESv2/ResourceManager.cpp b/src/OpenGL/libGLESv2/ResourceManager.cpp
deleted file mode 100644
index 51a7bc18e..000000000
--- a/src/OpenGL/libGLESv2/ResourceManager.cpp
+++ /dev/null
@@ -1,354 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// ResourceManager.cpp: Implements the ResourceManager class, which tracks and
-// retrieves objects which may be shared by multiple Contexts.
-
-#include "ResourceManager.h"
-
-#include "Buffer.h"
-#include "Fence.h"
-#include "Program.h"
-#include "Renderbuffer.h"
-#include "Sampler.h"
-#include "Shader.h"
-#include "Texture.h"
-
-namespace es2
-{
-ResourceManager::ResourceManager()
-{
- mRefCount = 1;
-}
-
-ResourceManager::~ResourceManager()
-{
- while(!mBufferNameSpace.empty())
- {
- deleteBuffer(mBufferNameSpace.firstName());
- }
-
- while(!mProgramNameSpace.empty())
- {
- deleteProgram(mProgramNameSpace.firstName());
- }
-
- while(!mShaderNameSpace.empty())
- {
- deleteShader(mShaderNameSpace.firstName());
- }
-
- while(!mRenderbufferNameSpace.empty())
- {
- deleteRenderbuffer(mRenderbufferNameSpace.firstName());
- }
-
- while(!mTextureNameSpace.empty())
- {
- deleteTexture(mTextureNameSpace.firstName());
- }
-
- while(!mSamplerNameSpace.empty())
- {
- deleteSampler(mSamplerNameSpace.firstName());
- }
-
- while(!mFenceSyncNameSpace.empty())
- {
- deleteFenceSync(mFenceSyncNameSpace.firstName());
- }
-}
-
-void ResourceManager::addRef()
-{
- mRefCount++;
-}
-
-void ResourceManager::release()
-{
- if(--mRefCount == 0)
- {
- delete this;
- }
-}
-
-// Returns an unused buffer name
-GLuint ResourceManager::createBuffer()
-{
- return mBufferNameSpace.allocate();
-}
-
-// Returns an unused shader name
-GLuint ResourceManager::createShader(GLenum type)
-{
- GLuint name = mProgramShaderNameSpace.allocate();
-
- if(type == GL_VERTEX_SHADER)
- {
- mShaderNameSpace.insert(name, new VertexShader(this, name));
- }
- else if(type == GL_FRAGMENT_SHADER)
- {
- mShaderNameSpace.insert(name, new FragmentShader(this, name));
- }
- else UNREACHABLE(type);
-
- return name;
-}
-
-// Returns an unused program name
-GLuint ResourceManager::createProgram()
-{
- GLuint name = mProgramShaderNameSpace.allocate();
-
- mProgramNameSpace.insert(name, new Program(this, name));
-
- return name;
-}
-
-// Returns an unused texture name
-GLuint ResourceManager::createTexture()
-{
- return mTextureNameSpace.allocate();
-}
-
-// Returns an unused renderbuffer name
-GLuint ResourceManager::createRenderbuffer()
-{
- return mRenderbufferNameSpace.allocate();
-}
-
-// Returns an unused sampler name
-GLuint ResourceManager::createSampler()
-{
- return mSamplerNameSpace.allocate();
-}
-
-// Returns the next unused fence name, and allocates the fence
-GLuint ResourceManager::createFenceSync(GLenum condition, GLbitfield flags)
-{
- GLuint name = mFenceSyncNameSpace.allocate();
-
- FenceSync *fenceSync = new FenceSync(name, condition, flags);
- fenceSync->addRef();
-
- mFenceSyncNameSpace.insert(name, fenceSync);
-
- return name;
-}
-
-void ResourceManager::deleteBuffer(GLuint buffer)
-{
- Buffer *bufferObject = mBufferNameSpace.remove(buffer);
-
- if(bufferObject)
- {
- bufferObject->release();
- }
-}
-
-void ResourceManager::deleteShader(GLuint shader)
-{
- Shader *shaderObject = mShaderNameSpace.find(shader);
-
- if(shaderObject)
- {
- if(shaderObject->getRefCount() == 0)
- {
- delete shaderObject;
- mShaderNameSpace.remove(shader);
- mProgramShaderNameSpace.remove(shader);
- }
- else
- {
- shaderObject->flagForDeletion();
- }
- }
-}
-
-void ResourceManager::deleteProgram(GLuint program)
-{
- Program *programObject = mProgramNameSpace.find(program);
-
- if(programObject)
- {
- if(programObject->getRefCount() == 0)
- {
- delete programObject;
- mProgramNameSpace.remove(program);
- mProgramShaderNameSpace.remove(program);
- }
- else
- {
- programObject->flagForDeletion();
- }
- }
-}
-
-void ResourceManager::deleteTexture(GLuint texture)
-{
- Texture *textureObject = mTextureNameSpace.remove(texture);
-
- if(textureObject)
- {
- textureObject->release();
- }
-}
-
-void ResourceManager::deleteRenderbuffer(GLuint renderbuffer)
-{
- Renderbuffer *renderbufferObject = mRenderbufferNameSpace.remove(renderbuffer);
-
- if(renderbufferObject)
- {
- renderbufferObject->release();
- }
-}
-
-void ResourceManager::deleteSampler(GLuint sampler)
-{
- Sampler *samplerObject = mSamplerNameSpace.remove(sampler);
-
- if(samplerObject)
- {
- samplerObject->release();
- }
-}
-
-void ResourceManager::deleteFenceSync(GLuint fenceSync)
-{
- FenceSync *fenceObject = mFenceSyncNameSpace.remove(fenceSync);
-
- if(fenceObject)
- {
- fenceObject->release();
- }
-}
-
-Buffer *ResourceManager::getBuffer(unsigned int handle)
-{
- return mBufferNameSpace.find(handle);
-}
-
-Shader *ResourceManager::getShader(unsigned int handle)
-{
- return mShaderNameSpace.find(handle);
-}
-
-Texture *ResourceManager::getTexture(unsigned int handle)
-{
- return mTextureNameSpace.find(handle);
-}
-
-Program *ResourceManager::getProgram(unsigned int handle)
-{
- return mProgramNameSpace.find(handle);
-}
-
-Renderbuffer *ResourceManager::getRenderbuffer(unsigned int handle)
-{
- return mRenderbufferNameSpace.find(handle);
-}
-
-Sampler *ResourceManager::getSampler(unsigned int handle)
-{
- return mSamplerNameSpace.find(handle);
-}
-
-FenceSync *ResourceManager::getFenceSync(unsigned int handle)
-{
- return mFenceSyncNameSpace.find(handle);
-}
-
-void ResourceManager::checkBufferAllocation(unsigned int buffer)
-{
- if(buffer != 0 && !getBuffer(buffer))
- {
- Buffer *bufferObject = new Buffer(buffer);
- bufferObject->addRef();
-
- mBufferNameSpace.insert(buffer, bufferObject);
- }
-}
-
-void ResourceManager::checkTextureAllocation(GLuint texture, TextureType type)
-{
- if(!getTexture(texture) && texture != 0)
- {
- Texture *textureObject;
-
- if(type == TEXTURE_2D)
- {
- textureObject = new Texture2D(texture);
- }
- else if(type == TEXTURE_CUBE)
- {
- textureObject = new TextureCubeMap(texture);
- }
- else if(type == TEXTURE_EXTERNAL)
- {
- textureObject = new TextureExternal(texture);
- }
- else if(type == TEXTURE_3D)
- {
- textureObject = new Texture3D(texture);
- }
- else if(type == TEXTURE_2D_ARRAY)
- {
- textureObject = new Texture2DArray(texture);
- }
- else if(type == TEXTURE_2D_RECT)
- {
- textureObject = new Texture2DRect(texture);
- }
- else
- {
- UNREACHABLE(type);
- return;
- }
-
- textureObject->addRef();
-
- mTextureNameSpace.insert(texture, textureObject);
- }
-}
-
-void ResourceManager::checkRenderbufferAllocation(GLuint handle)
-{
- if(handle != 0 && !getRenderbuffer(handle))
- {
- Renderbuffer *renderbufferObject = new Renderbuffer(handle, new Colorbuffer(0, 0, GL_NONE, 0));
- renderbufferObject->addRef();
-
- mRenderbufferNameSpace.insert(handle, renderbufferObject);
- }
-}
-
-void ResourceManager::checkSamplerAllocation(GLuint sampler)
-{
- if(sampler != 0 && !getSampler(sampler))
- {
- Sampler *samplerObject = new Sampler(sampler);
- samplerObject->addRef();
-
- mSamplerNameSpace.insert(sampler, samplerObject);
- }
-}
-
-bool ResourceManager::isSampler(GLuint sampler)
-{
- return mSamplerNameSpace.isReserved(sampler);
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/ResourceManager.h b/src/OpenGL/libGLESv2/ResourceManager.h
deleted file mode 100644
index a7c156a58..000000000
--- a/src/OpenGL/libGLESv2/ResourceManager.h
+++ /dev/null
@@ -1,108 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// ResourceManager.h : Defines the ResourceManager class, which tracks objects
-// shared by multiple GL contexts.
-
-#ifndef LIBGLESV2_RESOURCEMANAGER_H_
-#define LIBGLESV2_RESOURCEMANAGER_H_
-
-#include "common/NameSpace.hpp"
-#include "Common/MutexLock.hpp"
-
-#include <GLES2/gl2.h>
-
-#include <map>
-
-namespace es2
-{
-class Buffer;
-class Shader;
-class Program;
-class Texture;
-class Renderbuffer;
-class Sampler;
-class FenceSync;
-
-enum TextureType
-{
- TEXTURE_2D,
- TEXTURE_3D,
- TEXTURE_2D_ARRAY,
- TEXTURE_CUBE,
- TEXTURE_2D_RECT,
- TEXTURE_EXTERNAL,
-
- TEXTURE_TYPE_COUNT,
- TEXTURE_UNKNOWN
-};
-
-class ResourceManager
-{
-public:
- ResourceManager();
- ~ResourceManager();
-
- void addRef();
- void release();
-
- GLuint createBuffer();
- GLuint createShader(GLenum type);
- GLuint createProgram();
- GLuint createTexture();
- GLuint createRenderbuffer();
- GLuint createSampler();
- GLuint createFenceSync(GLenum condition, GLbitfield flags);
-
- void deleteBuffer(GLuint buffer);
- void deleteShader(GLuint shader);
- void deleteProgram(GLuint program);
- void deleteTexture(GLuint texture);
- void deleteRenderbuffer(GLuint renderbuffer);
- void deleteSampler(GLuint sampler);
- void deleteFenceSync(GLuint fenceSync);
-
- Buffer *getBuffer(GLuint handle);
- Shader *getShader(GLuint handle);
- Program *getProgram(GLuint handle);
- Texture *getTexture(GLuint handle);
- Renderbuffer *getRenderbuffer(GLuint handle);
- Sampler *getSampler(GLuint handle);
- FenceSync *getFenceSync(GLuint handle);
-
- void checkBufferAllocation(unsigned int buffer);
- void checkTextureAllocation(GLuint texture, TextureType type);
- void checkRenderbufferAllocation(GLuint handle);
- void checkSamplerAllocation(GLuint sampler);
-
- bool isSampler(GLuint sampler);
- sw::MutexLock *getLock() { return &mMutex; }
-
-private:
- std::size_t mRefCount;
- sw::MutexLock mMutex;
-
- gl::NameSpace<Buffer> mBufferNameSpace;
- gl::NameSpace<Program> mProgramNameSpace;
- gl::NameSpace<Shader> mShaderNameSpace;
- gl::NameSpace<void> mProgramShaderNameSpace; // Shaders and programs share a namespace
- gl::NameSpace<Texture> mTextureNameSpace;
- gl::NameSpace<Renderbuffer> mRenderbufferNameSpace;
- gl::NameSpace<Sampler> mSamplerNameSpace;
- gl::NameSpace<FenceSync> mFenceSyncNameSpace;
-};
-
-}
-
-#endif // LIBGLESV2_RESOURCEMANAGER_H_
diff --git a/src/OpenGL/libGLESv2/Sampler.h b/src/OpenGL/libGLESv2/Sampler.h
deleted file mode 100644
index 91185daa5..000000000
--- a/src/OpenGL/libGLESv2/Sampler.h
+++ /dev/null
@@ -1,86 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Sampler.h: Defines the es2::Sampler class
-
-#ifndef LIBGLESV2_SAMPLER_H_
-#define LIBGLESV2_SAMPLER_H_
-
-#include "common/Object.hpp"
-#include "Renderer/Renderer.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class Sampler : public gl::NamedObject
-{
-public:
- Sampler(GLuint name) : NamedObject(name)
- {
- mMinFilter = GL_NEAREST_MIPMAP_LINEAR;
- mMagFilter = GL_LINEAR;
-
- mWrapModeS = GL_REPEAT;
- mWrapModeT = GL_REPEAT;
- mWrapModeR = GL_REPEAT;
-
- mMinLod = -1000.0f;
- mMaxLod = 1000.0f;
- mCompareMode = GL_NONE;
- mCompareFunc = GL_LEQUAL;
- mMaxAnisotropy = 1.0f;
- }
-
- void setMinFilter(GLenum minFilter) { mMinFilter = minFilter; }
- void setMagFilter(GLenum magFilter) { mMagFilter = magFilter; }
- void setWrapS(GLenum wrapS) { mWrapModeS = wrapS; }
- void setWrapT(GLenum wrapT) { mWrapModeT = wrapT; }
- void setWrapR(GLenum wrapR) { mWrapModeR = wrapR; }
- void setMinLod(GLfloat minLod) { mMinLod = minLod; }
- void setMaxLod(GLfloat maxLod) { mMaxLod = maxLod; }
- void setCompareMode(GLenum compareMode) { mCompareMode = compareMode; }
- void setCompareFunc(GLenum compareFunc) { mCompareFunc = compareFunc; }
- void setMaxAnisotropy(GLfloat maxAnisotropy) { mMaxAnisotropy = maxAnisotropy; }
-
- GLenum getMinFilter() const { return mMinFilter; }
- GLenum getMagFilter() const { return mMagFilter; }
- GLenum getWrapS() const { return mWrapModeS; }
- GLenum getWrapT() const { return mWrapModeT; }
- GLenum getWrapR() const { return mWrapModeR; }
- GLfloat getMinLod() const { return mMinLod; }
- GLfloat getMaxLod() const { return mMaxLod; }
- GLenum getCompareMode() const { return mCompareMode; }
- GLenum getCompareFunc() const { return mCompareFunc; }
- GLfloat getMaxAnisotropy() const { return mMaxAnisotropy; }
-
-private:
- GLenum mMinFilter;
- GLenum mMagFilter;
-
- GLenum mWrapModeS;
- GLenum mWrapModeT;
- GLenum mWrapModeR;
-
- GLfloat mMinLod;
- GLfloat mMaxLod;
- GLenum mCompareMode;
- GLenum mCompareFunc;
- GLfloat mMaxAnisotropy;
-};
-
-}
-
-#endif // LIBGLESV2_SAMPLER_H_
diff --git a/src/OpenGL/libGLESv2/Shader.cpp b/src/OpenGL/libGLESv2/Shader.cpp
deleted file mode 100644
index db5efeb3c..000000000
--- a/src/OpenGL/libGLESv2/Shader.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Shader.cpp: Implements the Shader class and its derived classes
-// VertexShader and FragmentShader. Implements GL shader objects and related
-// functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section 3.8 page 84.
-
-#include "Shader.h"
-
-#include "main.h"
-#include "utilities.h"
-
-#include <string>
-#include <algorithm>
-
-namespace es2
-{
-std::mutex Shader::mutex;
-bool Shader::compilerInitialized = false;
-
-Shader::Shader(ResourceManager *manager, GLuint handle) : mHandle(handle), mResourceManager(manager)
-{
- mSource = nullptr;
-
- clear();
-
- mRefCount = 0;
- mDeleteStatus = false;
-}
-
-Shader::~Shader()
-{
- delete[] mSource;
-}
-
-GLuint Shader::getName() const
-{
- return mHandle;
-}
-
-void Shader::setSource(GLsizei count, const char *const *string, const GLint *length)
-{
- delete[] mSource;
- int totalLength = 0;
-
- for(int i = 0; i < count; i++)
- {
- if(length && length[i] >= 0)
- {
- totalLength += length[i];
- }
- else
- {
- totalLength += (int)strlen(string[i]);
- }
- }
-
- mSource = new char[totalLength + 1];
- char *code = mSource;
-
- for(int i = 0; i < count; i++)
- {
- int stringLength;
-
- if(length && length[i] >= 0)
- {
- stringLength = length[i];
- }
- else
- {
- stringLength = (int)strlen(string[i]);
- }
-
- strncpy(code, string[i], stringLength);
- code += stringLength;
- }
-
- mSource[totalLength] = '\0';
-}
-
-size_t Shader::getInfoLogLength() const
-{
- if(infoLog.empty())
- {
- return 0;
- }
- else
- {
- return infoLog.size() + 1;
- }
-}
-
-void Shader::getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLogOut)
-{
- int index = 0;
-
- if(bufSize > 0)
- {
- if(!infoLog.empty())
- {
- index = std::min(bufSize - 1, (GLsizei)infoLog.size());
- memcpy(infoLogOut, infoLog.c_str(), index);
- }
-
- infoLogOut[index] = '\0';
- }
-
- if(length)
- {
- *length = index;
- }
-}
-
-size_t Shader::getSourceLength() const
-{
- if(!mSource)
- {
- return 0;
- }
- else
- {
- return strlen(mSource) + 1;
- }
-}
-
-void Shader::getSource(GLsizei bufSize, GLsizei *length, char *source)
-{
- int index = 0;
-
- if(bufSize > 0)
- {
- if(mSource)
- {
- index = std::min(bufSize - 1, (int)strlen(mSource));
- memcpy(source, mSource, index);
- }
-
- source[index] = '\0';
- }
-
- if(length)
- {
- *length = index;
- }
-}
-
-TranslatorASM *Shader::createCompiler(GLenum shaderType)
-{
- if(!compilerInitialized)
- {
- compilerInitialized = InitCompilerGlobals();
-
- if(!compilerInitialized)
- {
- infoLog += "GLSL compiler failed to initialize.\n";
-
- return nullptr;
- }
- }
-
- TranslatorASM *assembler = new TranslatorASM(this, shaderType);
-
- ShBuiltInResources resources;
- resources.MaxVertexAttribs = MAX_VERTEX_ATTRIBS;
- resources.MaxVertexUniformVectors = MAX_VERTEX_UNIFORM_VECTORS;
- resources.MaxVaryingVectors = MAX_VARYING_VECTORS;
- resources.MaxVertexTextureImageUnits = MAX_VERTEX_TEXTURE_IMAGE_UNITS;
- resources.MaxCombinedTextureImageUnits = MAX_COMBINED_TEXTURE_IMAGE_UNITS;
- resources.MaxTextureImageUnits = MAX_TEXTURE_IMAGE_UNITS;
- resources.MaxFragmentUniformVectors = MAX_FRAGMENT_UNIFORM_VECTORS;
- resources.MaxDrawBuffers = MAX_DRAW_BUFFERS;
- resources.MaxVertexOutputVectors = MAX_VERTEX_OUTPUT_VECTORS;
- resources.MaxFragmentInputVectors = MAX_FRAGMENT_INPUT_VECTORS;
- resources.MinProgramTexelOffset = MIN_PROGRAM_TEXEL_OFFSET;
- resources.MaxProgramTexelOffset = MAX_PROGRAM_TEXEL_OFFSET;
- resources.OES_standard_derivatives = 1;
- resources.OES_fragment_precision_high = 1;
- resources.OES_EGL_image_external = 1;
- resources.OES_EGL_image_external_essl3 = 1;
- resources.EXT_draw_buffers = 1;
- resources.ARB_texture_rectangle = 1;
- resources.MaxCallStackDepth = MAX_SHADER_CALL_STACK_SIZE;
- assembler->Init(resources);
-
- return assembler;
-}
-
-void Shader::clear()
-{
- infoLog.clear();
-
- varyings.clear();
- activeUniforms.clear();
- activeAttributes.clear();
-}
-
-void Shader::compile()
-{
- // Our version of glslang is not thread safe.
- std::lock_guard<std::mutex> lock(mutex);
-
- clear();
-
- createShader();
- TranslatorASM *compiler = createCompiler(getType());
-
- if(!compiler)
- {
- deleteShader();
-
- return;
- }
-
- // Ensure we don't pass a nullptr source to the compiler
- const char *source = "\0";
- if(mSource)
- {
- source = mSource;
- }
-
- bool success = compiler->compile(&source, 1, SH_OBJECT_CODE);
-
- if(false)
- {
- static int serial = 1;
-
- if(false)
- {
- char buffer[256];
- sprintf(buffer, "shader-input-%d-%d.txt", getName(), serial);
- FILE *file = fopen(buffer, "wt");
- fprintf(file, "%s", mSource);
- fclose(file);
- }
-
- getShader()->print("shader-output-%d-%d.txt", getName(), serial);
-
- serial++;
- }
-
- shaderVersion = compiler->getShaderVersion();
- infoLog += compiler->getInfoSink().info.c_str();
-
- if(!success)
- {
- deleteShader();
-
- TRACE("\n%s", infoLog.c_str());
- }
-
- delete compiler;
-}
-
-bool Shader::isCompiled()
-{
- return getShader() != 0;
-}
-
-void Shader::addRef()
-{
- mRefCount++;
-}
-
-void Shader::release()
-{
- mRefCount--;
-
- if(mRefCount == 0 && mDeleteStatus)
- {
- mResourceManager->deleteShader(mHandle);
- }
-}
-
-unsigned int Shader::getRefCount() const
-{
- return mRefCount;
-}
-
-bool Shader::isFlaggedForDeletion() const
-{
- return mDeleteStatus;
-}
-
-void Shader::flagForDeletion()
-{
- mDeleteStatus = true;
-}
-
-void Shader::releaseCompiler()
-{
- // Our version of glslang is not thread safe.
- std::lock_guard<std::mutex> lock(mutex);
-
- FreeCompilerGlobals();
- compilerInitialized = false;
-}
-
-// true if varying x has a higher priority in packing than y
-bool Shader::compareVarying(const glsl::Varying &x, const glsl::Varying &y)
-{
- if(x.type == y.type)
- {
- return x.size() > y.size();
- }
-
- switch(x.type)
- {
- case GL_FLOAT_MAT4: return true;
- case GL_FLOAT_MAT2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return true;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE(y.type);
- }
- break;
- case GL_FLOAT_VEC4:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return true;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE(y.type);
- }
- break;
- case GL_FLOAT_MAT3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return true;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE(y.type);
- }
- break;
- case GL_FLOAT_VEC3:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return true;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE(y.type);
- }
- break;
- case GL_FLOAT_VEC2:
- switch(y.type)
- {
- case GL_FLOAT_MAT4: return false;
- case GL_FLOAT_MAT2: return false;
- case GL_FLOAT_VEC4: return false;
- case GL_FLOAT_MAT3: return false;
- case GL_FLOAT_VEC3: return false;
- case GL_FLOAT_VEC2: return true;
- case GL_FLOAT: return true;
- default: UNREACHABLE(y.type);
- }
- break;
- case GL_FLOAT: return false;
- default: UNREACHABLE(x.type);
- }
-
- return false;
-}
-
-VertexShader::VertexShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
-{
- vertexShader = 0;
-}
-
-VertexShader::~VertexShader()
-{
- delete vertexShader;
-}
-
-GLenum VertexShader::getType() const
-{
- return GL_VERTEX_SHADER;
-}
-
-int VertexShader::getSemanticIndex(const std::string &attributeName) const
-{
- if(!attributeName.empty())
- {
- for(const auto &attribute : activeAttributes)
- {
- if(attribute.name == attributeName)
- {
- return attribute.registerIndex;
- }
- }
- }
-
- return -1;
-}
-
-sw::Shader *VertexShader::getShader() const
-{
- return vertexShader;
-}
-
-sw::VertexShader *VertexShader::getVertexShader() const
-{
- return vertexShader;
-}
-
-void VertexShader::createShader()
-{
- delete vertexShader;
- vertexShader = new sw::VertexShader();
-}
-
-void VertexShader::deleteShader()
-{
- delete vertexShader;
- vertexShader = nullptr;
-}
-
-FragmentShader::FragmentShader(ResourceManager *manager, GLuint handle) : Shader(manager, handle)
-{
- pixelShader = 0;
-}
-
-FragmentShader::~FragmentShader()
-{
- delete pixelShader;
-}
-
-GLenum FragmentShader::getType() const
-{
- return GL_FRAGMENT_SHADER;
-}
-
-sw::Shader *FragmentShader::getShader() const
-{
- return pixelShader;
-}
-
-sw::PixelShader *FragmentShader::getPixelShader() const
-{
- return pixelShader;
-}
-
-void FragmentShader::createShader()
-{
- delete pixelShader;
- pixelShader = new sw::PixelShader();
-}
-
-void FragmentShader::deleteShader()
-{
- delete pixelShader;
- pixelShader = nullptr;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/Shader.h b/src/OpenGL/libGLESv2/Shader.h
deleted file mode 100644
index 32cbaf671..000000000
--- a/src/OpenGL/libGLESv2/Shader.h
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Shader.h: Defines the abstract Shader class and its concrete derived
-// classes VertexShader and FragmentShader. Implements GL shader objects and
-// related functionality. [OpenGL ES 2.0.24] section 2.10 page 24 and section
-// 3.8 page 84.
-
-#ifndef LIBGLESV2_SHADER_H_
-#define LIBGLESV2_SHADER_H_
-
-#include "ResourceManager.h"
-
-#include "compiler/TranslatorASM.h"
-
-#include <GLES2/gl2.h>
-
-#include <string>
-#include <list>
-#include <mutex>
-#include <vector>
-
-namespace glsl
-{
- class OutputASM;
-}
-
-namespace es2
-{
-
-class Shader : public glsl::Shader
-{
- friend class Program;
-
-public:
- Shader(ResourceManager *manager, GLuint handle);
-
- virtual ~Shader();
-
- virtual GLenum getType() const = 0;
- GLuint getName() const;
-
- void deleteSource();
- void setSource(GLsizei count, const char *const *string, const GLint *length);
- size_t getInfoLogLength() const;
- void getInfoLog(GLsizei bufSize, GLsizei *length, char *infoLog);
- size_t getSourceLength() const;
- void getSource(GLsizei bufSize, GLsizei *length, char *source);
-
- void compile();
- bool isCompiled();
-
- void addRef();
- void release();
- unsigned int getRefCount() const;
- bool isFlaggedForDeletion() const;
- void flagForDeletion();
-
- static void releaseCompiler();
-
-protected:
- static std::mutex mutex;
- static bool compilerInitialized;
-
- TranslatorASM *createCompiler(GLenum shaderType);
- void clear();
-
- static bool compareVarying(const glsl::Varying &x, const glsl::Varying &y);
-
- char *mSource;
- std::string infoLog;
-
-private:
- virtual void createShader() = 0;
- virtual void deleteShader() = 0;
-
- const GLuint mHandle;
- unsigned int mRefCount; // Number of program objects this shader is attached to
- bool mDeleteStatus; // Flag to indicate that the shader can be deleted when no longer in use
-
- ResourceManager *mResourceManager;
-};
-
-class VertexShader : public Shader
-{
- friend class Program;
-
-public:
- VertexShader(ResourceManager *manager, GLuint handle);
-
- ~VertexShader();
-
- virtual GLenum getType() const;
- int getSemanticIndex(const std::string &attributeName) const;
-
- virtual sw::Shader *getShader() const;
- virtual sw::VertexShader *getVertexShader() const;
-
-private:
- virtual void createShader();
- virtual void deleteShader();
-
- sw::VertexShader *vertexShader;
-};
-
-class FragmentShader : public Shader
-{
-public:
- FragmentShader(ResourceManager *manager, GLuint handle);
-
- ~FragmentShader();
-
- virtual GLenum getType() const;
-
- virtual sw::Shader *getShader() const;
- virtual sw::PixelShader *getPixelShader() const;
-
-private:
- virtual void createShader();
- virtual void deleteShader();
-
- sw::PixelShader *pixelShader;
-};
-}
-
-#endif // LIBGLESV2_SHADER_H_
diff --git a/src/OpenGL/libGLESv2/Texture.cpp b/src/OpenGL/libGLESv2/Texture.cpp
deleted file mode 100644
index d35c10836..000000000
--- a/src/OpenGL/libGLESv2/Texture.cpp
+++ /dev/null
@@ -1,2068 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Texture.cpp: Implements the Texture class and its derived classes
-// Texture2D, TextureCubeMap, Texture3D and Texture2DArray. Implements GL texture objects
-// and related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
-
-#include "Texture.h"
-
-#include "main.h"
-#include "mathutil.h"
-#include "Framebuffer.h"
-#include "Device.hpp"
-#include "Sampler.h"
-#include "Shader.h"
-#include "libEGL/Display.h"
-#include "common/Surface.hpp"
-#include "common/debug.h"
-
-#include <algorithm>
-
-namespace es2
-{
-
-egl::Image*& ImageLevels::getNullImage()
-{
- static egl::Image* nullImage;
- nullImage = nullptr;
- return nullImage;
-}
-
-Texture::Texture(GLuint name) : egl::Texture(name)
-{
- mMinFilter = GL_NEAREST_MIPMAP_LINEAR;
- mMagFilter = GL_LINEAR;
- mWrapS = GL_REPEAT;
- mWrapT = GL_REPEAT;
- mWrapR = GL_REPEAT;
- mMaxAnisotropy = 1.0f;
- mBaseLevel = 0;
- mCompareFunc = GL_LEQUAL;
- mCompareMode = GL_NONE;
- mImmutableFormat = GL_FALSE;
- mImmutableLevels = 0;
- mMaxLevel = 1000;
- mMaxLOD = 1000;
- mMinLOD = -1000;
- mSwizzleR = GL_RED;
- mSwizzleG = GL_GREEN;
- mSwizzleB = GL_BLUE;
- mSwizzleA = GL_ALPHA;
-
- resource = new sw::Resource(0);
-}
-
-Texture::~Texture()
-{
- resource->destruct();
-}
-
-sw::Resource *Texture::getResource() const
-{
- return resource;
-}
-
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMinFilter(GLenum filter)
-{
- switch(filter)
- {
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- if((getTarget() == GL_TEXTURE_EXTERNAL_OES) || (getTarget() == GL_TEXTURE_RECTANGLE_ARB))
- {
- return false;
- }
- // Fall through
- case GL_NEAREST:
- case GL_LINEAR:
- mMinFilter = filter;
- return true;
- default:
- return false;
- }
-}
-
-// Returns true on successful filter state update (valid enum parameter)
-bool Texture::setMagFilter(GLenum filter)
-{
- switch(filter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- mMagFilter = filter;
- return true;
- default:
- return false;
- }
-}
-
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapS(GLenum wrap)
-{
- switch(wrap)
- {
- case GL_REPEAT:
- case GL_MIRRORED_REPEAT:
- if((getTarget() == GL_TEXTURE_EXTERNAL_OES) || (getTarget() == GL_TEXTURE_RECTANGLE_ARB))
- {
- return false;
- }
- // Fall through
- case GL_CLAMP_TO_EDGE:
- mWrapS = wrap;
- return true;
- default:
- return false;
- }
-}
-
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapT(GLenum wrap)
-{
- switch(wrap)
- {
- case GL_REPEAT:
- case GL_MIRRORED_REPEAT:
- if((getTarget() == GL_TEXTURE_EXTERNAL_OES) || (getTarget() == GL_TEXTURE_RECTANGLE_ARB))
- {
- return false;
- }
- // Fall through
- case GL_CLAMP_TO_EDGE:
- mWrapT = wrap;
- return true;
- default:
- return false;
- }
-}
-
-// Returns true on successful wrap state update (valid enum parameter)
-bool Texture::setWrapR(GLenum wrap)
-{
- switch(wrap)
- {
- case GL_REPEAT:
- case GL_MIRRORED_REPEAT:
- if((getTarget() == GL_TEXTURE_EXTERNAL_OES) || (getTarget() == GL_TEXTURE_RECTANGLE_ARB))
- {
- return false;
- }
- // Fall through
- case GL_CLAMP_TO_EDGE:
- mWrapR = wrap;
- return true;
- default:
- return false;
- }
-}
-
-// Returns true on successful max anisotropy update (valid anisotropy value)
-bool Texture::setMaxAnisotropy(float textureMaxAnisotropy)
-{
- textureMaxAnisotropy = std::min(textureMaxAnisotropy, MAX_TEXTURE_MAX_ANISOTROPY);
-
- if(textureMaxAnisotropy < 1.0f)
- {
- return false;
- }
-
- if(mMaxAnisotropy != textureMaxAnisotropy)
- {
- mMaxAnisotropy = textureMaxAnisotropy;
- }
-
- return true;
-}
-
-bool Texture::setBaseLevel(GLint baseLevel)
-{
- if(baseLevel < 0)
- {
- return false;
- }
-
- mBaseLevel = baseLevel;
- return true;
-}
-
-bool Texture::setCompareFunc(GLenum compareFunc)
-{
- switch(compareFunc)
- {
- case GL_LEQUAL:
- case GL_GEQUAL:
- case GL_LESS:
- case GL_GREATER:
- case GL_EQUAL:
- case GL_NOTEQUAL:
- case GL_ALWAYS:
- case GL_NEVER:
- mCompareFunc = compareFunc;
- return true;
- default:
- return false;
- }
-}
-
-bool Texture::setCompareMode(GLenum compareMode)
-{
- switch(compareMode)
- {
- case GL_COMPARE_REF_TO_TEXTURE:
- case GL_NONE:
- mCompareMode = compareMode;
- return true;
- default:
- return false;
- }
-}
-
-void Texture::makeImmutable(GLsizei levels)
-{
- mImmutableFormat = GL_TRUE;
- mImmutableLevels = levels;
-}
-
-bool Texture::setMaxLevel(GLint maxLevel)
-{
- mMaxLevel = maxLevel;
- return true;
-}
-
-bool Texture::setMaxLOD(GLfloat maxLOD)
-{
- mMaxLOD = maxLOD;
- return true;
-}
-
-bool Texture::setMinLOD(GLfloat minLOD)
-{
- mMinLOD = minLOD;
- return true;
-}
-
-bool Texture::setSwizzleR(GLenum swizzleR)
-{
- switch(swizzleR)
- {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_ZERO:
- case GL_ONE:
- mSwizzleR = swizzleR;
- return true;
- default:
- return false;
- }
-}
-
-bool Texture::setSwizzleG(GLenum swizzleG)
-{
- switch(swizzleG)
- {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_ZERO:
- case GL_ONE:
- mSwizzleG = swizzleG;
- return true;
- default:
- return false;
- }
-}
-
-bool Texture::setSwizzleB(GLenum swizzleB)
-{
- switch(swizzleB)
- {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_ZERO:
- case GL_ONE:
- mSwizzleB = swizzleB;
- return true;
- default:
- return false;
- }
-}
-
-bool Texture::setSwizzleA(GLenum swizzleA)
-{
- switch(swizzleA)
- {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_ZERO:
- case GL_ONE:
- mSwizzleA = swizzleA;
- return true;
- default:
- return false;
- }
-}
-
-GLsizei Texture::getDepth(GLenum target, GLint level) const
-{
- return 1;
-}
-
-egl::Image *Texture::createSharedImage(GLenum target, unsigned int level)
-{
- egl::Image *image = getRenderTarget(target, level); // Increments reference count
-
- if(image)
- {
- image->markShared();
- }
-
- return image;
-}
-
-void Texture::setImage(GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels, egl::Image *image)
-{
- if(pixels && image)
- {
- GLsizei depth = (getTarget() == GL_TEXTURE_3D_OES || getTarget() == GL_TEXTURE_2D_ARRAY) ? image->getDepth() : 1;
- image->loadImageData(0, 0, 0, image->getWidth(), image->getHeight(), depth, format, type, unpackParameters, pixels);
- }
-}
-
-void Texture::setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image)
-{
- if(pixels && image && (imageSize > 0)) // imageSize's correlation to width and height is already validated with gl::ComputeCompressedSize() at the API level
- {
- GLsizei depth = (getTarget() == GL_TEXTURE_3D_OES || getTarget() == GL_TEXTURE_2D_ARRAY) ? image->getDepth() : 1;
- image->loadCompressedData(0, 0, 0, image->getWidth(), image->getHeight(), depth, imageSize, pixels);
- }
-}
-
-void Texture::subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels, egl::Image *image)
-{
- if(!image)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(pixels && width > 0 && height > 0 && depth > 0)
- {
- image->loadImageData(xoffset, yoffset, zoffset, width, height, depth, format, type, unpackParameters, pixels);
- }
-}
-
-void Texture::subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image)
-{
- if(!image)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(pixels && (imageSize > 0)) // imageSize's correlation to width and height is already validated with gl::ComputeCompressedSize() at the API level
- {
- image->loadCompressedData(xoffset, yoffset, zoffset, width, height, depth, imageSize, pixels);
- }
-}
-
-bool Texture::copy(egl::Image *source, const sw::SliceRect &sourceRect, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest)
-{
- Device *device = getDevice();
-
- sw::SliceRect destRect(xoffset, yoffset, xoffset + (sourceRect.x1 - sourceRect.x0), yoffset + (sourceRect.y1 - sourceRect.y0), zoffset);
- sw::SliceRectF sourceRectF(static_cast<float>(sourceRect.x0),
- static_cast<float>(sourceRect.y0),
- static_cast<float>(sourceRect.x1),
- static_cast<float>(sourceRect.y1),
- sourceRect.slice);
- bool success = device->stretchRect(source, &sourceRectF, dest, &destRect, Device::ALL_BUFFERS);
-
- if(!success)
- {
- return error(GL_OUT_OF_MEMORY, false);
- }
-
- return true;
-}
-
-bool Texture::isMipmapFiltered(Sampler *sampler) const
-{
- GLenum minFilter = sampler ? sampler->getMinFilter() : mMinFilter;
-
- switch(minFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- return false;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- return true;
- default: UNREACHABLE(minFilter);
- }
-
- return false;
-}
-
-Texture2D::Texture2D(GLuint name) : Texture(name)
-{
- mSurface = nullptr;
-
- mColorbufferProxy = nullptr;
- mProxyRefs = 0;
-}
-
-Texture2D::~Texture2D()
-{
- image.unbind(this);
-
- if(mSurface)
- {
- mSurface->setBoundTexture(nullptr);
- mSurface = nullptr;
- }
-
- mColorbufferProxy = nullptr;
-}
-
-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that we do not attempt to use a pointer
-// to a renderbuffer proxy which has been deleted.
-void Texture2D::addProxyRef(const Renderbuffer *proxy)
-{
- mProxyRefs++;
-}
-
-void Texture2D::releaseProxy(const Renderbuffer *proxy)
-{
- if(mProxyRefs > 0)
- {
- mProxyRefs--;
- }
-
- if(mProxyRefs == 0)
- {
- mColorbufferProxy = nullptr;
- }
-}
-
-void Texture2D::sweep()
-{
- int imageCount = 0;
-
- for(int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- if(image[i] && image[i]->isChildOf(this))
- {
- if(!image[i]->hasSingleReference())
- {
- return;
- }
-
- imageCount++;
- }
- }
-
- if(imageCount == referenceCount)
- {
- destroy();
- }
-}
-
-GLenum Texture2D::getTarget() const
-{
- return GL_TEXTURE_2D;
-}
-
-GLsizei Texture2D::getWidth(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getWidth() : 0;
-}
-
-GLsizei Texture2D::getHeight(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getHeight() : 0;
-}
-
-GLint Texture2D::getFormat(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getFormat() : GL_NONE;
-}
-
-int Texture2D::getTopLevel() const
-{
- int level = mBaseLevel;
-
- while(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && image[level])
- {
- level++;
- }
-
- return level - 1;
-}
-
-bool Texture2D::hasNonBaseLevels() const
-{
- for(int level = 1; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- if (image[level])
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool Texture2D::requiresSync() const
-{
- for(int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- if(image[level] && image[level]->requiresSync())
- {
- return true;
- }
- }
-
- return false;
-}
-
-void Texture2D::setImage(GLint level, GLsizei width, GLsizei height, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, internalformat);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setImage(format, type, unpackParameters, pixels, image[level]);
-}
-
-void Texture2D::bindTexImage(gl::Surface *surface)
-{
- image.release();
-
- image[0] = surface->getRenderTarget();
-
- assert(!mSurface); // eglBindTexImage called before eglReleaseTexImage
-
- mSurface = surface;
- mSurface->setBoundTexture(this);
-}
-
-void Texture2D::releaseTexImage()
-{
- image.release();
-
- if(mSurface)
- {
- mSurface->setBoundTexture(nullptr);
- mSurface = nullptr;
- }
-}
-
-void Texture2D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, format);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setCompressedImage(imageSize, pixels, image[level]);
-}
-
-void Texture2D::subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpackParameters, pixels, image[level]);
-}
-
-void Texture2D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
-{
- Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, image[level]);
-}
-
-void Texture2D::copyImage(GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, internalformat);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- if(width != 0 && height != 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- copy(renderTarget, sourceRect, 0, 0, 0, image[level]);
-
- renderTarget->release();
- }
-}
-
-void Texture2D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source)
-{
- if(!image[level])
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(xoffset + width > image[level]->getWidth() || yoffset + height > image[level]->getHeight() || zoffset != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > 0 && height > 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[level]);
-
- renderTarget->release();
- }
-}
-
-void Texture2D::setSharedImage(egl::Image *sharedImage)
-{
- if(sharedImage == image[0])
- {
- return;
- }
-
- sharedImage->addRef();
-
- if(image[0])
- {
- image[0]->release();
- }
-
- image[0] = sharedImage;
-}
-
-bool Texture2D::isBaseLevelDefined() const
-{
- if(!image[mBaseLevel])
- {
- return false;
- }
-
- GLsizei width = image[mBaseLevel]->getWidth();
- GLsizei height = image[mBaseLevel]->getHeight();
-
- if(width <= 0 || height <= 0)
- {
- return false;
- }
-
- return true;
-}
-
-// Tests for 2D texture sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
-bool Texture2D::isSamplerComplete(Sampler *sampler) const
-{
- if(mImmutableFormat == GL_TRUE)
- {
- return true;
- }
-
- if(!isBaseLevelDefined())
- {
- return false;
- }
-
- if(isMipmapFiltered(sampler))
- {
- if(!isMipmapComplete())
- {
- return false;
- }
- }
-
- return true;
-}
-
-// Tests for 2D texture (mipmap) completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
-bool Texture2D::isMipmapComplete() const
-{
- if(mBaseLevel > mMaxLevel)
- {
- return false;
- }
-
- GLsizei width = image[mBaseLevel]->getWidth();
- GLsizei height = image[mBaseLevel]->getHeight();
- int maxsize = std::max(width, height);
- int p = log2(maxsize) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int level = mBaseLevel + 1; level <= q; level++)
- {
- if(!image[level])
- {
- return false;
- }
-
- if(image[level]->getFormat() != image[mBaseLevel]->getFormat())
- {
- return false;
- }
-
- int i = level - mBaseLevel;
-
- if(image[level]->getWidth() != std::max(1, width >> i))
- {
- return false;
- }
-
- if(image[level]->getHeight() != std::max(1, height >> i))
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool Texture2D::isCompressed(GLenum target, GLint level) const
-{
- return IsCompressed(getFormat(target, level));
-}
-
-bool Texture2D::isDepth(GLenum target, GLint level) const
-{
- return IsDepthTexture(getFormat(target, level));
-}
-
-void Texture2D::generateMipmaps()
-{
- if(!image[mBaseLevel])
- {
- return; // Image unspecified. Not an error.
- }
-
- if(image[mBaseLevel]->getWidth() == 0 || image[mBaseLevel]->getHeight() == 0)
- {
- return; // Zero dimension. Not an error.
- }
-
- int maxsize = std::max(image[mBaseLevel]->getWidth(), image[mBaseLevel]->getHeight());
- int p = log2(maxsize) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int i = mBaseLevel + 1; i <= q; i++)
- {
- if(image[i])
- {
- image[i]->release();
- }
-
- image[i] = egl::Image::create(this, std::max(image[mBaseLevel]->getWidth() >> i, 1), std::max(image[mBaseLevel]->getHeight() >> i, 1), image[mBaseLevel]->getFormat());
-
- if(!image[i])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- getDevice()->stretchRect(image[i - 1], 0, image[i], 0, Device::ALL_BUFFERS | Device::USE_FILTER);
- }
-}
-
-egl::Image *Texture2D::getImage(unsigned int level)
-{
- return image[level];
-}
-
-Renderbuffer *Texture2D::getRenderbuffer(GLenum target, GLint level)
-{
- if(target != getTarget())
- {
- return error(GL_INVALID_OPERATION, (Renderbuffer*)nullptr);
- }
-
- if(!mColorbufferProxy)
- {
- mColorbufferProxy = new Renderbuffer(name, new RenderbufferTexture2D(this, level));
- }
- else
- {
- mColorbufferProxy->setLevel(level);
- }
-
- return mColorbufferProxy;
-}
-
-egl::Image *Texture2D::getRenderTarget(GLenum target, unsigned int level)
-{
- ASSERT(target == getTarget());
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- if(image[level])
- {
- image[level]->addRef();
- }
-
- return image[level];
-}
-
-bool Texture2D::isShared(GLenum target, unsigned int level) const
-{
- ASSERT(target == getTarget());
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- if(mSurface) // Bound to an EGLSurface
- {
- return true;
- }
-
- if(!image[level])
- {
- return false;
- }
-
- return image[level]->isShared();
-}
-
-Texture2DRect::Texture2DRect(GLuint name) : Texture2D(name)
-{
- mMinFilter = GL_LINEAR;
- mMagFilter = GL_LINEAR;
- mWrapS = GL_CLAMP_TO_EDGE;
- mWrapT = GL_CLAMP_TO_EDGE;
- mWrapR = GL_CLAMP_TO_EDGE;
-}
-
-GLenum Texture2DRect::getTarget() const
-{
- return GL_TEXTURE_RECTANGLE_ARB;
-}
-
-Renderbuffer *Texture2DRect::getRenderbuffer(GLenum target, GLint level)
-{
- if((target != getTarget()) || (level != 0))
- {
- return error(GL_INVALID_OPERATION, (Renderbuffer*)nullptr);
- }
-
- if(!mColorbufferProxy)
- {
- mColorbufferProxy = new Renderbuffer(name, new RenderbufferTexture2DRect(this));
- }
-
- return mColorbufferProxy;
-}
-
-TextureCubeMap::TextureCubeMap(GLuint name) : Texture(name)
-{
- for(int f = 0; f < 6; f++)
- {
- mFaceProxies[f] = nullptr;
- mFaceProxyRefs[f] = 0;
- }
-}
-
-TextureCubeMap::~TextureCubeMap()
-{
- for(int i = 0; i < 6; i++)
- {
- image[i].unbind(this);
- mFaceProxies[i] = nullptr;
- }
-}
-
-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that the texture is not deleted while
-// proxy references still exist. If the reference count drops to zero,
-// we set our proxy pointer null, so that a new attempt at referencing
-// will cause recreation.
-void TextureCubeMap::addProxyRef(const Renderbuffer *proxy)
-{
- for(int f = 0; f < 6; f++)
- {
- if(mFaceProxies[f] == proxy)
- {
- mFaceProxyRefs[f]++;
- }
- }
-}
-
-void TextureCubeMap::releaseProxy(const Renderbuffer *proxy)
-{
- for(int f = 0; f < 6; f++)
- {
- if(mFaceProxies[f] == proxy)
- {
- if(mFaceProxyRefs[f] > 0)
- {
- mFaceProxyRefs[f]--;
- }
-
- if(mFaceProxyRefs[f] == 0)
- {
- mFaceProxies[f] = nullptr;
- }
- }
- }
-}
-
-void TextureCubeMap::sweep()
-{
- int imageCount = 0;
-
- for(int f = 0; f < 6; f++)
- {
- for(int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- if(image[f][i] && image[f][i]->isChildOf(this))
- {
- if(!image[f][i]->hasSingleReference())
- {
- return;
- }
-
- imageCount++;
- }
- }
- }
-
- if(imageCount == referenceCount)
- {
- destroy();
- }
-}
-
-GLenum TextureCubeMap::getTarget() const
-{
- return GL_TEXTURE_CUBE_MAP;
-}
-
-GLsizei TextureCubeMap::getWidth(GLenum target, GLint level) const
-{
- int face = CubeFaceIndex(target);
- return image[face][level] ? image[face][level]->getWidth() : 0;
-}
-
-GLsizei TextureCubeMap::getHeight(GLenum target, GLint level) const
-{
- int face = CubeFaceIndex(target);
- return image[face][level] ? image[face][level]->getHeight() : 0;
-}
-
-GLint TextureCubeMap::getFormat(GLenum target, GLint level) const
-{
- int face = CubeFaceIndex(target);
- return image[face][level] ? image[face][level]->getFormat() : 0;
-}
-
-int TextureCubeMap::getTopLevel() const
-{
- int level = mBaseLevel;
-
- while(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && image[0][level])
- {
- level++;
- }
-
- return level - 1;
-}
-
-bool TextureCubeMap::hasNonBaseLevels() const
-{
- for(int level = 1; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- for(int face = 0; face < 6; face++)
- {
- if (image[face][level])
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-bool TextureCubeMap::requiresSync() const
-{
- for(int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- for(int face = 0; face < 6; face++)
- {
- if(image[face][level] && image[face][level]->requiresSync())
- {
- return true;
- }
- }
- }
-
- return false;
-}
-
-void TextureCubeMap::setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels)
-{
- int face = CubeFaceIndex(target);
-
- if(image[face][level])
- {
- image[face][level]->release();
- }
-
- image[face][level] = egl::Image::create(this, width, height, 1, 1, format);
-
- if(!image[face][level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setCompressedImage(imageSize, pixels, image[face][level]);
-}
-
-void TextureCubeMap::subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- Texture::subImage(xoffset, yoffset, 0, width, height, 1, format, type, unpackParameters, pixels, image[CubeFaceIndex(target)][level]);
-}
-
-void TextureCubeMap::subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels)
-{
- Texture::subImageCompressed(xoffset, yoffset, 0, width, height, 1, format, imageSize, pixels, image[CubeFaceIndex(target)][level]);
-}
-
-bool TextureCubeMap::isBaseLevelDefined() const
-{
- for(int face = 0; face < 6; face++)
- {
- if(!image[face][mBaseLevel])
- {
- return false;
- }
- }
-
- int size = image[0][mBaseLevel]->getWidth();
-
- if(size <= 0)
- {
- return false;
- }
-
- return true;
-}
-
-// Tests for cube map sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 161.
-bool TextureCubeMap::isSamplerComplete(Sampler *sampler) const
-{
- if(mImmutableFormat == GL_TRUE)
- {
- return true;
- }
-
- if(!isBaseLevelDefined())
- {
- return false;
- }
-
- if(!isMipmapFiltered(sampler))
- {
- if(!isCubeComplete())
- {
- return false;
- }
- }
- else
- {
- if(!isMipmapCubeComplete()) // Also tests for isCubeComplete()
- {
- return false;
- }
- }
-
- return true;
-}
-
-// Tests for cube texture completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
-bool TextureCubeMap::isCubeComplete() const
-{
- if(!isBaseLevelDefined())
- {
- return false;
- }
-
- if(image[0][mBaseLevel]->getWidth() <= 0 || image[0][mBaseLevel]->getHeight() != image[0][mBaseLevel]->getWidth())
- {
- return false;
- }
-
- for(unsigned int face = 1; face < 6; face++)
- {
- if(image[face][mBaseLevel]->getWidth() != image[0][mBaseLevel]->getWidth() ||
- image[face][mBaseLevel]->getWidth() != image[0][mBaseLevel]->getHeight() ||
- image[face][mBaseLevel]->getFormat() != image[0][mBaseLevel]->getFormat())
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool TextureCubeMap::isMipmapCubeComplete() const
-{
- if(mBaseLevel > mMaxLevel)
- {
- return false;
- }
-
- if(!isCubeComplete())
- {
- return false;
- }
-
- GLsizei size = image[0][mBaseLevel]->getWidth();
- int p = log2(size) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int face = 0; face < 6; face++)
- {
- for(int level = mBaseLevel + 1; level <= q; level++)
- {
- if(!image[face][level])
- {
- return false;
- }
-
- if(image[face][level]->getFormat() != image[0][mBaseLevel]->getFormat())
- {
- return false;
- }
-
- int i = level - mBaseLevel;
-
- if(image[face][level]->getWidth() != std::max(1, size >> i))
- {
- return false;
- }
- }
- }
-
- return true;
-}
-
-void TextureCubeMap::updateBorders(int level)
-{
- egl::Image *posX = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_POSITIVE_X)][level];
- egl::Image *negX = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_NEGATIVE_X)][level];
- egl::Image *posY = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_POSITIVE_Y)][level];
- egl::Image *negY = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_NEGATIVE_Y)][level];
- egl::Image *posZ = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_POSITIVE_Z)][level];
- egl::Image *negZ = image[CubeFaceIndex(GL_TEXTURE_CUBE_MAP_NEGATIVE_Z)][level];
-
- if(!posX || !negX || !posY || !negY || !posZ || !negZ)
- {
- return;
- }
-
- if(posX->getBorder() == 0) // Non-seamless cube map.
- {
- return;
- }
-
- if(!posX->hasDirtyContents() || !posY->hasDirtyContents() || !posZ->hasDirtyContents() || !negX->hasDirtyContents() || !negY->hasDirtyContents() || !negZ->hasDirtyContents())
- {
- return;
- }
-
- // Copy top / bottom first.
- posX->copyCubeEdge(sw::Surface::BOTTOM, negY, sw::Surface::RIGHT);
- posY->copyCubeEdge(sw::Surface::BOTTOM, posZ, sw::Surface::TOP);
- posZ->copyCubeEdge(sw::Surface::BOTTOM, negY, sw::Surface::TOP);
- negX->copyCubeEdge(sw::Surface::BOTTOM, negY, sw::Surface::LEFT);
- negY->copyCubeEdge(sw::Surface::BOTTOM, negZ, sw::Surface::BOTTOM);
- negZ->copyCubeEdge(sw::Surface::BOTTOM, negY, sw::Surface::BOTTOM);
-
- posX->copyCubeEdge(sw::Surface::TOP, posY, sw::Surface::RIGHT);
- posY->copyCubeEdge(sw::Surface::TOP, negZ, sw::Surface::TOP);
- posZ->copyCubeEdge(sw::Surface::TOP, posY, sw::Surface::BOTTOM);
- negX->copyCubeEdge(sw::Surface::TOP, posY, sw::Surface::LEFT);
- negY->copyCubeEdge(sw::Surface::TOP, posZ, sw::Surface::BOTTOM);
- negZ->copyCubeEdge(sw::Surface::TOP, posY, sw::Surface::TOP);
-
- // Copy left / right after top and bottom are done.
- // The corner colors will be computed assuming top / bottom are already set.
- posX->copyCubeEdge(sw::Surface::RIGHT, negZ, sw::Surface::LEFT);
- posY->copyCubeEdge(sw::Surface::RIGHT, posX, sw::Surface::TOP);
- posZ->copyCubeEdge(sw::Surface::RIGHT, posX, sw::Surface::LEFT);
- negX->copyCubeEdge(sw::Surface::RIGHT, posZ, sw::Surface::LEFT);
- negY->copyCubeEdge(sw::Surface::RIGHT, posX, sw::Surface::BOTTOM);
- negZ->copyCubeEdge(sw::Surface::RIGHT, negX, sw::Surface::LEFT);
-
- posX->copyCubeEdge(sw::Surface::LEFT, posZ, sw::Surface::RIGHT);
- posY->copyCubeEdge(sw::Surface::LEFT, negX, sw::Surface::TOP);
- posZ->copyCubeEdge(sw::Surface::LEFT, negX, sw::Surface::RIGHT);
- negX->copyCubeEdge(sw::Surface::LEFT, negZ, sw::Surface::RIGHT);
- negY->copyCubeEdge(sw::Surface::LEFT, negX, sw::Surface::BOTTOM);
- negZ->copyCubeEdge(sw::Surface::LEFT, posX, sw::Surface::RIGHT);
-
- posX->markContentsClean();
- posY->markContentsClean();
- posZ->markContentsClean();
- negX->markContentsClean();
- negY->markContentsClean();
- negZ->markContentsClean();
-}
-
-bool TextureCubeMap::isCompressed(GLenum target, GLint level) const
-{
- return IsCompressed(getFormat(target, level));
-}
-
-bool TextureCubeMap::isDepth(GLenum target, GLint level) const
-{
- return IsDepthTexture(getFormat(target, level));
-}
-
-void TextureCubeMap::releaseTexImage()
-{
- UNREACHABLE(0); // Cube maps cannot have an EGL surface bound as an image
-}
-
-void TextureCubeMap::setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- int face = CubeFaceIndex(target);
-
- if(image[face][level])
- {
- image[face][level]->release();
- }
-
- image[face][level] = egl::Image::create(this, width, height, 1, 1, internalformat);
-
- if(!image[face][level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setImage(format, type, unpackParameters, pixels, image[face][level]);
-}
-
-void TextureCubeMap::copyImage(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source)
-{
- int face = CubeFaceIndex(target);
-
- if(image[face][level])
- {
- image[face][level]->release();
- }
-
- image[face][level] = egl::Image::create(this, width, height, 1, 1, internalformat);
-
- if(!image[face][level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- if(width != 0 && height != 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- copy(renderTarget, sourceRect, 0, 0, 0, image[face][level]);
-
- renderTarget->release();
- }
-}
-
-egl::Image *TextureCubeMap::getImage(int face, unsigned int level)
-{
- return image[face][level];
-}
-
-egl::Image *TextureCubeMap::getImage(GLenum face, unsigned int level)
-{
- return image[CubeFaceIndex(face)][level];
-}
-
-void TextureCubeMap::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source)
-{
- int face = CubeFaceIndex(target);
-
- if(!image[face][level])
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLsizei size = image[face][level]->getWidth();
-
- if(xoffset + width > size || yoffset + height > size || zoffset != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > 0 && height > 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect(x, y, x + width, y + height, 0);
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[face][level]);
-
- renderTarget->release();
- }
-}
-
-void TextureCubeMap::generateMipmaps()
-{
- if(!isCubeComplete())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- int p = log2(image[0][mBaseLevel]->getWidth()) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int f = 0; f < 6; f++)
- {
- ASSERT(image[f][mBaseLevel]);
-
- for(int i = mBaseLevel + 1; i <= q; i++)
- {
- if(image[f][i])
- {
- image[f][i]->release();
- }
-
- image[f][i] = egl::Image::create(this, std::max(image[f][mBaseLevel]->getWidth() >> i, 1), std::max(image[f][mBaseLevel]->getHeight() >> i, 1), 1, 1, image[f][mBaseLevel]->getFormat());
-
- if(!image[f][i])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- getDevice()->stretchRect(image[f][i - 1], 0, image[f][i], 0, Device::ALL_BUFFERS | Device::USE_FILTER);
- }
- }
-}
-
-Renderbuffer *TextureCubeMap::getRenderbuffer(GLenum target, GLint level)
-{
- if(!IsCubemapTextureTarget(target))
- {
- return error(GL_INVALID_OPERATION, (Renderbuffer*)nullptr);
- }
-
- int face = CubeFaceIndex(target);
-
- if(!mFaceProxies[face])
- {
- mFaceProxies[face] = new Renderbuffer(name, new RenderbufferTextureCubeMap(this, target, level));
- }
- else
- {
- mFaceProxies[face]->setLevel(level);
- }
-
- return mFaceProxies[face];
-}
-
-egl::Image *TextureCubeMap::getRenderTarget(GLenum target, unsigned int level)
-{
- ASSERT(IsCubemapTextureTarget(target));
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- int face = CubeFaceIndex(target);
-
- if(image[face][level])
- {
- image[face][level]->addRef();
- }
-
- return image[face][level];
-}
-
-bool TextureCubeMap::isShared(GLenum target, unsigned int level) const
-{
- ASSERT(IsCubemapTextureTarget(target));
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- int face = CubeFaceIndex(target);
-
- if(!image[face][level])
- {
- return false;
- }
-
- return image[face][level]->isShared();
-}
-
-Texture3D::Texture3D(GLuint name) : Texture(name)
-{
- mSurface = nullptr;
-
- mColorbufferProxy = nullptr;
- mProxyRefs = 0;
-}
-
-Texture3D::~Texture3D()
-{
- image.unbind(this);
-
- if(mSurface)
- {
- mSurface->setBoundTexture(nullptr);
- mSurface = nullptr;
- }
-
- mColorbufferProxy = nullptr;
-}
-
-// We need to maintain a count of references to renderbuffers acting as
-// proxies for this texture, so that we do not attempt to use a pointer
-// to a renderbuffer proxy which has been deleted.
-void Texture3D::addProxyRef(const Renderbuffer *proxy)
-{
- mProxyRefs++;
-}
-
-void Texture3D::releaseProxy(const Renderbuffer *proxy)
-{
- if(mProxyRefs > 0)
- {
- mProxyRefs--;
- }
-
- if(mProxyRefs == 0)
- {
- mColorbufferProxy = nullptr;
- }
-}
-
-void Texture3D::sweep()
-{
- int imageCount = 0;
-
- for(int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- if(image[i] && image[i]->isChildOf(this))
- {
- if(!image[i]->hasSingleReference())
- {
- return;
- }
-
- imageCount++;
- }
- }
-
- if(imageCount == referenceCount)
- {
- destroy();
- }
-}
-
-GLenum Texture3D::getTarget() const
-{
- return GL_TEXTURE_3D_OES;
-}
-
-GLsizei Texture3D::getWidth(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getWidth() : 0;
-}
-
-GLsizei Texture3D::getHeight(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getHeight() : 0;
-}
-
-GLsizei Texture3D::getDepth(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getDepth() : 0;
-}
-
-GLint Texture3D::getFormat(GLenum target, GLint level) const
-{
- ASSERT(target == getTarget());
- return image[level] ? image[level]->getFormat() : GL_NONE;
-}
-
-int Texture3D::getTopLevel() const
-{
- int level = mBaseLevel;
-
- while(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS && image[level])
- {
- level++;
- }
-
- return level - 1;
-}
-
-bool Texture3D::hasNonBaseLevels() const
-{
- for(int level = 1; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- if (image[level])
- {
- return true;
- }
- }
-
- return false;
-}
-
-bool Texture3D::requiresSync() const
-{
- for(int level = 0; level < IMPLEMENTATION_MAX_TEXTURE_LEVELS; level++)
- {
- if(image[level] && image[level]->requiresSync())
- {
- return true;
- }
- }
-
- return false;
-}
-
-void Texture3D::setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, depth, 0, internalformat);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setImage(format, type, unpackParameters, pixels, image[level]);
-}
-
-void Texture3D::releaseTexImage()
-{
- UNREACHABLE(0); // 3D textures cannot have an EGL surface bound as an image
-}
-
-void Texture3D::setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, depth, 0, format);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- Texture::setCompressedImage(imageSize, pixels, image[level]);
-}
-
-void Texture3D::subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels)
-{
- Texture::subImage(xoffset, yoffset, zoffset, width, height, depth, format, type, unpackParameters, pixels, image[level]);
-}
-
-void Texture3D::subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels)
-{
- Texture::subImageCompressed(xoffset, yoffset, zoffset, width, height, depth, format, imageSize, pixels, image[level]);
-}
-
-void Texture3D::copyImage(GLint level, GLenum internalformat, GLint x, GLint y, GLint z, GLsizei width, GLsizei height, GLsizei depth, Renderbuffer *source)
-{
- if(image[level])
- {
- image[level]->release();
- }
-
- image[level] = egl::Image::create(this, width, height, depth, 0, internalformat);
-
- if(!image[level])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- if(width != 0 && height != 0 && depth != 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect(x, y, x + width, y + height, z);
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- for(GLint sliceZ = 0; sliceZ < depth; sliceZ++, sourceRect.slice++)
- {
- copy(renderTarget, sourceRect, 0, 0, sliceZ, image[level]);
- }
-
- renderTarget->release();
- }
-}
-
-void Texture3D::copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source)
-{
- if(!image[level])
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(xoffset + width > image[level]->getWidth() || yoffset + height > image[level]->getHeight() || zoffset >= image[level]->getDepth())
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > 0 && height > 0)
- {
- egl::Image *renderTarget = source->getRenderTarget();
-
- if(!renderTarget)
- {
- ERR("Failed to retrieve the render target.");
- return error(GL_OUT_OF_MEMORY);
- }
-
- sw::SliceRect sourceRect = {x, y, x + width, y + height, 0};
- sourceRect.clip(0, 0, renderTarget->getWidth(), renderTarget->getHeight());
-
- copy(renderTarget, sourceRect, xoffset, yoffset, zoffset, image[level]);
-
- renderTarget->release();
- }
-}
-
-void Texture3D::setSharedImage(egl::Image *sharedImage)
-{
- sharedImage->addRef();
-
- if(image[0])
- {
- image[0]->release();
- }
-
- image[0] = sharedImage;
-}
-
-bool Texture3D::isBaseLevelDefined() const
-{
- if(!image[mBaseLevel])
- {
- return false;
- }
-
- GLsizei width = image[mBaseLevel]->getWidth();
- GLsizei height = image[mBaseLevel]->getHeight();
- GLsizei depth = image[mBaseLevel]->getDepth();
-
- if(width <= 0 || height <= 0 || depth <= 0)
- {
- return false;
- }
-
- return true;
-}
-
-// Tests for 3D texture sampling completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
-bool Texture3D::isSamplerComplete(Sampler *sampler) const
-{
- if(mImmutableFormat == GL_TRUE)
- {
- return true;
- }
-
- if(!isBaseLevelDefined())
- {
- return false;
- }
-
- if(isMipmapFiltered(sampler))
- {
- if(!isMipmapComplete())
- {
- return false;
- }
- }
-
- return true;
-}
-
-// Tests for 3D texture (mipmap) completeness. [OpenGL ES 3.0.5] section 3.8.13 page 160.
-bool Texture3D::isMipmapComplete() const
-{
- if(mBaseLevel > mMaxLevel)
- {
- return false;
- }
-
- GLsizei width = image[mBaseLevel]->getWidth();
- GLsizei height = image[mBaseLevel]->getHeight();
- GLsizei depth = image[mBaseLevel]->getDepth();
- bool isTexture2DArray = getTarget() == GL_TEXTURE_2D_ARRAY;
-
- int maxsize = isTexture2DArray ? std::max(width, height) : std::max(std::max(width, height), depth);
- int p = log2(maxsize) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int level = mBaseLevel + 1; level <= q; level++)
- {
- if(!image[level])
- {
- return false;
- }
-
- if(image[level]->getFormat() != image[mBaseLevel]->getFormat())
- {
- return false;
- }
-
- int i = level - mBaseLevel;
-
- if(image[level]->getWidth() != std::max(1, width >> i))
- {
- return false;
- }
-
- if(image[level]->getHeight() != std::max(1, height >> i))
- {
- return false;
- }
-
- int levelDepth = isTexture2DArray ? depth : std::max(1, depth >> i);
- if(image[level]->getDepth() != levelDepth)
- {
- return false;
- }
- }
-
- return true;
-}
-
-bool Texture3D::isCompressed(GLenum target, GLint level) const
-{
- return IsCompressed(getFormat(target, level));
-}
-
-bool Texture3D::isDepth(GLenum target, GLint level) const
-{
- return IsDepthTexture(getFormat(target, level));
-}
-
-void Texture3D::generateMipmaps()
-{
- if(!image[mBaseLevel])
- {
- return; // Image unspecified. Not an error.
- }
-
- if(image[mBaseLevel]->getWidth() == 0 || image[mBaseLevel]->getHeight() == 0 || image[mBaseLevel]->getDepth() == 0)
- {
- return; // Zero dimension. Not an error.
- }
-
- int maxsize = std::max(std::max(image[mBaseLevel]->getWidth(), image[mBaseLevel]->getHeight()), image[mBaseLevel]->getDepth());
- int p = log2(maxsize) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int i = mBaseLevel + 1; i <= q; i++)
- {
- if(image[i])
- {
- image[i]->release();
- }
-
- image[i] = egl::Image::create(this, std::max(image[mBaseLevel]->getWidth() >> i, 1), std::max(image[mBaseLevel]->getHeight() >> i, 1), std::max(image[mBaseLevel]->getDepth() >> i, 1), 0, image[mBaseLevel]->getFormat());
-
- if(!image[i])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- getDevice()->stretchCube(image[i - 1], image[i]);
- }
-}
-
-egl::Image *Texture3D::getImage(unsigned int level)
-{
- return image[level];
-}
-
-Renderbuffer *Texture3D::getRenderbuffer(GLenum target, GLint level)
-{
- if(target != getTarget())
- {
- return error(GL_INVALID_OPERATION, (Renderbuffer*)nullptr);
- }
-
- if(!mColorbufferProxy)
- {
- mColorbufferProxy = new Renderbuffer(name, new RenderbufferTexture3D(this, level));
- }
- else
- {
- mColorbufferProxy->setLevel(level);
- }
-
- return mColorbufferProxy;
-}
-
-egl::Image *Texture3D::getRenderTarget(GLenum target, unsigned int level)
-{
- ASSERT(target == getTarget());
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- if(image[level])
- {
- image[level]->addRef();
- }
-
- return image[level];
-}
-
-bool Texture3D::isShared(GLenum target, unsigned int level) const
-{
- ASSERT(target == getTarget());
- ASSERT(level < IMPLEMENTATION_MAX_TEXTURE_LEVELS);
-
- if(mSurface) // Bound to an EGLSurface
- {
- return true;
- }
-
- if(!image[level])
- {
- return false;
- }
-
- return image[level]->isShared();
-}
-
-Texture2DArray::Texture2DArray(GLuint name) : Texture3D(name)
-{
-}
-
-Texture2DArray::~Texture2DArray()
-{
-}
-
-GLenum Texture2DArray::getTarget() const
-{
- return GL_TEXTURE_2D_ARRAY;
-}
-
-void Texture2DArray::generateMipmaps()
-{
- if(!image[mBaseLevel])
- {
- return; // Image unspecified. Not an error.
- }
-
- if(image[mBaseLevel]->getWidth() == 0 || image[mBaseLevel]->getHeight() == 0 || image[mBaseLevel]->getDepth() == 0)
- {
- return; // Zero dimension. Not an error.
- }
-
- int depth = image[mBaseLevel]->getDepth();
- int maxsize = std::max(image[mBaseLevel]->getWidth(), image[mBaseLevel]->getHeight());
- int p = log2(maxsize) + mBaseLevel;
- int q = std::min(p, mMaxLevel);
-
- for(int i = mBaseLevel + 1; i <= q; i++)
- {
- if(image[i])
- {
- image[i]->release();
- }
-
- GLsizei w = std::max(image[mBaseLevel]->getWidth() >> i, 1);
- GLsizei h = std::max(image[mBaseLevel]->getHeight() >> i, 1);
- image[i] = egl::Image::create(this, w, h, depth, 0, image[mBaseLevel]->getFormat());
-
- if(!image[i])
- {
- return error(GL_OUT_OF_MEMORY);
- }
-
- GLsizei srcw = image[i - 1]->getWidth();
- GLsizei srch = image[i - 1]->getHeight();
- for(int z = 0; z < depth; ++z)
- {
- sw::SliceRectF srcRect(0.0f, 0.0f, static_cast<float>(srcw), static_cast<float>(srch), z);
- sw::SliceRect dstRect(0, 0, w, h, z);
- getDevice()->stretchRect(image[i - 1], &srcRect, image[i], &dstRect, Device::ALL_BUFFERS | Device::USE_FILTER);
- }
- }
-}
-
-TextureExternal::TextureExternal(GLuint name) : Texture2D(name)
-{
- mMinFilter = GL_LINEAR;
- mMagFilter = GL_LINEAR;
- mWrapS = GL_CLAMP_TO_EDGE;
- mWrapT = GL_CLAMP_TO_EDGE;
- mWrapR = GL_CLAMP_TO_EDGE;
-}
-
-TextureExternal::~TextureExternal()
-{
-}
-
-GLenum TextureExternal::getTarget() const
-{
- return GL_TEXTURE_EXTERNAL_OES;
-}
-
-}
-
-NO_SANITIZE_FUNCTION egl::Image *createBackBuffer(int width, int height, sw::Format format, int multiSampleDepth)
-{
- if(width > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || height > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)
- {
- ERR("Invalid parameters: %dx%d", width, height);
- return nullptr;
- }
-
- GLenum internalformat = sw2es::ConvertBackBufferFormat(format);
-
- return egl::Image::create(width, height, internalformat, multiSampleDepth, false);
-}
-
-NO_SANITIZE_FUNCTION egl::Image *createBackBufferFromClientBuffer(const egl::ClientBuffer& clientBuffer)
-{
- if(clientBuffer.getWidth() > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
- clientBuffer.getHeight() > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)
- {
- ERR("Invalid parameters: %dx%d", clientBuffer.getWidth(), clientBuffer.getHeight());
- return nullptr;
- }
-
- return egl::Image::create(clientBuffer);
-}
-
-NO_SANITIZE_FUNCTION egl::Image *createDepthStencil(int width, int height, sw::Format format, int multiSampleDepth)
-{
- if(width > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE || height > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)
- {
- ERR("Invalid parameters: %dx%d", width, height);
- return nullptr;
- }
-
- bool lockable = true;
-
- switch(format)
- {
-// case sw::FORMAT_D15S1:
- case sw::FORMAT_D24S8:
- case sw::FORMAT_D24X8:
-// case sw::FORMAT_D24X4S4:
- case sw::FORMAT_D24FS8:
- case sw::FORMAT_D32:
- case sw::FORMAT_D16:
- lockable = false;
- break;
-// case sw::FORMAT_S8_LOCKABLE:
-// case sw::FORMAT_D16_LOCKABLE:
- case sw::FORMAT_D32F_LOCKABLE:
-// case sw::FORMAT_D32_LOCKABLE:
- case sw::FORMAT_DF24S8:
- case sw::FORMAT_DF16S8:
- lockable = true;
- break;
- default:
- UNREACHABLE(format);
- }
-
- GLenum internalformat = sw2es::ConvertDepthStencilFormat(format);
-
- egl::Image *surface = egl::Image::create(width, height, internalformat, multiSampleDepth, lockable);
-
- if(!surface)
- {
- ERR("Out of memory");
- return nullptr;
- }
-
- return surface;
-}
diff --git a/src/OpenGL/libGLESv2/Texture.h b/src/OpenGL/libGLESv2/Texture.h
deleted file mode 100644
index 1d37da45e..000000000
--- a/src/OpenGL/libGLESv2/Texture.h
+++ /dev/null
@@ -1,417 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// Texture.h: Defines the abstract Texture class and its concrete derived
-// classes Texture2D and TextureCubeMap. Implements GL texture objects and
-// related functionality. [OpenGL ES 2.0.24] section 3.7 page 63.
-
-#ifndef LIBGLESV2_TEXTURE_H_
-#define LIBGLESV2_TEXTURE_H_
-
-#include "Renderbuffer.h"
-#include "common/Object.hpp"
-#include "utilities.h"
-#include "libEGL/Texture.hpp"
-#include "common/debug.h"
-
-#include <GLES2/gl2.h>
-
-#include <vector>
-
-namespace gl { class Surface; }
-
-namespace es2
-{
-class Sampler;
-
-enum
-{
- IMPLEMENTATION_MAX_TEXTURE_LEVELS = sw::MIPMAP_LEVELS,
- IMPLEMENTATION_MAX_TEXTURE_SIZE = 1 << (IMPLEMENTATION_MAX_TEXTURE_LEVELS - 1),
- IMPLEMENTATION_MAX_3D_TEXTURE_SIZE = IMPLEMENTATION_MAX_TEXTURE_SIZE,
- IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE = IMPLEMENTATION_MAX_TEXTURE_SIZE,
- IMPLEMENTATION_MAX_ARRAY_TEXTURE_LAYERS = IMPLEMENTATION_MAX_TEXTURE_SIZE,
- IMPLEMENTATION_MAX_RENDERBUFFER_SIZE = sw::OUTLINE_RESOLUTION,
-};
-
-class ImageLevels
-{
-public:
- inline const egl::Image* operator[](size_t index) const
- {
- return (index < IMPLEMENTATION_MAX_TEXTURE_LEVELS) ? image[index] : nullptr;
- }
-
- inline egl::Image*& operator[](size_t index)
- {
- if(index < IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return image[index];
- }
-
- return getNullImage();
- }
-
- inline void release()
- {
- for(int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- if(image[i])
- {
- image[i]->release();
- image[i] = nullptr;
- }
- }
- }
-
- inline void unbind(const egl::Texture* texture)
- {
- for(int i = 0; i < IMPLEMENTATION_MAX_TEXTURE_LEVELS; i++)
- {
- if(image[i])
- {
- image[i]->unbind(texture);
- image[i] = nullptr;
- }
- }
- }
-
-private:
- egl::Image *image[IMPLEMENTATION_MAX_TEXTURE_LEVELS] = {};
- static egl::Image*& getNullImage();
-};
-
-class Texture : public egl::Texture
-{
-public:
- explicit Texture(GLuint name);
-
- sw::Resource *getResource() const override;
-
- virtual void addProxyRef(const Renderbuffer *proxy) = 0;
- virtual void releaseProxy(const Renderbuffer *proxy) = 0;
-
- virtual GLenum getTarget() const = 0;
-
- bool setMinFilter(GLenum filter);
- bool setMagFilter(GLenum filter);
- bool setWrapS(GLenum wrap);
- bool setWrapT(GLenum wrap);
- bool setWrapR(GLenum wrap);
- bool setMaxAnisotropy(GLfloat textureMaxAnisotropy);
- bool setBaseLevel(GLint baseLevel);
- bool setCompareFunc(GLenum compareFunc);
- bool setCompareMode(GLenum compareMode);
- void makeImmutable(GLsizei levels);
- bool setMaxLevel(GLint maxLevel);
- bool setMaxLOD(GLfloat maxLOD);
- bool setMinLOD(GLfloat minLOD);
- bool setSwizzleR(GLenum swizzleR);
- bool setSwizzleG(GLenum swizzleG);
- bool setSwizzleB(GLenum swizzleB);
- bool setSwizzleA(GLenum swizzleA);
-
- GLenum getMinFilter() const { return mMinFilter; }
- GLenum getMagFilter() const { return mMagFilter; }
- GLenum getWrapS() const { return mWrapS; }
- GLenum getWrapT() const { return mWrapT; }
- GLenum getWrapR() const { return mWrapR; }
- GLfloat getMaxAnisotropy() const { return mMaxAnisotropy; }
- GLint getBaseLevel() const { return mBaseLevel; }
- GLenum getCompareFunc() const { return mCompareFunc; }
- GLenum getCompareMode() const { return mCompareMode; }
- GLboolean getImmutableFormat() const { return mImmutableFormat; }
- GLsizei getImmutableLevels() const { return mImmutableLevels; }
- GLint getMaxLevel() const { return mMaxLevel; }
- GLfloat getMaxLOD() const { return mMaxLOD; }
- GLfloat getMinLOD() const { return mMinLOD; }
- GLenum getSwizzleR() const { return mSwizzleR; }
- GLenum getSwizzleG() const { return mSwizzleG; }
- GLenum getSwizzleB() const { return mSwizzleB; }
- GLenum getSwizzleA() const { return mSwizzleA; }
-
- virtual GLsizei getWidth(GLenum target, GLint level) const = 0;
- virtual GLsizei getHeight(GLenum target, GLint level) const = 0;
- virtual GLsizei getDepth(GLenum target, GLint level) const;
- virtual GLint getFormat(GLenum target, GLint level) const = 0;
- virtual int getTopLevel() const = 0;
- virtual bool hasNonBaseLevels() const = 0;
- virtual bool requiresSync() const = 0;
-
- virtual bool isBaseLevelDefined() const = 0;
- virtual bool isSamplerComplete(Sampler *sampler) const = 0;
- virtual bool isCompressed(GLenum target, GLint level) const = 0;
- virtual bool isDepth(GLenum target, GLint level) const = 0;
-
- virtual Renderbuffer *getRenderbuffer(GLenum target, GLint level) = 0;
- virtual egl::Image *getRenderTarget(GLenum target, unsigned int level) = 0;
- egl::Image *createSharedImage(GLenum target, unsigned int level);
- virtual bool isShared(GLenum target, unsigned int level) const = 0;
-
- virtual void generateMipmaps() = 0;
- virtual void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source) = 0;
-
-protected:
- ~Texture() override;
-
- void setImage(GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels, egl::Image *image);
- void subImage(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels, egl::Image *image);
- void setCompressedImage(GLsizei imageSize, const void *pixels, egl::Image *image);
- void subImageCompressed(GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels, egl::Image *image);
-
- bool copy(egl::Image *source, const sw::SliceRect &sourceRect, GLint xoffset, GLint yoffset, GLint zoffset, egl::Image *dest);
-
- bool isMipmapFiltered(Sampler *sampler) const;
-
- GLenum mMinFilter;
- GLenum mMagFilter;
- GLenum mWrapS;
- GLenum mWrapT;
- GLenum mWrapR;
- GLfloat mMaxAnisotropy;
- GLint mBaseLevel;
- GLenum mCompareFunc;
- GLenum mCompareMode;
- GLboolean mImmutableFormat;
- GLsizei mImmutableLevels;
- GLint mMaxLevel;
- GLfloat mMaxLOD;
- GLfloat mMinLOD;
- GLenum mSwizzleR;
- GLenum mSwizzleG;
- GLenum mSwizzleB;
- GLenum mSwizzleA;
-
- sw::Resource *resource;
-};
-
-class Texture2D : public Texture
-{
-public:
- explicit Texture2D(GLuint name);
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
- void sweep() override;
-
- GLenum getTarget() const override;
-
- GLsizei getWidth(GLenum target, GLint level) const override;
- GLsizei getHeight(GLenum target, GLint level) const override;
- GLint getFormat(GLenum target, GLint level) const override;
- int getTopLevel() const override;
- bool hasNonBaseLevels() const override;
- bool requiresSync() const override;
-
- void setImage(GLint level, GLsizei width, GLsizei height, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
- void subImage(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
- void copyImage(GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source);
- void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source) override;
-
- void setSharedImage(egl::Image *image);
-
- bool isBaseLevelDefined() const override;
- bool isSamplerComplete(Sampler *sampler) const override;
- bool isCompressed(GLenum target, GLint level) const override;
- bool isDepth(GLenum target, GLint level) const override;
-
- void bindTexImage(gl::Surface *surface);
- void releaseTexImage() override;
-
- void generateMipmaps() override;
-
- Renderbuffer *getRenderbuffer(GLenum target, GLint level) override;
- egl::Image *getRenderTarget(GLenum target, unsigned int level) override;
- bool isShared(GLenum target, unsigned int level) const override;
-
- egl::Image *getImage(unsigned int level);
-
-protected:
- ~Texture2D() override;
-
- bool isMipmapComplete() const;
-
- ImageLevels image;
-
- gl::Surface *mSurface;
-
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to null if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mColorbufferProxy;
- unsigned int mProxyRefs;
-};
-
-class Texture2DRect : public Texture2D
-{
-public:
- explicit Texture2DRect(GLuint name);
-
- GLenum getTarget() const override;
-
- Renderbuffer *getRenderbuffer(GLenum target, GLint level) override;
-};
-
-class TextureCubeMap : public Texture
-{
-public:
- explicit TextureCubeMap(GLuint name);
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
- void sweep() override;
-
- GLenum getTarget() const override;
-
- GLsizei getWidth(GLenum target, GLint level) const override;
- GLsizei getHeight(GLenum target, GLint level) const override;
- GLint getFormat(GLenum target, GLint level) const override;
- int getTopLevel() const override;
- bool hasNonBaseLevels() const override;
- bool requiresSync() const override;
-
- void setImage(GLenum target, GLint level, GLsizei width, GLsizei height, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void setCompressedImage(GLenum target, GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei imageSize, const void *pixels);
-
- void subImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void subImageCompressed(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *pixels);
- void copyImage(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source);
- void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source) override;
-
- bool isBaseLevelDefined() const override;
- bool isSamplerComplete(Sampler *sampler) const override;
- bool isCompressed(GLenum target, GLint level) const override;
- bool isDepth(GLenum target, GLint level) const override;
- void releaseTexImage() override;
-
- void generateMipmaps() override;
- void updateBorders(int level);
-
- Renderbuffer *getRenderbuffer(GLenum target, GLint level) override;
- egl::Image *getRenderTarget(GLenum target, unsigned int level) override;
- bool isShared(GLenum target, unsigned int level) const override;
-
- egl::Image *getImage(int face, unsigned int level);
-
- bool isCubeComplete() const;
-
-protected:
- ~TextureCubeMap() override;
-
-private:
- bool isMipmapCubeComplete() const;
-
- // face is one of the GL_TEXTURE_CUBE_MAP_* enumerants. Returns nullptr on failure.
- egl::Image *getImage(GLenum face, unsigned int level);
-
- ImageLevels image[6];
-
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to null if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mFaceProxies[6];
- unsigned int mFaceProxyRefs[6];
-};
-
-class Texture3D : public Texture
-{
-public:
- explicit Texture3D(GLuint name);
-
- void addProxyRef(const Renderbuffer *proxy) override;
- void releaseProxy(const Renderbuffer *proxy) override;
- void sweep() override;
-
- GLenum getTarget() const override;
-
- GLsizei getWidth(GLenum target, GLint level) const override;
- GLsizei getHeight(GLenum target, GLint level) const override;
- GLsizei getDepth(GLenum target, GLint level) const override;
- GLint getFormat(GLenum target, GLint level) const override;
- int getTopLevel() const override;
- bool hasNonBaseLevels() const override;
- bool requiresSync() const override;
-
- void setImage(GLint level, GLsizei width, GLsizei height, GLsizei depth, GLint internalformat, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void setCompressedImage(GLint level, GLenum format, GLsizei width, GLsizei height, GLsizei depth, GLsizei imageSize, const void *pixels);
- void subImage(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const gl::PixelStorageModes &unpackParameters, const void *pixels);
- void subImageCompressed(GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *pixels);
- void copyImage(GLint level, GLenum internalformat, GLint x, GLint y, GLint z, GLsizei width, GLsizei height, GLsizei depth, Renderbuffer *source);
- void copySubImage(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height, Renderbuffer *source) override;
-
- void setSharedImage(egl::Image *image);
-
- bool isBaseLevelDefined() const override;
- bool isSamplerComplete(Sampler *sampler) const override;
- bool isCompressed(GLenum target, GLint level) const override;
- bool isDepth(GLenum target, GLint level) const override;
- void releaseTexImage() override;
-
- void generateMipmaps() override;
-
- Renderbuffer *getRenderbuffer(GLenum target, GLint level) override;
- egl::Image *getRenderTarget(GLenum target, unsigned int level) override;
- bool isShared(GLenum target, unsigned int level) const override;
-
- egl::Image *getImage(unsigned int level);
-
-protected:
- ~Texture3D() override;
-
- bool isMipmapComplete() const;
-
- ImageLevels image;
-
- gl::Surface *mSurface;
-
- // A specific internal reference count is kept for colorbuffer proxy references,
- // because, as the renderbuffer acting as proxy will maintain a binding pointer
- // back to this texture, there would be a circular reference if we used a binding
- // pointer here. This reference count will cause the pointer to be set to null if
- // the count drops to zero, but will not cause deletion of the Renderbuffer.
- Renderbuffer *mColorbufferProxy;
- unsigned int mProxyRefs;
-};
-
-class Texture2DArray : public Texture3D
-{
-public:
- explicit Texture2DArray(GLuint name);
-
- GLenum getTarget() const override;
- void generateMipmaps() override;
-
-protected:
- ~Texture2DArray() override;
-};
-
-class TextureExternal : public Texture2D
-{
-public:
- explicit TextureExternal(GLuint name);
-
- GLenum getTarget() const override;
-
-protected:
- ~TextureExternal() override;
-};
-}
-
-#endif // LIBGLESV2_TEXTURE_H_
diff --git a/src/OpenGL/libGLESv2/TransformFeedback.cpp b/src/OpenGL/libGLESv2/TransformFeedback.cpp
deleted file mode 100644
index 0ab6e9554..000000000
--- a/src/OpenGL/libGLESv2/TransformFeedback.cpp
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// TransformFeedback.cpp: Implements the es2::TransformFeedback class
-
-#include "TransformFeedback.h"
-
-namespace es2
-{
-
-TransformFeedback::TransformFeedback(GLuint name) : NamedObject(name), mActive(false), mPaused(false), mVertexOffset(0)
-{
-}
-
-TransformFeedback::~TransformFeedback()
-{
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS; ++i)
- {
- mBuffer[i].set(nullptr);
- }
-}
-
-Buffer* TransformFeedback::getBuffer(GLuint index) const
-{
- return mBuffer[index].get();
-}
-
-GLuint TransformFeedback::getBufferName(GLuint index) const
-{
- return mBuffer[index].get().name();
-}
-
-int TransformFeedback::getOffset(GLuint index) const
-{
- return mBuffer[index].getOffset();
-}
-
-int TransformFeedback::getSize(GLuint index) const
-{
- return mBuffer[index].getSize();
-}
-
-void TransformFeedback::addVertexOffset(int count)
-{
- if(isActive() && !isPaused())
- {
- mVertexOffset += count;
- }
-}
-
-int TransformFeedback::vertexOffset() const
-{
- return mVertexOffset;
-}
-
-bool TransformFeedback::isActive() const
-{
- return mActive;
-}
-
-bool TransformFeedback::isPaused() const
-{
- return mPaused;
-}
-
-GLenum TransformFeedback::primitiveMode() const
-{
- return mPrimitiveMode;
-}
-
-void TransformFeedback::begin(GLenum primitiveMode)
-{
- mActive = true; mPrimitiveMode = primitiveMode;
-}
-
-void TransformFeedback::end()
-{
- mActive = false;
- mPaused = false;
- mVertexOffset = 0;
-}
-
-void TransformFeedback::setPaused(bool paused)
-{
- mPaused = paused;
-}
-
-void TransformFeedback::setBuffer(GLuint index, Buffer* buffer)
-{
- mBuffer[index].set(buffer);
-}
-
-void TransformFeedback::setBuffer(GLuint index, Buffer* buffer, GLintptr offset, GLsizeiptr size)
-{
- mBuffer[index].set(buffer, static_cast<int>(offset), static_cast<int>(size));
-}
-
-void TransformFeedback::detachBuffer(GLuint buffer)
-{
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS; ++i)
- {
- if(mBuffer[i].get().name() == buffer)
- {
- mBuffer[i].set(nullptr);
- }
- }
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/TransformFeedback.h b/src/OpenGL/libGLESv2/TransformFeedback.h
deleted file mode 100644
index 787de0e2e..000000000
--- a/src/OpenGL/libGLESv2/TransformFeedback.h
+++ /dev/null
@@ -1,66 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// TransformFeedback.h: Defines the es2::TransformFeedback class
-
-#ifndef LIBGLESV2_TRANSFORM_FEEDBACK_H_
-#define LIBGLESV2_TRANSFORM_FEEDBACK_H_
-
-#include "Buffer.h"
-#include "Context.h"
-#include "common/Object.hpp"
-#include "Renderer/Renderer.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class TransformFeedback : public gl::NamedObject
-{
-public:
- TransformFeedback(GLuint name);
- ~TransformFeedback();
-
- BufferBinding* getBuffers() { return mBuffer; }
-
- Buffer* getBuffer(GLuint index) const;
- GLuint getBufferName(GLuint index) const;
- int getOffset(GLuint index) const;
- int getSize(GLuint index) const;
- bool isActive() const;
- bool isPaused() const;
- GLenum primitiveMode() const;
- int vertexOffset() const;
-
- void setBuffer(GLuint index, Buffer* buffer);
- void setBuffer(GLuint index, Buffer* buffer, GLintptr offset, GLsizeiptr size);
- void detachBuffer(GLuint buffer);
- void begin(GLenum primitiveMode);
- void end();
- void setPaused(bool paused);
- void addVertexOffset(int count);
-
-private:
- BufferBinding mBuffer[MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS];
-
- bool mActive;
- bool mPaused;
- GLenum mPrimitiveMode;
- int mVertexOffset;
-};
-
-}
-
-#endif // LIBGLESV2_TRANSFORM_FEEDBACK_H_
diff --git a/src/OpenGL/libGLESv2/VertexArray.cpp b/src/OpenGL/libGLESv2/VertexArray.cpp
deleted file mode 100644
index 64ae221d4..000000000
--- a/src/OpenGL/libGLESv2/VertexArray.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexArray.h"
-
-namespace es2
-{
-
-VertexArray::VertexArray(GLuint name) : gl::NamedObject(name)
-{
-}
-
-VertexArray::~VertexArray()
-{
- for(size_t i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- mVertexAttributes[i].mBoundBuffer = nullptr;
- }
- mElementArrayBuffer = nullptr;
-}
-
-void VertexArray::detachBuffer(GLuint bufferName)
-{
- for(size_t attribute = 0; attribute < MAX_VERTEX_ATTRIBS; attribute++)
- {
- if(mVertexAttributes[attribute].mBoundBuffer.name() == bufferName)
- {
- mVertexAttributes[attribute].mBoundBuffer = nullptr;
- }
- }
-
- if(mElementArrayBuffer.name() == bufferName)
- {
- mElementArrayBuffer = nullptr;
- }
-}
-
-const VertexAttribute& VertexArray::getVertexAttribute(size_t attributeIndex) const
-{
- ASSERT(attributeIndex < MAX_VERTEX_ATTRIBS);
- return mVertexAttributes[attributeIndex];
-}
-
-void VertexArray::setVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- ASSERT(index < MAX_VERTEX_ATTRIBS);
- mVertexAttributes[index].mDivisor = divisor;
-}
-
-void VertexArray::enableAttribute(unsigned int attributeIndex, bool enabledState)
-{
- ASSERT(attributeIndex < MAX_VERTEX_ATTRIBS);
- mVertexAttributes[attributeIndex].mArrayEnabled = enabledState;
-}
-
-void VertexArray::setAttributeState(unsigned int attributeIndex, Buffer *boundBuffer, GLint size, GLenum type,
- bool normalized, bool pureInteger, GLsizei stride, const void *pointer)
-{
- ASSERT(attributeIndex < MAX_VERTEX_ATTRIBS);
- mVertexAttributes[attributeIndex].mBoundBuffer = boundBuffer;
- mVertexAttributes[attributeIndex].mSize = size;
- mVertexAttributes[attributeIndex].mType = type;
- mVertexAttributes[attributeIndex].mNormalized = normalized;
- mVertexAttributes[attributeIndex].mPureInteger = pureInteger;
- mVertexAttributes[attributeIndex].mStride = stride;
- mVertexAttributes[attributeIndex].mPointer = pointer;
-}
-
-void VertexArray::setElementArrayBuffer(Buffer *buffer)
-{
- mElementArrayBuffer = buffer;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/VertexArray.h b/src/OpenGL/libGLESv2/VertexArray.h
deleted file mode 100644
index bb0f480e6..000000000
--- a/src/OpenGL/libGLESv2/VertexArray.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// VertexArray.h: Defines the es2::VertexArray class
-
-#ifndef LIBGLESV2_VERTEX_ARRAY_H_
-#define LIBGLESV2_VERTEX_ARRAY_H_
-
-#include "Buffer.h"
-#include "Context.h"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-class VertexArray : public gl::NamedObject
-{
-public:
- VertexArray(GLuint name);
- ~VertexArray();
-
- const VertexAttribute& getVertexAttribute(size_t attributeIndex) const;
- VertexAttributeArray& getVertexAttributes() { return mVertexAttributes; }
-
- void detachBuffer(GLuint bufferName);
- void setVertexAttribDivisor(GLuint index, GLuint divisor);
- void enableAttribute(unsigned int attributeIndex, bool enabledState);
- void setAttributeState(unsigned int attributeIndex, Buffer *boundBuffer, GLint size, GLenum type,
- bool normalized, bool pureInteger, GLsizei stride, const void *pointer);
-
- Buffer *getElementArrayBuffer() const { return mElementArrayBuffer; }
- void setElementArrayBuffer(Buffer *buffer);
-
-private:
- VertexAttributeArray mVertexAttributes;
- gl::BindingPointer<Buffer> mElementArrayBuffer;
-};
-
-}
-
-#endif // LIBGLESV2_VERTEX_ARRAY_H_
diff --git a/src/OpenGL/libGLESv2/VertexDataManager.cpp b/src/OpenGL/libGLESv2/VertexDataManager.cpp
deleted file mode 100644
index 59062f7cb..000000000
--- a/src/OpenGL/libGLESv2/VertexDataManager.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#include "VertexDataManager.h"
-
-#include "Buffer.h"
-#include "Program.h"
-#include "IndexDataManager.h"
-#include "common/debug.h"
-
-namespace
-{
- enum {INITIAL_STREAM_BUFFER_SIZE = 1024 * 1024};
-}
-
-namespace es2
-{
-
-VertexDataManager::VertexDataManager(Context *context) : mContext(context)
-{
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- mDirtyCurrentValue[i] = true;
- mCurrentValueBuffer[i] = nullptr;
- }
-
- mStreamingBuffer = new StreamingVertexBuffer(INITIAL_STREAM_BUFFER_SIZE);
-
- if(!mStreamingBuffer)
- {
- ERR("Failed to allocate the streaming vertex buffer.");
- }
-}
-
-VertexDataManager::~VertexDataManager()
-{
- delete mStreamingBuffer;
-
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- delete mCurrentValueBuffer[i];
- }
-}
-
-unsigned int VertexDataManager::writeAttributeData(StreamingVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute)
-{
- Buffer *buffer = attribute.mBoundBuffer;
-
- int inputStride = attribute.stride();
- int elementSize = attribute.typeSize();
- unsigned int streamOffset = 0;
-
- char *output = nullptr;
-
- if(vertexBuffer)
- {
- output = (char*)vertexBuffer->map(attribute, attribute.typeSize() * count, &streamOffset);
- }
-
- if(!output)
- {
- ERR("Failed to map vertex buffer.");
- return ~0u;
- }
-
- const char *input = nullptr;
-
- if(buffer)
- {
- input = static_cast<const char*>(buffer->data()) + attribute.mOffset;
- }
- else
- {
- input = static_cast<const char*>(attribute.mPointer);
- }
-
- input += inputStride * start;
-
- if(inputStride == elementSize)
- {
- memcpy(output, input, count * inputStride);
- }
- else
- {
- for(int i = 0; i < count; i++)
- {
- memcpy(output, input, elementSize);
- output += elementSize;
- input += inputStride;
- }
- }
-
- vertexBuffer->unmap();
-
- return streamOffset;
-}
-
-GLenum VertexDataManager::prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *translated, GLsizei instanceId)
-{
- if(!mStreamingBuffer)
- {
- return GL_OUT_OF_MEMORY;
- }
-
- const VertexAttributeArray &attribs = mContext->getVertexArrayAttributes();
- const VertexAttributeArray &currentAttribs = mContext->getCurrentVertexAttributes();
- Program *program = mContext->getCurrentProgram();
-
- // Determine the required storage size per used buffer
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- const VertexAttribute &attrib = attribs[i].mArrayEnabled ? attribs[i] : currentAttribs[i];
-
- if(program->getAttributeStream(i) != -1 && attrib.mArrayEnabled)
- {
- if(!attrib.mBoundBuffer)
- {
- const bool isInstanced = attrib.mDivisor > 0;
- mStreamingBuffer->addRequiredSpace(attrib.typeSize() * (isInstanced ? 1 : count));
- }
- }
- }
-
- mStreamingBuffer->reserveRequiredSpace();
-
- // Perform the vertex data translations
- for(int i = 0; i < MAX_VERTEX_ATTRIBS; i++)
- {
- if(program->getAttributeStream(i) != -1)
- {
- const VertexAttribute &attrib = attribs[i].mArrayEnabled ? attribs[i] : currentAttribs[i];
-
- if(attrib.mArrayEnabled)
- {
- const bool isInstanced = attrib.mDivisor > 0;
-
- // Instanced vertices do not apply the 'start' offset
- GLint firstVertexIndex = isInstanced ? instanceId / attrib.mDivisor : start;
-
- Buffer *buffer = attrib.mBoundBuffer;
-
- if((!buffer && attrib.mPointer == nullptr) || (buffer && !buffer->data()))
- {
- // This is an application error that would normally result in a crash, but we catch it and return an error
- ERR("An enabled vertex array has no buffer and no pointer.");
- return GL_INVALID_OPERATION;
- }
-
- sw::Resource *staticBuffer = buffer ? buffer->getResource() : nullptr;
-
- if(staticBuffer)
- {
- translated[i].vertexBuffer = staticBuffer;
- translated[i].offset = firstVertexIndex * attrib.stride() + static_cast<int>(attrib.mOffset);
- translated[i].stride = isInstanced ? 0 : attrib.stride();
- }
- else
- {
- unsigned int streamOffset = writeAttributeData(mStreamingBuffer, firstVertexIndex, isInstanced ? 1 : count, attrib);
-
- if(streamOffset == ~0u)
- {
- return GL_OUT_OF_MEMORY;
- }
-
- translated[i].vertexBuffer = mStreamingBuffer->getResource();
- translated[i].offset = streamOffset;
- translated[i].stride = isInstanced ? 0 : attrib.typeSize();
- }
-
- switch(attrib.mType)
- {
- case GL_BYTE: translated[i].type = sw::STREAMTYPE_SBYTE; break;
- case GL_UNSIGNED_BYTE: translated[i].type = sw::STREAMTYPE_BYTE; break;
- case GL_SHORT: translated[i].type = sw::STREAMTYPE_SHORT; break;
- case GL_UNSIGNED_SHORT: translated[i].type = sw::STREAMTYPE_USHORT; break;
- case GL_INT: translated[i].type = sw::STREAMTYPE_INT; break;
- case GL_UNSIGNED_INT: translated[i].type = sw::STREAMTYPE_UINT; break;
- case GL_FIXED: translated[i].type = sw::STREAMTYPE_FIXED; break;
- case GL_FLOAT: translated[i].type = sw::STREAMTYPE_FLOAT; break;
- case GL_HALF_FLOAT: translated[i].type = sw::STREAMTYPE_HALF; break;
- case GL_HALF_FLOAT_OES: translated[i].type = sw::STREAMTYPE_HALF; break;
- case GL_INT_2_10_10_10_REV: translated[i].type = sw::STREAMTYPE_2_10_10_10_INT; break;
- case GL_UNSIGNED_INT_2_10_10_10_REV: translated[i].type = sw::STREAMTYPE_2_10_10_10_UINT; break;
- default: UNREACHABLE(attrib.mType); translated[i].type = sw::STREAMTYPE_FLOAT; break;
- }
-
- translated[i].count = attrib.mSize;
- translated[i].normalized = attrib.mNormalized;
- }
- else
- {
- if(mDirtyCurrentValue[i])
- {
- delete mCurrentValueBuffer[i];
- mCurrentValueBuffer[i] = new ConstantVertexBuffer(attrib.getCurrentValueBitsAsFloat(0), attrib.getCurrentValueBitsAsFloat(1), attrib.getCurrentValueBitsAsFloat(2), attrib.getCurrentValueBitsAsFloat(3));
- mDirtyCurrentValue[i] = false;
- }
-
- translated[i].vertexBuffer = mCurrentValueBuffer[i]->getResource();
-
- switch(attrib.currentValueType())
- {
- case GL_INT:
- translated[i].type = sw::STREAMTYPE_INT;
- break;
- case GL_UNSIGNED_INT:
- translated[i].type = sw::STREAMTYPE_UINT;
- break;
- default:
- translated[i].type = sw::STREAMTYPE_FLOAT;
- break;
- }
- translated[i].count = 4;
- translated[i].stride = 0;
- translated[i].offset = 0;
- translated[i].normalized = false;
- }
- }
- }
-
- return GL_NO_ERROR;
-}
-
-VertexBuffer::VertexBuffer(unsigned int size) : mVertexBuffer(nullptr)
-{
- if(size > 0)
- {
- mVertexBuffer = new sw::Resource(size + 1024);
-
- if(!mVertexBuffer)
- {
- ERR("Out of memory allocating a vertex buffer of size %u.", size);
- }
- }
-}
-
-VertexBuffer::~VertexBuffer()
-{
- if(mVertexBuffer)
- {
- mVertexBuffer->destruct();
- }
-}
-
-void VertexBuffer::unmap()
-{
- if(mVertexBuffer)
- {
- mVertexBuffer->unlock();
- }
-}
-
-sw::Resource *VertexBuffer::getResource() const
-{
- return mVertexBuffer;
-}
-
-ConstantVertexBuffer::ConstantVertexBuffer(float x, float y, float z, float w) : VertexBuffer(4 * sizeof(float))
-{
- if(mVertexBuffer)
- {
- float *vector = (float*)mVertexBuffer->lock(sw::PUBLIC);
-
- vector[0] = x;
- vector[1] = y;
- vector[2] = z;
- vector[3] = w;
-
- mVertexBuffer->unlock();
- }
-}
-
-ConstantVertexBuffer::~ConstantVertexBuffer()
-{
-}
-
-StreamingVertexBuffer::StreamingVertexBuffer(unsigned int size) : VertexBuffer(size)
-{
- mBufferSize = size;
- mWritePosition = 0;
- mRequiredSpace = 0;
-}
-
-StreamingVertexBuffer::~StreamingVertexBuffer()
-{
-}
-
-void StreamingVertexBuffer::addRequiredSpace(unsigned int requiredSpace)
-{
- mRequiredSpace += requiredSpace;
-}
-
-void *StreamingVertexBuffer::map(const VertexAttribute &attribute, unsigned int requiredSpace, unsigned int *offset)
-{
- void *mapPtr = nullptr;
-
- if(mVertexBuffer)
- {
- // We can use a private lock because we never overwrite the content
- mapPtr = (char*)mVertexBuffer->lock(sw::PRIVATE) + mWritePosition;
-
- *offset = mWritePosition;
- mWritePosition += requiredSpace;
- }
-
- return mapPtr;
-}
-
-void StreamingVertexBuffer::reserveRequiredSpace()
-{
- if(mRequiredSpace > mBufferSize)
- {
- if(mVertexBuffer)
- {
- mVertexBuffer->destruct();
- mVertexBuffer = 0;
- }
-
- mBufferSize = std::max(mRequiredSpace, 3 * mBufferSize / 2); // 1.5 x mBufferSize is arbitrary and should be checked to see we don't have too many reallocations.
-
- mVertexBuffer = new sw::Resource(mBufferSize);
-
- if(!mVertexBuffer)
- {
- ERR("Out of memory allocating a vertex buffer of size %u.", mBufferSize);
- }
-
- mWritePosition = 0;
- }
- else if(mWritePosition + mRequiredSpace > mBufferSize) // Recycle
- {
- if(mVertexBuffer)
- {
- mVertexBuffer->destruct();
- mVertexBuffer = new sw::Resource(mBufferSize);
- }
-
- mWritePosition = 0;
- }
-
- mRequiredSpace = 0;
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/VertexDataManager.h b/src/OpenGL/libGLESv2/VertexDataManager.h
deleted file mode 100644
index caf1ffa05..000000000
--- a/src/OpenGL/libGLESv2/VertexDataManager.h
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// VertexDataManager.h: Defines the VertexDataManager, a class that
-// runs the Buffer translation process.
-
-#ifndef LIBGLESV2_VERTEXDATAMANAGER_H_
-#define LIBGLESV2_VERTEXDATAMANAGER_H_
-
-#include "Context.h"
-#include "Device.hpp"
-
-#include <GLES2/gl2.h>
-
-namespace es2
-{
-
-struct TranslatedAttribute
-{
- sw::StreamType type;
- int count;
- bool normalized;
-
- unsigned int offset;
- unsigned int stride; // 0 means not to advance the read pointer at all
-
- sw::Resource *vertexBuffer;
-};
-
-class VertexBuffer
-{
-public:
- VertexBuffer(unsigned int size);
- virtual ~VertexBuffer();
-
- void unmap();
-
- sw::Resource *getResource() const;
-
-protected:
- sw::Resource *mVertexBuffer;
-};
-
-class ConstantVertexBuffer : public VertexBuffer
-{
-public:
- ConstantVertexBuffer(float x, float y, float z, float w);
- ~ConstantVertexBuffer();
-};
-
-class StreamingVertexBuffer : public VertexBuffer
-{
-public:
- StreamingVertexBuffer(unsigned int size);
- ~StreamingVertexBuffer();
-
- void *map(const VertexAttribute &attribute, unsigned int requiredSpace, unsigned int *streamOffset);
- void reserveRequiredSpace();
- void addRequiredSpace(unsigned int requiredSpace);
-
-protected:
- unsigned int mBufferSize;
- unsigned int mWritePosition;
- unsigned int mRequiredSpace;
-};
-
-class VertexDataManager
-{
-public:
- VertexDataManager(Context *context);
- virtual ~VertexDataManager();
-
- void dirtyCurrentValue(int index) { mDirtyCurrentValue[index] = true; }
-
- GLenum prepareVertexData(GLint start, GLsizei count, TranslatedAttribute *outAttribs, GLsizei instanceId);
-
-private:
- unsigned int writeAttributeData(StreamingVertexBuffer *vertexBuffer, GLint start, GLsizei count, const VertexAttribute &attribute);
-
- Context *const mContext;
-
- StreamingVertexBuffer *mStreamingBuffer;
-
- bool mDirtyCurrentValue[MAX_VERTEX_ATTRIBS];
- ConstantVertexBuffer *mCurrentValueBuffer[MAX_VERTEX_ATTRIBS];
-};
-
-}
-
-#endif // LIBGLESV2_VERTEXDATAMANAGER_H_
diff --git a/src/OpenGL/libGLESv2/entry_points.cpp b/src/OpenGL/libGLESv2/entry_points.cpp
deleted file mode 100644
index dac5d3f19..000000000
--- a/src/OpenGL/libGLESv2/entry_points.cpp
+++ /dev/null
@@ -1,1754 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// entry_points.cpp: GL entry points exports and definition
-
-#include "entry_points.h"
-#include "libEGL/main.h"
-#include "main.h"
-
-extern "C"
-{
-GL_APICALL void GL_APIENTRY glActiveTexture(GLenum texture)
-{
- return gl::ActiveTexture(texture);
-}
-
-GL_APICALL void GL_APIENTRY glAttachShader(GLuint program, GLuint shader)
-{
- return gl::AttachShader(program, shader);
-}
-
-GL_APICALL void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint name)
-{
- return gl::BeginQueryEXT(target, name);
-}
-
-GL_APICALL void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name)
-{
- return gl::BindAttribLocation(program, index, name);
-}
-
-GL_APICALL void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer)
-{
- return gl::BindBuffer(target, buffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer)
-{
- return gl::BindFramebuffer(target, framebuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindFramebufferOES(GLenum target, GLuint framebuffer)
-{
- return gl::BindFramebuffer(target, framebuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- return gl::BindRenderbuffer(target, renderbuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindRenderbufferOES(GLenum target, GLuint renderbuffer)
-{
- return gl::BindRenderbuffer(target, renderbuffer);
-}
-
-GL_APICALL void GL_APIENTRY glBindTexture(GLenum target, GLuint texture)
-{
- return gl::BindTexture(target, texture);
-}
-
-GL_APICALL void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- return gl::BlendColor(red, green, blue, alpha);
-}
-
-GL_APICALL void GL_APIENTRY glBlendEquation(GLenum mode)
-{
- return gl::BlendEquation(mode);
-}
-
-GL_APICALL void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- return gl::BlendEquationSeparate(modeRGB, modeAlpha);
-}
-
-GL_APICALL void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor)
-{
- return gl::BlendFunc(sfactor, dfactor);
-}
-
-GL_APICALL void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- return gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha);
-}
-
-GL_APICALL void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- return gl::BufferData(target, size, data, usage);
-}
-
-GL_APICALL void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- return gl::BufferSubData(target, offset, size, data);
-}
-
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target)
-{
- return gl::CheckFramebufferStatus(target);
-}
-
-GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatusOES(GLenum target)
-{
- return gl::CheckFramebufferStatus(target);
-}
-
-GL_APICALL void GL_APIENTRY glClear(GLbitfield mask)
-{
- return gl::Clear(mask);
-}
-
-GL_APICALL void GL_APIENTRY glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- return gl::ClearColor(red, green, blue, alpha);
-}
-
-GL_APICALL void GL_APIENTRY glClearDepthf(GLclampf depth)
-{
- return gl::ClearDepthf(depth);
-}
-
-GL_APICALL void GL_APIENTRY glClearStencil(GLint s)
-{
- return gl::ClearStencil(s);
-}
-
-GL_APICALL void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- return gl::ColorMask(red, green, blue, alpha);
-}
-
-GL_APICALL void GL_APIENTRY glCompileShader(GLuint shader)
-{
- return gl::CompileShader(shader);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid* data)
-{
- return gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- return gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- return gl::CopyTexImage2D(target, level, internalformat, x, y, width, height, border);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
-}
-
-GL_APICALL GLuint GL_APIENTRY glCreateProgram(void)
-{
- return gl::CreateProgram();
-}
-
-GL_APICALL GLuint GL_APIENTRY glCreateShader(GLenum type)
-{
- return gl::CreateShader(type);
-}
-
-GL_APICALL void GL_APIENTRY glCullFace(GLenum mode)
-{
- return gl::CullFace(mode);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- return gl::DeleteBuffers(n, buffers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences)
-{
- return gl::DeleteFencesNV(n, fences);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- return gl::DeleteFramebuffers(n, framebuffers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
-{
- return gl::DeleteFramebuffers(n, framebuffers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteProgram(GLuint program)
-{
- return gl::DeleteProgram(program);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteQueriesEXT(n, ids);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- return gl::DeleteRenderbuffers(n, renderbuffers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
-{
- return gl::DeleteRenderbuffers(n, renderbuffers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteShader(GLuint shader)
-{
- return gl::DeleteShader(shader);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures)
-{
- return gl::DeleteTextures(n, textures);
-}
-
-GL_APICALL void GL_APIENTRY glDepthFunc(GLenum func)
-{
- return gl::DepthFunc(func);
-}
-
-GL_APICALL void GL_APIENTRY glDepthMask(GLboolean flag)
-{
- return gl::DepthMask(flag);
-}
-
-GL_APICALL void GL_APIENTRY glDepthRangef(GLclampf zNear, GLclampf zFar)
-{
- return gl::DepthRangef(zNear, zFar);
-}
-
-GL_APICALL void GL_APIENTRY glDetachShader(GLuint program, GLuint shader)
-{
- return gl::DetachShader(program, shader);
-}
-
-GL_APICALL void GL_APIENTRY glDisable(GLenum cap)
-{
- return gl::Disable(cap);
-}
-
-GL_APICALL void GL_APIENTRY glDisableVertexAttribArray(GLuint index)
-{
- return gl::DisableVertexAttribArray(index);
-}
-
-GL_APICALL void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- return gl::DrawArrays(mode, first, count);
-}
-
-GL_APICALL void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
- return gl::DrawElements(mode, count, type, indices);
-}
-
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- return gl::DrawArraysInstancedEXT(mode, first, count, instanceCount);
-}
-
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- return gl::DrawElementsInstancedEXT(mode, count, type, indices, instanceCount);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT(GLuint index, GLuint divisor)
-{
- return gl::VertexAttribDivisorEXT(index, divisor);
-}
-
-GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- return gl::DrawArraysInstancedANGLE(mode, first, count, instanceCount);
-}
-
-GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- return gl::DrawElementsInstancedANGLE(mode, count, type, indices, instanceCount);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor)
-{
- return gl::VertexAttribDivisorANGLE(index, divisor);
-}
-
-GL_APICALL void GL_APIENTRY glEnable(GLenum cap)
-{
- return gl::Enable(cap);
-}
-
-GL_APICALL void GL_APIENTRY glEnableVertexAttribArray(GLuint index)
-{
- return gl::EnableVertexAttribArray(index);
-}
-
-GL_APICALL void GL_APIENTRY glEndQueryEXT(GLenum target)
-{
- return gl::EndQueryEXT(target);
-}
-
-GL_APICALL void GL_APIENTRY glFinishFenceNV(GLuint fence)
-{
- return gl::FinishFenceNV(fence);
-}
-
-GL_APICALL void GL_APIENTRY glFinish(void)
-{
- return gl::Finish();
-}
-
-GL_APICALL void GL_APIENTRY glFlush(void)
-{
- return gl::Flush();
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- return gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- return gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- return gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- return gl::FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-GL_APICALL void GL_APIENTRY glFrontFace(GLenum mode)
-{
- return gl::FrontFace(mode);
-}
-
-GL_APICALL void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers)
-{
- return gl::GenBuffers(n, buffers);
-}
-
-GL_APICALL void GL_APIENTRY glGenerateMipmap(GLenum target)
-{
- return gl::GenerateMipmap(target);
-}
-
-GL_APICALL void GL_APIENTRY glGenerateMipmapOES(GLenum target)
-{
- return gl::GenerateMipmap(target);
-}
-
-GL_APICALL void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences)
-{
- return gl::GenFencesNV(n, fences);
-}
-
-GL_APICALL void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- return gl::GenFramebuffers(n, framebuffers);
-}
-
-GL_APICALL void GL_APIENTRY glGenFramebuffersOES(GLsizei n, GLuint* framebuffers)
-{
- return gl::GenFramebuffers(n, framebuffers);
-}
-
-GL_APICALL void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint* ids)
-{
- return gl::GenQueriesEXT(n, ids);
-}
-
-GL_APICALL void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- return gl::GenRenderbuffers(n, renderbuffers);
-}
-
-GL_APICALL void GL_APIENTRY glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
-{
- return gl::GenRenderbuffers(n, renderbuffers);
-}
-
-GL_APICALL void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures)
-{
- return gl::GenTextures(n, textures);
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- return gl::GetActiveAttrib(program, index, bufsize, length, size, type, name);
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- return gl::GetActiveUniform(program, index, bufsize, length, size, type, name);
-}
-
-GL_APICALL void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- return gl::GetAttachedShaders(program, maxcount, count, shaders);
-}
-
-GL_APICALL int GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name)
-{
- return gl::GetAttribLocation(program, name);
-}
-
-GL_APICALL void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params)
-{
- return gl::GetBooleanv(pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- return gl::GetBufferParameteriv(target, pname, params);
-}
-
-GL_APICALL GLenum GL_APIENTRY glGetError(void)
-{
- return gl::GetError();
-}
-
-GL_APICALL void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
- return gl::GetFenceivNV(fence, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params)
-{
- return gl::GetFloatv(pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- return gl::GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- return gl::GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void)
-{
- return gl::GetGraphicsResetStatusEXT();
-}
-
-GL_APICALL void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params)
-{
- return gl::GetIntegerv(pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- return gl::GetProgramiv(program, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- return gl::GetProgramInfoLog(program, bufsize, length, infolog);
-}
-
-GL_APICALL void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetQueryivEXT(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT(GLuint name, GLenum pname, GLuint *params)
-{
- return gl::GetQueryObjectuivEXT(name, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- return gl::GetRenderbufferParameteriv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
-{
- return gl::GetRenderbufferParameteriv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- return gl::GetShaderiv(shader, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- return gl::GetShaderInfoLog(shader, bufsize, length, infolog);
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- return gl::GetShaderPrecisionFormat(shadertype, precisiontype, range, precision);
-}
-
-GL_APICALL void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
- return gl::GetShaderSource(shader, bufsize, length, source);
-}
-
-GL_APICALL const GLubyte* GL_APIENTRY glGetString(GLenum name)
-{
- return gl::GetString(name);
-}
-
-GL_APICALL void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- return gl::GetTexParameterfv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- return gl::GetTexParameteriv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
-{
- return gl::GetnUniformfvEXT(program, location, bufSize, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- return gl::GetUniformfv(program, location, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
-{
- return gl::GetnUniformivEXT(program, location, bufSize, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params)
-{
- return gl::GetUniformiv(program, location, params);
-}
-
-GL_APICALL int GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name)
-{
- return gl::GetUniformLocation(program, name);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
- return gl::GetVertexAttribfv(index, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
- return gl::GetVertexAttribiv(index, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
- return gl::GetVertexAttribPointerv(index, pname, pointer);
-}
-
-GL_APICALL void GL_APIENTRY glHint(GLenum target, GLenum mode)
-{
- return gl::Hint(target, mode);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsBuffer(GLuint buffer)
-{
- return gl::IsBuffer(buffer);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsEnabled(GLenum cap)
-{
- return gl::IsEnabled(cap);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsFenceNV(GLuint fence)
-{
- return gl::IsFenceNV(fence);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer)
-{
- return gl::IsFramebuffer(framebuffer);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsFramebufferOES(GLuint framebuffer)
-{
- return gl::IsFramebuffer(framebuffer);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsProgram(GLuint program)
-{
- return gl::IsProgram(program);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT(GLuint name)
-{
- return gl::IsQueryEXT(name);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer)
-{
- return gl::IsRenderbuffer(renderbuffer);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsRenderbufferOES(GLuint renderbuffer)
-{
- return gl::IsRenderbuffer(renderbuffer);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsShader(GLuint shader)
-{
- return gl::IsShader(shader);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsTexture(GLuint texture)
-{
- return gl::IsTexture(texture);
-}
-
-GL_APICALL void GL_APIENTRY glLineWidth(GLfloat width)
-{
- return gl::LineWidth(width);
-}
-
-GL_APICALL void GL_APIENTRY glLinkProgram(GLuint program)
-{
- return gl::LinkProgram(program);
-}
-
-GL_APICALL void GL_APIENTRY glPixelStorei(GLenum pname, GLint param)
-{
- return gl::PixelStorei(pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units)
-{
- return gl::PolygonOffset(factor, units);
-}
-
-GL_APICALL void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei bufSize, GLvoid *data)
-{
- return gl::ReadnPixelsEXT(x, y, width, height, format, type, bufSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- return gl::ReadPixels(x, y, width, height, format, type, pixels);
-}
-
-GL_APICALL void GL_APIENTRY glReleaseShaderCompiler(void)
-{
- return gl::ReleaseShaderCompiler();
-}
-
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- return gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- return gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- return gl::RenderbufferStorage(target, internalformat, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- return gl::RenderbufferStorage(target, internalformat, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glSampleCoverage(GLclampf value, GLboolean invert)
-{
- return gl::SampleCoverage(value, invert);
-}
-
-GL_APICALL void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition)
-{
- return gl::SetFenceNV(fence, condition);
-}
-
-GL_APICALL void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::Scissor(x, y, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
- return gl::ShaderBinary(n, shaders, binaryformat, binary, length);
-}
-
-GL_APICALL void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- return gl::ShaderSource(shader, count, string, length);
-}
-
-GL_APICALL void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- return gl::StencilFunc(func, ref, mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- return gl::StencilFuncSeparate(face, func, ref, mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilMask(GLuint mask)
-{
- return gl::StencilMask(mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask)
-{
- return gl::StencilMaskSeparate(face, mask);
-}
-
-GL_APICALL void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- return gl::StencilOp(fail, zfail, zpass);
-}
-
-GL_APICALL void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- return gl::StencilOpSeparate(face, fail, zfail, zpass);
-}
-
-GLboolean GL_APIENTRY glTestFenceNV(GLuint fence)
-{
- return gl::TestFenceNV(fence);
-}
-
-GL_APICALL void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- return gl::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels);
-}
-
-GL_APICALL void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- return gl::TexParameterf(target, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- return gl::TexParameterfv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param)
-{
- return gl::TexParameteri(target, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- return gl::TexParameteriv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid* pixels)
-{
- return gl::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1f(GLint location, GLfloat x)
-{
- return gl::Uniform1f(location, x);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- return gl::Uniform1fv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1i(GLint location, GLint x)
-{
- return gl::Uniform1i(location, x);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- return gl::Uniform1iv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y)
-{
- return gl::Uniform2f(location, x, y);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- return gl::Uniform2fv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y)
-{
- return gl::Uniform2i(location, x, y);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- return gl::Uniform2iv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- return gl::Uniform3f(location, x, y, z);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- return gl::Uniform3fv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- return gl::Uniform3i(location, x, y, z);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- return gl::Uniform3iv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- return gl::Uniform4f(location, x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- return gl::Uniform4fv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- return gl::Uniform4i(location, x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- return gl::Uniform4iv(location, count, v);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- return gl::UniformMatrix2fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- return gl::UniformMatrix3fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- return gl::UniformMatrix4fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUseProgram(GLuint program)
-{
- return gl::UseProgram(program);
-}
-
-GL_APICALL void GL_APIENTRY glValidateProgram(GLuint program)
-{
- return gl::ValidateProgram(program);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib1f(GLuint index, GLfloat x)
-{
- return gl::VertexAttrib1f(index, x);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib1fv(GLuint index, const GLfloat* values)
-{
- return gl::VertexAttrib1fv(index, values);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- return gl::VertexAttrib2f(index, x, y);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib2fv(GLuint index, const GLfloat* values)
-{
- return gl::VertexAttrib2fv(index, values);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- return gl::VertexAttrib3f(index, x, y, z);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib3fv(GLuint index, const GLfloat* values)
-{
- return gl::VertexAttrib3fv(index, values);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- return gl::VertexAttrib4f(index, x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttrib4fv(GLuint index, const GLfloat* values)
-{
- return gl::VertexAttrib4fv(index, values);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
- return gl::VertexAttribPointer(index, size, type, normalized, stride, ptr);
-}
-
-GL_APICALL void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::Viewport(x, y, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glBlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- return gl::BlitFramebufferNV(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter)
-{
- return gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-GL_APICALL void GL_APIENTRY glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels)
-{
- return gl::TexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels);
-}
-
-GL_APICALL void GL_APIENTRY glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels)
-{
- return gl::TexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::CopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- return gl::CompressedTexImage3DOES(target, level,internalformat, width, height, depth, border, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- return gl::CompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- return gl::FramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset);
-}
-
-GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- return gl::EGLImageTargetTexture2DOES(target, image);
-}
-
-GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- return gl::EGLImageTargetRenderbufferStorageOES(target, image);
-}
-
-GL_APICALL void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs)
-{
- return gl::DrawBuffersEXT(n, bufs);
-}
-
-GL_APICALL void GL_APIENTRY glReadBuffer(GLenum src)
-{
- return gl::ReadBuffer(src);
-}
-
-GL_APICALL void GL_APIENTRY glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- return gl::DrawRangeElements(mode, start, end, count, type, indices);
-}
-
-GL_APICALL void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *data)
-{
- return gl::TexImage3D(target, level, internalformat, width, height, depth, border, format, type, data);
-}
-
-GL_APICALL void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- return gl::TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-}
-
-GL_APICALL void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- return gl::CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- return gl::CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-}
-
-GL_APICALL void GL_APIENTRY glGenQueries(GLsizei n, GLuint *ids)
-{
- return gl::GenQueries(n, ids);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteQueries(n, ids);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsQuery(GLuint id)
-{
- return gl::IsQuery(id);
-}
-
-GL_APICALL void GL_APIENTRY glBeginQuery(GLenum target, GLuint id)
-{
- return gl::BeginQuery(target, id);
-}
-
-GL_APICALL void GL_APIENTRY glEndQuery(GLenum target)
-{
- return gl::EndQuery(target);
-}
-
-GL_APICALL void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- return gl::GetQueryiv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- return gl::GetQueryObjectuiv(id, pname, params);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer(GLenum target)
-{
- return gl::UnmapBuffer(target);
-}
-
-GL_APICALL void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, void **params)
-{
- return gl::GetBufferPointerv(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum *bufs)
-{
- return gl::DrawBuffers(n, bufs);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix2x3fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix3x2fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix2x4fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix4x2fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix3x4fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- return gl::UniformMatrix4x3fv(location, count, transpose, value);
-}
-
-GL_APICALL void GL_APIENTRY glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- return gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-}
-
-GL_APICALL void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- return gl::FramebufferTextureLayer(target, attachment, texture, level, layer);
-}
-
-GL_APICALL void *GL_APIENTRY glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- return gl::MapBufferRange(target, offset, length, access);
-}
-
-GL_APICALL void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- return gl::FlushMappedBufferRange(target, offset, length);
-}
-
-GL_APICALL void GL_APIENTRY glBindVertexArray(GLuint array)
-{
- return gl::BindVertexArray(array);
-}
-
-GL_APICALL void GL_APIENTRY glBindVertexArrayOES(GLuint array)
-{
- return gl::BindVertexArrayOES(array);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- return gl::DeleteVertexArrays(n, arrays);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
-{
- return gl::DeleteFramebuffersOES(n, arrays);
-}
-
-GL_APICALL void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint *arrays)
-{
- return gl::GenVertexArrays(n, arrays);
-}
-
-GL_APICALL void GL_APIENTRY glGenVertexArraysOES(GLsizei n, GLuint *arrays)
-{
- return gl::GenVertexArraysOES(n, arrays);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArray(GLuint array)
-{
- return gl::IsVertexArray(array);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES(GLuint array)
-{
- return gl::IsVertexArrayOES(array);
-}
-
-GL_APICALL void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- return gl::GetIntegeri_v(target, index, data);
-}
-
-GL_APICALL void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode)
-{
- return gl::BeginTransformFeedback(primitiveMode);
-}
-
-GL_APICALL void GL_APIENTRY glEndTransformFeedback(void)
-{
- return gl::EndTransformFeedback();
-}
-
-GL_APICALL void GL_APIENTRY glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- return gl::BindBufferRange(target, index, buffer, offset, size);
-}
-
-GL_APICALL void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- return gl::BindBufferBase(target, index, buffer);
-}
-
-GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const *varyings, GLenum bufferMode)
-{
- return gl::TransformFeedbackVaryings(program, count, varyings, bufferMode);
-}
-
-GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- return gl::GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- return gl::VertexAttribIPointer(index, size, type, stride, pointer);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- return gl::GetVertexAttribIiv(index, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- return gl::GetVertexAttribIuiv(index, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- return gl::VertexAttribI4i(index, x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- return gl::VertexAttribI4ui(index, x, y, z, w);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint *v)
-{
- return gl::VertexAttribI4iv(index, v);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- return gl::VertexAttribI4uiv(index, v);
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- return gl::GetUniformuiv(program, location, params);
-}
-
-GL_APICALL GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name)
-{
- return gl::GetFragDataLocation(program, name);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1ui(GLint location, GLuint v0)
-{
- return gl::Uniform1ui(location, v0);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- return gl::Uniform2ui(location, v0, v1);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- return gl::Uniform3ui(location, v0, v1, v2);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- return gl::Uniform4ui(location, v0, v1, v2, v3);
-}
-
-GL_APICALL void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform1uiv(location, count, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform2uiv(location, count, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform3uiv(location, count, value);
-}
-
-GL_APICALL void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- return gl::Uniform4uiv(location, count, value);
-}
-
-GL_APICALL void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- return gl::ClearBufferiv(buffer, drawbuffer, value);
-}
-
-GL_APICALL void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- return gl::ClearBufferuiv(buffer, drawbuffer, value);
-}
-
-GL_APICALL void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- return gl::ClearBufferfv(buffer, drawbuffer, value);
-}
-
-GL_APICALL void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- return gl::ClearBufferfi(buffer, drawbuffer, depth, stencil);
-}
-
-GL_APICALL const GLubyte *GL_APIENTRY glGetStringi(GLenum name, GLuint index)
-{
- return gl::GetStringi(name, index);
-}
-
-GL_APICALL void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- return gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size);
-}
-
-GL_APICALL void GL_APIENTRY glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices)
-{
- return gl::GetUniformIndices(program, uniformCount, uniformNames, uniformIndices);
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- return gl::GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params);
-}
-
-GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- return gl::GetUniformBlockIndex(program, uniformBlockName);
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- return gl::GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- return gl::GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName);
-}
-
-GL_APICALL void GL_APIENTRY glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- return gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding);
-}
-
-GL_APICALL void GL_APIENTRY glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- return gl::DrawArraysInstanced(mode, first, count, instanceCount);
-}
-
-GL_APICALL void GL_APIENTRY glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- return gl::DrawElementsInstanced(mode, count, type, indices, instanceCount);
-}
-
-GL_APICALL GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags)
-{
- return gl::FenceSync(condition, flags);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsSync(GLsync sync)
-{
- return gl::IsSync(sync);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteSync(GLsync sync)
-{
- return gl::DeleteSync(sync);
-}
-
-GL_APICALL GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return gl::ClientWaitSync(sync, flags, timeout);
-}
-
-GL_APICALL void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- return gl::WaitSync(sync, flags, timeout);
-}
-
-GL_APICALL void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64 *data)
-{
- return gl::GetInteger64v(pname, data);
-}
-
-GL_APICALL void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- return gl::GetSynciv(sync, pname, bufSize, length, values);
-}
-
-GL_APICALL void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- return gl::GetInteger64i_v(target, index, data);
-}
-
-GL_APICALL void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- return gl::GetBufferParameteri64v(target, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGenSamplers(GLsizei count, GLuint *samplers)
-{
- return gl::GenSamplers(count, samplers);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- return gl::DeleteSamplers(count, samplers);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsSampler(GLuint sampler)
-{
- return gl::IsSampler(sampler);
-}
-
-GL_APICALL void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler)
-{
- return gl::BindSampler(unit, sampler);
-}
-
-GL_APICALL void GL_APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- return gl::SamplerParameteri(sampler, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- return gl::SamplerParameteriv(sampler, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- return gl::SamplerParameterf(sampler, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- return gl::SamplerParameterfv(sampler, pname, param);
-}
-
-GL_APICALL void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- return gl::GetSamplerParameteriv(sampler, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- return gl::GetSamplerParameterfv(sampler, pname, params);
-}
-
-GL_APICALL void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor)
-{
- return gl::VertexAttribDivisor(index, divisor);
-}
-
-GL_APICALL void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id)
-{
- return gl::BindTransformFeedback(target, id);
-}
-
-GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- return gl::DeleteTransformFeedbacks(n, ids);
-}
-
-GL_APICALL void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- return gl::GenTransformFeedbacks(n, ids);
-}
-
-GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id)
-{
- return gl::IsTransformFeedback(id);
-}
-
-GL_APICALL void GL_APIENTRY glPauseTransformFeedback(void)
-{
- return gl::PauseTransformFeedback();
-}
-
-GL_APICALL void GL_APIENTRY glResumeTransformFeedback(void)
-{
- return gl::ResumeTransformFeedback();
-}
-
-GL_APICALL void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- return gl::GetProgramBinary(program, bufSize, length, binaryFormat, binary);
-}
-
-GL_APICALL void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- return gl::ProgramBinary(program, binaryFormat, binary, length);
-}
-
-GL_APICALL void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- return gl::ProgramParameteri(program, pname, value);
-}
-
-GL_APICALL void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- return gl::InvalidateFramebuffer(target, numAttachments, attachments);
-}
-
-GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- return gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- return gl::TexStorage2D(target, levels, internalformat, width, height);
-}
-
-GL_APICALL void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- return gl::TexStorage3D(target, levels, internalformat, width, height, depth);
-}
-
-GL_APICALL void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- return gl::GetInternalformativ(target, internalformat, pname, bufSize, params);
-}
-}
-
-egl::Context *es2CreateContext(egl::Display *display, const egl::Context *shareContext, const egl::Config *config);
-extern "C" __eglMustCastToProperFunctionPointerType es2GetProcAddress(const char *procname);
-egl::Image *createBackBuffer(int width, int height, sw::Format format, int multiSampleDepth);
-egl::Image *createBackBufferFromClientBuffer(const egl::ClientBuffer& clientBuffer);
-egl::Image *createDepthStencil(int width, int height, sw::Format format, int multiSampleDepth);
-sw::FrameBuffer *createFrameBuffer(void *nativeDisplay, EGLNativeWindowType window, int width, int height);
-
-LibGLESv2exports::LibGLESv2exports()
-{
- this->glActiveTexture = gl::ActiveTexture;
- this->glAttachShader = gl::AttachShader;
- this->glBeginQueryEXT = gl::BeginQueryEXT;
- this->glBindAttribLocation = gl::BindAttribLocation;
- this->glBindBuffer = gl::BindBuffer;
- this->glBindFramebuffer = gl::BindFramebuffer;
- this->glBindRenderbuffer = gl::BindRenderbuffer;
- this->glBindTexture = gl::BindTexture;
- this->glBlendColor = gl::BlendColor;
- this->glBlendEquation = gl::BlendEquation;
- this->glBlendEquationSeparate = gl::BlendEquationSeparate;
- this->glBlendFunc = gl::BlendFunc;
- this->glBlendFuncSeparate = gl::BlendFuncSeparate;
- this->glBufferData = gl::BufferData;
- this->glBufferSubData = gl::BufferSubData;
- this->glCheckFramebufferStatus = gl::CheckFramebufferStatus;
- this->glClear = gl::Clear;
- this->glClearColor = gl::ClearColor;
- this->glClearDepthf = gl::ClearDepthf;
- this->glClearStencil = gl::ClearStencil;
- this->glColorMask = gl::ColorMask;
- this->glCompileShader = gl::CompileShader;
- this->glCompressedTexImage2D = gl::CompressedTexImage2D;
- this->glCompressedTexSubImage2D = gl::CompressedTexSubImage2D;
- this->glCopyTexImage2D = gl::CopyTexImage2D;
- this->glCopyTexSubImage2D = gl::CopyTexSubImage2D;
- this->glCreateProgram = gl::CreateProgram;
- this->glCreateShader = gl::CreateShader;
- this->glCullFace = gl::CullFace;
- this->glDeleteBuffers = gl::DeleteBuffers;
- this->glDeleteFencesNV = gl::DeleteFencesNV;
- this->glDeleteFramebuffers = gl::DeleteFramebuffers;
- this->glDeleteProgram = gl::DeleteProgram;
- this->glDeleteQueriesEXT = gl::DeleteQueriesEXT;
- this->glDeleteRenderbuffers = gl::DeleteRenderbuffers;
- this->glDeleteShader = gl::DeleteShader;
- this->glDeleteTextures = gl::DeleteTextures;
- this->glDepthFunc = gl::DepthFunc;
- this->glDepthMask = gl::DepthMask;
- this->glDepthRangef = gl::DepthRangef;
- this->glDetachShader = gl::DetachShader;
- this->glDisable = gl::Disable;
- this->glDisableVertexAttribArray = gl::DisableVertexAttribArray;
- this->glDrawArrays = gl::DrawArrays;
- this->glDrawElements = gl::DrawElements;
- this->glDrawArraysInstancedEXT = gl::DrawArraysInstancedEXT;
- this->glDrawElementsInstancedEXT = gl::DrawElementsInstancedEXT;
- this->glVertexAttribDivisorEXT = gl::VertexAttribDivisorEXT;
- this->glDrawArraysInstancedANGLE = gl::DrawArraysInstancedANGLE;
- this->glDrawElementsInstancedANGLE = gl::DrawElementsInstancedANGLE;
- this->glVertexAttribDivisorANGLE = gl::VertexAttribDivisorANGLE;
- this->glEnable = gl::Enable;
- this->glEnableVertexAttribArray = gl::EnableVertexAttribArray;
- this->glEndQueryEXT = gl::EndQueryEXT;
- this->glFinishFenceNV = gl::FinishFenceNV;
- this->glFinish = gl::Finish;
- this->glFlush = gl::Flush;
- this->glFramebufferRenderbuffer = gl::FramebufferRenderbuffer;
- this->glFramebufferTexture2D = gl::FramebufferTexture2D;
- this->glFrontFace = gl::FrontFace;
- this->glGenBuffers = gl::GenBuffers;
- this->glGenerateMipmap = gl::GenerateMipmap;
- this->glGenFencesNV = gl::GenFencesNV;
- this->glGenFramebuffers = gl::GenFramebuffers;
- this->glGenQueriesEXT = gl::GenQueriesEXT;
- this->glGenRenderbuffers = gl::GenRenderbuffers;
- this->glGenTextures = gl::GenTextures;
- this->glGetActiveAttrib = gl::GetActiveAttrib;
- this->glGetActiveUniform = gl::GetActiveUniform;
- this->glGetAttachedShaders = gl::GetAttachedShaders;
- this->glGetAttribLocation = gl::GetAttribLocation;
- this->glGetBooleanv = gl::GetBooleanv;
- this->glGetBufferParameteriv = gl::GetBufferParameteriv;
- this->glGetError = gl::GetError;
- this->glGetFenceivNV = gl::GetFenceivNV;
- this->glGetFloatv = gl::GetFloatv;
- this->glGetFramebufferAttachmentParameteriv = gl::GetFramebufferAttachmentParameteriv;
- this->glGetGraphicsResetStatusEXT = gl::GetGraphicsResetStatusEXT;
- this->glGetIntegerv = gl::GetIntegerv;
- this->glGetProgramiv = gl::GetProgramiv;
- this->glGetProgramInfoLog = gl::GetProgramInfoLog;
- this->glGetQueryivEXT = gl::GetQueryivEXT;
- this->glGetQueryObjectuivEXT = gl::GetQueryObjectuivEXT;
- this->glGetRenderbufferParameteriv = gl::GetRenderbufferParameteriv;
- this->glGetShaderiv = gl::GetShaderiv;
- this->glGetShaderInfoLog = gl::GetShaderInfoLog;
- this->glGetShaderPrecisionFormat = gl::GetShaderPrecisionFormat;
- this->glGetShaderSource = gl::GetShaderSource;
- this->glGetString = gl::GetString;
- this->glGetTexParameterfv = gl::GetTexParameterfv;
- this->glGetTexParameteriv = gl::GetTexParameteriv;
- this->glGetnUniformfvEXT = gl::GetnUniformfvEXT;
- this->glGetUniformfv = gl::GetUniformfv;
- this->glGetnUniformivEXT = gl::GetnUniformivEXT;
- this->glGetUniformiv = gl::GetUniformiv;
- this->glGetUniformLocation = gl::GetUniformLocation;
- this->glGetVertexAttribfv = gl::GetVertexAttribfv;
- this->glGetVertexAttribiv = gl::GetVertexAttribiv;
- this->glGetVertexAttribPointerv = gl::GetVertexAttribPointerv;
- this->glHint = gl::Hint;
- this->glIsBuffer = gl::IsBuffer;
- this->glIsEnabled = gl::IsEnabled;
- this->glIsFenceNV = gl::IsFenceNV;
- this->glIsFramebuffer = gl::IsFramebuffer;
- this->glIsProgram = gl::IsProgram;
- this->glIsQueryEXT = gl::IsQueryEXT;
- this->glIsRenderbuffer = gl::IsRenderbuffer;
- this->glIsShader = gl::IsShader;
- this->glIsTexture = gl::IsTexture;
- this->glLineWidth = gl::LineWidth;
- this->glLinkProgram = gl::LinkProgram;
- this->glPixelStorei = gl::PixelStorei;
- this->glPolygonOffset = gl::PolygonOffset;
- this->glReadnPixelsEXT = gl::ReadnPixelsEXT;
- this->glReadPixels = gl::ReadPixels;
- this->glReleaseShaderCompiler = gl::ReleaseShaderCompiler;
- this->glRenderbufferStorageMultisample = gl::RenderbufferStorageMultisample;
- this->glRenderbufferStorageMultisampleANGLE = gl::RenderbufferStorageMultisampleANGLE;
- this->glRenderbufferStorage = gl::RenderbufferStorage;
- this->glSampleCoverage = gl::SampleCoverage;
- this->glSetFenceNV = gl::SetFenceNV;
- this->glScissor = gl::Scissor;
- this->glShaderBinary = gl::ShaderBinary;
- this->glShaderSource = gl::ShaderSource;
- this->glStencilFunc = gl::StencilFunc;
- this->glStencilFuncSeparate = gl::StencilFuncSeparate;
- this->glStencilMask = gl::StencilMask;
- this->glStencilMaskSeparate = gl::StencilMaskSeparate;
- this->glStencilOp = gl::StencilOp;
- this->glStencilOpSeparate = gl::StencilOpSeparate;
- this->glTestFenceNV = gl::TestFenceNV;
- this->glTexImage2D = gl::TexImage2D;
- this->glTexParameterf = gl::TexParameterf;
- this->glTexParameterfv = gl::TexParameterfv;
- this->glTexParameteri = gl::TexParameteri;
- this->glTexParameteriv = gl::TexParameteriv;
- this->glTexSubImage2D = gl::TexSubImage2D;
- this->glUniform1f = gl::Uniform1f;
- this->glUniform1fv = gl::Uniform1fv;
- this->glUniform1i = gl::Uniform1i;
- this->glUniform1iv = gl::Uniform1iv;
- this->glUniform2f = gl::Uniform2f;
- this->glUniform2fv = gl::Uniform2fv;
- this->glUniform2i = gl::Uniform2i;
- this->glUniform2iv = gl::Uniform2iv;
- this->glUniform3f = gl::Uniform3f;
- this->glUniform3fv = gl::Uniform3fv;
- this->glUniform3i = gl::Uniform3i;
- this->glUniform3iv = gl::Uniform3iv;
- this->glUniform4f = gl::Uniform4f;
- this->glUniform4fv = gl::Uniform4fv;
- this->glUniform4i = gl::Uniform4i;
- this->glUniform4iv = gl::Uniform4iv;
- this->glUniformMatrix2fv = gl::UniformMatrix2fv;
- this->glUniformMatrix3fv = gl::UniformMatrix3fv;
- this->glUniformMatrix4fv = gl::UniformMatrix4fv;
- this->glUseProgram = gl::UseProgram;
- this->glValidateProgram = gl::ValidateProgram;
- this->glVertexAttrib1f = gl::VertexAttrib1f;
- this->glVertexAttrib1fv = gl::VertexAttrib1fv;
- this->glVertexAttrib2f = gl::VertexAttrib2f;
- this->glVertexAttrib2fv = gl::VertexAttrib2fv;
- this->glVertexAttrib3f = gl::VertexAttrib3f;
- this->glVertexAttrib3fv = gl::VertexAttrib3fv;
- this->glVertexAttrib4f = gl::VertexAttrib4f;
- this->glVertexAttrib4fv = gl::VertexAttrib4fv;
- this->glVertexAttribPointer = gl::VertexAttribPointer;
- this->glViewport = gl::Viewport;
- this->glBlitFramebufferNV = gl::BlitFramebufferNV;
- this->glBlitFramebufferANGLE = gl::BlitFramebufferANGLE;
- this->glTexImage3DOES = gl::TexImage3DOES;
- this->glTexSubImage3DOES = gl::TexSubImage3DOES;
- this->glCopyTexSubImage3DOES = gl::CopyTexSubImage3DOES;
- this->glCompressedTexImage3DOES = gl::CompressedTexImage3DOES;
- this->glCompressedTexSubImage3DOES = gl::CompressedTexSubImage3DOES;
- this->glFramebufferTexture3DOES = gl::FramebufferTexture3DOES;
- this->glEGLImageTargetTexture2DOES = gl::EGLImageTargetTexture2DOES;
- this->glEGLImageTargetRenderbufferStorageOES = gl::EGLImageTargetRenderbufferStorageOES;
- this->glIsRenderbufferOES = gl::IsRenderbufferOES;
- this->glBindRenderbufferOES = gl::BindRenderbufferOES;
- this->glDeleteRenderbuffersOES = gl::DeleteRenderbuffersOES;
- this->glGenRenderbuffersOES = gl::GenRenderbuffersOES;
- this->glRenderbufferStorageOES = gl::RenderbufferStorageOES;
- this->glGetRenderbufferParameterivOES = gl::GetRenderbufferParameterivOES;
- this->glIsFramebufferOES = gl::IsFramebufferOES;
- this->glBindFramebufferOES = gl::BindFramebufferOES;
- this->glDeleteFramebuffersOES = gl::DeleteFramebuffersOES;
- this->glGenFramebuffersOES = gl::GenFramebuffersOES;
- this->glCheckFramebufferStatusOES = gl::CheckFramebufferStatusOES;
- this->glFramebufferRenderbufferOES = gl::FramebufferRenderbufferOES;
- this->glFramebufferTexture2DOES = gl::FramebufferTexture2DOES;
- this->glGetFramebufferAttachmentParameterivOES = gl::GetFramebufferAttachmentParameterivOES;
- this->glGenerateMipmapOES = gl::GenerateMipmapOES;
- this->glDrawBuffersEXT = gl::DrawBuffersEXT;
-
- this->es2CreateContext = ::es2CreateContext;
- this->es2GetProcAddress = ::es2GetProcAddress;
- this->createBackBuffer = ::createBackBuffer;
- this->createBackBufferFromClientBuffer = ::createBackBufferFromClientBuffer;
- this->createDepthStencil = ::createDepthStencil;
- this->createFrameBuffer = ::createFrameBuffer;
-}
-
-extern "C" GL_APICALL LibGLESv2exports *libGLESv2_swiftshader()
-{
- static LibGLESv2exports libGLESv2;
- return &libGLESv2;
-}
-
-LibEGL libEGL;
diff --git a/src/OpenGL/libGLESv2/entry_points.h b/src/OpenGL/libGLESv2/entry_points.h
deleted file mode 100644
index b3107a023..000000000
--- a/src/OpenGL/libGLESv2/entry_points.h
+++ /dev/null
@@ -1,334 +0,0 @@
-// Copyright 2018 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef LIBGLESV2_ENTRY_POINTS_H_
-#define LIBGLESV2_ENTRY_POINTS_H_
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-
-namespace gl
-{
- void GL_APIENTRY ActiveTexture(GLenum texture);
- void GL_APIENTRY AttachShader(GLuint program, GLuint shader);
- void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint name);
- void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name);
- void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer);
- void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer);
- void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer);
- void GL_APIENTRY BindTexture(GLenum target, GLuint texture);
- void GL_APIENTRY BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void GL_APIENTRY BlendEquation(GLenum mode);
- void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
- void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor);
- void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target);
- void GL_APIENTRY Clear(GLbitfield mask);
- void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void GL_APIENTRY ClearDepthf(GLclampf depth);
- void GL_APIENTRY ClearStencil(GLint s);
- void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void GL_APIENTRY CompileShader(GLuint shader);
- void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid* data);
- void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid* data);
- void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- GLuint GL_APIENTRY CreateProgram(void);
- GLuint GL_APIENTRY CreateShader(GLenum type);
- void GL_APIENTRY CullFace(GLenum mode);
- void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers);
- void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint* fences);
- void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers);
- void GL_APIENTRY DeleteProgram(GLuint program);
- void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids);
- void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers);
- void GL_APIENTRY DeleteShader(GLuint shader);
- void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures);
- void GL_APIENTRY DepthFunc(GLenum func);
- void GL_APIENTRY DepthMask(GLboolean flag);
- void GL_APIENTRY DepthRangef(GLclampf zNear, GLclampf zFar);
- void GL_APIENTRY DetachShader(GLuint program, GLuint shader);
- void GL_APIENTRY Disable(GLenum cap);
- void GL_APIENTRY DisableVertexAttribArray(GLuint index);
- void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count);
- void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
- void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount);
- void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor);
- void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
- void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount);
- void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor);
- void GL_APIENTRY Enable(GLenum cap);
- void GL_APIENTRY EnableVertexAttribArray(GLuint index);
- void GL_APIENTRY EndQueryEXT(GLenum target);
- void GL_APIENTRY FinishFenceNV(GLuint fence);
- void GL_APIENTRY Finish(void);
- void GL_APIENTRY Flush(void);
- void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void GL_APIENTRY FrontFace(GLenum mode);
- void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers);
- void GL_APIENTRY GenerateMipmap(GLenum target);
- void GL_APIENTRY GenFencesNV(GLsizei n, GLuint* fences);
- void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers);
- void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint* ids);
- void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers);
- void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures);
- void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name);
- void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params);
- void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params);
- GLenum GL_APIENTRY GetError(void);
- void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params);
- void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params);
- void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void);
- void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params);
- void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params);
- void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params);
- void GL_APIENTRY GetQueryObjectuivEXT(GLuint name, GLenum pname, GLuint *params);
- void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params);
- void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params);
- void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- const GLubyte* GL_APIENTRY GetString(GLenum name);
- void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params);
- void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params);
- void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
- void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params);
- void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params);
- void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params);
- int GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name);
- void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params);
- void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params);
- void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer);
- void GL_APIENTRY Hint(GLenum target, GLenum mode);
- GLboolean GL_APIENTRY IsBuffer(GLuint buffer);
- GLboolean GL_APIENTRY IsEnabled(GLenum cap);
- GLboolean GL_APIENTRY IsFenceNV(GLuint fence);
- GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer);
- GLboolean GL_APIENTRY IsProgram(GLuint program);
- GLboolean GL_APIENTRY IsQueryEXT(GLuint name);
- GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer);
- GLboolean GL_APIENTRY IsShader(GLuint shader);
- GLboolean GL_APIENTRY IsTexture(GLuint texture);
- void GL_APIENTRY LineWidth(GLfloat width);
- void GL_APIENTRY LinkProgram(GLuint program);
- void GL_APIENTRY PixelStorei(GLenum pname, GLint param);
- void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units);
- void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
- void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void GL_APIENTRY ReleaseShaderCompiler(void);
- void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void GL_APIENTRY SampleCoverage(GLclampf value, GLboolean invert);
- void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition);
- void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height);
- void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length);
- void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask);
- void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
- void GL_APIENTRY StencilMask(GLuint mask);
- void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask);
- void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass);
- void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- GLboolean GL_APIENTRY TestFenceNV(GLuint fence);
- void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param);
- void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat* params);
- void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param);
- void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint* params);
- void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid* pixels);
- void GL_APIENTRY Uniform1f(GLint location, GLfloat x);
- void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v);
- void GL_APIENTRY Uniform1i(GLint location, GLint x);
- void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v);
- void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y);
- void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v);
- void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y);
- void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v);
- void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v);
- void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z);
- void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v);
- void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v);
- void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w);
- void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v);
- void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void GL_APIENTRY UseProgram(GLuint program);
- void GL_APIENTRY ValidateProgram(GLuint program);
- void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x);
- void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat* values);
- void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y);
- void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat* values);
- void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat* values);
- void GL_APIENTRY VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat* values);
- void GL_APIENTRY VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height);
- void GL_APIENTRY BlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter);
- void GL_APIENTRY TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void GL_APIENTRY TexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void GL_APIENTRY CopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void GL_APIENTRY CompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void GL_APIENTRY CompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void GL_APIENTRY FramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image);
- void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image);
- GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer);
- void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer);
- void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers);
- void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint* renderbuffers);
- void GL_APIENTRY RenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params);
- GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer);
- void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer);
- void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers);
- void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint* framebuffers);
- GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target);
- void GL_APIENTRY FramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void GL_APIENTRY FramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void GL_APIENTRY GenerateMipmapOES(GLenum target);
- void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs);
- void GL_APIENTRY ReadBuffer(GLenum src);
- void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices);
- void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *data);
- void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data);
- void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void GL_APIENTRY 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 GL_APIENTRY GenQueries(GLsizei n, GLuint *ids);
- void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids);
- GLboolean GL_APIENTRY IsQuery(GLuint id);
- void GL_APIENTRY BeginQuery(GLenum target, GLuint id);
- void GL_APIENTRY EndQuery(GLenum target);
- void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params);
- void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params);
- GLboolean GL_APIENTRY UnmapBuffer(GLenum target);
- void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params);
- void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs);
- void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value);
- void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
- void *GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access);
- void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length);
- void GL_APIENTRY BindVertexArray(GLuint array);
- void GL_APIENTRY BindVertexArrayOES(GLuint array);
- void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays);
- void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
- void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays);
- void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays);
- GLboolean GL_APIENTRY IsVertexArray(GLuint array);
- GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array);
- void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data);
- void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode);
- void GL_APIENTRY EndTransformFeedback(void);
- void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size);
- void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer);
- void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode);
- void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name);
- void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer);
- void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params);
- void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params);
- void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
- void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
- void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v);
- void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v);
- void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params);
- GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name);
- void GL_APIENTRY Uniform1ui(GLint location, GLuint v0);
- void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1);
- void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2);
- void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
- void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value);
- void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value);
- void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value);
- void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value);
- void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value);
- void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value);
- void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value);
- void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
- const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index);
- void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
- void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices);
- void GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params);
- GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName);
- void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params);
- void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName);
- void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
- void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
- void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount);
- GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags);
- GLboolean GL_APIENTRY IsSync(GLsync sync);
- void GL_APIENTRY DeleteSync(GLsync sync);
- GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout);
- void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data);
- void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values);
- void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data);
- void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params);
- void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers);
- void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers);
- GLboolean GL_APIENTRY IsSampler(GLuint sampler);
- void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler);
- void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param);
- void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param);
- void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param);
- void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param);
- void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params);
- void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params);
- void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor);
- void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id);
- void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids);
- void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids);
- GLboolean GL_APIENTRY IsTransformFeedback(GLuint id);
- void GL_APIENTRY PauseTransformFeedback(void);
- void GL_APIENTRY ResumeTransformFeedback(void);
- void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary);
- void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length);
- void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value);
- void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments);
- void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height);
- void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
- void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
- void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
-}
-
-#endif // LIBGLESV2_ENTRY_POINTS_H_
diff --git a/src/OpenGL/libGLESv2/libGLESv2.cpp b/src/OpenGL/libGLESv2/libGLESv2.cpp
deleted file mode 100644
index 1c5a05500..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2.cpp
+++ /dev/null
@@ -1,6604 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-// libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions.
-
-#include "Buffer.h"
-#include "Common/Version.h"
-#include "Context.h"
-#include "Fence.h"
-#include "Framebuffer.h"
-#include "Program.h"
-#include "Query.h"
-#include "Renderbuffer.h"
-#include "Shader.h"
-#include "Texture.h"
-#include "TransformFeedback.h"
-#include "VertexArray.h"
-#include "common/debug.h"
-#include "main.h"
-#include "mathutil.h"
-#include "utilities.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-
-#include <algorithm>
-#include <limits>
-
-namespace es2
-{
-
-static bool validImageSize(GLint level, GLsizei width, GLsizei height)
-{
- if(level < 0 || level >= IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)
- {
- return false;
- }
-
- return true;
-}
-
-}
-
-namespace gl
-{
-
-using namespace es2;
-
-void GL_APIENTRY ActiveTexture(GLenum texture)
-{
- TRACE("(GLenum texture = 0x%X)", texture);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(texture < GL_TEXTURE0 || texture > GL_TEXTURE0 + es2::MAX_COMBINED_TEXTURE_IMAGE_UNITS - 1)
- {
- return error(GL_INVALID_ENUM);
- }
-
- context->setActiveSampler(texture - GL_TEXTURE0);
- }
-}
-
-void GL_APIENTRY AttachShader(GLuint program, GLuint shader)
-{
- TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->attachShader(shaderObject))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint name)
-{
- TRACE("(GLenum target = 0x%X, GLuint name = %d)", target, name);
-
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(name == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->beginQuery(target, name);
- }
-}
-
-void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name)
-{
- TRACE("(GLuint program = %d, GLuint index = %d, const GLchar* name = %s)", program, index, name);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(strncmp(name, "gl_", 3) == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- programObject->bindAttributeLocation(index, name);
- }
-}
-
-void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer)
-{
- TRACE("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_ARRAY_BUFFER:
- context->bindArrayBuffer(buffer);
- return;
- case GL_ELEMENT_ARRAY_BUFFER:
- context->bindElementArrayBuffer(buffer);
- return;
- case GL_COPY_READ_BUFFER:
- context->bindCopyReadBuffer(buffer);
- return;
- case GL_COPY_WRITE_BUFFER:
- context->bindCopyWriteBuffer(buffer);
- return;
- case GL_PIXEL_PACK_BUFFER:
- context->bindPixelPackBuffer(buffer);
- return;
- case GL_PIXEL_UNPACK_BUFFER:
- context->bindPixelUnpackBuffer(buffer);
- return;
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- context->bindTransformFeedbackBuffer(buffer);
- return;
- case GL_UNIFORM_BUFFER:
- context->bindGenericUniformBuffer(buffer);
- return;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer)
-{
- TRACE("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer);
-
- if(target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(target == GL_READ_FRAMEBUFFER || target == GL_FRAMEBUFFER)
- {
- context->bindReadFramebuffer(framebuffer);
- }
-
- if(target == GL_DRAW_FRAMEBUFFER || target == GL_FRAMEBUFFER)
- {
- context->bindDrawFramebuffer(framebuffer);
- }
- }
-}
-
-void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer)
-{
- TRACE("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer);
-
- if(target != GL_RENDERBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- // [OpenGL ES 2.0.25] Section 4.4.3 page 110
- // [OpenGL ES 3.0.4] Section 4.4.2 page 204
- // If renderbuffer is not zero, then the resulting renderbuffer object
- // is a new state vector, initialized with a zero-sized memory buffer.
- context->bindRenderbuffer(renderbuffer);
- }
-}
-
-void GL_APIENTRY BindTexture(GLenum target, GLuint texture)
-{
- TRACE("(GLenum target = 0x%X, GLuint texture = %d)", target, texture);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *textureObject = context->getTexture(texture);
-
- if(textureObject && textureObject->getTarget() != target && texture != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(target)
- {
- case GL_TEXTURE_2D:
- context->bindTexture(TEXTURE_2D, texture);
- break;
- case GL_TEXTURE_CUBE_MAP:
- context->bindTexture(TEXTURE_CUBE, texture);
- break;
- case GL_TEXTURE_EXTERNAL_OES:
- context->bindTexture(TEXTURE_EXTERNAL, texture);
- break;
- case GL_TEXTURE_2D_ARRAY:
- context->bindTexture(TEXTURE_2D_ARRAY, texture);
- break;
- case GL_TEXTURE_3D:
- context->bindTexture(TEXTURE_3D, texture);
- break;
- case GL_TEXTURE_RECTANGLE_ARB:
- context->bindTexture(TEXTURE_2D_RECT, texture);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
- red, green, blue, alpha);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setBlendColor(es2::clamp01(red), es2::clamp01(green), es2::clamp01(blue), es2::clamp01(alpha));
- }
-}
-
-void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha)
-{
- TRACE("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha);
-
- switch(modeRGB)
- {
- case GL_FUNC_ADD:
- case GL_FUNC_SUBTRACT:
- case GL_FUNC_REVERSE_SUBTRACT:
- case GL_MIN_EXT:
- case GL_MAX_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(modeAlpha)
- {
- case GL_FUNC_ADD:
- case GL_FUNC_SUBTRACT:
- case GL_FUNC_REVERSE_SUBTRACT:
- case GL_MIN_EXT:
- case GL_MAX_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setBlendEquation(modeRGB, modeAlpha);
- }
-}
-
-void GL_APIENTRY BlendEquation(GLenum mode)
-{
- BlendEquationSeparate(mode, mode);
-}
-
-void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha)
-{
- TRACE("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)",
- srcRGB, dstRGB, srcAlpha, dstAlpha);
-
- switch(srcRGB)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(dstRGB)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(srcAlpha)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(dstAlpha)
- {
- case GL_ZERO:
- case GL_ONE:
- case GL_SRC_COLOR:
- case GL_ONE_MINUS_SRC_COLOR:
- case GL_DST_COLOR:
- case GL_ONE_MINUS_DST_COLOR:
- case GL_SRC_ALPHA:
- case GL_ONE_MINUS_SRC_ALPHA:
- case GL_DST_ALPHA:
- case GL_ONE_MINUS_DST_ALPHA:
- case GL_CONSTANT_COLOR:
- case GL_ONE_MINUS_CONSTANT_COLOR:
- case GL_CONSTANT_ALPHA:
- case GL_ONE_MINUS_CONSTANT_ALPHA:
- break;
- case GL_SRC_ALPHA_SATURATE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setBlendFactors(srcRGB, dstRGB, srcAlpha, dstAlpha);
- }
-}
-
-void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor)
-{
- BlendFuncSeparate(sfactor, dfactor, sfactor, dfactor);
-}
-
-void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage)
-{
- size = static_cast<GLint>(size); // Work around issues with some 64-bit applications
-
- TRACE("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = %p, GLenum usage = %d)",
- target, size, data, usage);
-
- if(size < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(usage)
- {
- case GL_STREAM_DRAW:
- case GL_STATIC_DRAW:
- case GL_DYNAMIC_DRAW:
- break;
- case GL_STREAM_READ:
- case GL_STREAM_COPY:
- case GL_STATIC_READ:
- case GL_STATIC_COPY:
- case GL_DYNAMIC_READ:
- case GL_DYNAMIC_COPY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- buffer->bufferData(data, size, usage);
- }
-}
-
-void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data)
-{
- size = static_cast<GLint>(size); // Work around issues with some 64-bit applications
- offset = static_cast<GLint>(offset);
-
- TRACE("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = %p)",
- target, offset, size, data);
-
- if(size < 0 || offset < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- if(buffer->isMapped())
- {
- // It is an invalid operation to update an already mapped buffer
- return error(GL_INVALID_OPERATION);
- }
-
- if((size_t)size + offset > buffer->size())
- {
- return error(GL_INVALID_VALUE);
- }
-
- buffer->bufferSubData(data, size, offset);
- }
-}
-
-GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target)
-{
- TRACE("(GLenum target = 0x%X)", target);
-
- if(target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
- {
- return error(GL_INVALID_ENUM, 0);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Framebuffer *framebuffer = nullptr;
- if(target == GL_READ_FRAMEBUFFER)
- {
- framebuffer = context->getReadFramebuffer();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- }
-
- if(!framebuffer)
- {
- return GL_FRAMEBUFFER_UNDEFINED_OES;
- }
-
- return framebuffer->completeness();
- }
-
- return 0;
-}
-
-void GL_APIENTRY Clear(GLbitfield mask)
-{
- TRACE("(GLbitfield mask = %X)", mask);
-
- if((mask & ~(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT)) != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->clear(mask);
- }
-}
-
-void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
-{
- TRACE("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)",
- red, green, blue, alpha);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setClearColor(red, green, blue, alpha);
- }
-}
-
-void GL_APIENTRY ClearDepthf(GLclampf depth)
-{
- TRACE("(GLclampf depth = %f)", depth);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setClearDepth(depth);
- }
-}
-
-void GL_APIENTRY ClearStencil(GLint s)
-{
- TRACE("(GLint s = %d)", s);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setClearStencil(s);
- }
-}
-
-void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)
-{
- TRACE("(GLboolean red = %d, GLboolean green = %d, GLboolean blue = %d, GLboolean alpha = %d)",
- red, green, blue, alpha);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setColorMask(red != GL_FALSE, green != GL_FALSE, blue != GL_FALSE, alpha != GL_FALSE);
- }
-}
-
-void GL_APIENTRY CompileShader(GLuint shader)
-{
- TRACE("(GLuint shader = %d)", shader);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- shaderObject->compile();
- }
-}
-
-void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid* data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
- "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = %p)",
- target, level, internalformat, width, height, border, imageSize, data);
-
- if(!validImageSize(level, width, height) || border != 0 || imageSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(internalformat))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(border != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(target)
- {
- case GL_TEXTURE_2D:
- if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if(width != height)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_RECTANGLE_ARB: // Rectangle textures cannot be compressed
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, internalformat))
- {
- return error(GL_INVALID_VALUE);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->setCompressedImage(level, internalformat, width, height, imageSize, data);
- }
- else if(es2::IsCubemapTextureTarget(target))
- {
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->setCompressedImage(target, level, internalformat, width, height, imageSize, data);
- }
- else UNREACHABLE(target);
- }
-}
-
-void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid* data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, "
- "GLsizei imageSize = %d, const GLvoid* data = %p)",
- target, level, xoffset, yoffset, width, height, format, imageSize, data);
-
- if(!es2::IsTexImageTarget(target))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(xoffset < 0 || yoffset < 0 || !validImageSize(level, width, height) || imageSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(format))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, format))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(xoffset % 4 != 0 || yoffset % 4 != 0)
- {
- // We wait to check the offsets until this point, because the multiple-of-four restriction does not exist unless DXT1 textures are supported
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- GLenum validationError = ValidateSubImageParams(true, false, target, level, xoffset, yoffset, width, height, format, GL_NONE, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImageCompressed(level, xoffset, yoffset, width, height, format, imageSize, data);
- }
- else if(es2::IsCubemapTextureTarget(target))
- {
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
-
- GLenum validationError = ValidateSubImageParams(true, false, target, level, xoffset, yoffset, width, height, format, GL_NONE, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImageCompressed(target, level, xoffset, yoffset, width, height, format, imageSize, data);
- }
- else UNREACHABLE(target);
- }
-}
-
-void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
- "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)",
- target, level, internalformat, x, y, width, height, border);
-
- if(!validImageSize(level, width, height))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(border != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_TEXTURE_RECTANGLE_ARB:
- if(level != 0)
- {
- return error(GL_INVALID_VALUE);
- }
- // Fall through to GL_TEXTURE_2D case.
- case GL_TEXTURE_2D:
- if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if(width != height)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- es2::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- es2::Renderbuffer *source = framebuffer->getReadColorbuffer();
-
- if(context->getReadFramebufferName() != 0 && (!source || source->getSamples() > 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum colorbufferFormat = source->getFormat();
-
- // Determine the sized internal format.
- if(gl::IsUnsizedInternalFormat(internalformat))
- {
- if(colorbufferFormat == GL_RGB10_A2)
- {
- // Not supported with unsized internalformat.
- // https://www.khronos.org/members/login/bugzilla/show_bug.cgi?id=9807#c56
- return error(GL_INVALID_OPERATION);
- }
-
- if(gl::GetBaseInternalFormat(colorbufferFormat) == internalformat)
- {
- internalformat = colorbufferFormat;
- }
- else if(GetColorComponentType(colorbufferFormat) == GL_UNSIGNED_NORMALIZED && GetRedSize(colorbufferFormat) <= 8)
- {
- // TODO: Convert to the smallest format that fits all components.
- // e.g. Copying RGBA4 to RGB should result in RGB565, not RGB8.
-
- internalformat = gl::GetSizedInternalFormat(internalformat, GL_UNSIGNED_BYTE);
- }
- else if(GetColorComponentType(colorbufferFormat) == GL_INT)
- {
- internalformat = gl::GetSizedInternalFormat(internalformat, GL_INT);
- }
- else if(GetColorComponentType(colorbufferFormat) == GL_UNSIGNED_INT)
- {
- internalformat = gl::GetSizedInternalFormat(internalformat, GL_UNSIGNED_INT);
- }
- else if(GetColorComponentType(colorbufferFormat) == GL_FLOAT && GetRedSize(colorbufferFormat) == 16) // GL_EXT_color_buffer_half_float
- {
- internalformat = gl::GetSizedInternalFormat(internalformat, GL_HALF_FLOAT_OES);
- }
- else if(GetColorComponentType(colorbufferFormat) == GL_FLOAT && GetRedSize(colorbufferFormat) == 32) // GL_EXT_color_buffer_float
- {
- internalformat = gl::GetSizedInternalFormat(internalformat, GL_FLOAT);
- }
- else
- {
- UNIMPLEMENTED("internalformat = %x, colorbufferFormat = %X", internalformat, colorbufferFormat);
-
- return error(GL_INVALID_OPERATION);
- }
- }
-
- if(!ValidateCopyFormats(internalformat, colorbufferFormat))
- {
- return;
- }
-
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(level, internalformat, x, y, width, height, source);
- }
- else if(es2::IsCubemapTextureTarget(target))
- {
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->copyImage(target, level, internalformat, x, y, width, height, source);
- }
- else UNREACHABLE(target);
- }
-}
-
-void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
- target, level, xoffset, yoffset, x, y, width, height);
-
- if(!es2::IsTexImageTarget(target))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- es2::Renderbuffer *source = framebuffer->getReadColorbuffer();
-
- if(context->getReadFramebufferName() != 0 && (!source || source->getSamples() > 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Texture *texture = nullptr;
-
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- texture = context->getTexture2D(target);
- }
- else if(es2::IsCubemapTextureTarget(target))
- {
- texture = context->getTextureCubeMap();
- }
- else UNREACHABLE(target);
-
- GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, width, height, GL_NONE, GL_NONE, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->copySubImage(target, level, xoffset, yoffset, 0, x, y, width, height, source);
- }
-}
-
-GLuint GL_APIENTRY CreateProgram(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- return context->createProgram();
- }
-
- return 0;
-}
-
-GLuint GL_APIENTRY CreateShader(GLenum type)
-{
- TRACE("(GLenum type = 0x%X)", type);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(type)
- {
- case GL_FRAGMENT_SHADER:
- case GL_VERTEX_SHADER:
- return context->createShader(type);
- default:
- return error(GL_INVALID_ENUM, 0);
- }
- }
-
- return 0;
-}
-
-void GL_APIENTRY CullFace(GLenum mode)
-{
- TRACE("(GLenum mode = 0x%X)", mode);
-
- switch(mode)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- {
- auto context = es2::getContext();
-
- if(context)
- {
- context->setCullMode(mode);
- }
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-}
-
-void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers)
-{
- TRACE("(GLsizei n = %d, const GLuint* buffers = %p)", n, buffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- context->deleteBuffer(buffers[i]);
- }
- }
-}
-
-void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint* fences)
-{
- TRACE("(GLsizei n = %d, const GLuint* fences = %p)", n, fences);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- context->deleteFence(fences[i]);
- }
- }
-}
-
-void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers)
-{
- TRACE("(GLsizei n = %d, const GLuint* framebuffers = %p)", n, framebuffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- if(framebuffers[i] != 0) // Attempts to delete default framebuffer silently ignored.
- {
- context->deleteFramebuffer(framebuffers[i]);
- }
- }
- }
-}
-
-void GL_APIENTRY DeleteProgram(GLuint program)
-{
- TRACE("(GLuint program = %d)", program);
-
- if(program == 0)
- {
- return;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->getProgram(program))
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- context->deleteProgram(program);
- }
-}
-
-void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids)
-{
- TRACE("(GLsizei n = %d, const GLuint *ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- context->deleteQuery(ids[i]);
- }
- }
-}
-
-void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers)
-{
- TRACE("(GLsizei n = %d, const GLuint* renderbuffers = %p)", n, renderbuffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- context->deleteRenderbuffer(renderbuffers[i]);
- }
- }
-}
-
-void GL_APIENTRY DeleteShader(GLuint shader)
-{
- TRACE("(GLuint shader = %d)", shader);
-
- if(shader == 0)
- {
- return;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->getShader(shader))
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- context->deleteShader(shader);
- }
-}
-
-void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures)
-{
- TRACE("(GLsizei n = %d, const GLuint* textures = %p)", n, textures);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- if(textures[i] != 0) // Attempts to delete default texture silently ignored.
- {
- context->deleteTexture(textures[i]);
- }
- }
- }
-}
-
-void GL_APIENTRY DepthFunc(GLenum func)
-{
- TRACE("(GLenum func = 0x%X)", func);
-
- switch(func)
- {
- case GL_NEVER:
- case GL_ALWAYS:
- case GL_LESS:
- case GL_LEQUAL:
- case GL_EQUAL:
- case GL_GREATER:
- case GL_GEQUAL:
- case GL_NOTEQUAL:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setDepthFunc(func);
- }
-}
-
-void GL_APIENTRY DepthMask(GLboolean flag)
-{
- TRACE("(GLboolean flag = %d)", flag);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setDepthMask(flag != GL_FALSE);
- }
-}
-
-void GL_APIENTRY DepthRangef(GLclampf zNear, GLclampf zFar)
-{
- TRACE("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setDepthRange(zNear, zFar);
- }
-}
-
-void GL_APIENTRY DetachShader(GLuint program, GLuint shader)
-{
- TRACE("(GLuint program = %d, GLuint shader = %d)", program, shader);
-
- auto context = es2::getContext();
-
- if(context)
- {
-
- es2::Program *programObject = context->getProgram(program);
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!programObject)
- {
- es2::Shader *shaderByProgramHandle;
- shaderByProgramHandle = context->getShader(program);
- if(!shaderByProgramHandle)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- if(!shaderObject)
- {
- es2::Program *programByShaderHandle = context->getProgram(shader);
- if(!programByShaderHandle)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- if(!programObject->detachShader(shaderObject))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Disable(GLenum cap)
-{
- TRACE("(GLenum cap = 0x%X)", cap);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(cap)
- {
- case GL_CULL_FACE: context->setCullFaceEnabled(false); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFillEnabled(false); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverageEnabled(false); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverageEnabled(false); break;
- case GL_SCISSOR_TEST: context->setScissorTestEnabled(false); break;
- case GL_STENCIL_TEST: context->setStencilTestEnabled(false); break;
- case GL_DEPTH_TEST: context->setDepthTestEnabled(false); break;
- case GL_BLEND: context->setBlendEnabled(false); break;
- case GL_DITHER: context->setDitherEnabled(false); break;
- case GL_PRIMITIVE_RESTART_FIXED_INDEX: context->setPrimitiveRestartFixedIndexEnabled(false); break;
- case GL_RASTERIZER_DISCARD: context->setRasterizerDiscardEnabled(false); break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY DisableVertexAttribArray(GLuint index)
-{
- TRACE("(GLuint index = %d)", index);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setVertexAttribArrayEnabled(index, false);
- }
-}
-
-void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count)
-{
- TRACE("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || first < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && (mode != transformFeedback->primitiveMode()))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawArrays(mode, first, count);
- }
-}
-
-void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices)
-{
- TRACE("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = %p)",
- mode, count, type, indices);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- context->drawElements(mode, 0, MAX_ELEMENT_INDEX, count, type, indices);
- }
-}
-
-void GL_APIENTRY DrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
- mode, first, count, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && (mode != transformFeedback->primitiveMode()))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawArrays(mode, first, count, instanceCount);
- }
-}
-
-void GL_APIENTRY DrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = %p, GLsizei instanceCount = %d)",
- mode, count, type, indices, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawElements(mode, 0, MAX_ELEMENT_INDEX, count, type, indices, instanceCount);
- }
-}
-
-void GL_APIENTRY VertexAttribDivisorEXT(GLuint index, GLuint divisor)
-{
- TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- context->setVertexAttribDivisor(index, divisor);
- }
-}
-
-void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
- mode, first, count, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->hasZeroDivisor())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && (mode != transformFeedback->primitiveMode()))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawArrays(mode, first, count, instanceCount);
- }
-}
-
-void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = %p, GLsizei instanceCount = %d)",
- mode, count, type, indices, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->hasZeroDivisor())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawElements(mode, 0, MAX_ELEMENT_INDEX, count, type, indices, instanceCount);
- }
-}
-
-void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor)
-{
- TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- context->setVertexAttribDivisor(index, divisor);
- }
-}
-
-void GL_APIENTRY Enable(GLenum cap)
-{
- TRACE("(GLenum cap = 0x%X)", cap);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(cap)
- {
- case GL_CULL_FACE: context->setCullFaceEnabled(true); break;
- case GL_POLYGON_OFFSET_FILL: context->setPolygonOffsetFillEnabled(true); break;
- case GL_SAMPLE_ALPHA_TO_COVERAGE: context->setSampleAlphaToCoverageEnabled(true); break;
- case GL_SAMPLE_COVERAGE: context->setSampleCoverageEnabled(true); break;
- case GL_SCISSOR_TEST: context->setScissorTestEnabled(true); break;
- case GL_STENCIL_TEST: context->setStencilTestEnabled(true); break;
- case GL_DEPTH_TEST: context->setDepthTestEnabled(true); break;
- case GL_BLEND: context->setBlendEnabled(true); break;
- case GL_DITHER: context->setDitherEnabled(true); break;
- case GL_PRIMITIVE_RESTART_FIXED_INDEX: context->setPrimitiveRestartFixedIndexEnabled(true); break;
- case GL_RASTERIZER_DISCARD: context->setRasterizerDiscardEnabled(true); break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY EnableVertexAttribArray(GLuint index)
-{
- TRACE("(GLuint index = %d)", index);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setVertexAttribArrayEnabled(index, true);
- }
-}
-
-void GL_APIENTRY EndQueryEXT(GLenum target)
-{
- TRACE("GLenum target = 0x%X)", target);
-
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED_EXT:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->endQuery(target);
- }
-}
-
-void GL_APIENTRY FinishFenceNV(GLuint fence)
-{
- TRACE("(GLuint fence = %d)", fence);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Fence *fenceObject = context->getFence(fence);
-
- if(!fenceObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- fenceObject->finishFence();
- }
-}
-
-void GL_APIENTRY Finish(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->finish();
- }
-}
-
-void GL_APIENTRY Flush(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->flush();
- }
-}
-
-void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, "
- "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer);
-
- if((target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER) ||
- (renderbuffertarget != GL_RENDERBUFFER && renderbuffer != 0))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Framebuffer *framebuffer = nullptr;
- GLuint framebufferName = 0;
- if(target == GL_READ_FRAMEBUFFER)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferName = context->getReadFramebufferName();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferName = context->getDrawFramebufferName();
- }
-
- if(!framebuffer || framebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- // [OpenGL ES 2.0.25] Section 4.4.3 page 112
- // [OpenGL ES 3.0.2] Section 4.4.2 page 201
- // 'renderbuffer' must be either zero or the name of an existing renderbuffer object of
- // type 'renderbuffertarget', otherwise an INVALID_OPERATION error is generated.
- if(renderbuffer != 0)
- {
- if(!context->getRenderbuffer(renderbuffer))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- switch(attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
- break;
- case GL_STENCIL_ATTACHMENT:
- framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- framebuffer->setDepthbuffer(GL_RENDERBUFFER, renderbuffer);
- framebuffer->setStencilbuffer(GL_RENDERBUFFER, renderbuffer);
- break;
- default:
- if(attachment < GL_COLOR_ATTACHMENT0 || attachment > GL_COLOR_ATTACHMENT31)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if((attachment - GL_COLOR_ATTACHMENT0) >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- framebuffer->setColorbuffer(GL_RENDERBUFFER, renderbuffer, attachment - GL_COLOR_ATTACHMENT0);
- break;
- }
- }
-}
-
-void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, "
- "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level);
-
- if(target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(texture == 0)
- {
- textarget = GL_NONE;
- }
- else
- {
- es2::Texture *tex = context->getTexture(texture);
-
- if(!tex)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(textarget)
- {
- case GL_TEXTURE_2D:
- if(tex->getTarget() != GL_TEXTURE_2D)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_TEXTURE_RECTANGLE_ARB:
- if(tex->getTarget() != GL_TEXTURE_RECTANGLE_ARB)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if(tex->getTarget() != GL_TEXTURE_CUBE_MAP)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((textarget == GL_TEXTURE_RECTANGLE_ARB) && (level != 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(tex->isCompressed(textarget, level))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- es2::Framebuffer *framebuffer = nullptr;
- GLuint framebufferName = 0;
- if(target == GL_READ_FRAMEBUFFER)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferName = context->getReadFramebufferName();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferName = context->getDrawFramebufferName();
- }
-
- if(framebufferName == 0 || !framebuffer)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(attachment)
- {
- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level); break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- framebuffer->setDepthbuffer(textarget, texture, level);
- framebuffer->setStencilbuffer(textarget, texture, level);
- break;
- default:
- if(attachment < GL_COLOR_ATTACHMENT0 || attachment > GL_COLOR_ATTACHMENT31)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if((attachment - GL_COLOR_ATTACHMENT0) >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- framebuffer->setColorbuffer(textarget, texture, attachment - GL_COLOR_ATTACHMENT0, level);
- break;
- }
- }
-}
-
-void GL_APIENTRY FrontFace(GLenum mode)
-{
- TRACE("(GLenum mode = 0x%X)", mode);
-
- switch(mode)
- {
- case GL_CW:
- case GL_CCW:
- {
- auto context = es2::getContext();
-
- if(context)
- {
- context->setFrontFace(mode);
- }
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-}
-
-void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers)
-{
- TRACE("(GLsizei n = %d, GLuint* buffers = %p)", n, buffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- buffers[i] = context->createBuffer();
- }
- }
-}
-
-void GL_APIENTRY GenerateMipmap(GLenum target)
-{
- TRACE("(GLenum target = 0x%X)", target);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *texture = context->getTargetTexture(target);
-
- if(!texture)
- {
- return;
- }
-
- if(!IsMipmappable(texture->getFormat(target, texture->getBaseLevel())))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(target == GL_TEXTURE_CUBE_MAP)
- {
- TextureCubeMap *cube = context->getTextureCubeMap();
-
- if(!cube->isCubeComplete())
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- // [OpenGL ES 3.2]: "Otherwise, if levelbase is not defined, or if any dimension
- // is zero, all mipmap levels are left unchanged. This is not an error."
- if(!texture->isBaseLevelDefined())
- {
- return;
- }
-
- texture->generateMipmaps();
- }
-}
-
-void GL_APIENTRY GenFencesNV(GLsizei n, GLuint* fences)
-{
- TRACE("(GLsizei n = %d, GLuint* fences = %p)", n, fences);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- fences[i] = context->createFence();
- }
- }
-}
-
-void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers)
-{
- TRACE("(GLsizei n = %d, GLuint* framebuffers = %p)", n, framebuffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- framebuffers[i] = context->createFramebuffer();
- }
- }
-}
-
-void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint* ids)
-{
- TRACE("(GLsizei n = %d, GLuint* ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- ids[i] = context->createQuery();
- }
- }
-}
-
-void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers)
-{
- TRACE("(GLsizei n = %d, GLuint* renderbuffers = %p)", n, renderbuffers);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- renderbuffers[i] = context->createRenderbuffer();
- }
- }
-}
-
-void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures)
-{
- TRACE("(GLsizei n = %d, GLuint* textures = %p)", n, textures);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- textures[i] = context->createTexture();
- }
- }
-}
-
-void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)
-{
- TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = %p, "
- "GLint *size = %p, GLenum *type = %p, GLchar *name = %p)",
- program, index, bufsize, length, size, type, name);
-
- if(bufsize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(index >= programObject->getActiveAttributeCount())
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->getActiveAttribute(index, bufsize, length, size, type, name);
- }
-}
-
-void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name)
-{
- TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, "
- "GLsizei* length = %p, GLint* size = %p, GLenum* type = %p, GLchar* name = %s)",
- program, index, bufsize, length, size, type, name);
-
- if(bufsize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(index >= programObject->getActiveUniformCount())
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->getActiveUniform(index, bufsize, length, size, type, name);
- }
-}
-
-void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders)
-{
- TRACE("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = %p, GLuint* shaders = %p)",
- program, maxcount, count, shaders);
-
- if(maxcount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- return programObject->getAttachedShaders(maxcount, count, shaders);
- }
-}
-
-int GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name)
-{
- TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION, -1);
- }
- else
- {
- return error(GL_INVALID_VALUE, -1);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION, -1);
- }
-
- return programObject->getAttributeLocation(name);
- }
-
- return -1;
-}
-
-void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params)
-{
- TRACE("(GLenum pname = 0x%X, GLboolean* params = %p)", pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!(context->getBooleanv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that the pname is valid, but there are no parameters to return
-
- if(nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = nullptr;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(floatParams[i] == 0.0f)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
-
- delete [] floatParams;
- }
- else if(nativeType == GL_INT)
- {
- GLint *intParams = nullptr;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(intParams[i] == 0)
- params[i] = GL_FALSE;
- else
- params[i] = GL_TRUE;
- }
-
- delete [] intParams;
- }
- }
- }
-}
-
-void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_BUFFER_USAGE:
- *params = buffer->usage();
- break;
- case GL_BUFFER_SIZE:
- *params = (GLint)buffer->size();
- break;
- case GL_BUFFER_ACCESS_FLAGS:
- *params = buffer->access();
- break;
- case GL_BUFFER_MAPPED:
- *params = buffer->isMapped();
- break;
- case GL_BUFFER_MAP_LENGTH:
- *params = (GLint)buffer->length();
- break;
- case GL_BUFFER_MAP_OFFSET:
- *params = (GLint)buffer->offset();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-GLenum GL_APIENTRY GetError(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- return context->getError();
- }
-
- return GL_NO_ERROR;
-}
-
-void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params)
-{
- TRACE("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = %p)", fence, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Fence *fenceObject = context->getFence(fence);
-
- if(!fenceObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- fenceObject->getFenceiv(pname, params);
- }
-}
-
-void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params)
-{
- TRACE("(GLenum pname = 0x%X, GLfloat* params = %p)", pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!(context->getFloatv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that the pname is valid, but that there are no parameters to return.
-
- if(nativeType == GL_BOOL)
- {
- GLboolean *boolParams = nullptr;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(boolParams[i] == GL_FALSE)
- params[i] = 0.0f;
- else
- params[i] = 1.0f;
- }
-
- delete [] boolParams;
- }
- else if(nativeType == GL_INT)
- {
- GLint *intParams = nullptr;
- intParams = new GLint[numParams];
-
- context->getIntegerv(pname, intParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- params[i] = (GLfloat)intParams[i];
- }
-
- delete [] intParams;
- }
- }
- }
-}
-
-void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = %p)",
- target, attachment, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- GLuint framebufferName = 0;
-
- if(target == GL_READ_FRAMEBUFFER)
- {
- framebufferName = context->getReadFramebufferName();
- }
- else
- {
- framebufferName = context->getDrawFramebufferName();
- }
-
- switch(attachment)
- {
- case GL_BACK:
- case GL_DEPTH:
- case GL_STENCIL:
- if(framebufferName != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- if(framebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- if(framebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- if(framebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(attachment < GL_COLOR_ATTACHMENT0 || attachment > GL_COLOR_ATTACHMENT31)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if((attachment - GL_COLOR_ATTACHMENT0) >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- }
-
- es2::Framebuffer *framebuffer = context->getFramebuffer(framebufferName);
-
- if(!framebuffer)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum attachmentType;
- GLuint attachmentHandle;
- GLint attachmentLayer;
- Renderbuffer *renderbuffer = nullptr;
- switch(attachment)
- {
- case GL_BACK:
- attachmentType = framebuffer->getColorbufferType(0);
- attachmentHandle = framebuffer->getColorbufferName(0);
- attachmentLayer = framebuffer->getColorbufferLayer(0);
- renderbuffer = framebuffer->getColorbuffer(0);
- break;
- case GL_DEPTH:
- case GL_DEPTH_ATTACHMENT:
- attachmentType = framebuffer->getDepthbufferType();
- attachmentHandle = framebuffer->getDepthbufferName();
- attachmentLayer = framebuffer->getDepthbufferLayer();
- renderbuffer = framebuffer->getDepthbuffer();
- break;
- case GL_STENCIL:
- case GL_STENCIL_ATTACHMENT:
- attachmentType = framebuffer->getStencilbufferType();
- attachmentHandle = framebuffer->getStencilbufferName();
- attachmentLayer = framebuffer->getStencilbufferLayer();
- renderbuffer = framebuffer->getStencilbuffer();
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- attachmentType = framebuffer->getDepthbufferType();
- attachmentHandle = framebuffer->getDepthbufferName();
- attachmentLayer = framebuffer->getDepthbufferLayer();
- renderbuffer = framebuffer->getDepthbuffer();
-
- if(attachmentHandle != framebuffer->getStencilbufferName())
- {
- // Different attachments to DEPTH and STENCIL, query fails
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- ASSERT((unsigned int)(attachment - GL_COLOR_ATTACHMENT0) < MAX_COLOR_ATTACHMENTS);
- attachmentType = framebuffer->getColorbufferType(attachment - GL_COLOR_ATTACHMENT0);
- attachmentHandle = framebuffer->getColorbufferName(attachment - GL_COLOR_ATTACHMENT0);
- attachmentLayer = framebuffer->getColorbufferLayer(attachment - GL_COLOR_ATTACHMENT0);
- renderbuffer = framebuffer->getColorbuffer(attachment - GL_COLOR_ATTACHMENT0);
- break;
- }
-
- GLenum attachmentObjectType = GL_NONE; // Type category
- if(framebufferName == 0)
- {
- attachmentObjectType = GL_FRAMEBUFFER_DEFAULT;
- }
- else if(attachmentType == GL_NONE || Framebuffer::IsRenderbuffer(attachmentType))
- {
- attachmentObjectType = attachmentType;
- }
- else if(es2::IsTextureTarget(attachmentType))
- {
- attachmentObjectType = GL_TEXTURE;
- }
- else UNREACHABLE(attachmentType);
-
- if(attachmentObjectType != GL_NONE)
- {
- switch(pname)
- {
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = attachmentObjectType;
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- if(attachmentObjectType == GL_RENDERBUFFER || attachmentObjectType == GL_TEXTURE)
- {
- *params = attachmentHandle;
- }
- else
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:
- if(attachmentObjectType == GL_TEXTURE)
- {
- *params = renderbuffer->getLevel();
- }
- else
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:
- if(attachmentObjectType == GL_TEXTURE)
- {
- if(es2::IsCubemapTextureTarget(attachmentType))
- {
- *params = attachmentType;
- }
- else
- {
- *params = 0;
- }
- }
- else
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER:
- *params = attachmentLayer;
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE:
- *params = renderbuffer->getRedSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE:
- *params = renderbuffer->getGreenSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE:
- *params = renderbuffer->getBlueSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE:
- *params = renderbuffer->getAlphaSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE:
- *params = renderbuffer->getDepthSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE:
- *params = renderbuffer->getStencilSize();
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE:
- // case GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: // GL_EXT_color_buffer_half_float
- if(attachment == GL_DEPTH_STENCIL_ATTACHMENT)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- *params = GetComponentType(renderbuffer->getFormat(), attachment);
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING:
- *params = GetColorEncoding(renderbuffer->getFormat());
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
- else
- {
- // ES 2.0.25 spec pg 127 states that if the value of FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE
- // is NONE, then querying any other pname will generate INVALID_ENUM.
-
- // ES 3.0.2 spec pg 235 states that if the attachment type is none,
- // GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME will return zero and be an
- // INVALID_OPERATION for all other pnames
-
- switch(pname)
- {
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:
- *params = GL_NONE;
- break;
- case GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:
- *params = 0;
- break;
- default:
- return error(GL_INVALID_OPERATION);
- }
- }
- }
-}
-
-GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void)
-{
- TRACE("()");
-
- return GL_NO_ERROR;
-}
-
-void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params)
-{
- TRACE("(GLenum pname = 0x%X, GLint* params = %p)", pname, params);
-
- auto context = es2::getContext();
-
- if(!context)
- {
- // Not strictly an error, but probably unintended or attempting to rely on non-compliant behavior
- ERR("glGetIntegerv() called without current context.");
-
- // This is not spec compliant! When there is no current GL context, functions should
- // have no side effects. Google Maps queries these values before creating a context,
- // so we need this as a bug-compatible workaround.
- switch(pname)
- {
- case GL_MAX_TEXTURE_SIZE: *params = es2::IMPLEMENTATION_MAX_TEXTURE_SIZE; return;
- case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS: *params = es2::MAX_VERTEX_TEXTURE_IMAGE_UNITS; return;
- case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS: *params = es2::MAX_COMBINED_TEXTURE_IMAGE_UNITS; return;
- case GL_STENCIL_BITS: *params = 8; return;
- case GL_ALIASED_LINE_WIDTH_RANGE:
- params[0] = (GLint)es2::ALIASED_LINE_WIDTH_RANGE_MIN;
- params[1] = (GLint)es2::ALIASED_LINE_WIDTH_RANGE_MAX;
- return;
- }
- }
-
- if(context)
- {
- if(!(context->getIntegerv(pname, params)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
-
- if(nativeType == GL_BOOL)
- {
- GLboolean *boolParams = nullptr;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- params[i] = (boolParams[i] == GL_FALSE) ? 0 : 1;
- }
-
- delete [] boolParams;
- }
- else if(nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = nullptr;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
- {
- params[i] = convert_float_fixed(floatParams[i]);
- }
- else
- {
- params[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
- }
-
- delete [] floatParams;
- }
- }
- }
-}
-
-void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params)
-{
- TRACE("(GLuint program = %d, GLenum pname = 0x%X, GLint* params = %p)", program, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- switch(pname)
- {
- case GL_DELETE_STATUS:
- *params = programObject->isFlaggedForDeletion();
- return;
- case GL_LINK_STATUS:
- *params = programObject->isLinked();
- return;
- case GL_VALIDATE_STATUS:
- *params = programObject->isValidated();
- return;
- case GL_INFO_LOG_LENGTH:
- *params = (GLint)programObject->getInfoLogLength();
- return;
- case GL_ATTACHED_SHADERS:
- *params = programObject->getAttachedShadersCount();
- return;
- case GL_ACTIVE_ATTRIBUTES:
- *params = (GLint)programObject->getActiveAttributeCount();
- return;
- case GL_ACTIVE_ATTRIBUTE_MAX_LENGTH:
- *params = programObject->getActiveAttributeMaxLength();
- return;
- case GL_ACTIVE_UNIFORMS:
- *params = (GLint)programObject->getActiveUniformCount();
- return;
- case GL_ACTIVE_UNIFORM_MAX_LENGTH:
- *params = programObject->getActiveUniformMaxLength();
- return;
- case GL_ACTIVE_UNIFORM_BLOCKS:
- *params = (GLint)programObject->getActiveUniformBlockCount();
- return;
- case GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH:
- *params = programObject->getActiveUniformBlockMaxLength();
- return;
- case GL_TRANSFORM_FEEDBACK_BUFFER_MODE:
- *params = programObject->getTransformFeedbackBufferMode();
- return;
- case GL_TRANSFORM_FEEDBACK_VARYINGS:
- *params = programObject->getTransformFeedbackVaryingCount();
- return;
- case GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH:
- *params = programObject->getTransformFeedbackVaryingMaxLength();
- return;
- case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
- *params = programObject->getBinaryRetrievableHint();
- return;
- case GL_PROGRAM_BINARY_LENGTH:
- *params = programObject->getBinaryLength();
- return;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- TRACE("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = %p, GLchar* infolog = %p)",
- program, bufsize, length, infolog);
-
- if(bufsize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- programObject->getInfoLog(bufsize, length, infolog);
- }
-}
-
-void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params)
-{
- TRACE("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = %p)", target, pname, params);
-
- switch(pname)
- {
- case GL_CURRENT_QUERY_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- params[0] = context->getActiveQuery(target);
- }
-}
-
-void GL_APIENTRY GetQueryObjectuivEXT(GLuint name, GLenum pname, GLuint *params)
-{
- TRACE("(GLuint name = %d, GLenum pname = 0x%X, GLuint *params = %p)", name, pname, params);
-
- switch(pname)
- {
- case GL_QUERY_RESULT_EXT:
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Query *queryObject = context->getQuery(name);
-
- if(!queryObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(context->getActiveQuery(queryObject->getType()) == name)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_QUERY_RESULT_EXT:
- params[0] = queryObject->getResult();
- break;
- case GL_QUERY_RESULT_AVAILABLE_EXT:
- params[0] = queryObject->isResultAvailable();
- break;
- default:
- ASSERT(false);
- }
- }
-}
-
-void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(target != GL_RENDERBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(context->getRenderbufferName() == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Renderbuffer *renderbuffer = context->getRenderbuffer(context->getRenderbufferName());
-
- switch(pname)
- {
- case GL_RENDERBUFFER_WIDTH: *params = renderbuffer->getWidth(); break;
- case GL_RENDERBUFFER_HEIGHT: *params = renderbuffer->getHeight(); break;
- case GL_RENDERBUFFER_INTERNAL_FORMAT:
- {
- GLint internalformat = renderbuffer->getFormat();
- *params = (internalformat == GL_NONE) ? GL_RGBA4 : internalformat;
- }
- break;
- case GL_RENDERBUFFER_RED_SIZE: *params = renderbuffer->getRedSize(); break;
- case GL_RENDERBUFFER_GREEN_SIZE: *params = renderbuffer->getGreenSize(); break;
- case GL_RENDERBUFFER_BLUE_SIZE: *params = renderbuffer->getBlueSize(); break;
- case GL_RENDERBUFFER_ALPHA_SIZE: *params = renderbuffer->getAlphaSize(); break;
- case GL_RENDERBUFFER_DEPTH_SIZE: *params = renderbuffer->getDepthSize(); break;
- case GL_RENDERBUFFER_STENCIL_SIZE: *params = renderbuffer->getStencilSize(); break;
- case GL_RENDERBUFFER_SAMPLES: *params = renderbuffer->getSamples(); break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params)
-{
- TRACE("(GLuint shader = %d, GLenum pname = %d, GLint* params = %p)", shader, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- switch(pname)
- {
- case GL_SHADER_TYPE:
- *params = shaderObject->getType();
- return;
- case GL_DELETE_STATUS:
- *params = shaderObject->isFlaggedForDeletion();
- return;
- case GL_COMPILE_STATUS:
- *params = shaderObject->isCompiled() ? GL_TRUE : GL_FALSE;
- return;
- case GL_INFO_LOG_LENGTH:
- *params = (GLint)shaderObject->getInfoLogLength();
- return;
- case GL_SHADER_SOURCE_LENGTH:
- *params = (GLint)shaderObject->getSourceLength();
- return;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog)
-{
- TRACE("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = %p, GLchar* infolog = %p)",
- shader, bufsize, length, infolog);
-
- if(bufsize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- shaderObject->getInfoLog(bufsize, length, infolog);
- }
-}
-
-void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision)
-{
- TRACE("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = %p, GLint* precision = %p)",
- shadertype, precisiontype, range, precision);
-
- switch(shadertype)
- {
- case GL_VERTEX_SHADER:
- case GL_FRAGMENT_SHADER:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(precisiontype)
- {
- case GL_LOW_FLOAT:
- case GL_MEDIUM_FLOAT:
- case GL_HIGH_FLOAT:
- // IEEE 754 single-precision
- range[0] = 127;
- range[1] = 127;
- *precision = 23;
- break;
- case GL_LOW_INT:
- case GL_MEDIUM_INT:
- case GL_HIGH_INT:
- // Full integer precision is supported
- range[0] = 31;
- range[1] = 30;
- *precision = 0;
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-}
-
-void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source)
-{
- TRACE("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = %p, GLchar* source = %p)",
- shader, bufsize, length, source);
-
- if(bufsize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- shaderObject->getSource(bufsize, length, source);
- }
-}
-
-const GLubyte* GL_APIENTRY GetString(GLenum name)
-{
- TRACE("(GLenum name = 0x%X)", name);
-
- switch(name)
- {
- case GL_VENDOR:
- return (GLubyte*)"Google Inc.";
- case GL_RENDERER:
- return (GLubyte*)"Google SwiftShader";
- case GL_VERSION:
- return (GLubyte*)"OpenGL ES 3.0 SwiftShader " VERSION_STRING;
- case GL_SHADING_LANGUAGE_VERSION:
- return (GLubyte*)"OpenGL ES GLSL ES 3.00 SwiftShader " VERSION_STRING;
- case GL_EXTENSIONS:
- {
- auto context = es2::getContext();
- return context ? context->getExtensions(GL_INVALID_INDEX) : (GLubyte*)nullptr;
- }
- default:
- return error(GL_INVALID_ENUM, (GLubyte*)nullptr);
- }
-}
-
-void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = %p)", target, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *texture = context->getTargetTexture(target);
-
- if(!texture)
- {
- return;
- }
-
- switch(pname)
- {
- case GL_TEXTURE_MAG_FILTER:
- *params = (GLfloat)texture->getMagFilter();
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = (GLfloat)texture->getMinFilter();
- break;
- case GL_TEXTURE_WRAP_S:
- *params = (GLfloat)texture->getWrapS();
- break;
- case GL_TEXTURE_WRAP_T:
- *params = (GLfloat)texture->getWrapT();
- break;
- case GL_TEXTURE_WRAP_R_OES:
- *params = (GLfloat)texture->getWrapR();
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- *params = texture->getMaxAnisotropy();
- break;
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- *params = (GLfloat)1;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- *params = (GLfloat)texture->getBaseLevel();
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- *params = (GLfloat)texture->getCompareFunc();
- break;
- case GL_TEXTURE_COMPARE_MODE:
- *params = (GLfloat)texture->getCompareMode();
- break;
- case GL_TEXTURE_IMMUTABLE_FORMAT:
- *params = (GLfloat)texture->getImmutableFormat();
- break;
- case GL_TEXTURE_IMMUTABLE_LEVELS:
- *params = (GLfloat)texture->getImmutableLevels();
- break;
- case GL_TEXTURE_MAX_LEVEL:
- *params = (GLfloat)texture->getMaxLevel();
- break;
- case GL_TEXTURE_MAX_LOD:
- *params = texture->getMaxLOD();
- break;
- case GL_TEXTURE_MIN_LOD:
- *params = texture->getMinLOD();
- break;
- case GL_TEXTURE_SWIZZLE_R:
- *params = (GLfloat)texture->getSwizzleR();
- break;
- case GL_TEXTURE_SWIZZLE_G:
- *params = (GLfloat)texture->getSwizzleG();
- break;
- case GL_TEXTURE_SWIZZLE_B:
- *params = (GLfloat)texture->getSwizzleB();
- break;
- case GL_TEXTURE_SWIZZLE_A:
- *params = (GLfloat)texture->getSwizzleA();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = %p)", target, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *texture = context->getTargetTexture(target);
-
- if(!texture)
- {
- return;
- }
-
- switch(pname)
- {
- case GL_TEXTURE_MAG_FILTER:
- *params = texture->getMagFilter();
- break;
- case GL_TEXTURE_MIN_FILTER:
- *params = texture->getMinFilter();
- break;
- case GL_TEXTURE_WRAP_S:
- *params = texture->getWrapS();
- break;
- case GL_TEXTURE_WRAP_T:
- *params = texture->getWrapT();
- break;
- case GL_TEXTURE_WRAP_R_OES:
- *params = texture->getWrapR();
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- *params = (GLint)texture->getMaxAnisotropy();
- break;
- case GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES:
- *params = 1;
- break;
- case GL_TEXTURE_BASE_LEVEL:
- *params = texture->getBaseLevel();
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- *params = (GLint)texture->getCompareFunc();
- break;
- case GL_TEXTURE_COMPARE_MODE:
- *params = (GLint)texture->getCompareMode();
- break;
- case GL_TEXTURE_IMMUTABLE_FORMAT:
- *params = (GLint)texture->getImmutableFormat();
- break;
- case GL_TEXTURE_IMMUTABLE_LEVELS:
- *params = (GLint)texture->getImmutableLevels();
- break;
- case GL_TEXTURE_MAX_LEVEL:
- *params = texture->getMaxLevel();
- break;
- case GL_TEXTURE_MAX_LOD:
- *params = (GLint)roundf(texture->getMaxLOD());
- break;
- case GL_TEXTURE_MIN_LOD:
- *params = (GLint)roundf(texture->getMinLOD());
- break;
- case GL_TEXTURE_SWIZZLE_R:
- *params = (GLint)texture->getSwizzleR();
- break;
- case GL_TEXTURE_SWIZZLE_G:
- *params = (GLint)texture->getSwizzleG();
- break;
- case GL_TEXTURE_SWIZZLE_B:
- *params = (GLint)texture->getSwizzleB();
- break;
- case GL_TEXTURE_SWIZZLE_A:
- *params = (GLint)texture->getSwizzleA();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params)
-{
- TRACE("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = %p)",
- program, location, bufSize, params);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!programObject->getUniformfv(location, &bufSize, params))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params)
-{
- TRACE("(GLuint program = %d, GLint location = %d, GLfloat* params = %p)", program, location, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!programObject->getUniformfv(location, nullptr, params))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params)
-{
- TRACE("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = %p)",
- program, location, bufSize, params);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!programObject->getUniformiv(location, &bufSize, params))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params)
-{
- TRACE("(GLuint program = %d, GLint location = %d, GLint* params = %p)", program, location, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!programObject->getUniformiv(location, nullptr, params))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-int GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name)
-{
- TRACE("(GLuint program = %d, const GLchar* name = %s)", program, name);
-
- auto context = es2::getContext();
-
- if(strstr(name, "gl_") == name)
- {
- return -1;
- }
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION, -1);
- }
- else
- {
- return error(GL_INVALID_VALUE, -1);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION, -1);
- }
-
- return programObject->getUniformLocation(name);
- }
-
- return -1;
-}
-
-void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params)
-{
- TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = %p)", index, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
-
- switch(pname)
- {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (GLfloat)(attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = (GLfloat)attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = (GLfloat)attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = (GLfloat)attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (GLfloat)(attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = (GLfloat)attribState.mBoundBuffer.name();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- {
- const VertexAttribute& attrib = context->getCurrentVertexAttributes()[index];
- for(int i = 0; i < 4; ++i)
- {
- params[i] = attrib.getCurrentValueF(i);
- }
- }
- break;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- *params = (GLfloat)(attribState.mPureInteger ? GL_TRUE : GL_FALSE);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params)
-{
- TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = %p)", index, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
-
- switch(pname)
- {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = attribState.mBoundBuffer.name();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- {
- const VertexAttribute& attrib = context->getCurrentVertexAttributes()[index];
- for(int i = 0; i < 4; ++i)
- {
- float currentValue = attrib.getCurrentValueF(i);
- params[i] = (GLint)(currentValue > 0.0f ? floor(currentValue + 0.5f) : ceil(currentValue - 0.5f));
- }
- }
- break;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- *params = (attribState.mPureInteger ? GL_TRUE : GL_FALSE);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer)
-{
- TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = %p)", index, pname, pointer);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(pname != GL_VERTEX_ATTRIB_ARRAY_POINTER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- *pointer = const_cast<GLvoid*>(context->getVertexAttribPointer(index));
- }
-}
-
-void GL_APIENTRY Hint(GLenum target, GLenum mode)
-{
- TRACE("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode);
-
- switch(mode)
- {
- case GL_FASTEST:
- case GL_NICEST:
- case GL_DONT_CARE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_GENERATE_MIPMAP_HINT:
- context->setGenerateMipmapHint(mode);
- break;
- case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
- context->setFragmentShaderDerivativeHint(mode);
- break;
- case GL_TEXTURE_FILTERING_HINT_CHROMIUM:
- context->setTextureFilteringHint(mode);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsBuffer(GLuint buffer)
-{
- TRACE("(GLuint buffer = %d)", buffer);
-
- auto context = es2::getContext();
-
- if(context && buffer)
- {
- es2::Buffer *bufferObject = context->getBuffer(buffer);
-
- if(bufferObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsEnabled(GLenum cap)
-{
- TRACE("(GLenum cap = 0x%X)", cap);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(cap)
- {
- case GL_CULL_FACE: return context->isCullFaceEnabled();
- case GL_POLYGON_OFFSET_FILL: return context->isPolygonOffsetFillEnabled();
- case GL_SAMPLE_ALPHA_TO_COVERAGE: return context->isSampleAlphaToCoverageEnabled();
- case GL_SAMPLE_COVERAGE: return context->isSampleCoverageEnabled();
- case GL_SCISSOR_TEST: return context->isScissorTestEnabled();
- case GL_STENCIL_TEST: return context->isStencilTestEnabled();
- case GL_DEPTH_TEST: return context->isDepthTestEnabled();
- case GL_BLEND: return context->isBlendEnabled();
- case GL_DITHER: return context->isDitherEnabled();
- case GL_PRIMITIVE_RESTART_FIXED_INDEX: return context->isPrimitiveRestartFixedIndexEnabled();
- case GL_RASTERIZER_DISCARD: return context->isRasterizerDiscardEnabled();
- default:
- return error(GL_INVALID_ENUM, false);
- }
- }
-
- return false;
-}
-
-GLboolean GL_APIENTRY IsFenceNV(GLuint fence)
-{
- TRACE("(GLuint fence = %d)", fence);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Fence *fenceObject = context->getFence(fence);
-
- if(!fenceObject)
- {
- return GL_FALSE;
- }
-
- return fenceObject->isFence();
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer)
-{
- TRACE("(GLuint framebuffer = %d)", framebuffer);
-
- auto context = es2::getContext();
-
- if(context && framebuffer)
- {
- es2::Framebuffer *framebufferObject = context->getFramebuffer(framebuffer);
-
- if(framebufferObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsProgram(GLuint program)
-{
- TRACE("(GLuint program = %d)", program);
-
- auto context = es2::getContext();
-
- if(context && program)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(programObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsQueryEXT(GLuint name)
-{
- TRACE("(GLuint name = %d)", name);
-
- if(name == 0)
- {
- return GL_FALSE;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Query *queryObject = context->getQuery(name);
-
- if(queryObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer)
-{
- TRACE("(GLuint renderbuffer = %d)", renderbuffer);
-
- auto context = es2::getContext();
-
- if(context && renderbuffer)
- {
- es2::Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer);
-
- if(renderbufferObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsShader(GLuint shader)
-{
- TRACE("(GLuint shader = %d)", shader);
-
- auto context = es2::getContext();
-
- if(context && shader)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(shaderObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsTexture(GLuint texture)
-{
- TRACE("(GLuint texture = %d)", texture);
-
- auto context = es2::getContext();
-
- if(context && texture)
- {
- es2::Texture *textureObject = context->getTexture(texture);
-
- if(textureObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY LineWidth(GLfloat width)
-{
- TRACE("(GLfloat width = %f)", width);
-
- if(width <= 0.0f)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setLineWidth(width);
- }
-}
-
-void GL_APIENTRY LinkProgram(GLuint program)
-{
- TRACE("(GLuint program = %d)", program);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(programObject == context->getCurrentProgram())
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive())
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- programObject->link();
- }
-}
-
-void GL_APIENTRY PixelStorei(GLenum pname, GLint param)
-{
- TRACE("(GLenum pname = 0x%X, GLint param = %d)", pname, param);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(pname)
- {
- case GL_UNPACK_ALIGNMENT:
- if(param != 1 && param != 2 && param != 4 && param != 8)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackAlignment(param);
- break;
- case GL_PACK_ALIGNMENT:
- if(param != 1 && param != 2 && param != 4 && param != 8)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setPackAlignment(param);
- break;
- case GL_PACK_ROW_LENGTH:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setPackRowLength(param);
- break;
- case GL_PACK_SKIP_PIXELS:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setPackSkipPixels(param);
- break;
- case GL_PACK_SKIP_ROWS:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setPackSkipRows(param);
- break;
- case GL_UNPACK_ROW_LENGTH:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackRowLength(param);
- break;
- case GL_UNPACK_IMAGE_HEIGHT:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackImageHeight(param);
- break;
- case GL_UNPACK_SKIP_PIXELS:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackSkipPixels(param);
- break;
- case GL_UNPACK_SKIP_ROWS:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackSkipRows(param);
- break;
- case GL_UNPACK_SKIP_IMAGES:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->setUnpackSkipImages(param);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units)
-{
- TRACE("(GLfloat factor = %f, GLfloat units = %f)", factor, units);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setPolygonOffsetParams(factor, units);
- }
-}
-
-void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei bufSize, GLvoid *data)
-{
- TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = %p)",
- x, y, width, height, format, type, bufSize, data);
-
- if(width < 0 || height < 0 || bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->readPixels(x, y, width, height, format, type, &bufSize, data);
- }
-}
-
-void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels)
-{
- TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = %p)",
- x, y, width, height, format, type, pixels);
-
- if(width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->readPixels(x, y, width, height, format, type, nullptr, pixels);
- }
-}
-
-void GL_APIENTRY ReleaseShaderCompiler(void)
-{
- TRACE("()");
-
- es2::Shader::releaseCompiler();
-}
-
-void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
- target, samples, internalformat, width, height);
-
- switch(target)
- {
- case GL_RENDERBUFFER:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(width < 0 || height < 0 || samples < 0 ||
- width > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE ||
- height > es2::IMPLEMENTATION_MAX_RENDERBUFFER_SIZE)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(samples > es2::IMPLEMENTATION_MAX_SAMPLES ||
- (IsNonNormalizedInteger(internalformat) && samples > 0))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLuint handle = context->getRenderbufferName();
- if(handle == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(IsColorRenderable(internalformat))
- {
- context->setRenderbufferStorage(new es2::Colorbuffer(width, height, internalformat, samples));
- }
- else if(IsDepthRenderable(internalformat) && IsStencilRenderable(internalformat))
- {
- context->setRenderbufferStorage(new es2::DepthStencilbuffer(width, height, internalformat, samples));
- }
- else if(IsDepthRenderable(internalformat))
- {
- context->setRenderbufferStorage(new es2::Depthbuffer(width, height, internalformat, samples));
- }
- else if(IsStencilRenderable(internalformat))
- {
- context->setRenderbufferStorage(new es2::Stencilbuffer(width, height, samples));
- }
- else error(GL_INVALID_ENUM);
- }
-}
-
-void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height)
-{
- RenderbufferStorageMultisample(target, samples, internalformat, width, height);
-}
-
-void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- RenderbufferStorageMultisample(target, 0, internalformat, width, height);
-}
-
-void GL_APIENTRY SampleCoverage(GLclampf value, GLboolean invert)
-{
- TRACE("(GLclampf value = %f, GLboolean invert = %d)", value, invert);
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setSampleCoverageParams(es2::clamp01(value), invert != GL_FALSE);
- }
-}
-
-void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition)
-{
- TRACE("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition);
-
- if(condition != GL_ALL_COMPLETED_NV)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Fence *fenceObject = context->getFence(fence);
-
- if(!fenceObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- fenceObject->setFence(condition);
- }
-}
-
-void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
-
- if(width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setScissorParams(x, y, width, height);
- }
-}
-
-void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length)
-{
- TRACE("(GLsizei n = %d, const GLuint* shaders = %p, GLenum binaryformat = 0x%X, "
- "const GLvoid* binary = %p, GLsizei length = %d)",
- n, shaders, binaryformat, binary, length);
-
- // No binary shader formats are supported.
- return error(GL_INVALID_ENUM);
-}
-
-void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length)
-{
- TRACE("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = %p, const GLint* length = %p)",
- shader, count, string, length);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Shader *shaderObject = context->getShader(shader);
-
- if(!shaderObject)
- {
- if(context->getProgram(shader))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- shaderObject->setSource(count, string, length);
- }
-}
-
-void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
-{
- TRACE("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask);
-
- switch(face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(func)
- {
- case GL_NEVER:
- case GL_ALWAYS:
- case GL_LESS:
- case GL_LEQUAL:
- case GL_EQUAL:
- case GL_GEQUAL:
- case GL_GREATER:
- case GL_NOTEQUAL:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->setStencilParams(func, ref, mask);
- }
-
- if(face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->setStencilBackParams(func, ref, mask);
- }
- }
-}
-
-void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask)
-{
- StencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask);
-}
-
-void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask)
-{
- TRACE("(GLenum face = 0x%X, GLuint mask = %d)", face, mask);
-
- switch(face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->setStencilWritemask(mask);
- }
-
- if(face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->setStencilBackWritemask(mask);
- }
- }
-}
-
-void GL_APIENTRY StencilMask(GLuint mask)
-{
- StencilMaskSeparate(GL_FRONT_AND_BACK, mask);
-}
-
-void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass)
-{
- TRACE("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)",
- face, fail, zfail, zpass);
-
- switch(face)
- {
- case GL_FRONT:
- case GL_BACK:
- case GL_FRONT_AND_BACK:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(fail)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(zfail)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(zpass)
- {
- case GL_ZERO:
- case GL_KEEP:
- case GL_REPLACE:
- case GL_INCR:
- case GL_DECR:
- case GL_INVERT:
- case GL_INCR_WRAP:
- case GL_DECR_WRAP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(face == GL_FRONT || face == GL_FRONT_AND_BACK)
- {
- context->setStencilOperations(fail, zfail, zpass);
- }
-
- if(face == GL_BACK || face == GL_FRONT_AND_BACK)
- {
- context->setStencilBackOperations(fail, zfail, zpass);
- }
- }
-}
-
-void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass)
-{
- StencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass);
-}
-
-GLboolean GL_APIENTRY TestFenceNV(GLuint fence)
-{
- TRACE("(GLuint fence = %d)", fence);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Fence *fenceObject = context->getFence(fence);
-
- if(!fenceObject)
- {
- return error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- return fenceObject->testFence();
- }
-
- return GL_TRUE;
-}
-
-void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const GLvoid* data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, "
- "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* data = %p)",
- target, level, internalformat, width, height, border, format, type, data);
-
- if(!validImageSize(level, width, height))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- // GL_APPLE_texture_format_BGRA8888 allows (only) GL_BGRA_EXT / GL_RGBA, while
- // GL_EXT_texture_format_BGRA8888 also allows GL_BGRA_EXT / GL_BGRA_EXT.
- if(format == GL_BGRA_EXT && internalformat == GL_RGBA)
- {
- internalformat = GL_BGRA_EXT;
- }
-
- GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- if(border != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(target)
- {
- case GL_TEXTURE_RECTANGLE_ARB:
- if(level != 0)
- {
- return error(GL_INVALID_VALUE); // Defining level other than 0 is not allowed
- }
- // Fall through to GL_TEXTURE_2D case.
- case GL_TEXTURE_2D:
- if(width > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- if(width != height)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(width > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level) ||
- height > (es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE >> level))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
-
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->setImage(level, width, height, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
- }
- else
- {
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->setImage(target, level, width, height, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
- }
- }
-}
-
-void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat param = %f)", target, pname, param);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *texture = context->getTargetTexture(target);
-
- if(!texture)
- {
- return;
- }
-
- switch(pname)
- {
- case GL_TEXTURE_WRAP_S:
- if(!texture->setWrapS((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if(!texture->setWrapT((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_R_OES:
- if(!texture->setWrapR((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if(!texture->setMinFilter((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if(!texture->setMagFilter((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if(!texture->setMaxAnisotropy(param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_BASE_LEVEL:
- if(!texture->setBaseLevel((GLint)(roundf(param))))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- if(!texture->setCompareFunc((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_COMPARE_MODE:
- if(!texture->setCompareMode((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MAX_LEVEL:
- if(!texture->setMaxLevel((GLint)(roundf(param))))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MAX_LOD:
- if(!texture->setMaxLOD(param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MIN_LOD:
- if(!texture->setMinLOD(param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_R:
- if(!texture->setSwizzleR((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_G:
- if(!texture->setSwizzleG((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_B:
- if(!texture->setSwizzleB((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_A:
- if(!texture->setSwizzleA((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat* params)
-{
- TexParameterf(target, pname, *params);
-}
-
-void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture *texture = context->getTargetTexture(target);
-
- if(!texture)
- {
- return;
- }
-
- switch(pname)
- {
- case GL_TEXTURE_WRAP_S:
- if(!texture->setWrapS((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_T:
- if(!texture->setWrapT((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_WRAP_R_OES:
- if(!texture->setWrapR((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MIN_FILTER:
- if(!texture->setMinFilter((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAG_FILTER:
- if(!texture->setMagFilter((GLenum)param))
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- if(!texture->setMaxAnisotropy((GLfloat)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_BASE_LEVEL:
- if((texture->getTarget() == GL_TEXTURE_RECTANGLE_ARB) && (param != 0))
- {
- return error(GL_INVALID_OPERATION); // Base level has to be 0
- }
- if(!texture->setBaseLevel(param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_COMPARE_FUNC:
- if(!texture->setCompareFunc((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_COMPARE_MODE:
- if(!texture->setCompareMode((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MAX_LEVEL:
- if(!texture->setMaxLevel(param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MAX_LOD:
- if(!texture->setMaxLOD((GLfloat)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_MIN_LOD:
- if(!texture->setMinLOD((GLfloat)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_R:
- if(!texture->setSwizzleR((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_G:
- if(!texture->setSwizzleG((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_B:
- if(!texture->setSwizzleB((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_SWIZZLE_A:
- if(!texture->setSwizzleA((GLenum)param))
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint* params)
-{
- TexParameteri(target, pname, *params);
-}
-
-void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid* data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, "
- "const GLvoid* data = %p)",
- target, level, xoffset, yoffset, width, height, format, type, data);
-
- if(!es2::IsTexImageTarget(target))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(xoffset < 0 || yoffset < 0 || width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(std::numeric_limits<GLsizei>::max() - xoffset < width || std::numeric_limits<GLsizei>::max() - yoffset < height)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(target == GL_TEXTURE_2D || target == GL_TEXTURE_RECTANGLE_ARB)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, width, height, format, type, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImage(level, xoffset, yoffset, width, height, format, type, context->getUnpackParameters(), data);
- }
- else if(es2::IsCubemapTextureTarget(target))
- {
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
-
- GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, width, height, format, type, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, 1, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImage(target, level, xoffset, yoffset, width, height, format, type, context->getUnpackParameters(), data);
- }
- else UNREACHABLE(target);
- }
-}
-
-void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform1fv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform1f(GLint location, GLfloat x)
-{
- Uniform1fv(location, 1, &x);
-}
-
-void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform1iv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform1i(GLint location, GLint x)
-{
- Uniform1iv(location, 1, &x);
-}
-
-void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform2fv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y)
-{
- GLfloat xy[2] = {x, y};
-
- Uniform2fv(location, 1, (GLfloat*)&xy);
-}
-
-void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform2iv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y)
-{
- GLint xy[4] = {x, y};
-
- Uniform2iv(location, 1, (GLint*)&xy);
-}
-
-void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform3fv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z)
-{
- GLfloat xyz[3] = {x, y, z};
-
- Uniform3fv(location, 1, (GLfloat*)&xyz);
-}
-
-void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform3iv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z)
-{
- GLint xyz[3] = {x, y, z};
-
- Uniform3iv(location, 1, (GLint*)&xyz);
-}
-
-void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLfloat* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform4fv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- GLfloat xyzw[4] = {x, y, z, w};
-
- Uniform4fv(location, 1, (GLfloat*)&xyzw);
-}
-
-void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLint* v = %p)", location, count, v);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform4iv(location, count, v))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w)
-{
- GLint xyzw[4] = {x, y, z, w};
-
- Uniform4iv(location, 1, (GLint*)&xyzw);
-}
-
-void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = %p)",
- location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix2fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = %p)",
- location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix3fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat* value = %p)",
- location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix4fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UseProgram(GLuint program)
-{
- TRACE("(GLuint program = %d)", program);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject && program != 0)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(program != 0 && !programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->useProgram(program);
- }
-}
-
-void GL_APIENTRY ValidateProgram(GLuint program)
-{
- TRACE("(GLuint program = %d)", program);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- programObject->validate(context->getDevice());
- }
-}
-
-void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x)
-{
- TRACE("(GLuint index = %d, GLfloat x = %f)", index, x);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { x, 0, 0, 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat* values)
-{
- TRACE("(GLuint index = %d, const GLfloat* values = %p)", index, values);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { values[0], 0, 0, 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y)
-{
- TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { x, y, 0, 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat* values)
-{
- TRACE("(GLuint index = %d, const GLfloat* values = %p)", index, values);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { values[0], values[1], 0, 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z)
-{
- TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { x, y, z, 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat* values)
-{
- TRACE("(GLuint index = %d, const GLfloat* values = %p)", index, values);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { values[0], values[1], values[2], 1 };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)
-{
- TRACE("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLfloat vals[4] = { x, y, z, w };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat* values)
-{
- TRACE("(GLuint index = %d, const GLfloat* values = %p)", index, values);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setVertexAttrib(index, values);
- }
-}
-
-void GL_APIENTRY VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr)
-{
- TRACE("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, "
- "GLboolean normalized = %d, GLsizei stride = %d, const GLvoid* ptr = %p)",
- index, size, type, normalized, stride, ptr);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(size < 1 || size > 4)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(type)
- {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_FIXED:
- case GL_FLOAT:
- case GL_HALF_FLOAT_OES: // GL_OES_vertex_half_float
- case GL_HALF_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- break;
- case GL_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- if(size != 4)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(stride < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::VertexArray* vertexArray = context->getCurrentVertexArray();
- if((context->getArrayBufferName() == 0) && vertexArray && (vertexArray->name != 0) && ptr)
- {
- // GL_INVALID_OPERATION is generated if a non-zero vertex array object is bound, zero is bound
- // to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.
- return error(GL_INVALID_OPERATION);
- }
-
- context->setVertexAttribState(index, context->getArrayBuffer(), size, type, (normalized != GL_FALSE), false, stride, ptr);
- }
-}
-
-void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height);
-
- if(width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setViewportParams(x, y, width, height);
- }
-}
-
-static void GL_APIENTRY BlitFramebufferSW(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter, bool allowPartialDepthStencilBlit)
-{
- TRACE("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
- "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
- "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
- srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
- switch(filter)
- {
- case GL_NEAREST:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(context->getReadFramebufferName() == context->getDrawFramebufferName())
- {
- ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
- return error(GL_INVALID_OPERATION);
- }
-
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, false, allowPartialDepthStencilBlit);
- }
-}
-
-void GL_APIENTRY BlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- BlitFramebufferSW(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter, true);
-}
-
-void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter)
-{
- if(srcX1 - srcX0 != dstX1 - dstX0 || srcY1 - srcY0 != dstY1 - dstY0)
- {
- ERR("Scaling and flipping in BlitFramebufferANGLE not supported by this implementation");
- return error(GL_INVALID_OPERATION);
- }
-
- BlitFramebufferSW(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter, false);
-}
-
-void GL_APIENTRY TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type, const GLvoid* data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
- "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* data = %p)",
- target, level, internalformat, width, height, depth, border, format, type, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- switch(format)
- {
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- return error(GL_INVALID_OPERATION);
- default:
- break;
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(internalformat != format)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- const GLsizei maxSize3D = es2::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE >> level;
- if((width < 0) || (height < 0) || (depth < 0) || (width > maxSize3D) || (height > maxSize3D) || (depth > maxSize3D))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(border != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = context->getTexture3D();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
- texture->setImage(level, width, height, depth, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
- }
-}
-
-void GL_APIENTRY TexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* data = %p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if((width < 0) || (height < 0) || (depth < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = context->getTexture3D();
-
- GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackParameters(), data);
- }
-}
-
-void GL_APIENTRY CopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
- target, level, xoffset, yoffset, zoffset, x, y, width, height);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- es2::Renderbuffer *source = framebuffer->getReadColorbuffer();
-
- if(context->getReadFramebufferName() != 0 && (!source || source->getSamples() > 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Texture3D *texture = context->getTexture3D();
-
- GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_NONE, GL_NONE, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, source);
- }
-}
-
-void GL_APIENTRY CompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
- "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = %p)",
- target, level, internalformat, width, height, depth, border, imageSize, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- const GLsizei maxSize3D = es2::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE >> level;
- if((width < 0) || (height < 0) || (depth < 0) || (width > maxSize3D) || (height > maxSize3D) || (depth > maxSize3D) ||(border != 0) || (imageSize < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(internalformat))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, internalformat) * depth)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = context->getTexture3D();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
-
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
- }
-}
-
-void GL_APIENTRY CompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
- "GLenum format = 0x%X, GLsizei imageSize = %d, const void *data = %p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(xoffset < 0 || yoffset < 0 || zoffset < 0 || !validImageSize(level, width, height) || depth < 0 || imageSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(format))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, format) * depth)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = context->getTexture3D();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
- }
-}
-
-void GL_APIENTRY FramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset)
-{
- TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, "
- "GLuint texture = %d, GLint level = %d, GLint zoffset = %d)", target, attachment, textarget, texture, level, zoffset);
-
- if(target != GL_FRAMEBUFFER && target != GL_DRAW_FRAMEBUFFER && target != GL_READ_FRAMEBUFFER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(texture == 0)
- {
- textarget = GL_NONE;
- }
- else
- {
- es2::Texture *tex = context->getTexture(texture);
-
- if(!tex)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(textarget)
- {
- case GL_TEXTURE_3D:
- if(tex->getTarget() != GL_TEXTURE_3D)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(tex->isCompressed(textarget, level))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- es2::Framebuffer *framebuffer = nullptr;
- GLuint framebufferName = 0;
- if(target == GL_READ_FRAMEBUFFER)
- {
- framebuffer = context->getReadFramebuffer();
- framebufferName = context->getReadFramebufferName();
- }
- else
- {
- framebuffer = context->getDrawFramebuffer();
- framebufferName = context->getDrawFramebufferName();
- }
-
- if(framebufferName == 0 || !framebuffer)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(attachment)
- {
- case GL_DEPTH_ATTACHMENT: framebuffer->setDepthbuffer(textarget, texture, level); break;
- case GL_STENCIL_ATTACHMENT: framebuffer->setStencilbuffer(textarget, texture, level); break;
- default:
- if(attachment < GL_COLOR_ATTACHMENT0 || attachment > GL_COLOR_ATTACHMENT31)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if((attachment - GL_COLOR_ATTACHMENT0) >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- framebuffer->setColorbuffer(textarget, texture, attachment - GL_COLOR_ATTACHMENT0, level);
- break;
- }
- }
-}
-
-void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image)
-{
- TRACE("(GLenum target = 0x%X, GLeglImageOES image = %p)", target, image);
-
- switch(target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_RECTANGLE_ARB:
- case GL_TEXTURE_EXTERNAL_OES:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture2D *texture = context->getTexture2D(target);
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- egl::Image *eglImage = context->getSharedImage(image);
-
- if(!eglImage)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- texture->setSharedImage(eglImage);
- }
-}
-
-void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image)
-{
- TRACE("(GLenum target = 0x%X, GLeglImageOES image = %p)", target, image);
-
- UNIMPLEMENTED();
-}
-
-GLboolean GL_APIENTRY IsRenderbufferOES(GLuint renderbuffer)
-{
- return IsRenderbuffer(renderbuffer);
-}
-
-void GL_APIENTRY BindRenderbufferOES(GLenum target, GLuint renderbuffer)
-{
- BindRenderbuffer(target, renderbuffer);
-}
-
-void GL_APIENTRY DeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers)
-{
- DeleteRenderbuffers(n, renderbuffers);
-}
-
-void GL_APIENTRY GenRenderbuffersOES(GLsizei n, GLuint* renderbuffers)
-{
- GenRenderbuffers(n, renderbuffers);
-}
-
-void GL_APIENTRY RenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height)
-{
- RenderbufferStorage(target, internalformat, width, height);
-}
-
-void GL_APIENTRY GetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params)
-{
- GetRenderbufferParameteriv(target, pname, params);
-}
-
-GLboolean GL_APIENTRY IsFramebufferOES(GLuint framebuffer)
-{
- return IsFramebuffer(framebuffer);
-}
-
-void GL_APIENTRY BindFramebufferOES(GLenum target, GLuint framebuffer)
-{
- BindFramebuffer(target, framebuffer);
-}
-
-void GL_APIENTRY DeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers)
-{
- DeleteFramebuffers(n, framebuffers);
-}
-
-void GL_APIENTRY GenFramebuffersOES(GLsizei n, GLuint* framebuffers)
-{
- GenFramebuffers(n, framebuffers);
-}
-
-GLenum GL_APIENTRY CheckFramebufferStatusOES(GLenum target)
-{
- return CheckFramebufferStatus(target);
-}
-
-void GL_APIENTRY FramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer)
-{
- FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer);
-}
-
-void GL_APIENTRY FramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level)
-{
- FramebufferTexture2D(target, attachment, textarget, texture, level);
-}
-
-void GL_APIENTRY GetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params)
-{
- GetFramebufferAttachmentParameteriv(target, attachment, pname, params);
-}
-
-void GL_APIENTRY GenerateMipmapOES(GLenum target)
-{
- GenerateMipmap(target);
-}
-
-void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs)
-{
- TRACE("(GLsizei n = %d, const GLenum *bufs = %p)", n, bufs);
-
- if(n < 0 || n > MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLuint drawFramebufferName = context->getDrawFramebufferName();
-
- if((drawFramebufferName == 0) && (n != 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(unsigned int i = 0; i < (unsigned)n; i++)
- {
- switch(bufs[i])
- {
- case GL_BACK:
- if(drawFramebufferName != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_NONE:
- break;
- case GL_COLOR_ATTACHMENT0_EXT:
- case GL_COLOR_ATTACHMENT1_EXT:
- case GL_COLOR_ATTACHMENT2_EXT:
- case GL_COLOR_ATTACHMENT3_EXT:
- case GL_COLOR_ATTACHMENT4_EXT:
- case GL_COLOR_ATTACHMENT5_EXT:
- case GL_COLOR_ATTACHMENT6_EXT:
- case GL_COLOR_ATTACHMENT7_EXT:
- case GL_COLOR_ATTACHMENT8_EXT:
- case GL_COLOR_ATTACHMENT9_EXT:
- case GL_COLOR_ATTACHMENT10_EXT:
- case GL_COLOR_ATTACHMENT11_EXT:
- case GL_COLOR_ATTACHMENT12_EXT:
- case GL_COLOR_ATTACHMENT13_EXT:
- case GL_COLOR_ATTACHMENT14_EXT:
- case GL_COLOR_ATTACHMENT15_EXT:
- {
- GLuint index = (bufs[i] - GL_COLOR_ATTACHMENT0_EXT);
-
- if(index >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(index != i)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(drawFramebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-
- context->setFramebufferDrawBuffers(n, bufs);
- }
-}
-
-}
-
-#include "entry_points.h"
-
-extern "C" NO_SANITIZE_FUNCTION __eglMustCastToProperFunctionPointerType es2GetProcAddress(const char *procname)
-{
- struct Function
- {
- const char *name;
- __eglMustCastToProperFunctionPointerType address;
- };
-
- static const Function glFunctions[] =
- {
- #define FUNCTION(name) {"gl" #name, (__eglMustCastToProperFunctionPointerType)gl::name}
-
- FUNCTION(ActiveTexture),
- FUNCTION(AttachShader),
- FUNCTION(BeginQuery),
- FUNCTION(BeginQueryEXT),
- FUNCTION(BeginTransformFeedback),
- FUNCTION(BindAttribLocation),
- FUNCTION(BindBuffer),
- FUNCTION(BindBufferBase),
- FUNCTION(BindBufferRange),
- FUNCTION(BindFramebuffer),
- FUNCTION(BindFramebufferOES),
- FUNCTION(BindRenderbuffer),
- FUNCTION(BindRenderbufferOES),
- FUNCTION(BindSampler),
- FUNCTION(BindTexture),
- FUNCTION(BindTransformFeedback),
- FUNCTION(BindVertexArray),
- FUNCTION(BindVertexArrayOES),
- FUNCTION(BlendColor),
- FUNCTION(BlendEquation),
- FUNCTION(BlendEquationSeparate),
- FUNCTION(BlendFunc),
- FUNCTION(BlendFuncSeparate),
- FUNCTION(BlitFramebuffer),
- FUNCTION(BlitFramebufferANGLE),
- FUNCTION(BufferData),
- FUNCTION(BufferSubData),
- FUNCTION(CheckFramebufferStatus),
- FUNCTION(CheckFramebufferStatusOES),
- FUNCTION(Clear),
- FUNCTION(ClearBufferfi),
- FUNCTION(ClearBufferfv),
- FUNCTION(ClearBufferiv),
- FUNCTION(ClearBufferuiv),
- FUNCTION(ClearColor),
- FUNCTION(ClearDepthf),
- FUNCTION(ClearStencil),
- FUNCTION(ClientWaitSync),
- FUNCTION(ColorMask),
- FUNCTION(CompileShader),
- FUNCTION(CompressedTexImage2D),
- FUNCTION(CompressedTexImage3D),
- FUNCTION(CompressedTexSubImage2D),
- FUNCTION(CompressedTexSubImage3D),
- FUNCTION(CopyBufferSubData),
- FUNCTION(CopyTexImage2D),
- FUNCTION(CopyTexSubImage2D),
- FUNCTION(CopyTexSubImage3D),
- FUNCTION(CreateProgram),
- FUNCTION(CreateShader),
- FUNCTION(CullFace),
- FUNCTION(DeleteBuffers),
- FUNCTION(DeleteFencesNV),
- FUNCTION(DeleteFramebuffers),
- FUNCTION(DeleteFramebuffersOES),
- FUNCTION(DeleteProgram),
- FUNCTION(DeleteQueries),
- FUNCTION(DeleteQueriesEXT),
- FUNCTION(DeleteRenderbuffers),
- FUNCTION(DeleteRenderbuffersOES),
- FUNCTION(DeleteSamplers),
- FUNCTION(DeleteShader),
- FUNCTION(DeleteSync),
- FUNCTION(DeleteTextures),
- FUNCTION(DeleteTransformFeedbacks),
- FUNCTION(DeleteVertexArrays),
- FUNCTION(DeleteVertexArraysOES),
- FUNCTION(DepthFunc),
- FUNCTION(DepthMask),
- FUNCTION(DepthRangef),
- FUNCTION(DetachShader),
- FUNCTION(Disable),
- FUNCTION(DisableVertexAttribArray),
- FUNCTION(DrawArrays),
- FUNCTION(DrawArraysInstanced),
- FUNCTION(DrawBuffers),
- FUNCTION(DrawBuffersEXT),
- FUNCTION(DrawElements),
- FUNCTION(DrawElementsInstanced),
- FUNCTION(DrawRangeElements),
- FUNCTION(EGLImageTargetRenderbufferStorageOES),
- FUNCTION(EGLImageTargetTexture2DOES),
- FUNCTION(Enable),
- FUNCTION(EnableVertexAttribArray),
- FUNCTION(EndQuery),
- FUNCTION(EndQueryEXT),
- FUNCTION(EndTransformFeedback),
- FUNCTION(FenceSync),
- FUNCTION(Finish),
- FUNCTION(FinishFenceNV),
- FUNCTION(Flush),
- FUNCTION(FlushMappedBufferRange),
- FUNCTION(FramebufferRenderbuffer),
- FUNCTION(FramebufferRenderbufferOES),
- FUNCTION(FramebufferTexture2D),
- FUNCTION(FramebufferTexture2DOES),
- FUNCTION(FramebufferTextureLayer),
- FUNCTION(FrontFace),
- FUNCTION(GenBuffers),
- FUNCTION(GenFencesNV),
- FUNCTION(GenFramebuffers),
- FUNCTION(GenFramebuffersOES),
- FUNCTION(GenQueries),
- FUNCTION(GenQueriesEXT),
- FUNCTION(GenRenderbuffers),
- FUNCTION(GenRenderbuffersOES),
- FUNCTION(GenSamplers),
- FUNCTION(GenTextures),
- FUNCTION(GenTransformFeedbacks),
- FUNCTION(GenVertexArrays),
- FUNCTION(GenVertexArraysOES),
- FUNCTION(GenerateMipmap),
- FUNCTION(GenerateMipmapOES),
- FUNCTION(GetActiveAttrib),
- FUNCTION(GetActiveUniform),
- FUNCTION(GetActiveUniformBlockName),
- FUNCTION(GetActiveUniformBlockiv),
- FUNCTION(GetActiveUniformsiv),
- FUNCTION(GetAttachedShaders),
- FUNCTION(GetAttribLocation),
- FUNCTION(GetBooleanv),
- FUNCTION(GetBufferParameteri64v),
- FUNCTION(GetBufferParameteriv),
- FUNCTION(GetBufferPointerv),
- FUNCTION(GetError),
- FUNCTION(GetFenceivNV),
- FUNCTION(GetFloatv),
- FUNCTION(GetFragDataLocation),
- FUNCTION(GetFramebufferAttachmentParameteriv),
- FUNCTION(GetFramebufferAttachmentParameterivOES),
- FUNCTION(GetGraphicsResetStatusEXT),
- FUNCTION(GetInteger64i_v),
- FUNCTION(GetInteger64v),
- FUNCTION(GetIntegeri_v),
- FUNCTION(GetIntegerv),
- FUNCTION(GetInternalformativ),
- FUNCTION(GetProgramBinary),
- FUNCTION(GetProgramInfoLog),
- FUNCTION(GetProgramiv),
- FUNCTION(GetQueryObjectuiv),
- FUNCTION(GetQueryObjectuivEXT),
- FUNCTION(GetQueryiv),
- FUNCTION(GetQueryivEXT),
- FUNCTION(GetRenderbufferParameteriv),
- FUNCTION(GetRenderbufferParameterivOES),
- FUNCTION(GetSamplerParameterfv),
- FUNCTION(GetSamplerParameteriv),
- FUNCTION(GetShaderInfoLog),
- FUNCTION(GetShaderPrecisionFormat),
- FUNCTION(GetShaderSource),
- FUNCTION(GetShaderiv),
- FUNCTION(GetString),
- FUNCTION(GetStringi),
- FUNCTION(GetSynciv),
- FUNCTION(GetTexParameterfv),
- FUNCTION(GetTexParameteriv),
- FUNCTION(GetTransformFeedbackVarying),
- FUNCTION(GetUniformBlockIndex),
- FUNCTION(GetUniformIndices),
- FUNCTION(GetUniformLocation),
- FUNCTION(GetUniformfv),
- FUNCTION(GetUniformiv),
- FUNCTION(GetUniformuiv),
- FUNCTION(GetVertexAttribIiv),
- FUNCTION(GetVertexAttribIuiv),
- FUNCTION(GetVertexAttribPointerv),
- FUNCTION(GetVertexAttribfv),
- FUNCTION(GetVertexAttribiv),
- FUNCTION(GetnUniformfvEXT),
- FUNCTION(GetnUniformivEXT),
- FUNCTION(Hint),
- FUNCTION(InvalidateFramebuffer),
- FUNCTION(InvalidateSubFramebuffer),
- FUNCTION(IsBuffer),
- FUNCTION(IsEnabled),
- FUNCTION(IsFenceNV),
- FUNCTION(IsFramebuffer),
- FUNCTION(IsFramebufferOES),
- FUNCTION(IsProgram),
- FUNCTION(IsQuery),
- FUNCTION(IsQueryEXT),
- FUNCTION(IsRenderbuffer),
- FUNCTION(IsRenderbufferOES),
- FUNCTION(IsSampler),
- FUNCTION(IsShader),
- FUNCTION(IsSync),
- FUNCTION(IsTexture),
- FUNCTION(IsTransformFeedback),
- FUNCTION(IsVertexArray),
- FUNCTION(IsVertexArrayOES),
- FUNCTION(LineWidth),
- FUNCTION(LinkProgram),
- FUNCTION(MapBufferRange),
- FUNCTION(PauseTransformFeedback),
- FUNCTION(PixelStorei),
- FUNCTION(PolygonOffset),
- FUNCTION(ProgramBinary),
- FUNCTION(ProgramParameteri),
- FUNCTION(ReadBuffer),
- FUNCTION(ReadPixels),
- FUNCTION(ReadnPixelsEXT),
- FUNCTION(ReleaseShaderCompiler),
- FUNCTION(RenderbufferStorage),
- FUNCTION(RenderbufferStorageMultisample),
- FUNCTION(RenderbufferStorageMultisampleANGLE),
- FUNCTION(RenderbufferStorageOES),
- FUNCTION(ResumeTransformFeedback),
- FUNCTION(SampleCoverage),
- FUNCTION(SamplerParameterf),
- FUNCTION(SamplerParameterfv),
- FUNCTION(SamplerParameteri),
- FUNCTION(SamplerParameteriv),
- FUNCTION(Scissor),
- FUNCTION(SetFenceNV),
- FUNCTION(ShaderBinary),
- FUNCTION(ShaderSource),
- FUNCTION(StencilFunc),
- FUNCTION(StencilFuncSeparate),
- FUNCTION(StencilMask),
- FUNCTION(StencilMaskSeparate),
- FUNCTION(StencilOp),
- FUNCTION(StencilOpSeparate),
- FUNCTION(TestFenceNV),
- FUNCTION(TexImage2D),
- FUNCTION(TexImage3D),
- FUNCTION(TexImage3DOES),
- FUNCTION(TexParameterf),
- FUNCTION(TexParameterfv),
- FUNCTION(TexParameteri),
- FUNCTION(TexParameteriv),
- FUNCTION(TexStorage2D),
- FUNCTION(TexStorage3D),
- FUNCTION(TexSubImage2D),
- FUNCTION(TexSubImage3D),
- FUNCTION(TransformFeedbackVaryings),
- FUNCTION(Uniform1f),
- FUNCTION(Uniform1fv),
- FUNCTION(Uniform1i),
- FUNCTION(Uniform1iv),
- FUNCTION(Uniform1ui),
- FUNCTION(Uniform1uiv),
- FUNCTION(Uniform2f),
- FUNCTION(Uniform2fv),
- FUNCTION(Uniform2i),
- FUNCTION(Uniform2iv),
- FUNCTION(Uniform2ui),
- FUNCTION(Uniform2uiv),
- FUNCTION(Uniform3f),
- FUNCTION(Uniform3fv),
- FUNCTION(Uniform3i),
- FUNCTION(Uniform3iv),
- FUNCTION(Uniform3ui),
- FUNCTION(Uniform3uiv),
- FUNCTION(Uniform4f),
- FUNCTION(Uniform4fv),
- FUNCTION(Uniform4i),
- FUNCTION(Uniform4iv),
- FUNCTION(Uniform4ui),
- FUNCTION(Uniform4uiv),
- FUNCTION(UniformBlockBinding),
- FUNCTION(UniformMatrix2fv),
- FUNCTION(UniformMatrix2x3fv),
- FUNCTION(UniformMatrix2x4fv),
- FUNCTION(UniformMatrix3fv),
- FUNCTION(UniformMatrix3x2fv),
- FUNCTION(UniformMatrix3x4fv),
- FUNCTION(UniformMatrix4fv),
- FUNCTION(UniformMatrix4x2fv),
- FUNCTION(UniformMatrix4x3fv),
- FUNCTION(UnmapBuffer),
- FUNCTION(UseProgram),
- FUNCTION(ValidateProgram),
- FUNCTION(VertexAttrib1f),
- FUNCTION(VertexAttrib1fv),
- FUNCTION(VertexAttrib2f),
- FUNCTION(VertexAttrib2fv),
- FUNCTION(VertexAttrib3f),
- FUNCTION(VertexAttrib3fv),
- FUNCTION(VertexAttrib4f),
- FUNCTION(VertexAttrib4fv),
- FUNCTION(VertexAttribDivisor),
- FUNCTION(VertexAttribDivisorANGLE),
- FUNCTION(VertexAttribDivisorEXT),
- FUNCTION(VertexAttribI4i),
- FUNCTION(VertexAttribI4iv),
- FUNCTION(VertexAttribI4ui),
- FUNCTION(VertexAttribI4uiv),
- FUNCTION(VertexAttribIPointer),
- FUNCTION(VertexAttribPointer),
- FUNCTION(Viewport),
- FUNCTION(WaitSync),
-
- #undef FUNCTION
- };
-
- static const size_t numFunctions = sizeof glFunctions / sizeof(Function);
- static const Function *const glFunctionsEnd = glFunctions + numFunctions;
-
- // The array must be kept sorted with respect to strcmp(), so that binary search works correctly.
- // The Unix command "LC_COLLATE=C sort" will generate the correct order.
- #ifndef NDEBUG
- for(size_t i = 0; i < numFunctions - 1; i++)
- {
- ASSERT(strcmp(glFunctions[i].name, glFunctions[i + 1].name) < 0);
- }
- #endif
-
- if(procname && strncmp("gl", procname, 2) == 0)
- {
- struct CompareFunctor
- {
- bool operator()(const Function &a, const Function &b) const
- {
- return strcmp(a.name, b.name) < 0;
- }
- };
-
- Function needle;
- needle.name = procname;
- const Function *result = std::lower_bound(glFunctions, glFunctionsEnd, needle, CompareFunctor());
-
- if(result != glFunctionsEnd && strcmp(procname, result->name) == 0)
- {
- return (__eglMustCastToProperFunctionPointerType)result->address;
- }
- }
-
- return nullptr;
-}
diff --git a/src/OpenGL/libGLESv2/libGLESv2.def b/src/OpenGL/libGLESv2/libGLESv2.def
deleted file mode 100644
index 485f6c3b1..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2.def
+++ /dev/null
@@ -1,297 +0,0 @@
-LIBRARY libGLESv2
-EXPORTS
- glActiveTexture @1
- glAttachShader @2
- glBindAttribLocation @3
- glBindBuffer @4
- glBindFramebuffer @5
- glBindRenderbuffer @6
- glBindTexture @7
- glBlendColor @8
- glBlendEquation @9
- glBlendEquationSeparate @10
- glBlendFunc @11
- glBlendFuncSeparate @12
- glBufferData @13
- glBufferSubData @14
- glCheckFramebufferStatus @15
- glClear @16
- glClearColor @17
- glClearDepthf @18
- glClearStencil @19
- glColorMask @20
- glCompileShader @21
- glCompressedTexImage2D @22
- glCompressedTexSubImage2D @23
- glCopyTexImage2D @24
- glCopyTexSubImage2D @25
- glCreateProgram @26
- glCreateShader @27
- glCullFace @28
- glDeleteBuffers @29
- glDeleteFramebuffers @30
- glDeleteProgram @32
- glDeleteRenderbuffers @33
- glDeleteShader @34
- glDeleteTextures @31
- glDepthFunc @36
- glDepthMask @37
- glDepthRangef @38
- glDetachShader @35
- glDisable @39
- glDisableVertexAttribArray @40
- glDrawArrays @41
- glDrawElements @42
- glEnable @43
- glEnableVertexAttribArray @44
- glFinish @45
- glFlush @46
- glFramebufferRenderbuffer @47
- glFramebufferTexture2D @48
- glFrontFace @49
- glGenBuffers @50
- glGenFramebuffers @52
- glGenRenderbuffers @53
- glGenTextures @54
- glGenerateMipmap @51
- glGetActiveAttrib @55
- glGetActiveUniform @56
- glGetAttachedShaders @57
- glGetAttribLocation @58
- glGetBooleanv @59
- glGetBufferParameteriv @60
- glGetError @61
- glGetFloatv @62
- glGetFramebufferAttachmentParameteriv @63
- glGetIntegerv @64
- glGetProgramInfoLog @66
- glGetProgramiv @65
- glGetRenderbufferParameteriv @67
- glGetShaderInfoLog @69
- glGetShaderPrecisionFormat @70
- glGetShaderSource @71
- glGetShaderiv @68
- glGetString @72
- glGetTexParameterfv @73
- glGetTexParameteriv @74
- glGetUniformLocation @77
- glGetUniformfv @75
- glGetUniformiv @76
- glGetVertexAttribPointerv @80
- glGetVertexAttribfv @78
- glGetVertexAttribiv @79
- glHint @81
- glIsBuffer @82
- glIsEnabled @83
- glIsFramebuffer @84
- glIsProgram @85
- glIsRenderbuffer @86
- glIsShader @87
- glIsTexture @88
- glLineWidth @89
- glLinkProgram @90
- glPixelStorei @91
- glPolygonOffset @92
- glReadPixels @93
- glReleaseShaderCompiler @94
- glRenderbufferStorage @95
- glSampleCoverage @96
- glScissor @97
- glShaderBinary @98
- glShaderSource @99
- glStencilFunc @100
- glStencilFuncSeparate @101
- glStencilMask @102
- glStencilMaskSeparate @103
- glStencilOp @104
- glStencilOpSeparate @105
- glTexImage2D @106
- glTexParameterf @107
- glTexParameterfv @108
- glTexParameteri @109
- glTexParameteriv @110
- glTexSubImage2D @111
- glUniform1f @112
- glUniform1fv @113
- glUniform1i @114
- glUniform1iv @115
- glUniform2f @116
- glUniform2fv @117
- glUniform2i @118
- glUniform2iv @119
- glUniform3f @120
- glUniform3fv @121
- glUniform3i @122
- glUniform3iv @123
- glUniform4f @124
- glUniform4fv @125
- glUniform4i @126
- glUniform4iv @127
- glUniformMatrix2fv @128
- glUniformMatrix3fv @129
- glUniformMatrix4fv @130
- glUseProgram @131
- glValidateProgram @132
- glVertexAttrib1f @133
- glVertexAttrib1fv @134
- glVertexAttrib2f @135
- glVertexAttrib2fv @136
- glVertexAttrib3f @137
- glVertexAttrib3fv @138
- glVertexAttrib4f @139
- glVertexAttrib4fv @140
- glVertexAttribPointer @141
- glViewport @142
-
- ; Extensions
- glTexImage3DOES
- glBlitFramebufferANGLE
- glRenderbufferStorageMultisampleANGLE
- glDeleteFencesNV
- glFinishFenceNV
- glGenFencesNV
- glGetFenceivNV
- glIsFenceNV
- glSetFenceNV
- glTestFenceNV
- glGetGraphicsResetStatusEXT
- glReadnPixelsEXT
- glGetnUniformfvEXT
- glGetnUniformivEXT
- glGenQueriesEXT
- glDeleteQueriesEXT
- glIsQueryEXT
- glBeginQueryEXT
- glEndQueryEXT
- glGetQueryivEXT
- glGetQueryObjectuivEXT
- glEGLImageTargetTexture2DOES
- glEGLImageTargetRenderbufferStorageOES
- glIsRenderbufferOES
- glBindRenderbufferOES
- glDeleteRenderbuffersOES
- glGenRenderbuffersOES
- glRenderbufferStorageOES
- glGetRenderbufferParameterivOES
- glIsFramebufferOES
- glBindFramebufferOES
- glDeleteFramebuffersOES
- glGenFramebuffersOES
- glCheckFramebufferStatusOES
- glFramebufferRenderbufferOES
- glFramebufferTexture2DOES
- glGetFramebufferAttachmentParameterivOES
- glGenerateMipmapOES
- glDrawBuffersEXT
- glBindVertexArrayOES
- glDeleteVertexArraysOES
- glGenVertexArraysOES
- glIsVertexArrayOES
-
- ; GLES 3.0 Functions
- glReadBuffer @211
- glDrawRangeElements @212
- glTexImage3D @213
- glTexSubImage3D @214
- glCopyTexSubImage3D @215
- glCompressedTexImage3D @216
- glCompressedTexSubImage3D @217
- glGenQueries @218
- glDeleteQueries @219
- glIsQuery @220
- glBeginQuery @221
- glEndQuery @222
- glGetQueryiv @223
- glGetQueryObjectuiv @224
- glUnmapBuffer @204
- glGetBufferPointerv @205
- glDrawBuffers @225
- glUniformMatrix2x3fv @226
- glUniformMatrix3x2fv @227
- glUniformMatrix2x4fv @228
- glUniformMatrix4x2fv @229
- glUniformMatrix3x4fv @230
- glUniformMatrix4x3fv @231
- glBlitFramebuffer @232
- glRenderbufferStorageMultisample @305
- glFramebufferTextureLayer @233
- glMapBufferRange @307
- glFlushMappedBufferRange @234
- glBindVertexArray @206
- glDeleteVertexArrays @207
- glGenVertexArrays @208
- glIsVertexArray @209
- glGetIntegeri_v @235
- glBeginTransformFeedback @236
- glEndTransformFeedback @237
- glBindBufferRange @238
- glBindBufferBase @239
- glTransformFeedbackVaryings @240
- glGetTransformFeedbackVarying @241
- glVertexAttribIPointer @242
- glGetVertexAttribIiv @243
- glGetVertexAttribIuiv @244
- glVertexAttribI4i @245
- glVertexAttribI4ui @246
- glVertexAttribI4iv @247
- glVertexAttribI4uiv @248
- glGetUniformuiv @249
- glGetFragDataLocation @309
- glUniform1ui @250
- glUniform2ui @251
- glUniform3ui @252
- glUniform4ui @253
- glUniform1uiv @254
- glUniform2uiv @255
- glUniform3uiv @256
- glUniform4uiv @257
- glClearBufferiv @258
- glClearBufferuiv @259
- glClearBufferfv @260
- glClearBufferfi @261
- glGetStringi @262
- glCopyBufferSubData @263
- glGetUniformIndices @264
- glGetActiveUniformsiv @265
- glGetUniformBlockIndex @267
- glGetActiveUniformBlockiv @268
- glGetActiveUniformBlockName @269
- glUniformBlockBinding @270
- glDrawArraysInstanced @271
- glDrawElementsInstanced @272
- glFenceSync @273
- glIsSync @274
- glDeleteSync @275
- glClientWaitSync @276
- glWaitSync @277
- glGetInteger64v @278
- glGetSynciv @279
- glGetInteger64i_v @280
- glGetBufferParameteri64v @306
- glGenSamplers @281
- glDeleteSamplers @282
- glIsSampler @283
- glBindSampler @284
- glSamplerParameteri @285
- glSamplerParameteriv @286
- glSamplerParameterf @287
- glSamplerParameterfv @288
- glGetSamplerParameteriv @289
- glGetSamplerParameterfv @290
- glVertexAttribDivisor @291
- glBindTransformFeedback @292
- glDeleteTransformFeedbacks @293
- glGenTransformFeedbacks @294
- glIsTransformFeedback @295
- glPauseTransformFeedback @296
- glResumeTransformFeedback @297
- glGetProgramBinary @299
- glProgramBinary @300
- glProgramParameteri @301
- glInvalidateFramebuffer @210
- glInvalidateSubFramebuffer @302
- glTexStorage2D @303
- glTexStorage3D @304
- glGetInternalformativ @308
-
- libGLESv2_swiftshader
diff --git a/src/OpenGL/libGLESv2/libGLESv2.hpp b/src/OpenGL/libGLESv2/libGLESv2.hpp
deleted file mode 100644
index bfd37d051..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2.hpp
+++ /dev/null
@@ -1,327 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef libGLESv2_hpp
-#define libGLESv2_hpp
-
-#include <EGL/egl.h>
-#include <GLES/gl.h>
-#include <GLES/glext.h>
-
-#include "Common/SharedLibrary.hpp"
-#include "Renderer/Surface.hpp"
-
-namespace sw
-{
-class FrameBuffer;
-}
-
-namespace egl
-{
-class Display;
-class Context;
-class Image;
-class Config;
-class ClientBuffer;
-}
-
-class LibGLESv2exports
-{
-public:
- LibGLESv2exports();
-
- void (GL_APIENTRY *glActiveTexture)(GLenum texture);
- void (GL_APIENTRY *glAttachShader)(GLuint program, GLuint shader);
- void (GL_APIENTRY *glBeginQueryEXT)(GLenum target, GLuint name);
- void (GL_APIENTRY *glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name);
- void (GL_APIENTRY *glBindBuffer)(GLenum target, GLuint buffer);
- void (GL_APIENTRY *glBindFramebuffer)(GLenum target, GLuint framebuffer);
- void (GL_APIENTRY *glBindRenderbuffer)(GLenum target, GLuint renderbuffer);
- void (GL_APIENTRY *glBindTexture)(GLenum target, GLuint texture);
- void (GL_APIENTRY *glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void (GL_APIENTRY *glBlendEquation)(GLenum mode);
- void (GL_APIENTRY *glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha);
- void (GL_APIENTRY *glBlendFunc)(GLenum sfactor, GLenum dfactor);
- void (GL_APIENTRY *glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha);
- void (GL_APIENTRY *glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage);
- void (GL_APIENTRY *glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data);
- GLenum (GL_APIENTRY *glCheckFramebufferStatus)(GLenum target);
- void (GL_APIENTRY *glClear)(GLbitfield mask);
- void (GL_APIENTRY *glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
- void (GL_APIENTRY *glClearDepthf)(GLclampf depth);
- void (GL_APIENTRY *glClearStencil)(GLint s);
- void (GL_APIENTRY *glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
- void (GL_APIENTRY *glCompileShader)(GLuint shader);
- void (GL_APIENTRY *glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height,
- GLint border, GLsizei imageSize, const GLvoid* data);
- void (GL_APIENTRY *glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLsizei imageSize, const GLvoid* data);
- void (GL_APIENTRY *glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border);
- void (GL_APIENTRY *glCopyTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- GLuint (GL_APIENTRY *glCreateProgram)(void);
- GLuint (GL_APIENTRY *glCreateShader)(GLenum type);
- void (GL_APIENTRY *glCullFace)(GLenum mode);
- void (GL_APIENTRY *glDeleteBuffers)(GLsizei n, const GLuint* buffers);
- void (GL_APIENTRY *glDeleteFencesNV)(GLsizei n, const GLuint* fences);
- void (GL_APIENTRY *glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers);
- void (GL_APIENTRY *glDeleteProgram)(GLuint program);
- void (GL_APIENTRY *glDeleteQueriesEXT)(GLsizei n, const GLuint *ids);
- void (GL_APIENTRY *glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers);
- void (GL_APIENTRY *glDeleteShader)(GLuint shader);
- void (GL_APIENTRY *glDeleteTextures)(GLsizei n, const GLuint* textures);
- void (GL_APIENTRY *glDepthFunc)(GLenum func);
- void (GL_APIENTRY *glDepthMask)(GLboolean flag);
- void (GL_APIENTRY *glDepthRangef)(GLclampf zNear, GLclampf zFar);
- void (GL_APIENTRY *glDetachShader)(GLuint program, GLuint shader);
- void (GL_APIENTRY *glDisable)(GLenum cap);
- void (GL_APIENTRY *glDisableVertexAttribArray)(GLuint index);
- void (GL_APIENTRY *glDrawArrays)(GLenum mode, GLint first, GLsizei count);
- void (GL_APIENTRY *glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices);
- void (GL_APIENTRY *glDrawArraysInstancedEXT)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
- void (GL_APIENTRY *glDrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount);
- void (GL_APIENTRY *glVertexAttribDivisorEXT)(GLuint index, GLuint divisor);
- void (GL_APIENTRY *glDrawArraysInstancedANGLE)(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
- void (GL_APIENTRY *glDrawElementsInstancedANGLE)(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount);
- void (GL_APIENTRY *glVertexAttribDivisorANGLE)(GLuint index, GLuint divisor);
- void (GL_APIENTRY *glEnable)(GLenum cap);
- void (GL_APIENTRY *glEnableVertexAttribArray)(GLuint index);
- void (GL_APIENTRY *glEndQueryEXT)(GLenum target);
- void (GL_APIENTRY *glFinishFenceNV)(GLuint fence);
- void (GL_APIENTRY *glFinish)(void);
- void (GL_APIENTRY *glFlush)(void);
- void (GL_APIENTRY *glFramebufferRenderbuffer)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void (GL_APIENTRY *glFramebufferTexture2D)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void (GL_APIENTRY *glFrontFace)(GLenum mode);
- void (GL_APIENTRY *glGenBuffers)(GLsizei n, GLuint* buffers);
- void (GL_APIENTRY *glGenerateMipmap)(GLenum target);
- void (GL_APIENTRY *glGenFencesNV)(GLsizei n, GLuint* fences);
- void (GL_APIENTRY *glGenFramebuffers)(GLsizei n, GLuint* framebuffers);
- void (GL_APIENTRY *glGenQueriesEXT)(GLsizei n, GLuint* ids);
- void (GL_APIENTRY *glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers);
- void (GL_APIENTRY *glGenTextures)(GLsizei n, GLuint* textures);
- void (GL_APIENTRY *glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name);
- void (GL_APIENTRY *glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name);
- void (GL_APIENTRY *glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders);
- int (GL_APIENTRY *glGetAttribLocation)(GLuint program, const GLchar* name);
- void (GL_APIENTRY *glGetBooleanv)(GLenum pname, GLboolean* params);
- void (GL_APIENTRY *glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params);
- GLenum (GL_APIENTRY *glGetError)(void);
- void (GL_APIENTRY *glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params);
- void (GL_APIENTRY *glGetFloatv)(GLenum pname, GLfloat* params);
- void (GL_APIENTRY *glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- GLenum (GL_APIENTRY *glGetGraphicsResetStatusEXT)(void);
- void (GL_APIENTRY *glGetIntegerv)(GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetProgramiv)(GLuint program, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void (GL_APIENTRY *glGetQueryivEXT)(GLenum target, GLenum pname, GLint *params);
- void (GL_APIENTRY *glGetQueryObjectuivEXT)(GLuint name, GLenum pname, GLuint *params);
- void (GL_APIENTRY *glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetShaderiv)(GLuint shader, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog);
- void (GL_APIENTRY *glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
- void (GL_APIENTRY *glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source);
- const GLubyte* (GL_APIENTRY *glGetString)(GLenum name);
- void (GL_APIENTRY *glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params);
- void (GL_APIENTRY *glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, GLfloat* params);
- void (GL_APIENTRY *glGetUniformfv)(GLuint program, GLint location, GLfloat* params);
- void (GL_APIENTRY *glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint* params);
- void (GL_APIENTRY *glGetUniformiv)(GLuint program, GLint location, GLint* params);
- int (GL_APIENTRY *glGetUniformLocation)(GLuint program, const GLchar* name);
- void (GL_APIENTRY *glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params);
- void (GL_APIENTRY *glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer);
- void (GL_APIENTRY *glHint)(GLenum target, GLenum mode);
- GLboolean (GL_APIENTRY *glIsBuffer)(GLuint buffer);
- GLboolean (GL_APIENTRY *glIsEnabled)(GLenum cap);
- GLboolean (GL_APIENTRY *glIsFenceNV)(GLuint fence);
- GLboolean (GL_APIENTRY *glIsFramebuffer)(GLuint framebuffer);
- GLboolean (GL_APIENTRY *glIsProgram)(GLuint program);
- GLboolean (GL_APIENTRY *glIsQueryEXT)(GLuint name);
- GLboolean (GL_APIENTRY *glIsRenderbuffer)(GLuint renderbuffer);
- GLboolean (GL_APIENTRY *glIsShader)(GLuint shader);
- GLboolean (GL_APIENTRY *glIsTexture)(GLuint texture);
- void (GL_APIENTRY *glLineWidth)(GLfloat width);
- void (GL_APIENTRY *glLinkProgram)(GLuint program);
- void (GL_APIENTRY *glPixelStorei)(GLenum pname, GLint param);
- void (GL_APIENTRY *glPolygonOffset)(GLfloat factor, GLfloat units);
- void (GL_APIENTRY *glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height,
- GLenum format, GLenum type, GLsizei bufSize, GLvoid *data);
- void (GL_APIENTRY *glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels);
- void (GL_APIENTRY *glReleaseShaderCompiler)(void);
- void (GL_APIENTRY *glRenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glRenderbufferStorageMultisampleANGLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glSampleCoverage)(GLclampf value, GLboolean invert);
- void (GL_APIENTRY *glSetFenceNV)(GLuint fence, GLenum condition);
- void (GL_APIENTRY *glScissor)(GLint x, GLint y, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length);
- void (GL_APIENTRY *glShaderSource)(GLuint shader, GLsizei count, const GLchar *const *string, const GLint *length);
- void (GL_APIENTRY *glStencilFunc)(GLenum func, GLint ref, GLuint mask);
- void (GL_APIENTRY *glStencilFuncSeparate)(GLenum face, GLenum func, GLint ref, GLuint mask);
- void (GL_APIENTRY *glStencilMask)(GLuint mask);
- void (GL_APIENTRY *glStencilMaskSeparate)(GLenum face, GLuint mask);
- void (GL_APIENTRY *glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass);
- void (GL_APIENTRY *glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
- GLboolean (GL_APIENTRY *glTestFenceNV)(GLuint fence);
- void (GL_APIENTRY *glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void (GL_APIENTRY *glTexParameterf)(GLenum target, GLenum pname, GLfloat param);
- void (GL_APIENTRY *glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params);
- void (GL_APIENTRY *glTexParameteri)(GLenum target, GLenum pname, GLint param);
- void (GL_APIENTRY *glTexParameteriv)(GLenum target, GLenum pname, const GLint* params);
- void (GL_APIENTRY *glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height,
- GLenum format, GLenum type, const GLvoid* pixels);
- void (GL_APIENTRY *glUniform1f)(GLint location, GLfloat x);
- void (GL_APIENTRY *glUniform1fv)(GLint location, GLsizei count, const GLfloat* v);
- void (GL_APIENTRY *glUniform1i)(GLint location, GLint x);
- void (GL_APIENTRY *glUniform1iv)(GLint location, GLsizei count, const GLint* v);
- void (GL_APIENTRY *glUniform2f)(GLint location, GLfloat x, GLfloat y);
- void (GL_APIENTRY *glUniform2fv)(GLint location, GLsizei count, const GLfloat* v);
- void (GL_APIENTRY *glUniform2i)(GLint location, GLint x, GLint y);
- void (GL_APIENTRY *glUniform2iv)(GLint location, GLsizei count, const GLint* v);
- void (GL_APIENTRY *glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z);
- void (GL_APIENTRY *glUniform3fv)(GLint location, GLsizei count, const GLfloat* v);
- void (GL_APIENTRY *glUniform3i)(GLint location, GLint x, GLint y, GLint z);
- void (GL_APIENTRY *glUniform3iv)(GLint location, GLsizei count, const GLint* v);
- void (GL_APIENTRY *glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (GL_APIENTRY *glUniform4fv)(GLint location, GLsizei count, const GLfloat* v);
- void (GL_APIENTRY *glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w);
- void (GL_APIENTRY *glUniform4iv)(GLint location, GLsizei count, const GLint* v);
- void (GL_APIENTRY *glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (GL_APIENTRY *glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (GL_APIENTRY *glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value);
- void (GL_APIENTRY *glUseProgram)(GLuint program);
- void (GL_APIENTRY *glValidateProgram)(GLuint program);
- void (GL_APIENTRY *glVertexAttrib1f)(GLuint index, GLfloat x);
- void (GL_APIENTRY *glVertexAttrib1fv)(GLuint index, const GLfloat* values);
- void (GL_APIENTRY *glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y);
- void (GL_APIENTRY *glVertexAttrib2fv)(GLuint index, const GLfloat* values);
- void (GL_APIENTRY *glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z);
- void (GL_APIENTRY *glVertexAttrib3fv)(GLuint index, const GLfloat* values);
- void (GL_APIENTRY *glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
- void (GL_APIENTRY *glVertexAttrib4fv)(GLuint index, const GLfloat* values);
- void (GL_APIENTRY *glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr);
- void (GL_APIENTRY *glViewport)(GLint x, GLint y, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glBlitFramebufferNV)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
- void (GL_APIENTRY *glBlitFramebufferANGLE)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1,
- GLbitfield mask, GLenum filter);
- void (GL_APIENTRY *glTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth,
- GLint border, GLenum format, GLenum type, const GLvoid* pixels);
- void (GL_APIENTRY *glTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels);
- void (GL_APIENTRY *glCopyTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glCompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data);
- void (GL_APIENTRY *glCompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data);
- void (GL_APIENTRY *glFramebufferTexture3DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset);
- void (GL_APIENTRY *glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image);
- void (GL_APIENTRY *glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image);
- GLboolean (GL_APIENTRY *glIsRenderbufferOES)(GLuint renderbuffer);
- void (GL_APIENTRY *glBindRenderbufferOES)(GLenum target, GLuint renderbuffer);
- void (GL_APIENTRY *glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers);
- void (GL_APIENTRY *glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers);
- void (GL_APIENTRY *glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
- void (GL_APIENTRY *glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params);
- GLboolean (GL_APIENTRY *glIsFramebufferOES)(GLuint framebuffer);
- void (GL_APIENTRY *glBindFramebufferOES)(GLenum target, GLuint framebuffer);
- void (GL_APIENTRY *glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers);
- void (GL_APIENTRY *glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers);
- GLenum (GL_APIENTRY *glCheckFramebufferStatusOES)(GLenum target);
- void (GL_APIENTRY *glFramebufferRenderbufferOES)(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
- void (GL_APIENTRY *glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);
- void (GL_APIENTRY *glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params);
- void (GL_APIENTRY *glGenerateMipmapOES)(GLenum target);
- void (GL_APIENTRY *glDrawBuffersEXT)(GLsizei n, const GLenum *bufs);
-
- egl::Context *(*es2CreateContext)(egl::Display *display, const egl::Context *shareContext, const egl::Config *config);
- __eglMustCastToProperFunctionPointerType (*es2GetProcAddress)(const char *procname);
- egl::Image *(*createBackBuffer)(int width, int height, sw::Format format, int multiSampleDepth);
- egl::Image *(*createBackBufferFromClientBuffer)(const egl::ClientBuffer& clientBuffer);
- egl::Image *(*createDepthStencil)(int width, int height, sw::Format format, int multiSampleDepth);
- sw::FrameBuffer *(*createFrameBuffer)(void *nativeDisplay, EGLNativeWindowType window, int width, int height);
-};
-
-class LibGLESv2
-{
-public:
- LibGLESv2()
- {
- }
-
- ~LibGLESv2()
- {
- freeLibrary(libGLESv2);
- }
-
- operator bool()
- {
- return loadExports() != nullptr;
- }
-
- LibGLESv2exports *operator->()
- {
- return loadExports();
- }
-
-private:
- LibGLESv2exports *loadExports()
- {
- if(!loadLibraryAttempted && !libGLESv2)
- {
- #if defined(_WIN32)
- #if defined(__LP64__)
- const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dll", "libGLESv2.dll", "lib64GLES_V2_translator.dll", "libGLESv2_deprecated.dll"};
- #else
- const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dll", "libGLESv2.dll", "libGLES_V2_translator.dll", "libGLESv2_deprecated.dll"};
- #endif
- #elif defined(__ANDROID__)
- const char *libGLESv2_lib[] = {"libGLESv2_swiftshader.so", "libGLESv2_swiftshader.so"};
- #elif defined(__linux__)
- #if defined(__LP64__)
- const char *libGLESv2_lib[] = {"lib64GLES_V2_translator.so", "libGLESv2.so.2", "libGLESv2.so", "libGLESv2_deprecated.so.2", "libGLESv2_deprecated.so"};
- #else
- const char *libGLESv2_lib[] = {"libGLES_V2_translator.so", "libGLESv2.so.2", "libGLESv2.so", "libGLESv2_deprecated.so.2", "libGLESv2_deprecated.so"};
- #endif
- #elif defined(__APPLE__)
- #if defined(__LP64__)
- const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dylib", "lib64GLES_V2_translator.dylib", "libGLESv2.dylib", "libGLESv2_deprecated.dylib"};
- #else
- const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.dylib", "libGLES_V2_translator.dylib", "libGLESv2.dylib", "libGLESv2_deprecated.dylib"};
- #endif
- #elif defined(__Fuchsia__)
- const char *libGLESv2_lib[] = {"libswiftshader_libGLESv2.so", "libGLESv2.so", "libGLESv2_deprecated.so"};
- #else
- #error "libGLESv2::loadExports unimplemented for this platform"
- #endif
-
- std::string directory = getModuleDirectory();
- libGLESv2 = loadLibrary(directory, libGLESv2_lib, "libGLESv2_swiftshader");
-
- if(libGLESv2)
- {
- auto libGLESv2_swiftshader = (LibGLESv2exports *(*)())getProcAddress(libGLESv2, "libGLESv2_swiftshader");
- libGLESv2exports = libGLESv2_swiftshader();
- }
-
- loadLibraryAttempted = true;
- }
-
- return libGLESv2exports;
- }
-
- void *libGLESv2 = nullptr;
- LibGLESv2exports *libGLESv2exports = nullptr;
- bool loadLibraryAttempted = false;
-};
-
-#endif // libGLESv2_hpp
diff --git a/src/OpenGL/libGLESv2/libGLESv2.rc b/src/OpenGL/libGLESv2/libGLESv2.rc
deleted file mode 100644
index 9a4a6eb1f..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2.rc
+++ /dev/null
@@ -1,106 +0,0 @@
-// Microsoft Visual C++ generated resource script.
-//
-#include "resource.h"
-
-#define APSTUDIO_READONLY_SYMBOLS
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 2 resource.
-//
-#include <windows.h>
-#include "../../Common/Version.h"
-
-/////////////////////////////////////////////////////////////////////////////
-#undef APSTUDIO_READONLY_SYMBOLS
-
-/////////////////////////////////////////////////////////////////////////////
-// English (U.S.) resources
-
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
-#ifdef _WIN32
-LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
-#pragma code_page(1252)
-#endif //_WIN32
-
-#ifdef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// TEXTINCLUDE
-//
-
-1 TEXTINCLUDE
-BEGIN
- "resource.h\0"
-END
-
-2 TEXTINCLUDE
-BEGIN
- "#include ""afxres.h""\r\n"
- "#include ""../Common/Version.h""\0"
-END
-
-3 TEXTINCLUDE
-BEGIN
- "\r\n"
- "\0"
-END
-
-#endif // APSTUDIO_INVOKED
-
-
-/////////////////////////////////////////////////////////////////////////////
-//
-// Version
-//
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- PRODUCTVERSION MAJOR_VERSION,MINOR_VERSION,BUILD_VERSION,BUILD_REVISION
- FILEFLAGSMASK 0x17L
-#ifdef _DEBUG
- FILEFLAGS 0x1L
-#else
- FILEFLAGS 0x0L
-#endif
- FILEOS 0x4L
- FILETYPE 0x2L
- FILESUBTYPE 0x0L
-BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904b0"
- BEGIN
- #ifdef WIN64
- VALUE "FileDescription", "SwiftShader libGLESv2 64-bit Dynamic Link Library"
- #else
- VALUE "FileDescription", "SwiftShader libGLESv2 32-bit Dynamic Link Library"
- #endif
- VALUE "FileVersion", VERSION_STRING
- VALUE "InternalName", "libGLESv2"
- VALUE "LegalCopyright", "Copyright (C) 2016 Google Inc."
- VALUE "OriginalFilename", "libGLESv2.dll"
- VALUE "PrivateBuild", VERSION_STRING
- VALUE "ProductName", "SwiftShader libGLESv2 Dynamic Link Library"
- VALUE "ProductVersion", VERSION_STRING
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
-END
-
-#endif // English (U.S.) resources
-/////////////////////////////////////////////////////////////////////////////
-
-
-
-#ifndef APSTUDIO_INVOKED
-/////////////////////////////////////////////////////////////////////////////
-//
-// Generated from the TEXTINCLUDE 3 resource.
-//
-
-
-/////////////////////////////////////////////////////////////////////////////
-#endif // not APSTUDIO_INVOKED
diff --git a/src/OpenGL/libGLESv2/libGLESv2_deprecated.def b/src/OpenGL/libGLESv2/libGLESv2_deprecated.def
deleted file mode 100644
index 1a21fd2d5..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2_deprecated.def
+++ /dev/null
@@ -1,297 +0,0 @@
-LIBRARY libGLESv2_deprecated
-EXPORTS
- glActiveTexture @1
- glAttachShader @2
- glBindAttribLocation @3
- glBindBuffer @4
- glBindFramebuffer @5
- glBindRenderbuffer @6
- glBindTexture @7
- glBlendColor @8
- glBlendEquation @9
- glBlendEquationSeparate @10
- glBlendFunc @11
- glBlendFuncSeparate @12
- glBufferData @13
- glBufferSubData @14
- glCheckFramebufferStatus @15
- glClear @16
- glClearColor @17
- glClearDepthf @18
- glClearStencil @19
- glColorMask @20
- glCompileShader @21
- glCompressedTexImage2D @22
- glCompressedTexSubImage2D @23
- glCopyTexImage2D @24
- glCopyTexSubImage2D @25
- glCreateProgram @26
- glCreateShader @27
- glCullFace @28
- glDeleteBuffers @29
- glDeleteFramebuffers @30
- glDeleteProgram @32
- glDeleteRenderbuffers @33
- glDeleteShader @34
- glDeleteTextures @31
- glDepthFunc @36
- glDepthMask @37
- glDepthRangef @38
- glDetachShader @35
- glDisable @39
- glDisableVertexAttribArray @40
- glDrawArrays @41
- glDrawElements @42
- glEnable @43
- glEnableVertexAttribArray @44
- glFinish @45
- glFlush @46
- glFramebufferRenderbuffer @47
- glFramebufferTexture2D @48
- glFrontFace @49
- glGenBuffers @50
- glGenFramebuffers @52
- glGenRenderbuffers @53
- glGenTextures @54
- glGenerateMipmap @51
- glGetActiveAttrib @55
- glGetActiveUniform @56
- glGetAttachedShaders @57
- glGetAttribLocation @58
- glGetBooleanv @59
- glGetBufferParameteriv @60
- glGetError @61
- glGetFloatv @62
- glGetFramebufferAttachmentParameteriv @63
- glGetIntegerv @64
- glGetProgramInfoLog @66
- glGetProgramiv @65
- glGetRenderbufferParameteriv @67
- glGetShaderInfoLog @69
- glGetShaderPrecisionFormat @70
- glGetShaderSource @71
- glGetShaderiv @68
- glGetString @72
- glGetTexParameterfv @73
- glGetTexParameteriv @74
- glGetUniformLocation @77
- glGetUniformfv @75
- glGetUniformiv @76
- glGetVertexAttribPointerv @80
- glGetVertexAttribfv @78
- glGetVertexAttribiv @79
- glHint @81
- glIsBuffer @82
- glIsEnabled @83
- glIsFramebuffer @84
- glIsProgram @85
- glIsRenderbuffer @86
- glIsShader @87
- glIsTexture @88
- glLineWidth @89
- glLinkProgram @90
- glPixelStorei @91
- glPolygonOffset @92
- glReadPixels @93
- glReleaseShaderCompiler @94
- glRenderbufferStorage @95
- glSampleCoverage @96
- glScissor @97
- glShaderBinary @98
- glShaderSource @99
- glStencilFunc @100
- glStencilFuncSeparate @101
- glStencilMask @102
- glStencilMaskSeparate @103
- glStencilOp @104
- glStencilOpSeparate @105
- glTexImage2D @106
- glTexParameterf @107
- glTexParameterfv @108
- glTexParameteri @109
- glTexParameteriv @110
- glTexSubImage2D @111
- glUniform1f @112
- glUniform1fv @113
- glUniform1i @114
- glUniform1iv @115
- glUniform2f @116
- glUniform2fv @117
- glUniform2i @118
- glUniform2iv @119
- glUniform3f @120
- glUniform3fv @121
- glUniform3i @122
- glUniform3iv @123
- glUniform4f @124
- glUniform4fv @125
- glUniform4i @126
- glUniform4iv @127
- glUniformMatrix2fv @128
- glUniformMatrix3fv @129
- glUniformMatrix4fv @130
- glUseProgram @131
- glValidateProgram @132
- glVertexAttrib1f @133
- glVertexAttrib1fv @134
- glVertexAttrib2f @135
- glVertexAttrib2fv @136
- glVertexAttrib3f @137
- glVertexAttrib3fv @138
- glVertexAttrib4f @139
- glVertexAttrib4fv @140
- glVertexAttribPointer @141
- glViewport @142
-
- ; Extensions
- glTexImage3DOES
- glBlitFramebufferANGLE
- glRenderbufferStorageMultisampleANGLE
- glDeleteFencesNV
- glFinishFenceNV
- glGenFencesNV
- glGetFenceivNV
- glIsFenceNV
- glSetFenceNV
- glTestFenceNV
- glGetGraphicsResetStatusEXT
- glReadnPixelsEXT
- glGetnUniformfvEXT
- glGetnUniformivEXT
- glGenQueriesEXT
- glDeleteQueriesEXT
- glIsQueryEXT
- glBeginQueryEXT
- glEndQueryEXT
- glGetQueryivEXT
- glGetQueryObjectuivEXT
- glEGLImageTargetTexture2DOES
- glEGLImageTargetRenderbufferStorageOES
- glIsRenderbufferOES
- glBindRenderbufferOES
- glDeleteRenderbuffersOES
- glGenRenderbuffersOES
- glRenderbufferStorageOES
- glGetRenderbufferParameterivOES
- glIsFramebufferOES
- glBindFramebufferOES
- glDeleteFramebuffersOES
- glGenFramebuffersOES
- glCheckFramebufferStatusOES
- glFramebufferRenderbufferOES
- glFramebufferTexture2DOES
- glGetFramebufferAttachmentParameterivOES
- glGenerateMipmapOES
- glDrawBuffersEXT
- glBindVertexArrayOES
- glDeleteVertexArraysOES
- glGenVertexArraysOES
- glIsVertexArrayOES
-
- ; GLES 3.0 Functions
- glReadBuffer @211
- glDrawRangeElements @212
- glTexImage3D @213
- glTexSubImage3D @214
- glCopyTexSubImage3D @215
- glCompressedTexImage3D @216
- glCompressedTexSubImage3D @217
- glGenQueries @218
- glDeleteQueries @219
- glIsQuery @220
- glBeginQuery @221
- glEndQuery @222
- glGetQueryiv @223
- glGetQueryObjectuiv @224
- glUnmapBuffer @204
- glGetBufferPointerv @205
- glDrawBuffers @225
- glUniformMatrix2x3fv @226
- glUniformMatrix3x2fv @227
- glUniformMatrix2x4fv @228
- glUniformMatrix4x2fv @229
- glUniformMatrix3x4fv @230
- glUniformMatrix4x3fv @231
- glBlitFramebuffer @232
- glRenderbufferStorageMultisample @305
- glFramebufferTextureLayer @233
- glMapBufferRange @307
- glFlushMappedBufferRange @234
- glBindVertexArray @206
- glDeleteVertexArrays @207
- glGenVertexArrays @208
- glIsVertexArray @209
- glGetIntegeri_v @235
- glBeginTransformFeedback @236
- glEndTransformFeedback @237
- glBindBufferRange @238
- glBindBufferBase @239
- glTransformFeedbackVaryings @240
- glGetTransformFeedbackVarying @241
- glVertexAttribIPointer @242
- glGetVertexAttribIiv @243
- glGetVertexAttribIuiv @244
- glVertexAttribI4i @245
- glVertexAttribI4ui @246
- glVertexAttribI4iv @247
- glVertexAttribI4uiv @248
- glGetUniformuiv @249
- glGetFragDataLocation @309
- glUniform1ui @250
- glUniform2ui @251
- glUniform3ui @252
- glUniform4ui @253
- glUniform1uiv @254
- glUniform2uiv @255
- glUniform3uiv @256
- glUniform4uiv @257
- glClearBufferiv @258
- glClearBufferuiv @259
- glClearBufferfv @260
- glClearBufferfi @261
- glGetStringi @262
- glCopyBufferSubData @263
- glGetUniformIndices @264
- glGetActiveUniformsiv @265
- glGetUniformBlockIndex @267
- glGetActiveUniformBlockiv @268
- glGetActiveUniformBlockName @269
- glUniformBlockBinding @270
- glDrawArraysInstanced @271
- glDrawElementsInstanced @272
- glFenceSync @273
- glIsSync @274
- glDeleteSync @275
- glClientWaitSync @276
- glWaitSync @277
- glGetInteger64v @278
- glGetSynciv @279
- glGetInteger64i_v @280
- glGetBufferParameteri64v @306
- glGenSamplers @281
- glDeleteSamplers @282
- glIsSampler @283
- glBindSampler @284
- glSamplerParameteri @285
- glSamplerParameteriv @286
- glSamplerParameterf @287
- glSamplerParameterfv @288
- glGetSamplerParameteriv @289
- glGetSamplerParameterfv @290
- glVertexAttribDivisor @291
- glBindTransformFeedback @292
- glDeleteTransformFeedbacks @293
- glGenTransformFeedbacks @294
- glIsTransformFeedback @295
- glPauseTransformFeedback @296
- glResumeTransformFeedback @297
- glGetProgramBinary @299
- glProgramBinary @300
- glProgramParameteri @301
- glInvalidateFramebuffer @210
- glInvalidateSubFramebuffer @302
- glTexStorage2D @303
- glTexStorage3D @304
- glGetInternalformativ @308
-
- libGLESv2_swiftshader
diff --git a/src/OpenGL/libGLESv2/libGLESv2_deprecated.exports b/src/OpenGL/libGLESv2/libGLESv2_deprecated.exports
deleted file mode 100644
index 8dfb1cad4..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2_deprecated.exports
+++ /dev/null
@@ -1,302 +0,0 @@
-
-# OpenGL ES 2.0 core functions
-_glActiveTexture
-_glAttachShader
-_glBindAttribLocation
-_glBindBuffer
-_glBindFramebuffer
-_glBindRenderbuffer
-_glBindTexture
-_glBlendColor
-_glBlendEquation
-_glBlendEquationSeparate
-_glBlendFunc
-_glBlendFuncSeparate
-_glBufferData
-_glBufferSubData
-_glCheckFramebufferStatus
-_glClear
-_glClearColor
-_glClearDepthf
-_glClearStencil
-_glColorMask
-_glCompileShader
-_glCompressedTexImage2D
-_glCompressedTexSubImage2D
-_glCopyTexImage2D
-_glCopyTexSubImage2D
-_glCreateProgram
-_glCreateShader
-_glCullFace
-_glDeleteBuffers
-_glDeleteFramebuffers
-_glDeleteProgram
-_glDeleteRenderbuffers
-_glDeleteShader
-_glDeleteTextures
-_glDepthFunc
-_glDepthMask
-_glDepthRangef
-_glDetachShader
-_glDisable
-_glDisableVertexAttribArray
-_glDrawArrays
-_glDrawElements
-_glEnable
-_glEnableVertexAttribArray
-_glFinish
-_glFlush
-_glFramebufferRenderbuffer
-_glFramebufferTexture2D
-_glFrontFace
-_glGenBuffers
-_glGenFramebuffers
-_glGenRenderbuffers
-_glGenTextures
-_glGenerateMipmap
-_glGetActiveAttrib
-_glGetActiveUniform
-_glGetAttachedShaders
-_glGetAttribLocation
-_glGetBooleanv
-_glGetBufferParameteriv
-_glGetError
-_glGetFloatv
-_glGetFramebufferAttachmentParameteriv
-_glGetIntegerv
-_glGetProgramInfoLog
-_glGetProgramiv
-_glGetRenderbufferParameteriv
-_glGetShaderInfoLog
-_glGetShaderPrecisionFormat
-_glGetShaderSource
-_glGetShaderiv
-_glGetString
-_glGetTexParameterfv
-_glGetTexParameteriv
-_glGetUniformLocation
-_glGetUniformfv
-_glGetUniformiv
-_glGetVertexAttribPointerv
-_glGetVertexAttribfv
-_glGetVertexAttribiv
-_glHint
-_glIsBuffer
-_glIsEnabled
-_glIsFramebuffer
-_glIsProgram
-_glIsRenderbuffer
-_glIsShader
-_glIsTexture
-_glLineWidth
-_glLinkProgram
-_glPixelStorei
-_glPolygonOffset
-_glReadPixels
-_glReleaseShaderCompiler
-_glRenderbufferStorage
-_glSampleCoverage
-_glScissor
-_glShaderBinary
-_glShaderSource
-_glStencilFunc
-_glStencilFuncSeparate
-_glStencilMask
-_glStencilMaskSeparate
-_glStencilOp
-_glStencilOpSeparate
-_glTexImage2D
-_glTexParameterf
-_glTexParameterfv
-_glTexParameteri
-_glTexParameteriv
-_glTexSubImage2D
-_glUniform1f
-_glUniform1fv
-_glUniform1i
-_glUniform1iv
-_glUniform2f
-_glUniform2fv
-_glUniform2i
-_glUniform2iv
-_glUniform3f
-_glUniform3fv
-_glUniform3i
-_glUniform3iv
-_glUniform4f
-_glUniform4fv
-_glUniform4i
-_glUniform4iv
-_glUniformMatrix2fv
-_glUniformMatrix3fv
-_glUniformMatrix4fv
-_glUseProgram
-_glValidateProgram
-_glVertexAttrib1f
-_glVertexAttrib1fv
-_glVertexAttrib2f
-_glVertexAttrib2fv
-_glVertexAttrib3f
-_glVertexAttrib3fv
-_glVertexAttrib4f
-_glVertexAttrib4fv
-_glVertexAttribPointer
-_glViewport
-
-# OpenGL ES 3.0 core functions
-_glReadBuffer
-_glDrawRangeElements
-_glTexImage3D
-_glTexSubImage3D
-_glCopyTexSubImage3D
-_glCompressedTexImage3D
-_glCompressedTexSubImage3D
-_glGenQueries
-_glDeleteQueries
-_glIsQuery
-_glBeginQuery
-_glEndQuery
-_glGetQueryiv
-_glGetQueryObjectuiv
-_glUnmapBuffer
-_glGetBufferPointerv
-_glDrawBuffers
-_glUniformMatrix2x3fv
-_glUniformMatrix3x2fv
-_glUniformMatrix2x4fv
-_glUniformMatrix4x2fv
-_glUniformMatrix3x4fv
-_glUniformMatrix4x3fv
-_glBlitFramebuffer
-_glRenderbufferStorageMultisample
-_glFramebufferTextureLayer
-_glMapBufferRange
-_glFlushMappedBufferRange
-_glBindVertexArray
-_glDeleteVertexArrays
-_glGenVertexArrays
-_glIsVertexArray
-_glGetIntegeri_v
-_glBeginTransformFeedback
-_glEndTransformFeedback
-_glBindBufferRange
-_glBindBufferBase
-_glTransformFeedbackVaryings
-_glGetTransformFeedbackVarying
-_glVertexAttribIPointer
-_glGetVertexAttribIiv
-_glGetVertexAttribIuiv
-_glVertexAttribI4i
-_glVertexAttribI4ui
-_glVertexAttribI4iv
-_glVertexAttribI4uiv
-_glGetUniformuiv
-_glGetFragDataLocation
-_glUniform1ui
-_glUniform2ui
-_glUniform3ui
-_glUniform4ui
-_glUniform1uiv
-_glUniform2uiv
-_glUniform3uiv
-_glUniform4uiv
-_glClearBufferiv
-_glClearBufferuiv
-_glClearBufferfv
-_glClearBufferfi
-_glGetStringi
-_glCopyBufferSubData
-_glGetUniformIndices
-_glGetActiveUniformsiv
-_glGetUniformBlockIndex
-_glGetActiveUniformBlockiv
-_glGetActiveUniformBlockName
-_glUniformBlockBinding
-_glDrawArraysInstanced
-_glDrawElementsInstanced
-_glFenceSync
-_glIsSync
-_glDeleteSync
-_glClientWaitSync
-_glWaitSync
-_glGetInteger64v
-_glGetSynciv
-_glGetInteger64i_v
-_glGetBufferParameteri64v
-_glGenSamplers
-_glDeleteSamplers
-_glIsSampler
-_glBindSampler
-_glSamplerParameteri
-_glSamplerParameteriv
-_glSamplerParameterf
-_glSamplerParameterfv
-_glGetSamplerParameteriv
-_glGetSamplerParameterfv
-_glVertexAttribDivisor
-_glBindTransformFeedback
-_glDeleteTransformFeedbacks
-_glGenTransformFeedbacks
-_glIsTransformFeedback
-_glPauseTransformFeedback
-_glResumeTransformFeedback
-_glGetProgramBinary
-_glProgramBinary
-_glProgramParameteri
-_glInvalidateFramebuffer
-_glInvalidateSubFramebuffer
-_glTexStorage2D
-_glTexStorage3D
-_glGetInternalformativ
-
-# Extensions
-_glTexImage3DOES
-_glBlitFramebufferANGLE
-_glRenderbufferStorageMultisampleANGLE
-_glDeleteFencesNV
-_glFinishFenceNV
-_glGenFencesNV
-_glGetFenceivNV
-_glIsFenceNV
-_glSetFenceNV
-_glTestFenceNV
-_glGetGraphicsResetStatusEXT
-_glReadnPixelsEXT
-_glGetnUniformfvEXT
-_glGetnUniformivEXT
-_glGenQueriesEXT
-_glDeleteQueriesEXT
-_glIsQueryEXT
-_glBeginQueryEXT
-_glEndQueryEXT
-_glGetQueryivEXT
-_glGetQueryObjectuivEXT
-_glEGLImageTargetTexture2DOES
-_glEGLImageTargetRenderbufferStorageOES
-_glIsRenderbufferOES
-_glBindRenderbufferOES
-_glDeleteRenderbuffersOES
-_glGenRenderbuffersOES
-_glRenderbufferStorageOES
-_glGetRenderbufferParameterivOES
-_glIsFramebufferOES
-_glBindFramebufferOES
-_glDeleteFramebuffersOES
-_glGenFramebuffersOES
-_glCheckFramebufferStatusOES
-_glFramebufferRenderbufferOES
-_glFramebufferTexture2DOES
-_glGetFramebufferAttachmentParameterivOES
-_glGenerateMipmapOES
-_glDrawBuffersEXT
-_glBindVertexArrayOES
-_glDeleteVertexArraysOES
-_glGenVertexArraysOES
-_glIsVertexArrayOES
-
-# Table of function pointers to disambiguate between libraries
-_libGLESv2_swiftshader
-
-# Type-strings and type-infos required by sanitizers
-_ZTS*
-_ZTI*
diff --git a/src/OpenGL/libGLESv2/libGLESv2_deprecated.lds b/src/OpenGL/libGLESv2/libGLESv2_deprecated.lds
deleted file mode 100644
index 5f27b6832..000000000
--- a/src/OpenGL/libGLESv2/libGLESv2_deprecated.lds
+++ /dev/null
@@ -1,303 +0,0 @@
-{
-global:
- # OpenGL ES 2.0 core functions
- glActiveTexture;
- glAttachShader;
- glBindAttribLocation;
- glBindBuffer;
- glBindFramebuffer;
- glBindRenderbuffer;
- glBindTexture;
- glBlendColor;
- glBlendEquation;
- glBlendEquationSeparate;
- glBlendFunc;
- glBlendFuncSeparate;
- glBufferData;
- glBufferSubData;
- glCheckFramebufferStatus;
- glClear;
- glClearColor;
- glClearDepthf;
- glClearStencil;
- glColorMask;
- glCompileShader;
- glCompressedTexImage2D;
- glCompressedTexSubImage2D;
- glCopyTexImage2D;
- glCopyTexSubImage2D;
- glCreateProgram;
- glCreateShader;
- glCullFace;
- glDeleteBuffers;
- glDeleteFramebuffers;
- glDeleteProgram;
- glDeleteRenderbuffers;
- glDeleteShader;
- glDeleteTextures;
- glDepthFunc;
- glDepthMask;
- glDepthRangef;
- glDetachShader;
- glDisable;
- glDisableVertexAttribArray;
- glDrawArrays;
- glDrawElements;
- glEnable;
- glEnableVertexAttribArray;
- glFinish;
- glFlush;
- glFramebufferRenderbuffer;
- glFramebufferTexture2D;
- glFrontFace;
- glGenBuffers;
- glGenFramebuffers;
- glGenRenderbuffers;
- glGenTextures;
- glGenerateMipmap;
- glGetActiveAttrib;
- glGetActiveUniform;
- glGetAttachedShaders;
- glGetAttribLocation;
- glGetBooleanv;
- glGetBufferParameteriv;
- glGetError;
- glGetFloatv;
- glGetFramebufferAttachmentParameteriv;
- glGetIntegerv;
- glGetProgramInfoLog;
- glGetProgramiv;
- glGetRenderbufferParameteriv;
- glGetShaderInfoLog;
- glGetShaderPrecisionFormat;
- glGetShaderSource;
- glGetShaderiv;
- glGetString;
- glGetTexParameterfv;
- glGetTexParameteriv;
- glGetUniformLocation;
- glGetUniformfv;
- glGetUniformiv;
- glGetVertexAttribPointerv;
- glGetVertexAttribfv;
- glGetVertexAttribiv;
- glHint;
- glIsBuffer;
- glIsEnabled;
- glIsFramebuffer;
- glIsProgram;
- glIsRenderbuffer;
- glIsShader;
- glIsTexture;
- glLineWidth;
- glLinkProgram;
- glPixelStorei;
- glPolygonOffset;
- glReadPixels;
- glReleaseShaderCompiler;
- glRenderbufferStorage;
- glSampleCoverage;
- glScissor;
- glShaderBinary;
- glShaderSource;
- glStencilFunc;
- glStencilFuncSeparate;
- glStencilMask;
- glStencilMaskSeparate;
- glStencilOp;
- glStencilOpSeparate;
- glTexImage2D;
- glTexParameterf;
- glTexParameterfv;
- glTexParameteri;
- glTexParameteriv;
- glTexSubImage2D;
- glUniform1f;
- glUniform1fv;
- glUniform1i;
- glUniform1iv;
- glUniform2f;
- glUniform2fv;
- glUniform2i;
- glUniform2iv;
- glUniform3f;
- glUniform3fv;
- glUniform3i;
- glUniform3iv;
- glUniform4f;
- glUniform4fv;
- glUniform4i;
- glUniform4iv;
- glUniformMatrix2fv;
- glUniformMatrix3fv;
- glUniformMatrix4fv;
- glUseProgram;
- glValidateProgram;
- glVertexAttrib1f;
- glVertexAttrib1fv;
- glVertexAttrib2f;
- glVertexAttrib2fv;
- glVertexAttrib3f;
- glVertexAttrib3fv;
- glVertexAttrib4f;
- glVertexAttrib4fv;
- glVertexAttribPointer;
- glViewport;
-
- # OpenGL ES 3.0 core functions
- glReadBuffer;
- glDrawRangeElements;
- glTexImage3D;
- glTexSubImage3D;
- glCopyTexSubImage3D;
- glCompressedTexImage3D;
- glCompressedTexSubImage3D;
- glGenQueries;
- glDeleteQueries;
- glIsQuery;
- glBeginQuery;
- glEndQuery;
- glGetQueryiv;
- glGetQueryObjectuiv;
- glUnmapBuffer;
- glGetBufferPointerv;
- glDrawBuffers;
- glUniformMatrix2x3fv;
- glUniformMatrix3x2fv;
- glUniformMatrix2x4fv;
- glUniformMatrix4x2fv;
- glUniformMatrix3x4fv;
- glUniformMatrix4x3fv;
- glBlitFramebuffer;
- glRenderbufferStorageMultisample;
- glFramebufferTextureLayer;
- glMapBufferRange;
- glFlushMappedBufferRange;
- glBindVertexArray;
- glDeleteVertexArrays;
- glGenVertexArrays;
- glIsVertexArray;
- glGetIntegeri_v;
- glBeginTransformFeedback;
- glEndTransformFeedback;
- glBindBufferRange;
- glBindBufferBase;
- glTransformFeedbackVaryings;
- glGetTransformFeedbackVarying;
- glVertexAttribIPointer;
- glGetVertexAttribIiv;
- glGetVertexAttribIuiv;
- glVertexAttribI4i;
- glVertexAttribI4ui;
- glVertexAttribI4iv;
- glVertexAttribI4uiv;
- glGetUniformuiv;
- glGetFragDataLocation;
- glUniform1ui;
- glUniform2ui;
- glUniform3ui;
- glUniform4ui;
- glUniform1uiv;
- glUniform2uiv;
- glUniform3uiv;
- glUniform4uiv;
- glClearBufferiv;
- glClearBufferuiv;
- glClearBufferfv;
- glClearBufferfi;
- glGetStringi;
- glCopyBufferSubData;
- glGetUniformIndices;
- glGetActiveUniformsiv;
- glGetUniformBlockIndex;
- glGetActiveUniformBlockiv;
- glGetActiveUniformBlockName;
- glUniformBlockBinding;
- glDrawArraysInstanced;
- glDrawElementsInstanced;
- glFenceSync;
- glIsSync;
- glDeleteSync;
- glClientWaitSync;
- glWaitSync;
- glGetInteger64v;
- glGetSynciv;
- glGetInteger64i_v;
- glGetBufferParameteri64v;
- glGenSamplers;
- glDeleteSamplers;
- glIsSampler;
- glBindSampler;
- glSamplerParameteri;
- glSamplerParameteriv;
- glSamplerParameterf;
- glSamplerParameterfv;
- glGetSamplerParameteriv;
- glGetSamplerParameterfv;
- glVertexAttribDivisor;
- glBindTransformFeedback;
- glDeleteTransformFeedbacks;
- glGenTransformFeedbacks;
- glIsTransformFeedback;
- glPauseTransformFeedback;
- glResumeTransformFeedback;
- glGetProgramBinary;
- glProgramBinary;
- glProgramParameteri;
- glInvalidateFramebuffer;
- glInvalidateSubFramebuffer;
- glTexStorage2D;
- glTexStorage3D;
- glGetInternalformativ;
-
- # Extensions
- glTexImage3DOES;
- glBlitFramebufferANGLE;
- glRenderbufferStorageMultisampleANGLE;
- glDeleteFencesNV;
- glFinishFenceNV;
- glGenFencesNV;
- glGetFenceivNV;
- glIsFenceNV;
- glSetFenceNV;
- glTestFenceNV;
- glGetGraphicsResetStatusEXT;
- glReadnPixelsEXT;
- glGetnUniformfvEXT;
- glGetnUniformivEXT;
- glGenQueriesEXT;
- glDeleteQueriesEXT;
- glIsQueryEXT;
- glBeginQueryEXT;
- glEndQueryEXT;
- glGetQueryivEXT;
- glGetQueryObjectuivEXT;
- glEGLImageTargetTexture2DOES;
- glEGLImageTargetRenderbufferStorageOES;
- glIsRenderbufferOES;
- glBindRenderbufferOES;
- glDeleteRenderbuffersOES;
- glGenRenderbuffersOES;
- glRenderbufferStorageOES;
- glGetRenderbufferParameterivOES;
- glIsFramebufferOES;
- glBindFramebufferOES;
- glDeleteFramebuffersOES;
- glGenFramebuffersOES;
- glCheckFramebufferStatusOES;
- glFramebufferRenderbufferOES;
- glFramebufferTexture2DOES;
- glGetFramebufferAttachmentParameterivOES;
- glGenerateMipmapOES;
- glDrawBuffersEXT;
- glBindVertexArrayOES;
- glDeleteVertexArraysOES;
- glGenVertexArraysOES;
- glIsVertexArrayOES;
-
- # Table of function pointers to disambiguate between libraries
- libGLESv2_swiftshader;
-
-local:
- *;
-};
diff --git a/src/OpenGL/libGLESv2/libGLESv3.cpp b/src/OpenGL/libGLESv2/libGLESv3.cpp
deleted file mode 100644
index bdfce54e5..000000000
--- a/src/OpenGL/libGLESv2/libGLESv3.cpp
+++ /dev/null
@@ -1,3841 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// libGLESv3.cpp: Implements the exported OpenGL ES 3.0 functions.
-
-#include "main.h"
-#include "Buffer.h"
-#include "Fence.h"
-#include "Framebuffer.h"
-#include "Program.h"
-#include "Query.h"
-#include "Sampler.h"
-#include "Texture.h"
-#include "mathutil.h"
-#include "TransformFeedback.h"
-#include "VertexArray.h"
-#include "common/debug.h"
-
-#include <GLES3/gl3.h>
-#include <GLES2/gl2ext.h>
-
-#include <limits.h>
-
-using namespace es2;
-
-static bool validImageSize(GLint level, GLsizei width, GLsizei height)
-{
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || width < 0 || height < 0)
- {
- return false;
- }
-
- return true;
-}
-
-static bool ValidateQueryTarget(GLenum target)
-{
- switch(target)
- {
- case GL_ANY_SAMPLES_PASSED:
- case GL_ANY_SAMPLES_PASSED_CONSERVATIVE:
- case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- break;
- default:
- return false;
- }
-
- return true;
-}
-
-bool ValidateTexParamParameters(GLenum pname, GLint param)
-{
- switch(pname)
- {
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- switch(param)
- {
- case GL_REPEAT:
- case GL_CLAMP_TO_EDGE:
- case GL_MIRRORED_REPEAT:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
-
- case GL_TEXTURE_MIN_FILTER:
- switch(param)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_MAG_FILTER:
- switch(param)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_USAGE_ANGLE:
- switch(param)
- {
- case GL_NONE:
- case GL_FRAMEBUFFER_ATTACHMENT_ANGLE:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- // we assume the parameter passed to this validation method is truncated, not rounded
- if(param < 1)
- {
- return error(GL_INVALID_VALUE, false);
- }
- return true;
-
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- // any value is permissible
- return true;
-
- case GL_TEXTURE_COMPARE_MODE:
- // Acceptable mode parameters from GLES 3.0.2 spec, table 3.17
- switch(param)
- {
- case GL_NONE:
- case GL_COMPARE_REF_TO_TEXTURE:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_COMPARE_FUNC:
- // Acceptable function parameters from GLES 3.0.2 spec, table 3.17
- switch(param)
- {
- case GL_LEQUAL:
- case GL_GEQUAL:
- case GL_LESS:
- case GL_GREATER:
- case GL_EQUAL:
- case GL_NOTEQUAL:
- case GL_ALWAYS:
- case GL_NEVER:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_SWIZZLE_R:
- case GL_TEXTURE_SWIZZLE_G:
- case GL_TEXTURE_SWIZZLE_B:
- case GL_TEXTURE_SWIZZLE_A:
- switch(param)
- {
- case GL_RED:
- case GL_GREEN:
- case GL_BLUE:
- case GL_ALPHA:
- case GL_ZERO:
- case GL_ONE:
- return true;
- default:
- return error(GL_INVALID_ENUM, false);
- }
- break;
-
- case GL_TEXTURE_BASE_LEVEL:
- case GL_TEXTURE_MAX_LEVEL:
- if(param < 0)
- {
- return error(GL_INVALID_VALUE, false);
- }
- return true;
-
- default:
- break;
- }
-
- return error(GL_INVALID_ENUM, false);
-}
-
-static bool ValidateSamplerObjectParameter(GLenum pname)
-{
- switch(pname)
- {
- case GL_TEXTURE_MIN_FILTER:
- case GL_TEXTURE_MAG_FILTER:
- case GL_TEXTURE_WRAP_S:
- case GL_TEXTURE_WRAP_T:
- case GL_TEXTURE_WRAP_R:
- case GL_TEXTURE_MIN_LOD:
- case GL_TEXTURE_MAX_LOD:
- case GL_TEXTURE_COMPARE_MODE:
- case GL_TEXTURE_COMPARE_FUNC:
- case GL_TEXTURE_MAX_ANISOTROPY_EXT:
- return true;
- default:
- return false;
- }
-}
-
-namespace gl
-{
-
-void GL_APIENTRY ReadBuffer(GLenum src)
-{
- TRACE("(GLenum src = 0x%X)", src);
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLuint readFramebufferName = context->getReadFramebufferName();
-
- switch(src)
- {
- case GL_BACK:
- if(readFramebufferName != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- context->setFramebufferReadBuffer(src);
- break;
- case GL_NONE:
- context->setFramebufferReadBuffer(src);
- break;
- case GL_COLOR_ATTACHMENT0:
- case GL_COLOR_ATTACHMENT1:
- case GL_COLOR_ATTACHMENT2:
- case GL_COLOR_ATTACHMENT3:
- case GL_COLOR_ATTACHMENT4:
- case GL_COLOR_ATTACHMENT5:
- case GL_COLOR_ATTACHMENT6:
- case GL_COLOR_ATTACHMENT7:
- case GL_COLOR_ATTACHMENT8:
- case GL_COLOR_ATTACHMENT9:
- case GL_COLOR_ATTACHMENT10:
- case GL_COLOR_ATTACHMENT11:
- case GL_COLOR_ATTACHMENT12:
- case GL_COLOR_ATTACHMENT13:
- case GL_COLOR_ATTACHMENT14:
- case GL_COLOR_ATTACHMENT15:
- case GL_COLOR_ATTACHMENT16:
- case GL_COLOR_ATTACHMENT17:
- case GL_COLOR_ATTACHMENT18:
- case GL_COLOR_ATTACHMENT19:
- case GL_COLOR_ATTACHMENT20:
- case GL_COLOR_ATTACHMENT21:
- case GL_COLOR_ATTACHMENT22:
- case GL_COLOR_ATTACHMENT23:
- case GL_COLOR_ATTACHMENT24:
- case GL_COLOR_ATTACHMENT25:
- case GL_COLOR_ATTACHMENT26:
- case GL_COLOR_ATTACHMENT27:
- case GL_COLOR_ATTACHMENT28:
- case GL_COLOR_ATTACHMENT29:
- case GL_COLOR_ATTACHMENT30:
- case GL_COLOR_ATTACHMENT31:
- {
- GLuint index = (src - GL_COLOR_ATTACHMENT0);
- if(index >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
- if(readFramebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- context->setFramebufferReadBuffer(src);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices)
-{
- TRACE("(GLenum mode = 0x%X, GLuint start = %d, GLuint end = %d, "
- "GLsizei count = %d, GLenum type = 0x%x, const void* indices = %p)",
- mode, start, end, count, type, indices);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((count < 0) || (end < start))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawElements(mode, start, end, count, type, indices);
- }
-}
-
-void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, "
- "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* data = %p)",
- target, level, internalformat, width, height, depth, border, format, type, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- const GLsizei maxSize3D = es2::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE >> level;
- if((width < 0) || (height < 0) || (depth < 0) || (width > maxSize3D) || (height > maxSize3D) || (depth > maxSize3D))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(border != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLenum validationError = ValidateTextureFormatType(format, type, internalformat, target);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- GLint sizedInternalFormat = gl::GetSizedInternalFormat(internalformat, type);
- texture->setImage(level, width, height, depth, sizedInternalFormat, format, type, context->getUnpackParameters(), data);
- }
-}
-
-void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
- "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* data = %p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if((width < 0) || (height < 0) || (depth < 0) || (xoffset < 0) || (yoffset < 0) || (zoffset < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
-
- GLenum validationError = ValidateSubImageParams(false, false, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- validationError = context->getPixels(&data, type, context->getRequiredBufferSize(width, height, depth, format, type));
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->subImage(level, xoffset, yoffset, zoffset, width, height, depth, format, type, context->getUnpackParameters(), data);
- }
-}
-
-void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
- target, level, xoffset, yoffset, zoffset, x, y, width, height);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if((width < 0) || (height < 0) || (xoffset < 0) || (yoffset < 0) || (zoffset < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Framebuffer *framebuffer = context->getReadFramebuffer();
-
- if(!framebuffer || (framebuffer->completeness() != GL_FRAMEBUFFER_COMPLETE))
- {
- return error(GL_INVALID_FRAMEBUFFER_OPERATION);
- }
-
- es2::Renderbuffer *source = framebuffer->getReadColorbuffer();
-
- if(context->getReadFramebufferName() != 0 && (!source || source->getSamples() > 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum colorbufferFormat = source->getFormat();
- es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
-
- GLenum validationError = ValidateSubImageParams(false, true, target, level, xoffset, yoffset, zoffset, width, height, 1, GL_NONE, GL_NONE, texture);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- GLenum textureFormat = texture->getFormat(target, level);
-
- if(!ValidateCopyFormats(textureFormat, colorbufferFormat))
- {
- return;
- }
-
- texture->copySubImage(target, level, xoffset, yoffset, zoffset, x, y, width, height, source);
- }
-}
-
-void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, "
- "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = %p)",
- target, level, internalformat, width, height, depth, border, imageSize, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((level < 0) || (level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS))
- {
- return error(GL_INVALID_VALUE);
- }
-
- const GLsizei maxSize3D = es2::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE >> level;
- if((width < 0) || (height < 0) || (depth < 0) || (width > maxSize3D) || (height > maxSize3D) || (depth > maxSize3D) || (border != 0) || (imageSize < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(internalformat))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, internalformat) * depth)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- texture->setCompressedImage(level, internalformat, width, height, depth, imageSize, data);
- }
-}
-
-void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data)
-{
- TRACE("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, "
- "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, "
- "GLenum format = 0x%X, GLsizei imageSize = %d, const void *data = %p)",
- target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
-
- switch(target)
- {
- case GL_TEXTURE_3D:
- case GL_TEXTURE_2D_ARRAY:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(level < 0 || level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(xoffset < 0 || yoffset < 0 || zoffset < 0 || !validImageSize(level, width, height) || depth < 0 || imageSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsCompressed(format))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(imageSize != gl::ComputeCompressedSize(width, height, format) * depth)
- {
- return error(GL_INVALID_VALUE);
- }
-
- bool is_ETC2_EAC = false;
- switch(format)
- {
- case GL_COMPRESSED_R11_EAC:
- case GL_COMPRESSED_SIGNED_R11_EAC:
- case GL_COMPRESSED_RG11_EAC:
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- case GL_COMPRESSED_RGB8_ETC2:
- case GL_COMPRESSED_SRGB8_ETC2:
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- if(target != GL_TEXTURE_2D_ARRAY)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(((width % 4) != 0) || ((height % 4) != 0) ||
- ((xoffset % 4) != 0) || ((yoffset % 4) != 0))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- is_ETC2_EAC = true;
- break;
- default:
- break;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Texture3D *texture = (target == GL_TEXTURE_3D) ? context->getTexture3D() : context->getTexture2DArray();
-
- if(!texture)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- GLenum validationError = context->getPixels(&data, GL_UNSIGNED_BYTE, imageSize);
- if(validationError != GL_NO_ERROR)
- {
- return error(validationError);
- }
-
- if(is_ETC2_EAC)
- {
- if(((width + xoffset) != texture->getWidth(target, level)) ||
- ((height + yoffset) != texture->getHeight(target, level)) ||
- ((depth + zoffset) != texture->getDepth(target, level)))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- texture->subImageCompressed(level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data);
- }
-}
-
-void GL_APIENTRY GenQueries(GLsizei n, GLuint *ids)
-{
- TRACE("(GLsizei n = %d, GLuint* ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- ids[i] = context->createQuery();
- }
- }
-}
-
-void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint *ids)
-{
- TRACE("(GLsizei n = %d, GLuint* ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- context->deleteQuery(ids[i]);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsQuery(GLuint id)
-{
- TRACE("(GLuint id = %d)", id);
-
- if(id == 0)
- {
- return GL_FALSE;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Query *queryObject = context->getQuery(id);
-
- if(queryObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY BeginQuery(GLenum target, GLuint id)
-{
- TRACE("(GLenum target = 0x%X, GLuint id = %d)", target, id);
-
- if(!ValidateQueryTarget(target))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(id == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->beginQuery(target, id);
- }
-}
-
-void GL_APIENTRY EndQuery(GLenum target)
-{
- TRACE("(GLenum target = 0x%X)", target);
-
- if(!ValidateQueryTarget(target))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->endQuery(target);
- }
-}
-
-void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint *params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = %p)",
- target, pname, params);
-
- if(!ValidateQueryTarget(target) || (pname != GL_CURRENT_QUERY))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- params[0] = context->getActiveQuery(target);
- }
-}
-
-void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint *params)
-{
- TRACE("(GLuint id = %d, GLenum pname = 0x%X, GLint *params = %p)",
- id, pname, params);
-
- switch(pname)
- {
- case GL_QUERY_RESULT:
- case GL_QUERY_RESULT_AVAILABLE:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Query *queryObject = context->getQuery(id);
-
- if(!queryObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(context->getActiveQuery(queryObject->getType()) == id)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_QUERY_RESULT:
- params[0] = queryObject->getResult();
- break;
- case GL_QUERY_RESULT_AVAILABLE:
- params[0] = queryObject->isResultAvailable();
- break;
- default:
- ASSERT(false);
- }
- }
-}
-
-GLboolean GL_APIENTRY UnmapBuffer(GLenum target)
-{
- TRACE("(GLenum target = 0x%X)", target);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM, GL_TRUE);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- if(!buffer->isMapped())
- {
- // Already unmapped
- return error(GL_INVALID_OPERATION, GL_TRUE);
- }
-
- return buffer->unmap() ? GL_TRUE : GL_FALSE;
- }
-
- return GL_TRUE;
-}
-
-void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, void **params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = %p)",
- target, pname, params);
-
- if(pname != GL_BUFFER_MAP_POINTER)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- *params = buffer->isMapped() ? (void*)(((const char*)buffer->data()) + buffer->offset()) : nullptr;
- }
-}
-
-void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum *bufs)
-{
- TRACE("(GLsizei n = %d, const GLenum *bufs = %p)", n, bufs);
-
- if(n < 0 || n > MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLuint drawFramebufferName = context->getDrawFramebufferName();
-
- if((drawFramebufferName == 0) && (n != 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(unsigned int i = 0; i < (unsigned)n; i++)
- {
- switch(bufs[i])
- {
- case GL_BACK:
- if(drawFramebufferName != 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- case GL_NONE:
- break;
- case GL_COLOR_ATTACHMENT0:
- case GL_COLOR_ATTACHMENT1:
- case GL_COLOR_ATTACHMENT2:
- case GL_COLOR_ATTACHMENT3:
- case GL_COLOR_ATTACHMENT4:
- case GL_COLOR_ATTACHMENT5:
- case GL_COLOR_ATTACHMENT6:
- case GL_COLOR_ATTACHMENT7:
- case GL_COLOR_ATTACHMENT8:
- case GL_COLOR_ATTACHMENT9:
- case GL_COLOR_ATTACHMENT10:
- case GL_COLOR_ATTACHMENT11:
- case GL_COLOR_ATTACHMENT12:
- case GL_COLOR_ATTACHMENT13:
- case GL_COLOR_ATTACHMENT14:
- case GL_COLOR_ATTACHMENT15:
- case GL_COLOR_ATTACHMENT16:
- case GL_COLOR_ATTACHMENT17:
- case GL_COLOR_ATTACHMENT18:
- case GL_COLOR_ATTACHMENT19:
- case GL_COLOR_ATTACHMENT20:
- case GL_COLOR_ATTACHMENT21:
- case GL_COLOR_ATTACHMENT22:
- case GL_COLOR_ATTACHMENT23:
- case GL_COLOR_ATTACHMENT24:
- case GL_COLOR_ATTACHMENT25:
- case GL_COLOR_ATTACHMENT26:
- case GL_COLOR_ATTACHMENT27:
- case GL_COLOR_ATTACHMENT28:
- case GL_COLOR_ATTACHMENT29:
- case GL_COLOR_ATTACHMENT30:
- case GL_COLOR_ATTACHMENT31:
- {
- GLuint index = (bufs[i] - GL_COLOR_ATTACHMENT0);
-
- if(index >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(index != i)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(drawFramebufferName == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-
- context->setFramebufferDrawBuffers(n, bufs);
- }
-}
-
-void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix2x3fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix3x2fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix2x4fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix4x2fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix3x4fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %d, const GLfloat *value = %p)", location, count, transpose, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniformMatrix4x3fv(location, count, transpose, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter)
-{
- TRACE("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, "
- "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, "
- "GLbitfield mask = 0x%X, GLenum filter = 0x%X)",
- srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter);
-
- switch(filter)
- {
- case GL_NEAREST:
- break;
- case GL_LINEAR:
- if((mask & GL_DEPTH_BUFFER_BIT) || (mask & GL_STENCIL_BUFFER_BIT))
- {
- return error(GL_INVALID_OPERATION);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if((mask & ~(GL_COLOR_BUFFER_BIT | GL_STENCIL_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)) != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(context->getReadFramebufferName() == context->getDrawFramebufferName())
- {
- ERR("Blits with the same source and destination framebuffer are not supported by this implementation.");
- return error(GL_INVALID_OPERATION);
- }
-
- context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter == GL_LINEAR, true);
- }
-}
-
-void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer)
-{
- TRACE("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %d, GLint level = %d, GLint layer = %d)",
- target, attachment, texture, level, layer);
-
- // GLES 3.0.4 spec, p.209, section 4.4.2
- // If texture is zero, any image or array of images attached to the attachment point
- // named by attachment is detached. Any additional parameters(level, textarget,
- // and / or layer) are ignored when texture is zero.
- if(texture != 0 && (layer < 0 || level < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- Texture* textureObject = context->getTexture(texture);
- GLenum textarget = GL_NONE;
- if(texture != 0)
- {
- if(!textureObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(level >= es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- textarget = textureObject->getTarget();
- switch(textarget)
- {
- case GL_TEXTURE_3D:
- if(layer >= es2::IMPLEMENTATION_MAX_3D_TEXTURE_SIZE)
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- case GL_TEXTURE_2D_ARRAY:
- if(layer >= es2::IMPLEMENTATION_MAX_ARRAY_TEXTURE_LAYERS)
- {
- return error(GL_INVALID_VALUE);
- }
- break;
- default:
- return error(GL_INVALID_OPERATION);
- }
-
- if(textureObject->isCompressed(textarget, level))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- es2::Framebuffer *framebuffer = nullptr;
- switch(target)
- {
- case GL_DRAW_FRAMEBUFFER:
- case GL_FRAMEBUFFER:
- if(context->getDrawFramebufferName() == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- framebuffer = context->getDrawFramebuffer();
- break;
- case GL_READ_FRAMEBUFFER:
- if(context->getReadFramebufferName() == 0)
- {
- return error(GL_INVALID_OPERATION);
- }
- framebuffer = context->getReadFramebuffer();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(!framebuffer)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- switch(attachment)
- {
- case GL_DEPTH_ATTACHMENT:
- framebuffer->setDepthbuffer(textarget, texture, level, layer);
- break;
- case GL_STENCIL_ATTACHMENT:
- framebuffer->setStencilbuffer(textarget, texture, level, layer);
- break;
- case GL_DEPTH_STENCIL_ATTACHMENT:
- framebuffer->setDepthbuffer(textarget, texture, level, layer);
- framebuffer->setStencilbuffer(textarget, texture, level, layer);
- break;
- default:
- if(attachment < GL_COLOR_ATTACHMENT0 || attachment > GL_COLOR_ATTACHMENT31)
- {
- return error(GL_INVALID_ENUM);
- }
-
- if((attachment - GL_COLOR_ATTACHMENT0) >= MAX_COLOR_ATTACHMENTS)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- framebuffer->setColorbuffer(textarget, texture, attachment - GL_COLOR_ATTACHMENT0, level, layer);
- break;
- }
- }
-}
-
-void *GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access)
-{
- TRACE("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = %X)",
- target, offset, length, access);
-
- if((offset < 0) || (length < 0))
- {
- return error(GL_INVALID_VALUE, nullptr);
- }
-
- if(!(access & (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)))
- {
- // Must be able to read or write the buffer
- return error(GL_INVALID_OPERATION, nullptr);
- }
- else if((access & GL_MAP_READ_BIT) && (access & (GL_MAP_INVALIDATE_RANGE_BIT | GL_MAP_INVALIDATE_BUFFER_BIT | GL_MAP_UNSYNCHRONIZED_BIT)))
- {
- // GL_MAP_INVALIDATE_RANGE_BIT, GL_MAP_INVALIDATE_BUFFER_BIT and GL_MAP_UNSYNCHRONIZED_BIT can't be used with GL_MAP_READ_BIT
- return error(GL_INVALID_OPERATION, nullptr);
- }
- else if((!(access & GL_MAP_WRITE_BIT)) && (access & GL_MAP_FLUSH_EXPLICIT_BIT))
- {
- // GL_MAP_FLUSH_EXPLICIT_BIT can't be used without GL_MAP_WRITE_BIT
- return error(GL_INVALID_OPERATION, nullptr);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM, nullptr);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION, nullptr);
- }
-
- if(buffer->isMapped())
- {
- // It is an invalid operation to map an already mapped buffer
- return error(GL_INVALID_OPERATION, nullptr);
- }
-
- GLsizeiptr bufferSize = buffer->size();
- if((offset + length) > bufferSize)
- {
- return error(GL_INVALID_VALUE, nullptr);
- }
-
- if((access & ~(GL_MAP_READ_BIT |
- GL_MAP_WRITE_BIT |
- GL_MAP_INVALIDATE_RANGE_BIT |
- GL_MAP_INVALIDATE_BUFFER_BIT |
- GL_MAP_FLUSH_EXPLICIT_BIT |
- GL_MAP_UNSYNCHRONIZED_BIT)) != 0)
- {
- return error(GL_INVALID_VALUE, nullptr);
- }
-
- return buffer->mapRange(offset, length, access);
- }
-
- return nullptr;
-}
-
-void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length)
-{
- TRACE("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)",
- target, offset, length);
-
- if((offset < 0) || (length < 0))
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- if(!buffer->isMapped())
- {
- // Buffer must be mapped
- return error(GL_INVALID_OPERATION);
- }
-
- GLsizeiptr bufferSize = buffer->length();
- if((offset + length) > bufferSize)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!(buffer->access() & GL_MAP_FLUSH_EXPLICIT_BIT))
- {
- // Flush must be explicitly allowed
- return error(GL_INVALID_OPERATION);
- }
-
- buffer->flushMappedRange(offset, length);
- }
-}
-
-void GL_APIENTRY BindVertexArray(GLuint array)
-{
- TRACE("(GLuint array = %d)", array);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->isVertexArray(array))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->bindVertexArray(array);
- }
-}
-
-void GL_APIENTRY BindVertexArrayOES(GLuint array)
-{
- BindVertexArray(array);
-}
-
-void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint *arrays)
-{
- TRACE("(GLsizei n = %d, const GLuint *arrays = %p)", n, arrays);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- if(arrays[i] != 0) // Attempts to delete default vertex array silently ignored.
- {
- context->deleteVertexArray(arrays[i]);
- }
- }
- }
-}
-
-void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays)
-{
- DeleteVertexArrays(n, arrays);
-}
-
-void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint *arrays)
-{
- TRACE("(GLsizei n = %d, const GLuint *arrays = %p)", n, arrays);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- arrays[i] = context->createVertexArray();
- }
- }
-}
-
-void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays)
-{
- GenVertexArrays(n, arrays);
-}
-
-GLboolean GL_APIENTRY IsVertexArray(GLuint array)
-{
- TRACE("(GLuint array = %d)", array);
-
- if(array == 0)
- {
- return GL_FALSE;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::VertexArray *arrayObject = context->getVertexArray(array);
-
- if(arrayObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array)
-{
- return IsVertexArray(array);
-}
-
-void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data)
-{
- TRACE("(GLenum target = 0x%X, GLuint index = %d, GLint* data = %p)",
- target, index, data);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->getTransformFeedbackiv(index, target, data) &&
- !context->getUniformBufferiv(index, target, data) &&
- !context->getIntegerv(target, data))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(target, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that target is valid, but there are no parameters to return
-
- if(nativeType == GL_BOOL)
- {
- GLboolean *boolParams = nullptr;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(target, boolParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- data[i] = (boolParams[i] == GL_FALSE) ? 0 : 1;
- }
-
- delete[] boolParams;
- }
- else if(nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = nullptr;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(target, floatParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(target == GL_DEPTH_RANGE || target == GL_COLOR_CLEAR_VALUE || target == GL_DEPTH_CLEAR_VALUE || target == GL_BLEND_COLOR)
- {
- data[i] = convert_float_fixed(floatParams[i]);
- }
- else
- {
- data[i] = (GLint)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
- }
-
- delete[] floatParams;
- }
- }
- }
-}
-
-void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode)
-{
- TRACE("(GLenum primitiveMode = 0x%X)", primitiveMode);
-
- switch(primitiveMode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_TRIANGLES:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback();
-
- if(transformFeedbackObject)
- {
- if(transformFeedbackObject->isActive())
- {
- return error(GL_INVALID_OPERATION);
- }
- transformFeedbackObject->begin(primitiveMode);
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY EndTransformFeedback(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback();
-
- if(transformFeedbackObject)
- {
- if(!transformFeedbackObject->isActive())
- {
- return error(GL_INVALID_OPERATION);
- }
- transformFeedbackObject->end();
- }
- else
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)
-{
- TRACE("(GLenum target = 0x%X, GLuint index = %d, GLuint buffer = %d, GLintptr offset = %d, GLsizeiptr size = %d)",
- target, index, buffer, offset, size);
-
- if(buffer != 0 && size <= 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- if(index >= MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
- if(size & 0x3 || offset & 0x3) // size and offset must be multiples of 4
- {
- return error(GL_INVALID_VALUE);
- }
- context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size);
- context->bindGenericTransformFeedbackBuffer(buffer);
- break;
- case GL_UNIFORM_BUFFER:
- if(index >= MAX_UNIFORM_BUFFER_BINDINGS)
- {
- return error(GL_INVALID_VALUE);
- }
- if(offset % UNIFORM_BUFFER_OFFSET_ALIGNMENT != 0)
- {
- return error(GL_INVALID_VALUE);
- }
- context->bindIndexedUniformBuffer(buffer, index, offset, size);
- context->bindGenericUniformBuffer(buffer);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer)
-{
- TRACE("(GLenum target = 0x%X, GLuint index = %d, GLuint buffer = %d)",
- target, index, buffer);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_TRANSFORM_FEEDBACK_BUFFER:
- if(index >= MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
- context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0);
- context->bindGenericTransformFeedbackBuffer(buffer);
- break;
- case GL_UNIFORM_BUFFER:
- if(index >= MAX_UNIFORM_BUFFER_BINDINGS)
- {
- return error(GL_INVALID_VALUE);
- }
- context->bindIndexedUniformBuffer(buffer, index, 0, 0);
- context->bindGenericUniformBuffer(buffer);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode)
-{
- TRACE("(GLuint program = %d, GLsizei count = %d, const GLchar *const*varyings = %p, GLenum bufferMode = 0x%X)",
- program, count, varyings, bufferMode);
-
- switch(bufferMode)
- {
- case GL_SEPARATE_ATTRIBS:
- if(count > MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
- case GL_INTERLEAVED_ATTRIBS:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->setTransformFeedbackVaryings(count, varyings, bufferMode);
- }
-}
-
-void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)
-{
- TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLsizei *size = %p, GLenum *type = %p, GLchar *name = %p)",
- program, index, bufSize, length, size, type, name);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount()))
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name);
- }
-}
-
-void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer)
-{
- TRACE("(GLuint program = %d, GLuint index = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLsizei *size = %p, GLenum *type = %p, GLchar *name = %p)",
- index, size, type, stride, pointer);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(size < 1 || size > 4 || stride < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(type)
- {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- case GL_SHORT:
- case GL_UNSIGNED_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::VertexArray* vertexArray = context->getCurrentVertexArray();
- if((context->getArrayBufferName() == 0) && vertexArray && (vertexArray->name != 0) && pointer)
- {
- // GL_INVALID_OPERATION is generated if a non-zero vertex array object is bound, zero is bound
- // to the GL_ARRAY_BUFFER buffer object binding point and the pointer argument is not NULL.
- return error(GL_INVALID_OPERATION);
- }
-
- context->setVertexAttribState(index, context->getArrayBuffer(), size, type, false, true, stride, pointer);
- }
-}
-
-void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint *params)
-{
- TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLint *params = %p)",
- index, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
-
- switch(pname)
- {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = attribState.mBoundBuffer.name();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- {
- const VertexAttribute& attrib = context->getCurrentVertexAttributes()[index];
- for(int i = 0; i < 4; ++i)
- {
- params[i] = attrib.getCurrentValueI(i);
- }
- }
- break;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- *params = (attribState.mPureInteger ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
- *params = attribState.mDivisor;
- break;
- default: return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint *params)
-{
- TRACE("(GLuint index = %d, GLenum pname = 0x%X, GLuint *params = %p)",
- index, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- const es2::VertexAttribute &attribState = context->getVertexAttribState(index);
-
- switch(pname)
- {
- case GL_VERTEX_ATTRIB_ARRAY_ENABLED:
- *params = (attribState.mArrayEnabled ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_SIZE:
- *params = attribState.mSize;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_STRIDE:
- *params = attribState.mStride;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_TYPE:
- *params = attribState.mType;
- break;
- case GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:
- *params = (attribState.mNormalized ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:
- *params = attribState.mBoundBuffer.name();
- break;
- case GL_CURRENT_VERTEX_ATTRIB:
- {
- const VertexAttribute& attrib = context->getCurrentVertexAttributes()[index];
- for(int i = 0; i < 4; ++i)
- {
- params[i] = attrib.getCurrentValueUI(i);
- }
- }
- break;
- case GL_VERTEX_ATTRIB_ARRAY_INTEGER:
- *params = (attribState.mPureInteger ? GL_TRUE : GL_FALSE);
- break;
- case GL_VERTEX_ATTRIB_ARRAY_DIVISOR:
- *params = attribState.mDivisor;
- break;
- default: return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w)
-{
- TRACE("(GLuint index = %d, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)",
- index, x, y, z, w);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLint vals[4] = { x, y, z, w };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)
-{
- TRACE("(GLuint index = %d, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)",
- index, x, y, z, w);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- GLuint vals[4] = { x, y, z, w };
- context->setVertexAttrib(index, vals);
- }
-}
-
-void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint *v)
-{
- TRACE("(GLuint index = %d, GLint *v = %p)", index, v);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setVertexAttrib(index, v);
- }
-}
-
-void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint *v)
-{
- TRACE("(GLuint index = %d, GLint *v = %p)", index, v);
-
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- context->setVertexAttrib(index, v);
- }
-}
-
-void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint *params)
-{
- TRACE("(GLuint program = %d, GLint location = %d, GLuint *params = %p)",
- program, location, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!programObject->getUniformuiv(location, nullptr, params))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name)
-{
- TRACE("(GLuint program = %d, const GLchar *name = %p)", program, name);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION, -1);
- }
- else
- {
- return error(GL_INVALID_VALUE, -1);
- }
- }
-
- if(!programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION, -1);
- }
-
- return programObject->getFragDataLocation(name);
- }
-
- return -1;
-}
-
-void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLuint *value = %p)",
- location, count, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform1uiv(location, count, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLuint *value = %p)",
- location, count, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform2uiv(location, count, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLuint *value = %p)",
- location, count, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform3uiv(location, count, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint *value)
-{
- TRACE("(GLint location = %d, GLsizei count = %d, const GLuint *value = %p)",
- location, count, value);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *program = context->getCurrentProgram();
-
- if(!program)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(location == -1)
- {
- return;
- }
-
- if(!program->setUniform4uiv(location, count, value))
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-}
-
-void GL_APIENTRY Uniform1ui(GLint location, GLuint v0)
-{
- Uniform1uiv(location, 1, &v0);
-}
-
-void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1)
-{
- GLuint xy[2] = { v0, v1 };
-
- Uniform2uiv(location, 1, (GLuint*)&xy);
-}
-
-void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2)
-{
- GLuint xyz[3] = { v0, v1, v2 };
-
- Uniform3uiv(location, 1, (GLuint*)&xyz);
-}
-
-void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)
-{
- GLuint xyzw[4] = { v0, v1, v2, v3 };
-
- Uniform4uiv(location, 1, (GLuint*)&xyzw);
-}
-
-void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint *value)
-{
- TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint *value = %p)",
- buffer, drawbuffer, value);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(buffer)
- {
- case GL_COLOR:
- if(drawbuffer < 0 || drawbuffer >= MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearColorBuffer(drawbuffer, value);
- }
- break;
- case GL_STENCIL:
- if(drawbuffer != 0)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearStencilBuffer(value[0]);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint *value)
-{
- TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint *value = %p)",
- buffer, drawbuffer, value);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(buffer)
- {
- case GL_COLOR:
- if(drawbuffer < 0 || drawbuffer >= MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearColorBuffer(drawbuffer, value);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat *value)
-{
- TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat *value = %p)",
- buffer, drawbuffer, value);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(buffer)
- {
- case GL_COLOR:
- if(drawbuffer < 0 || drawbuffer >= MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearColorBuffer(drawbuffer, value);
- }
- break;
- case GL_DEPTH:
- if(drawbuffer != 0)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearDepthBuffer(value[0]);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)
-{
- TRACE("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth = %f, GLint stencil = %d)",
- buffer, drawbuffer, depth, stencil);
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(buffer)
- {
- case GL_DEPTH_STENCIL:
- if(drawbuffer != 0)
- {
- return error(GL_INVALID_VALUE);
- }
- else
- {
- context->clearDepthBuffer(depth);
- context->clearStencilBuffer(stencil);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index)
-{
- TRACE("(GLenum name = 0x%X, GLuint index = %d)", name, index);
-
- auto context = es2::getContext();
- if(context)
- {
- GLuint numExtensions;
- context->getExtensions(0, &numExtensions);
-
- if(index >= numExtensions)
- {
- return error(GL_INVALID_VALUE, (GLubyte*)nullptr);
- }
-
- switch(name)
- {
- case GL_EXTENSIONS:
- return context->getExtensions(index);
- default:
- return error(GL_INVALID_ENUM, (GLubyte*)nullptr);
- }
- }
-
- return (GLubyte*)nullptr;
-}
-
-void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size)
-{
- TRACE("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)",
- readTarget, writeTarget, readOffset, writeOffset, size);
-
- if(readOffset < 0 || writeOffset < 0 || size < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *readBuffer = nullptr, *writeBuffer = nullptr;
- if(!context->getBuffer(readTarget, &readBuffer) || !context->getBuffer(writeTarget, &writeBuffer))
- {
- return error(GL_INVALID_ENUM);
- }
- if(!readBuffer || readBuffer->isMapped() || !writeBuffer || writeBuffer->isMapped())
- {
- return error(GL_INVALID_OPERATION);
- }
- if(readBuffer == writeBuffer)
- {
- // If same buffer, check for overlap
- if(((readOffset >= writeOffset) && (readOffset < (writeOffset + size))) ||
- ((writeOffset >= readOffset) && (writeOffset < (readOffset + size))))
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- if((static_cast<size_t>(readOffset + size) > readBuffer->size()) ||
- (static_cast<size_t>(writeOffset + size) > writeBuffer->size()))
- {
- return error(GL_INVALID_VALUE);
- }
-
- writeBuffer->bufferSubData(((char*)readBuffer->data()) + readOffset, size, writeOffset);
- }
-}
-
-void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices)
-{
- TRACE("(GLuint program = %d, GLsizei uniformCount = %d, const GLchar *const*uniformNames = %p, GLuint *uniformIndices = %p)",
- program, uniformCount, uniformNames, uniformIndices);
-
- if(uniformCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- 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 GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params)
-{
- TRACE("(GLuint program = %d, GLsizei uniformCount = %d, const GLchar *const*uniformNames = %p, GLenum pname = 0x%X, GLuint *uniformIndices = %p)",
- program, uniformCount, uniformIndices, pname, uniformIndices);
-
- switch(pname)
- {
- case GL_UNIFORM_TYPE:
- case GL_UNIFORM_SIZE:
- case GL_UNIFORM_NAME_LENGTH:
- case GL_UNIFORM_BLOCK_INDEX:
- case GL_UNIFORM_OFFSET:
- case GL_UNIFORM_ARRAY_STRIDE:
- case GL_UNIFORM_MATRIX_STRIDE:
- case GL_UNIFORM_IS_ROW_MAJOR:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(uniformCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- for(int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
-
- if(index >= programObject->getActiveUniformCount())
- {
- return error(GL_INVALID_VALUE);
- }
- }
-
- for(int uniformId = 0; uniformId < uniformCount; uniformId++)
- {
- const GLuint index = uniformIndices[uniformId];
- params[uniformId] = programObject->getActiveUniformi(index, pname);
- }
- }
-}
-
-GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar *uniformBlockName)
-{
- TRACE("(GLuint program = %d, const GLchar *uniformBlockName = %p)",
- program, uniformBlockName);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- if(context->getShader(program))
- {
- return error(GL_INVALID_OPERATION, GL_INVALID_INDEX);
- }
- else
- {
- return error(GL_INVALID_VALUE, GL_INVALID_INDEX);
- }
- }
-
- return programObject->getUniformBlockIndex(uniformBlockName);
- }
-
- return GL_INVALID_INDEX;
-}
-
-void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params)
-{
- TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLenum pname = 0x%X, GLint *params = %p)",
- program, uniformBlockIndex, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(uniformBlockIndex >= programObject->getActiveUniformBlockCount())
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(pname)
- {
- case GL_UNIFORM_BLOCK_BINDING:
- *params = static_cast<GLint>(programObject->getUniformBlockBinding(uniformBlockIndex));
- break;
- case GL_UNIFORM_BLOCK_DATA_SIZE:
- case GL_UNIFORM_BLOCK_NAME_LENGTH:
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS:
- case GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES:
- case GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER:
- case GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER:
- programObject->getActiveUniformBlockiv(uniformBlockIndex, pname, params);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName)
-{
- TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLchar *uniformBlockName = %p)",
- program, uniformBlockIndex, bufSize, length, uniformBlockName);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(uniformBlockIndex >= programObject->getActiveUniformBlockCount())
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName);
- }
-}
-
-void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding)
-{
- TRACE("(GLuint program = %d, GLuint uniformBlockIndex = %d, GLuint uniformBlockBinding = %d)",
- program, uniformBlockIndex, uniformBlockBinding);
-
- if(uniformBlockBinding >= MAX_UNIFORM_BUFFER_BINDINGS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(uniformBlockIndex >= programObject->getActiveUniformBlockCount())
- {
- return error(GL_INVALID_VALUE);
- }
-
- programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding);
- }
-}
-
-void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)",
- mode, first, count, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && (mode != transformFeedback->primitiveMode()))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawArrays(mode, first, count, instanceCount);
- }
-}
-
-void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instanceCount)
-{
- TRACE("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const void *indices = %p, GLsizei instanceCount = %d)",
- mode, count, type, indices, instanceCount);
-
- switch(mode)
- {
- case GL_POINTS:
- case GL_LINES:
- case GL_LINE_LOOP:
- case GL_LINE_STRIP:
- case GL_TRIANGLES:
- case GL_TRIANGLE_FAN:
- case GL_TRIANGLE_STRIP:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(count < 0 || instanceCount < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback* transformFeedback = context->getTransformFeedback();
- if(transformFeedback && transformFeedback->isActive() && !transformFeedback->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->drawElements(mode, 0, MAX_ELEMENT_INDEX, count, type, indices, instanceCount);
- }
-}
-
-GLsync GL_APIENTRY FenceSync(GLenum condition, GLbitfield flags)
-{
- TRACE("(GLenum condition = 0x%X, GLbitfield flags = %X)", condition, flags);
-
- switch(condition)
- {
- case GL_SYNC_GPU_COMMANDS_COMPLETE:
- break;
- default:
- return error(GL_INVALID_ENUM, nullptr);
- }
-
- if(flags != 0)
- {
- return error(GL_INVALID_VALUE, nullptr);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- return context->createFenceSync(condition, flags);
- }
-
- return nullptr;
-}
-
-GLboolean GL_APIENTRY IsSync(GLsync sync)
-{
- TRACE("(GLsync sync = %p)", sync);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::FenceSync *fenceSyncObject = context->getFenceSync(sync);
-
- if(fenceSyncObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY DeleteSync(GLsync sync)
-{
- TRACE("(GLsync sync = %p)", sync);
-
- if(!sync)
- {
- return;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->getFenceSync(sync))
- {
- return error(GL_INVALID_VALUE);
- }
-
- context->deleteFenceSync(sync);
- }
-}
-
-GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- TRACE("(GLsync sync = %p, GLbitfield flags = %X, GLuint64 timeout = %llu)", sync, flags, timeout);
-
- if((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0)
- {
- return error(GL_INVALID_VALUE, GL_FALSE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::FenceSync *fenceSyncObject = context->getFenceSync(sync);
-
- if(fenceSyncObject)
- {
- return fenceSyncObject->clientWait(flags, timeout);
- }
- else
- {
- return error(GL_INVALID_VALUE, GL_FALSE);
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout)
-{
- TRACE("(GLsync sync = %p, GLbitfield flags = %X, GLuint64 timeout = %llu)", sync, flags, timeout);
-
- if(flags != 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(timeout != GL_TIMEOUT_IGNORED)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::FenceSync *fenceSyncObject = context->getFenceSync(sync);
-
- if(fenceSyncObject)
- {
- fenceSyncObject->serverWait(flags, timeout);
- }
- else
- {
- return error(GL_INVALID_VALUE);
- }
- }
-}
-
-void GL_APIENTRY GetInteger64v(GLenum pname, GLint64 *data)
-{
- TRACE("(GLenum pname = 0x%X, GLint64 *data = %p)", pname, data);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!(context->getIntegerv(pname, data)))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(pname, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that pname is valid, but there are no parameters to return
-
- if(nativeType == GL_BOOL)
- {
- GLboolean *boolParams = nullptr;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(pname, boolParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- data[i] = (boolParams[i] == GL_FALSE) ? 0 : 1;
- }
-
- delete[] boolParams;
- }
- else if(nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = nullptr;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(pname, floatParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(pname == GL_DEPTH_RANGE || pname == GL_COLOR_CLEAR_VALUE || pname == GL_DEPTH_CLEAR_VALUE || pname == GL_BLEND_COLOR)
- {
- data[i] = (GLint64)(convert_float_fixed(floatParams[i]));
- }
- else
- {
- data[i] = (GLint64)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
- }
-
- delete[] floatParams;
- }
- }
- }
-}
-
-void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values)
-{
- TRACE("(GLsync sync = %p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei *length = %p, GLint *values = %p)",
- sync, pname, bufSize, length, values);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::FenceSync *fenceSyncObject = context->getFenceSync(sync);
- if(!fenceSyncObject)
- {
- return error(GL_INVALID_VALUE);
- }
-
- fenceSyncObject->getSynciv(pname, length, values);
- }
-}
-
-void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64 *data)
-{
- TRACE("(GLenum target = 0x%X, GLuint index = %d, GLint64 *data = %p)", target, index, data);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->getTransformFeedbackiv(index, target, data) &&
- !context->getUniformBufferiv(index, target, data) &&
- !context->getIntegerv(target, data))
- {
- GLenum nativeType;
- unsigned int numParams = 0;
- if(!context->getQueryParameterInfo(target, &nativeType, &numParams))
- return error(GL_INVALID_ENUM);
-
- if(numParams == 0)
- return; // it is known that target is valid, but there are no parameters to return
-
- if(nativeType == GL_BOOL)
- {
- GLboolean *boolParams = nullptr;
- boolParams = new GLboolean[numParams];
-
- context->getBooleanv(target, boolParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- data[i] = (boolParams[i] == GL_FALSE) ? 0 : 1;
- }
-
- delete[] boolParams;
- }
- else if(nativeType == GL_FLOAT)
- {
- GLfloat *floatParams = nullptr;
- floatParams = new GLfloat[numParams];
-
- context->getFloatv(target, floatParams);
-
- for(unsigned int i = 0; i < numParams; ++i)
- {
- if(target == GL_DEPTH_RANGE || target == GL_COLOR_CLEAR_VALUE || target == GL_DEPTH_CLEAR_VALUE || target == GL_BLEND_COLOR)
- {
- data[i] = (GLint64)(convert_float_fixed(floatParams[i]));
- }
- else
- {
- data[i] = (GLint64)(floatParams[i] > 0.0f ? floor(floatParams[i] + 0.5) : ceil(floatParams[i] - 0.5));
- }
- }
-
- delete[] floatParams;
- }
- }
- }
-}
-
-void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64 *params)
-{
- TRACE("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64 *params = %p)", target, pname, params);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Buffer *buffer = nullptr;
-
- if(!context->getBuffer(target, &buffer))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!buffer)
- {
- // A null buffer means that "0" is bound to the requested buffer target
- return error(GL_INVALID_OPERATION);
- }
-
- switch(pname)
- {
- case GL_BUFFER_USAGE:
- *params = buffer->usage();
- break;
- case GL_BUFFER_SIZE:
- *params = buffer->size();
- break;
- case GL_BUFFER_ACCESS_FLAGS:
- *params = buffer->access();
- break;
- case GL_BUFFER_MAPPED:
- *params = buffer->isMapped();
- break;
- case GL_BUFFER_MAP_LENGTH:
- *params = buffer->length();
- break;
- case GL_BUFFER_MAP_OFFSET:
- *params = buffer->offset();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GenSamplers(GLsizei count, GLuint *samplers)
-{
- TRACE("(GLsizei count = %d, GLuint *samplers = %p)", count, samplers);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < count; i++)
- {
- samplers[i] = context->createSampler();
- }
- }
-}
-
-void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint *samplers)
-{
- TRACE("(GLsizei count = %d, GLuint *samplers = %p)", count, samplers);
-
- if(count < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < count; i++)
- {
- context->deleteSampler(samplers[i]);
- }
- }
-}
-
-GLboolean GL_APIENTRY IsSampler(GLuint sampler)
-{
- TRACE("(GLuint sampler = %d)", sampler);
-
- if(sampler == 0)
- {
- return GL_FALSE;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(context->isSampler(sampler))
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler)
-{
- TRACE("(GLuint unit = %d, GLuint sampler = %d)", unit, sampler);
-
- if(unit >= es2::MAX_COMBINED_TEXTURE_IMAGE_UNITS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(sampler != 0 && !context->isSampler(sampler))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->bindSampler(unit, sampler);
- }
-}
-
-void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint *param)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, const GLint *param = %p)",
- sampler, pname, param);
-
- if(!ValidateSamplerObjectParameter(pname))
- {
- return error(GL_INVALID_ENUM);
- }
-
- if(!ValidateTexParamParameters(pname, *param))
- {
- return;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->isSampler(sampler))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->samplerParameteri(sampler, pname, *param);
- }
-}
-
-void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, GLint param = %d)",
- sampler, pname, param);
-
- SamplerParameteriv(sampler, pname, &param);
-}
-
-void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat *param)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, const GLfloat *param = %p)",
- sampler, pname, param);
-
- if(!ValidateSamplerObjectParameter(pname))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->isSampler(sampler))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(ValidateTexParamParameters(pname, static_cast<GLint>(roundf(*param))))
- {
- context->samplerParameterf(sampler, pname, *param);
- }
- }
-}
-
-void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, GLfloat param = %f)",
- sampler, pname, param);
-
- SamplerParameterfv(sampler, pname, &param);
-}
-
-void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, GLint *params = %p)",
- sampler, pname, params);
-
- if(!ValidateSamplerObjectParameter(pname))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->isSampler(sampler))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- *params = context->getSamplerParameteri(sampler, pname);
- }
-}
-
-void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat *params)
-{
- TRACE("(GLuint sampler = %d, GLenum pname = 0x%X, GLfloat *params = %p)",
- sampler, pname, params);
-
- if(!ValidateSamplerObjectParameter(pname))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(!context->isSampler(sampler))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- *params = context->getSamplerParameterf(sampler, pname);
- }
-}
-
-void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor)
-{
- TRACE("(GLuint index = %d, GLuint divisor = %d)", index, divisor);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(index >= es2::MAX_VERTEX_ATTRIBS)
- {
- return error(GL_INVALID_VALUE);
- }
-
- context->setVertexAttribDivisor(index, divisor);
- }
-}
-
-void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id)
-{
- TRACE("(GLenum target = 0x%X, GLuint id = %d)", target, id);
-
- if(target != GL_TRANSFORM_FEEDBACK)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback();
-
- if(transformFeedbackObject && transformFeedbackObject->isActive() && !transformFeedbackObject->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- if(!context->isTransformFeedback(id))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->bindTransformFeedback(id);
- }
-}
-
-void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint *ids)
-{
- TRACE("(GLsizei n = %d, const GLuint *ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- if(ids[i] != 0) // Attempts to delete default transform feedback silently ignored.
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback(ids[i]);
-
- if(transformFeedbackObject && transformFeedbackObject->isActive())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- context->deleteTransformFeedback(ids[i]);
- }
- }
- }
-}
-
-void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint *ids)
-{
- TRACE("(GLsizei n = %d, const GLuint *ids = %p)", n, ids);
-
- if(n < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- for(int i = 0; i < n; i++)
- {
- ids[i] = context->createTransformFeedback();
- }
- }
-}
-
-GLboolean GL_APIENTRY IsTransformFeedback(GLuint id)
-{
- TRACE("(GLuint id = %d)", id);
-
- if(id == 0)
- {
- return GL_FALSE;
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback(id);
-
- if(transformFeedbackObject)
- {
- return GL_TRUE;
- }
- }
-
- return GL_FALSE;
-}
-
-void GL_APIENTRY PauseTransformFeedback(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback();
-
- if(transformFeedbackObject)
- {
- if(!transformFeedbackObject->isActive() || transformFeedbackObject->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
- transformFeedbackObject->setPaused(true);
- }
- }
-}
-
-void GL_APIENTRY ResumeTransformFeedback(void)
-{
- TRACE("()");
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::TransformFeedback *transformFeedbackObject = context->getTransformFeedback();
-
- if(transformFeedbackObject)
- {
- if(!transformFeedbackObject->isActive() || !transformFeedbackObject->isPaused())
- {
- return error(GL_INVALID_OPERATION);
- }
- transformFeedbackObject->setPaused(false);
- }
- }
-}
-
-void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary)
-{
- TRACE("(GLuint program = %d, GLsizei bufSize = %d, GLsizei *length = %p, GLenum *binaryFormat = %p, void *binary = %p)",
- program, bufSize, length, binaryFormat, binary);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject || !programObject->isLinked())
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- // SwiftShader doesn't return a program binary and sets the program binay size to 0, so any attempt at getting one is invalid.
- return error(GL_INVALID_OPERATION);
-}
-
-void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const void *binary, GLsizei length)
-{
- TRACE("(GLuint program = %d, GLenum binaryFormat = 0x%X, const void *binary = %p, GLsizei length = %d)",
- program, binaryFormat, binaryFormat, length);
-
- if(length < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_OPERATION);
- }
- }
-
- // Regardless of what the binaryFormat is, it is unrecognized by SwiftShader, since it supports no format.
- return error(GL_INVALID_ENUM);
-}
-
-void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value)
-{
- TRACE("(GLuint program = %d, GLenum pname = 0x%X, GLint value = %d)",
- program, pname, value);
-
- auto context = es2::getContext();
-
- if(context)
- {
- es2::Program *programObject = context->getProgram(program);
-
- if(!programObject)
- {
- return error(GL_INVALID_VALUE);
- }
-
- switch(pname)
- {
- case GL_PROGRAM_BINARY_RETRIEVABLE_HINT:
- if((value != GL_TRUE) && (value != GL_FALSE))
- {
- return error(GL_INVALID_VALUE);
- }
- programObject->setBinaryRetrievable(value != GL_FALSE);
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)",
- target, numAttachments, attachments, x, y, width, height);
-
- auto context = es2::getContext();
-
- if(context)
- {
- if(numAttachments < 0 || width < 0 || height < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- es2::Framebuffer *framebuffer = nullptr;
- switch(target)
- {
- case GL_DRAW_FRAMEBUFFER:
- case GL_FRAMEBUFFER:
- framebuffer = context->getDrawFramebuffer();
- break;
- case GL_READ_FRAMEBUFFER:
- framebuffer = context->getReadFramebuffer();
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- if(framebuffer)
- {
- for(int i = 0; i < numAttachments; i++)
- {
- switch(attachments[i])
- {
- case GL_COLOR:
- case GL_DEPTH:
- case GL_STENCIL:
- if(!framebuffer->isDefaultFramebuffer())
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- case GL_DEPTH_STENCIL_ATTACHMENT:
- break;
- default:
- if(attachments[i] >= GL_COLOR_ATTACHMENT0 &&
- attachments[i] <= GL_COLOR_ATTACHMENT31)
- {
- if(attachments[i] - GL_COLOR_ATTACHMENT0 >= MAX_DRAW_BUFFERS)
- {
- return error(GL_INVALID_OPERATION);
- }
- }
- else
- {
- return error(GL_INVALID_ENUM);
- }
- break;
- }
- }
- }
-
- // UNIMPLEMENTED(); // It is valid for this function to be treated as a no-op
- }
-}
-
-void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum *attachments)
-{
- TRACE("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum *attachments = %p)",
- target, numAttachments, attachments);
-
- InvalidateSubFramebuffer(target, numAttachments, attachments, 0, 0, std::numeric_limits<GLsizei>::max(), std::numeric_limits<GLsizei>::max());
-}
-
-void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height)
-{
- TRACE("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)",
- target, levels, internalformat, width, height);
-
- if(width < 1 || height < 1 || levels < 1 || ((target == GL_TEXTURE_RECTANGLE_ARB) && (levels != 1)))
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(levels > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || levels > (log2(std::max(width, height)) + 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- bool isCompressed = IsCompressed(internalformat);
- if(!IsSizedInternalFormat(internalformat) && !isCompressed)
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_TEXTURE_RECTANGLE_ARB:
- if(isCompressed) // Rectangle textures cannot be compressed
- {
- return error(GL_INVALID_ENUM);
- }
- // Fall through to GL_TEXTURE_2D case.
- case GL_TEXTURE_2D:
- {
- if((width > es2::IMPLEMENTATION_MAX_TEXTURE_SIZE) ||
- (height > es2::IMPLEMENTATION_MAX_TEXTURE_SIZE))
- {
- return error(GL_INVALID_VALUE);
- }
-
- es2::Texture2D *texture = context->getTexture2D(target);
- if(!texture || texture->name == 0 || texture->getImmutableFormat() != GL_FALSE)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(int level = 0; level < levels; level++)
- {
- texture->setImage(level, width, height, internalformat, GL_NONE, GL_NONE, context->getUnpackParameters(), nullptr);
- width = std::max(1, (width / 2));
- height = std::max(1, (height / 2));
- }
- texture->makeImmutable(levels);
- }
- break;
- case GL_TEXTURE_CUBE_MAP:
- {
- if((width > es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE) ||
- (height > es2::IMPLEMENTATION_MAX_CUBE_MAP_TEXTURE_SIZE))
- {
- return error(GL_INVALID_VALUE);
- }
-
- es2::TextureCubeMap *texture = context->getTextureCubeMap();
- if(!texture || texture->name == 0 || texture->getImmutableFormat())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(int level = 0; level < levels; level++)
- {
- for(int face = GL_TEXTURE_CUBE_MAP_POSITIVE_X; face <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z; face++)
- {
- texture->setImage(face, level, width, height, internalformat, GL_NONE, GL_NONE, context->getUnpackParameters(), nullptr);
- }
- width = std::max(1, (width / 2));
- height = std::max(1, (height / 2));
- }
- texture->makeImmutable(levels);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth)
-{
- TRACE("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d)",
- target, levels, internalformat, width, height, depth);
-
- if(width < 1 || height < 1 || depth < 1 || levels < 1)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(!IsSizedInternalFormat(internalformat) && !IsCompressed(internalformat))
- {
- return error(GL_INVALID_ENUM);
- }
-
- auto context = es2::getContext();
-
- if(context)
- {
- switch(target)
- {
- case GL_TEXTURE_3D:
- {
- if(levels > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || levels > (log2(std::max(std::max(width, height), depth)) + 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Texture3D *texture = context->getTexture3D();
- if(!texture || texture->name == 0 || texture->getImmutableFormat() != GL_FALSE)
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(int level = 0; level < levels; level++)
- {
- texture->setImage(level, width, height, depth, internalformat, GL_NONE, GL_NONE, context->getUnpackParameters(), nullptr);
- width = std::max(1, (width / 2));
- height = std::max(1, (height / 2));
- depth = std::max(1, (depth / 2));
- }
- texture->makeImmutable(levels);
- }
- break;
- case GL_TEXTURE_2D_ARRAY:
- {
- if(levels > es2::IMPLEMENTATION_MAX_TEXTURE_LEVELS || levels > (log2(std::max(width, height)) + 1))
- {
- return error(GL_INVALID_OPERATION);
- }
-
- es2::Texture3D *texture = context->getTexture2DArray();
- if(!texture || texture->name == 0 || texture->getImmutableFormat())
- {
- return error(GL_INVALID_OPERATION);
- }
-
- for(int level = 0; level < levels; level++)
- {
- texture->setImage(level, width, height, depth, internalformat, GL_NONE, GL_NONE, context->getUnpackParameters(), nullptr);
-
- width = std::max(1, (width / 2));
- height = std::max(1, (height / 2));
- }
- texture->makeImmutable(levels);
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
- }
-}
-
-void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params)
-{
- TRACE("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, GLint *params = %p)",
- target, internalformat, pname, bufSize, params);
-
- if(bufSize < 0)
- {
- return error(GL_INVALID_VALUE);
- }
-
- if(bufSize == 0)
- {
- return;
- }
-
- // OpenGL ES 3.0, section 4.4.4: "An internal format is color-renderable if it is one of the formats
- // from table 3.13 noted as color-renderable or if it is unsized format RGBA or RGB."
- // Since we only use sized formats internally, replace them here (assuming type = GL_UNSIGNED_BYTE).
- if(internalformat == GL_RGB) internalformat = GL_RGB8;
- if(internalformat == GL_RGBA) internalformat = GL_RGBA8;
-
- if(!IsColorRenderable(internalformat) &&
- !IsDepthRenderable(internalformat) &&
- !IsStencilRenderable(internalformat))
- {
- return error(GL_INVALID_ENUM);
- }
-
- switch(target)
- {
- case GL_RENDERBUFFER:
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-
- GLint numMultisampleCounts = NUM_MULTISAMPLE_COUNTS;
-
- // Integer types have no multisampling
- GLenum type = GetColorComponentType(internalformat);
- if(type != GL_UNSIGNED_NORMALIZED && type != GL_FLOAT)
- {
- numMultisampleCounts = 0;
- }
-
- switch(pname)
- {
- case GL_NUM_SAMPLE_COUNTS:
- *params = numMultisampleCounts;
- break;
- case GL_SAMPLES:
- for(int i = 0; i < numMultisampleCounts && i < bufSize; i++)
- {
- params[i] = multisampleCount[i];
- }
- break;
- default:
- return error(GL_INVALID_ENUM);
- }
-}
-
-}
diff --git a/src/OpenGL/libGLESv2/main.cpp b/src/OpenGL/libGLESv2/main.cpp
deleted file mode 100644
index aaabcbd7c..000000000
--- a/src/OpenGL/libGLESv2/main.cpp
+++ /dev/null
@@ -1,147 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// main.cpp: DLLMain and management of thread-local data.
-
-#include "main.h"
-
-#if !defined(_MSC_VER)
-#define CONSTRUCTOR __attribute__((constructor))
-#define DESTRUCTOR __attribute__((destructor))
-#else
-#define CONSTRUCTOR
-#define DESTRUCTOR
-#endif
-
-static void glAttachThread()
-{
- TRACE("()");
-}
-
-static void glDetachThread()
-{
- TRACE("()");
-}
-
-CONSTRUCTOR static void glAttachProcess()
-{
- TRACE("()");
-
- glAttachThread();
-}
-
-DESTRUCTOR static void glDetachProcess()
-{
- TRACE("()");
-
- glDetachThread();
-}
-
-#if defined(_WIN32)
-extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved)
-{
- switch(reason)
- {
- case DLL_PROCESS_ATTACH:
- glAttachProcess();
- break;
- case DLL_THREAD_ATTACH:
- glAttachThread();
- break;
- case DLL_THREAD_DETACH:
- glDetachThread();
- break;
- case DLL_PROCESS_DETACH:
- glDetachProcess();
- break;
- default:
- break;
- }
-
- return TRUE;
-}
-#endif
-
-namespace es2
-{
-Context *getContextLocked()
-{
- egl::Context *context = libEGL->clientGetCurrentContext();
-
- if(context && (context->getClientVersion() == 2 ||
- context->getClientVersion() == 3))
- {
- return static_cast<es2::Context*>(context);
- }
-
- return nullptr;
-}
-
-ContextPtr getContext()
-{
- return ContextPtr{getContextLocked()};
-}
-
-Device *getDevice()
-{
- Context *context = getContextLocked();
-
- return context ? context->getDevice() : nullptr;
-}
-
-// Records an error code
-// Assumed to already hold the context lock for the current context
-void error(GLenum errorCode)
-{
- es2::Context *context = es2::getContextLocked();
-
- if(context)
- {
- switch(errorCode)
- {
- case GL_INVALID_ENUM:
- context->recordInvalidEnum();
- TRACE("\t! Error generated: invalid enum\n");
- break;
- case GL_INVALID_VALUE:
- context->recordInvalidValue();
- TRACE("\t! Error generated: invalid value\n");
- break;
- case GL_INVALID_OPERATION:
- context->recordInvalidOperation();
- TRACE("\t! Error generated: invalid operation\n");
- break;
- case GL_OUT_OF_MEMORY:
- context->recordOutOfMemory();
- TRACE("\t! Error generated: out of memory\n");
- break;
- case GL_INVALID_FRAMEBUFFER_OPERATION:
- context->recordInvalidFramebufferOperation();
- TRACE("\t! Error generated: invalid framebuffer operation\n");
- break;
- default: UNREACHABLE(errorCode);
- }
- }
-}
-}
-
-namespace egl
-{
-GLint getClientVersion()
-{
- Context *context = libEGL->clientGetCurrentContext();
-
- return context ? context->getClientVersion() : 0;
-}
-}
diff --git a/src/OpenGL/libGLESv2/main.h b/src/OpenGL/libGLESv2/main.h
deleted file mode 100644
index 097b1ed88..000000000
--- a/src/OpenGL/libGLESv2/main.h
+++ /dev/null
@@ -1,54 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// main.h: Management of thread-local data.
-
-#ifndef LIBGLESV2_MAIN_H_
-#define LIBGLESV2_MAIN_H_
-
-#include "Context.h"
-#include "Device.hpp"
-#include "common/debug.h"
-#include "libEGL/Display.h"
-#include "libEGL/libEGL.hpp"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GLES3/gl3.h>
-
-namespace es2
-{
- Context *getContextLocked();
- ContextPtr getContext();
- Device *getDevice();
-
- void error(GLenum errorCode);
-
- template<class T>
- const T &error(GLenum errorCode, const T &returnValue)
- {
- error(errorCode);
-
- return returnValue;
- }
-}
-
-namespace egl
-{
- GLint getClientVersion();
-}
-
-extern LibEGL libEGL;
-
-#endif // LIBGLESV2_MAIN_H_
diff --git a/src/OpenGL/libGLESv2/mathutil.h b/src/OpenGL/libGLESv2/mathutil.h
deleted file mode 100644
index 1b0280e97..000000000
--- a/src/OpenGL/libGLESv2/mathutil.h
+++ /dev/null
@@ -1,100 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// mathutil.h: Math and bit manipulation functions.
-
-#ifndef LIBGLESV2_MATHUTIL_H_
-#define LIBGLESV2_MATHUTIL_H_
-
-#include "common/debug.h"
-#include "Common/Math.hpp"
-#include <limits>
-
-namespace es2
-{
-inline bool isPow2(int x)
-{
- return (x & (x - 1)) == 0 && (x != 0);
-}
-
-inline int log2(int x)
-{
- int r = 0;
- while((x >> r) > 1) r++;
- return r;
-}
-
-inline unsigned int ceilPow2(unsigned int x)
-{
- if(x != 0) x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x++;
-
- return x;
-}
-
-using sw::swap;
-using sw::clamp;
-using sw::clamp01;
-
-template<const int n>
-inline unsigned int unorm(float x)
-{
- const unsigned int max = 0xFFFFFFFF >> (32 - n);
-
- if(x > 1)
- {
- return max;
- }
- else if(x < 0)
- {
- return 0;
- }
- else
- {
- return (unsigned int)(max * x + 0.5f);
- }
-}
-
-// Converts floating-point values to the nearest representable integer
-inline int convert_float_int(float x)
-{
- // The largest positive integer value that is exactly representable in IEEE 754 binary32 is 0x7FFFFF80.
- // The next floating-point value is 128 larger and thus needs clamping to 0x7FFFFFFF.
- static_assert(std::numeric_limits<float>::is_iec559, "Unsupported floating-point format");
-
- if(x > 0x7FFFFF80)
- {
- return 0x7FFFFFFF;
- }
-
- if(x < (signed)0x80000000)
- {
- return 0x80000000;
- }
-
- return static_cast<int>(roundf(x));
-}
-
-inline int convert_float_fixed(float x)
-{
- return convert_float_int(static_cast<float>(0x7FFFFFFF) * x);
-}
-}
-
-#endif // LIBGLESV2_MATHUTIL_H_
diff --git a/src/OpenGL/libGLESv2/resource.h b/src/OpenGL/libGLESv2/resource.h
deleted file mode 100644
index 39adaad0d..000000000
--- a/src/OpenGL/libGLESv2/resource.h
+++ /dev/null
@@ -1,14 +0,0 @@
-//{{NO_DEPENDENCIES}}
-// Microsoft Visual C++ generated include file.
-// Used by libGLESv2.rc
-
-// Next default values for new objects
-//
-#ifdef APSTUDIO_INVOKED
-#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 101
-#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1001
-#define _APS_NEXT_SYMED_VALUE 101
-#endif
-#endif
diff --git a/src/OpenGL/libGLESv2/utilities.cpp b/src/OpenGL/libGLESv2/utilities.cpp
deleted file mode 100644
index 1ed35dcaa..000000000
--- a/src/OpenGL/libGLESv2/utilities.cpp
+++ /dev/null
@@ -1,2346 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// utilities.cpp: Conversion functions and other utility routines.
-
-#include "utilities.h"
-
-#include "Framebuffer.h"
-#include "main.h"
-#include "mathutil.h"
-#include "Context.h"
-#include "Shader.h"
-#include "common/debug.h"
-
-#include <limits>
-#include <stdio.h>
-#include <stdlib.h>
-
-namespace es2
-{
-
- unsigned int UniformComponentCount(GLenum type)
- {
- switch(type)
- {
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_3D_OES:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- return 2;
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_FLOAT_MAT2:
- return 4;
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT3x2:
- return 6;
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT4x2:
- return 8;
- case GL_FLOAT_MAT3:
- return 9;
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4x3:
- return 12;
- case GL_FLOAT_MAT4:
- return 16;
- default:
- UNREACHABLE(type);
- }
-
- return 0;
- }
-
- GLenum UniformComponentType(GLenum type)
- {
- switch(type)
- {
- case GL_BOOL:
- case GL_BOOL_VEC2:
- case GL_BOOL_VEC3:
- case GL_BOOL_VEC4:
- return GL_BOOL;
- case GL_FLOAT:
- case GL_FLOAT_VEC2:
- case GL_FLOAT_VEC3:
- case GL_FLOAT_VEC4:
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT3x4:
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return GL_FLOAT;
- case GL_INT:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_3D_OES:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- case GL_INT_VEC2:
- case GL_INT_VEC3:
- case GL_INT_VEC4:
- return GL_INT;
- case GL_UNSIGNED_INT:
- case GL_UNSIGNED_INT_VEC2:
- case GL_UNSIGNED_INT_VEC3:
- case GL_UNSIGNED_INT_VEC4:
- return GL_UNSIGNED_INT;
- default:
- UNREACHABLE(type);
- }
-
- return GL_NONE;
- }
-
- size_t UniformTypeSize(GLenum type)
- {
- switch(type)
- {
- case GL_BOOL: return sizeof(GLboolean);
- case GL_FLOAT: return sizeof(GLfloat);
- case GL_INT: return sizeof(GLint);
- case GL_UNSIGNED_INT: return sizeof(GLuint);
- }
-
- return UniformTypeSize(UniformComponentType(type)) * UniformComponentCount(type);
- }
-
- bool IsSamplerUniform(GLenum type)
- {
- switch(type)
- {
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_3D_OES:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- return true;
- default:
- return false;
- }
- }
-
- int VariableRowCount(GLenum type)
- {
- switch(type)
- {
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_SAMPLER_2D:
- case GL_SAMPLER_CUBE:
- case GL_SAMPLER_2D_RECT_ARB:
- case GL_SAMPLER_EXTERNAL_OES:
- case GL_SAMPLER_3D_OES:
- case GL_SAMPLER_2D_ARRAY:
- case GL_SAMPLER_2D_SHADOW:
- case GL_SAMPLER_CUBE_SHADOW:
- case GL_SAMPLER_2D_ARRAY_SHADOW:
- case GL_INT_SAMPLER_2D:
- case GL_UNSIGNED_INT_SAMPLER_2D:
- case GL_INT_SAMPLER_CUBE:
- case GL_UNSIGNED_INT_SAMPLER_CUBE:
- case GL_INT_SAMPLER_3D:
- case GL_UNSIGNED_INT_SAMPLER_3D:
- case GL_INT_SAMPLER_2D_ARRAY:
- case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY:
- return 1;
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT4x2:
- return 2;
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT4x3:
- return 3;
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT2x4:
- case GL_FLOAT_MAT3x4:
- return 4;
- default:
- UNREACHABLE(type);
- }
-
- return 0;
- }
-
- int VariableColumnCount(GLenum type)
- {
- switch(type)
- {
- case GL_NONE:
- return 0;
- case GL_BOOL:
- case GL_FLOAT:
- case GL_INT:
- case GL_UNSIGNED_INT:
- return 1;
- case GL_BOOL_VEC2:
- case GL_FLOAT_VEC2:
- case GL_INT_VEC2:
- case GL_UNSIGNED_INT_VEC2:
- case GL_FLOAT_MAT2:
- case GL_FLOAT_MAT2x3:
- case GL_FLOAT_MAT2x4:
- return 2;
- case GL_INT_VEC3:
- case GL_UNSIGNED_INT_VEC3:
- case GL_FLOAT_VEC3:
- case GL_BOOL_VEC3:
- case GL_FLOAT_MAT3:
- case GL_FLOAT_MAT3x2:
- case GL_FLOAT_MAT3x4:
- return 3;
- case GL_BOOL_VEC4:
- case GL_FLOAT_VEC4:
- case GL_INT_VEC4:
- case GL_UNSIGNED_INT_VEC4:
- case GL_FLOAT_MAT4:
- case GL_FLOAT_MAT4x2:
- case GL_FLOAT_MAT4x3:
- return 4;
- default:
- UNREACHABLE(type);
- }
-
- return 0;
- }
-
- int VariableRegisterCount(GLenum type)
- {
- // Number of registers used is the number of columns for matrices or 1 for scalars and vectors
- return (VariableRowCount(type) > 1) ? VariableColumnCount(type) : 1;
- }
-
- int VariableRegisterSize(GLenum type)
- {
- // Number of components per register is the number of rows for matrices or columns for scalars and vectors
- int nbRows = VariableRowCount(type);
- return (nbRows > 1) ? nbRows : VariableColumnCount(type);
- }
-
- int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize)
- {
- ASSERT(allocationSize <= bitsSize);
-
- unsigned int mask = std::numeric_limits<unsigned int>::max() >> (std::numeric_limits<unsigned int>::digits - allocationSize);
-
- for(unsigned int i = 0; i < bitsSize - allocationSize + 1; i++)
- {
- if((*bits & mask) == 0)
- {
- *bits |= mask;
- return i;
- }
-
- mask <<= 1;
- }
-
- return -1;
- }
-
- bool IsCompressed(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE:
- case GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE:
- case GL_ETC1_RGB8_OES:
- case GL_COMPRESSED_R11_EAC:
- case GL_COMPRESSED_SIGNED_R11_EAC:
- case GL_COMPRESSED_RG11_EAC:
- case GL_COMPRESSED_SIGNED_RG11_EAC:
- case GL_COMPRESSED_RGB8_ETC2:
- case GL_COMPRESSED_SRGB8_ETC2:
- case GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case GL_COMPRESSED_RGBA8_ETC2_EAC:
- case GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
- return true;
- default:
- return false;
- }
- }
-
- bool IsSizedInternalFormat(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_ALPHA8_EXT:
- case GL_LUMINANCE8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- case GL_R8:
- case GL_R8UI:
- case GL_R8I:
- case GL_R16UI:
- case GL_R16I:
- case GL_R32UI:
- case GL_R32I:
- case GL_RG8:
- case GL_RG8UI:
- case GL_RG8I:
- case GL_RG16UI:
- case GL_RG16I:
- case GL_RG32UI:
- case GL_RG32I:
- case GL_SRGB8_ALPHA8:
- case GL_RGB8UI:
- case GL_RGB8I:
- case GL_RGB16UI:
- case GL_RGB16I:
- case GL_RGB32UI:
- case GL_RGB32I:
- case GL_RG8_SNORM:
- case GL_R8_SNORM:
- case GL_RGB10_A2:
- case GL_RGBA8UI:
- case GL_RGBA8I:
- case GL_RGB10_A2UI:
- case GL_RGBA16UI:
- case GL_RGBA16I:
- case GL_RGBA32I:
- case GL_RGBA32UI:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8:
- case GL_RGBA8:
- case GL_BGRA8_EXT: // GL_APPLE_texture_format_BGRA8888
- case GL_R16F:
- case GL_RG16F:
- case GL_R11F_G11F_B10F:
- case GL_RGB16F:
- case GL_RGBA16F:
- case GL_R32F:
- case GL_RG32F:
- case GL_RGB32F:
- case GL_RGBA32F:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_COMPONENT32F:
- case GL_DEPTH32F_STENCIL8:
- case GL_DEPTH_COMPONENT16:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- case GL_RGBA8_SNORM:
- case GL_SRGB8:
- case GL_RGB8_SNORM:
- case GL_RGB9_E5:
- return true;
- default:
- return false;
- }
- }
-
- GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format, GLenum type, Texture *texture)
- {
- if(!texture)
- {
- return GL_INVALID_OPERATION;
- }
-
- GLenum sizedInternalFormat = texture->getFormat(target, level);
-
- if(compressed)
- {
- if(format != sizedInternalFormat)
- {
- return GL_INVALID_OPERATION;
- }
- }
- else if(!copy) // CopyTexSubImage doesn't have format/type parameters.
- {
- GLenum validationError = ValidateTextureFormatType(format, type, sizedInternalFormat, target);
- if(validationError != GL_NO_ERROR)
- {
- return validationError;
- }
- }
-
- if(compressed)
- {
- if((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
- (height % 4 != 0 && height != texture->getHeight(target, 0)))
- {
- return GL_INVALID_OPERATION;
- }
- }
-
- if(xoffset + width > texture->getWidth(target, level) ||
- yoffset + height > texture->getHeight(target, level))
- {
- return GL_INVALID_VALUE;
- }
-
- return GL_NO_ERROR;
- }
-
- GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, Texture *texture)
- {
- if(!texture)
- {
- return GL_INVALID_OPERATION;
- }
-
- if(compressed != texture->isCompressed(target, level))
- {
- return GL_INVALID_OPERATION;
- }
-
- if(!copy)
- {
- GLenum sizedInternalFormat = texture->getFormat(target, level);
-
- GLenum validationError = ValidateTextureFormatType(format, type, sizedInternalFormat, target);
- if(validationError != GL_NO_ERROR)
- {
- return validationError;
- }
- }
-
- if(compressed)
- {
- if((width % 4 != 0 && width != texture->getWidth(target, 0)) ||
- (height % 4 != 0 && height != texture->getHeight(target, 0)) ||
- (depth % 4 != 0 && depth != texture->getDepth(target, 0)))
- {
- return GL_INVALID_OPERATION;
- }
- }
-
- if(xoffset + width > texture->getWidth(target, level) ||
- yoffset + height > texture->getHeight(target, level) ||
- zoffset + depth > texture->getDepth(target, level))
- {
- return GL_INVALID_VALUE;
- }
-
- return GL_NO_ERROR;
- }
-
- bool ValidateCopyFormats(GLenum textureFormat, GLenum colorbufferFormat)
- {
- ASSERT(!gl::IsUnsizedInternalFormat(textureFormat));
- ASSERT(!gl::IsUnsizedInternalFormat(colorbufferFormat));
-
- if(GetColorComponentType(textureFormat) == GL_NONE)
- {
- return error(GL_INVALID_ENUM, false);
- }
-
- if(GetColorComponentType(colorbufferFormat) != GetColorComponentType(textureFormat))
- {
- return error(GL_INVALID_OPERATION, false);
- }
-
- if(GetColorEncoding(colorbufferFormat) != GetColorEncoding(textureFormat))
- {
- return error(GL_INVALID_OPERATION, false);
- }
-
- GLenum baseTexureFormat = gl::GetBaseInternalFormat(textureFormat);
- GLenum baseColorbufferFormat = gl::GetBaseInternalFormat(colorbufferFormat);
-
- // [OpenGL ES 2.0.24] table 3.9
- // [OpenGL ES 3.0.5] table 3.16
- switch(baseTexureFormat)
- {
- case GL_ALPHA:
- if(baseColorbufferFormat != GL_ALPHA &&
- baseColorbufferFormat != GL_RGBA &&
- baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
- {
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_RGBA:
- if(baseColorbufferFormat != GL_RGBA &&
- baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
- {
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_LUMINANCE:
- case GL_RED:
- if(baseColorbufferFormat != GL_RED &&
- baseColorbufferFormat != GL_RG &&
- baseColorbufferFormat != GL_RGB &&
- baseColorbufferFormat != GL_RGBA &&
- baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
- {
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_RG:
- if(baseColorbufferFormat != GL_RG &&
- baseColorbufferFormat != GL_RGB &&
- baseColorbufferFormat != GL_RGBA &&
- baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
- {
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_RGB:
- if(baseColorbufferFormat != GL_RGB &&
- baseColorbufferFormat != GL_RGBA &&
- baseColorbufferFormat != GL_BGRA_EXT) // GL_EXT_texture_format_BGRA8888 / GL_APPLE_texture_format_BGRA8888
- {
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_DEPTH_COMPONENT:
- case GL_DEPTH_STENCIL_OES:
- return error(GL_INVALID_OPERATION, false);
- case GL_BGRA_EXT: // GL_EXT_texture_format_BGRA8888 nor GL_APPLE_texture_format_BGRA8888 mention the format to be accepted by glCopyTexImage2D.
- default:
- return error(GL_INVALID_ENUM, false);
- }
-
- return true;
- }
-
- bool ValidateReadPixelsFormatType(const Framebuffer *framebuffer, GLenum format, GLenum type)
- {
- // GL_NV_read_depth
- if(format == GL_DEPTH_COMPONENT)
- {
- Renderbuffer *depthbuffer = framebuffer->getDepthbuffer();
-
- if(!depthbuffer)
- {
- return error(GL_INVALID_OPERATION, false);
- }
-
- GLint internalformat = depthbuffer->getFormat();
-
- switch(type)
- {
- case GL_UNSIGNED_SHORT:
- case GL_UNSIGNED_INT_24_8_OES:
- switch(internalformat)
- {
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8:
- break;
- case GL_DEPTH_COMPONENT32F:
- case GL_DEPTH32F_STENCIL8:
- return error(GL_INVALID_OPERATION, false);
- default:
- UNREACHABLE(internalformat);
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- case GL_FLOAT:
- switch(internalformat)
- {
- case GL_DEPTH_COMPONENT32F:
- case GL_DEPTH32F_STENCIL8:
- break;
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH24_STENCIL8:
- return error(GL_INVALID_OPERATION, false);
- default:
- UNREACHABLE(internalformat);
- return error(GL_INVALID_OPERATION, false);
- }
- break;
- default:
- return error(GL_INVALID_ENUM, false);
- }
-
- return true;
- }
-
- // GL_NV_read_stencil
- if(format == GL_STENCIL_INDEX_OES)
- {
- Renderbuffer *stencilbuffer = framebuffer->getStencilbuffer();
-
- if(!stencilbuffer)
- {
- return error(GL_INVALID_OPERATION, false);
- }
-
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- break;
- default:
- return error(GL_INVALID_ENUM, false);
- }
-
- return true;
- }
-
- Renderbuffer *colorbuffer = framebuffer->getReadColorbuffer();
-
- if(!colorbuffer)
- {
- return error(GL_INVALID_OPERATION, false);
- }
-
- GLint internalformat = colorbuffer->getFormat();
-
- if(IsNormalizedInteger(internalformat))
- {
- // Combination always supported by normalized fixed-point rendering surfaces.
- if(format == GL_RGBA && type == GL_UNSIGNED_BYTE)
- {
- return true;
- }
-
- // GL_EXT_read_format_bgra combinations.
- if(format == GL_BGRA_EXT)
- {
- if(type == GL_UNSIGNED_BYTE ||
- type == GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT ||
- type == GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT)
- {
- return true;
- }
- }
- }
- else if(IsFloatFormat(internalformat))
- {
- // Combination always supported by floating-point rendering surfaces.
- // Supported in OpenGL ES 2.0 due to GL_EXT_color_buffer_half_float.
- if(format == GL_RGBA && type == GL_FLOAT)
- {
- return true;
- }
- }
- else if(IsSignedNonNormalizedInteger(internalformat))
- {
- if(format == GL_RGBA_INTEGER && type == GL_INT)
- {
- return true;
- }
- }
- else if(IsUnsignedNonNormalizedInteger(internalformat))
- {
- if(format == GL_RGBA_INTEGER && type == GL_UNSIGNED_INT)
- {
- return true;
- }
- }
- else UNREACHABLE(internalformat);
-
- // GL_IMPLEMENTATION_COLOR_READ_FORMAT / GL_IMPLEMENTATION_COLOR_READ_TYPE
- GLenum implementationReadFormat = GL_NONE;
- GLenum implementationReadType = GL_NONE;
- switch(format)
- {
- default:
- implementationReadFormat = framebuffer->getImplementationColorReadFormat();
- implementationReadType = framebuffer->getImplementationColorReadType();
- break;
- case GL_DEPTH_COMPONENT:
- implementationReadFormat = framebuffer->getDepthReadFormat();
- implementationReadType = framebuffer->getDepthReadType();
- break;
- }
-
- GLenum coreType = (type == GL_HALF_FLOAT_OES) ? GL_HALF_FLOAT : type;
-
- if(format == implementationReadFormat && coreType == implementationReadType)
- {
- return true;
- }
-
- // Additional third combination accepted by OpenGL ES 3.0.
- if(internalformat == GL_RGB10_A2)
- {
- if(format == GL_RGBA && type == GL_UNSIGNED_INT_2_10_10_10_REV)
- {
- return true;
- }
- }
-
- return error(GL_INVALID_OPERATION, false);
- }
-
- bool IsDepthTexture(GLint format)
- {
- return format == GL_DEPTH_COMPONENT16 ||
- format == GL_DEPTH_COMPONENT24 ||
- format == GL_DEPTH_COMPONENT32_OES ||
- format == GL_DEPTH_COMPONENT32F ||
- format == GL_DEPTH24_STENCIL8 ||
- format == GL_DEPTH32F_STENCIL8;
- }
-
- bool IsStencilTexture(GLint format)
- {
- return format == GL_DEPTH24_STENCIL8 ||
- format == GL_DEPTH32F_STENCIL8 ||
- format == GL_STENCIL_INDEX8;
- }
-
- bool IsCubemapTextureTarget(GLenum target)
- {
- return (target >= GL_TEXTURE_CUBE_MAP_POSITIVE_X && target <= GL_TEXTURE_CUBE_MAP_NEGATIVE_Z);
- }
-
- int CubeFaceIndex(GLenum cubeFace)
- {
- switch(cubeFace)
- {
- case GL_TEXTURE_CUBE_MAP:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X: return 0;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: return 1;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: return 2;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: return 3;
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: return 4;
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: return 5;
- default: UNREACHABLE(cubeFace); return 0;
- }
- }
-
- bool IsTexImageTarget(GLenum target)
- {
- return target == GL_TEXTURE_2D || IsCubemapTextureTarget(target) || target == GL_TEXTURE_2D_ARRAY || target == GL_TEXTURE_RECTANGLE_ARB;
- }
-
- bool IsTextureTarget(GLenum target)
- {
- return IsTexImageTarget(target) || target == GL_TEXTURE_3D;
- }
-
- GLenum ValidateTextureFormatType(GLenum format, GLenum type, GLint internalformat, GLenum target)
- {
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_FLOAT: // GL_OES_texture_float
- case GL_HALF_FLOAT_OES: // GL_OES_texture_half_float
- case GL_HALF_FLOAT:
- case GL_UNSIGNED_INT_24_8: // GL_OES_packed_depth_stencil (GL_UNSIGNED_INT_24_8_EXT)
- case GL_UNSIGNED_SHORT: // GL_OES_depth_texture
- case GL_UNSIGNED_INT: // GL_OES_depth_texture
- break;
- case GL_BYTE:
- case GL_SHORT:
- case GL_INT:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_10F_11F_11F_REV:
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
- break;
- default:
- return GL_INVALID_ENUM;
- }
-
- switch(format)
- {
- case GL_ALPHA:
- case GL_RGB:
- case GL_RGBA:
- case GL_LUMINANCE:
- case GL_LUMINANCE_ALPHA:
- case GL_BGRA_EXT: // GL_EXT_texture_format_BGRA8888
- case GL_RED_EXT: // GL_EXT_texture_rg
- case GL_RG_EXT: // GL_EXT_texture_rg
- break;
- case GL_DEPTH_STENCIL: // GL_OES_packed_depth_stencil (GL_DEPTH_STENCIL_OES)
- case GL_DEPTH_COMPONENT: // GL_OES_depth_texture
- switch(target)
- {
- case GL_TEXTURE_2D:
- case GL_TEXTURE_2D_ARRAY:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_X: // GL_OES_depth_texture_cube_map
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_X:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Y:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
- case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
- case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_RED_INTEGER:
- case GL_RG_INTEGER:
- case GL_RGB_INTEGER:
- case GL_RGBA_INTEGER:
- break;
- default:
- return GL_INVALID_ENUM;
- }
-
- if((GLenum)internalformat != format)
- {
- if(gl::IsUnsizedInternalFormat(internalformat))
- {
- return GL_INVALID_OPERATION;
- }
-
- if(!IsSizedInternalFormat(internalformat))
- {
- return GL_INVALID_VALUE;
- }
- }
-
- if((GLenum)internalformat == format)
- {
- // Validate format, type, and unsized internalformat combinations [OpenGL ES 3.0 Table 3.3]
- switch(format)
- {
- case GL_RGBA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_FLOAT: // GL_OES_texture_float
- case GL_HALF_FLOAT_OES: // GL_OES_texture_half_float
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_RGB:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_FLOAT: // GL_OES_texture_float
- case GL_HALF_FLOAT_OES: // GL_OES_texture_half_float
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_LUMINANCE_ALPHA:
- case GL_LUMINANCE:
- case GL_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE:
- case GL_FLOAT: // GL_OES_texture_float
- case GL_HALF_FLOAT_OES: // GL_OES_texture_half_float
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_UNSIGNED_SHORT: // GL_OES_depth_texture
- case GL_UNSIGNED_INT: // GL_OES_depth_texture
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_DEPTH_STENCIL_OES:
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8_OES: // GL_OES_packed_depth_stencil
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_RED_EXT:
- case GL_RG_EXT:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: // GL_EXT_texture_rg
- case GL_FLOAT: // GL_EXT_texture_rg + GL_OES_texture_float
- case GL_HALF_FLOAT_OES: // GL_EXT_texture_rg + GL_OES_texture_half_float
- break;
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_BGRA_EXT:
- if(type != GL_UNSIGNED_BYTE) // GL_APPLE_texture_format_BGRA8888 / GL_EXT_texture_format_BGRA8888
- {
- return GL_INVALID_OPERATION;
- }
- break;
- default:
- UNREACHABLE(format);
- return GL_INVALID_ENUM;
- }
-
- return GL_NO_ERROR;
- }
-
- // Validate format, type, and sized internalformat combinations [OpenGL ES 3.0 Table 3.2]
- bool validSizedInternalformat = false;
- #define VALIDATE_INTERNALFORMAT(...) { GLint validInternalformats[] = {__VA_ARGS__}; for(GLint v : validInternalformats) {if(internalformat == v) validSizedInternalformat = true;} } break;
-
- switch(format)
- {
- case GL_RGBA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RGBA8, GL_RGB5_A1, GL_RGBA4, GL_SRGB8_ALPHA8)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RGBA8_SNORM)
- case GL_UNSIGNED_SHORT_4_4_4_4: VALIDATE_INTERNALFORMAT(GL_RGBA4)
- case GL_UNSIGNED_SHORT_5_5_5_1: VALIDATE_INTERNALFORMAT(GL_RGB5_A1)
- case GL_UNSIGNED_INT_2_10_10_10_REV: VALIDATE_INTERNALFORMAT(GL_RGB10_A2, GL_RGB5_A1)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_RGBA16F)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_RGBA32F, GL_RGBA16F)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RGBA_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RGBA8UI)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RGBA8I)
- case GL_UNSIGNED_SHORT: VALIDATE_INTERNALFORMAT(GL_RGBA16UI)
- case GL_SHORT: VALIDATE_INTERNALFORMAT(GL_RGBA16I)
- case GL_UNSIGNED_INT: VALIDATE_INTERNALFORMAT(GL_RGBA32UI)
- case GL_INT: VALIDATE_INTERNALFORMAT(GL_RGBA32I)
- case GL_UNSIGNED_INT_2_10_10_10_REV: VALIDATE_INTERNALFORMAT(GL_RGB10_A2UI)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RGB:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RGB8, GL_RGB565, GL_SRGB8)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RGB8_SNORM)
- case GL_UNSIGNED_SHORT_5_6_5: VALIDATE_INTERNALFORMAT(GL_RGB565)
- case GL_UNSIGNED_INT_10F_11F_11F_REV: VALIDATE_INTERNALFORMAT(GL_R11F_G11F_B10F)
- case GL_UNSIGNED_INT_5_9_9_9_REV: VALIDATE_INTERNALFORMAT(GL_RGB9_E5)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_RGB16F, GL_R11F_G11F_B10F, GL_RGB9_E5)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_RGB32F, GL_RGB16F, GL_R11F_G11F_B10F, GL_RGB9_E5)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RGB_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RGB8UI)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RGB8I)
- case GL_UNSIGNED_SHORT: VALIDATE_INTERNALFORMAT(GL_RGB16UI)
- case GL_SHORT: VALIDATE_INTERNALFORMAT(GL_RGB16I)
- case GL_UNSIGNED_INT: VALIDATE_INTERNALFORMAT(GL_RGB32UI)
- case GL_INT: VALIDATE_INTERNALFORMAT(GL_RGB32I)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RG:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RG8)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RG8_SNORM)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_RG16F)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_RG32F, GL_RG16F)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RG_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_RG8UI)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_RG8I)
- case GL_UNSIGNED_SHORT: VALIDATE_INTERNALFORMAT(GL_RG16UI)
- case GL_SHORT: VALIDATE_INTERNALFORMAT(GL_RG16I)
- case GL_UNSIGNED_INT: VALIDATE_INTERNALFORMAT(GL_RG32UI)
- case GL_INT: VALIDATE_INTERNALFORMAT(GL_RG32I)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RED:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_R8)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_R8_SNORM)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_R16F)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_R32F, GL_R16F)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_RED_INTEGER:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_R8UI)
- case GL_BYTE: VALIDATE_INTERNALFORMAT(GL_R8I)
- case GL_UNSIGNED_SHORT: VALIDATE_INTERNALFORMAT(GL_R16UI)
- case GL_SHORT: VALIDATE_INTERNALFORMAT(GL_R16I)
- case GL_UNSIGNED_INT: VALIDATE_INTERNALFORMAT(GL_R32UI)
- case GL_INT: VALIDATE_INTERNALFORMAT(GL_R32I)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_UNSIGNED_SHORT: VALIDATE_INTERNALFORMAT(GL_DEPTH_COMPONENT16)
- case GL_UNSIGNED_INT: VALIDATE_INTERNALFORMAT(GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_DEPTH_COMPONENT32F)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_DEPTH_STENCIL:
- switch(type)
- {
- case GL_UNSIGNED_INT_24_8: VALIDATE_INTERNALFORMAT(GL_DEPTH24_STENCIL8)
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: VALIDATE_INTERNALFORMAT(GL_DEPTH32F_STENCIL8)
- default: return GL_INVALID_OPERATION;
- }
- break;
- case GL_LUMINANCE_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_LUMINANCE8_ALPHA8_EXT)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_LUMINANCE_ALPHA16F_EXT)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_LUMINANCE_ALPHA32F_EXT, GL_LUMINANCE_ALPHA16F_EXT)
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_LUMINANCE:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_LUMINANCE8_EXT)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_LUMINANCE16F_EXT)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_LUMINANCE32F_EXT, GL_LUMINANCE16F_EXT)
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_ALPHA8_EXT)
- case GL_HALF_FLOAT_OES:
- case GL_HALF_FLOAT: VALIDATE_INTERNALFORMAT(GL_ALPHA16F_EXT)
- case GL_FLOAT: VALIDATE_INTERNALFORMAT(GL_ALPHA32F_EXT, GL_ALPHA16F_EXT)
- default:
- return GL_INVALID_OPERATION;
- }
- break;
- case GL_BGRA_EXT: // GL_APPLE_texture_format_BGRA8888
- switch(type)
- {
- case GL_UNSIGNED_BYTE: VALIDATE_INTERNALFORMAT(GL_BGRA8_EXT)
- default: return GL_INVALID_OPERATION;
- }
- break;
- default:
- UNREACHABLE(format);
- return GL_INVALID_ENUM;
- }
-
- #undef VALIDATE_INTERNALFORMAT
-
- if(!validSizedInternalformat)
- {
- return GL_INVALID_OPERATION;
- }
-
- return GL_NO_ERROR;
- }
-
- size_t GetTypeSize(GLenum type)
- {
- switch(type)
- {
- case GL_BYTE:
- case GL_UNSIGNED_BYTE:
- return 1;
- case GL_UNSIGNED_SHORT_4_4_4_4:
- case GL_UNSIGNED_SHORT_5_5_5_1:
- case GL_UNSIGNED_SHORT_5_6_5:
- case GL_UNSIGNED_SHORT:
- case GL_SHORT:
- case GL_HALF_FLOAT:
- case GL_HALF_FLOAT_OES:
- return 2;
- case GL_FLOAT:
- case GL_UNSIGNED_INT_24_8:
- case GL_UNSIGNED_INT:
- case GL_INT:
- case GL_UNSIGNED_INT_2_10_10_10_REV:
- case GL_UNSIGNED_INT_10F_11F_11F_REV:
- case GL_UNSIGNED_INT_5_9_9_9_REV:
- return 4;
- case GL_FLOAT_32_UNSIGNED_INT_24_8_REV:
- return 8;
- default:
- UNREACHABLE(type);
- break;
- }
-
- return 1;
- }
-
- sw::Format ConvertReadFormatType(GLenum format, GLenum type)
- {
- switch(format)
- {
- case GL_LUMINANCE:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_L8;
- case GL_HALF_FLOAT: return sw::FORMAT_L16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_L16F;
- case GL_FLOAT: return sw::FORMAT_L32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_LUMINANCE_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_A8L8;
- case GL_HALF_FLOAT: return sw::FORMAT_A16L16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_A16L16F;
- case GL_FLOAT: return sw::FORMAT_A32L32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGBA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_A8B8G8R8;
- case GL_UNSIGNED_SHORT_4_4_4_4: return sw::FORMAT_R4G4B4A4;
- case GL_UNSIGNED_SHORT_5_5_5_1: return sw::FORMAT_R5G5B5A1;
- case GL_HALF_FLOAT: return sw::FORMAT_A16B16G16R16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_A16B16G16R16F;
- case GL_FLOAT: return sw::FORMAT_A32B32G32R32F;
- case GL_UNSIGNED_INT_2_10_10_10_REV_EXT: return sw::FORMAT_A2B10G10R10;
- default: UNREACHABLE(type);
- }
- break;
- case GL_BGRA_EXT:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_A8R8G8B8;
- case GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT: return sw::FORMAT_A4R4G4B4;
- case GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT: return sw::FORMAT_A1R5G5B5;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGB:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_B8G8R8;
- case GL_UNSIGNED_SHORT_5_6_5: return sw::FORMAT_R5G6B5;
- case GL_HALF_FLOAT: return sw::FORMAT_B16G16R16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_B16G16R16F;
- case GL_FLOAT: return sw::FORMAT_B32G32R32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RG:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_G8R8;
- case GL_HALF_FLOAT: return sw::FORMAT_G16R16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_G16R16F;
- case GL_FLOAT: return sw::FORMAT_G32R32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RED:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_R8;
- case GL_HALF_FLOAT: return sw::FORMAT_R16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_R16F;
- case GL_FLOAT: return sw::FORMAT_R32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_ALPHA:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_A8;
- case GL_HALF_FLOAT: return sw::FORMAT_A16F;
- case GL_HALF_FLOAT_OES: return sw::FORMAT_A16F;
- case GL_FLOAT: return sw::FORMAT_A32F;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RED_INTEGER:
- switch(type)
- {
- case GL_INT: return sw::FORMAT_R32I;
- case GL_UNSIGNED_INT: return sw::FORMAT_R32UI;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RG_INTEGER:
- switch(type)
- {
- case GL_INT: return sw::FORMAT_G32R32I;
- case GL_UNSIGNED_INT: return sw::FORMAT_G32R32UI;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGB_INTEGER:
- switch(type)
- {
- case GL_INT: return sw::FORMAT_X32B32G32R32I;
- case GL_UNSIGNED_INT: return sw::FORMAT_X32B32G32R32UI;
- default: UNREACHABLE(type);
- }
- break;
- case GL_RGBA_INTEGER:
- switch(type)
- {
- case GL_INT: return sw::FORMAT_A32B32G32R32I;
- case GL_UNSIGNED_INT: return sw::FORMAT_A32B32G32R32UI;
- case GL_UNSIGNED_INT_2_10_10_10_REV: return sw::FORMAT_A2B10G10R10UI;
- default: UNREACHABLE(type);
- }
- break;
- case GL_DEPTH_COMPONENT:
- switch(type)
- {
- case GL_UNSIGNED_SHORT: return sw::FORMAT_D16;
- case GL_UNSIGNED_INT_24_8_OES: return sw::FORMAT_D24X8;
- case GL_FLOAT: return sw::FORMAT_D32F_LOCKABLE;
- default: UNREACHABLE(type);
- }
- break;
- case GL_STENCIL_INDEX_OES:
- switch(type)
- {
- case GL_UNSIGNED_BYTE: return sw::FORMAT_S8;
- default: UNREACHABLE(type);
- }
- break;
- case GL_DEPTH_STENCIL_OES: // Cannot be read as one format. Handled separately.
- default:
- UNREACHABLE(format);
- break;
- }
-
- return sw::FORMAT_NULL;
- }
-
- bool IsColorRenderable(GLint internalformat)
- {
- if(IsCompressed(internalformat))
- {
- return false;
- }
-
- switch(internalformat)
- {
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_R8:
- case GL_RG8:
- case GL_RGB8:
- case GL_RGBA8:
- case GL_R16F:
- case GL_RG16F:
- case GL_RGB16F:
- case GL_RGBA16F:
- case GL_R32F:
- case GL_RG32F:
- case GL_RGB32F:
- case GL_RGBA32F: // GL_EXT_color_buffer_float, OpenGL ES 3.0+ only.
- case GL_BGRA8_EXT: // GL_EXT_texture_format_BGRA8888
- case GL_R8UI:
- case GL_R8I:
- case GL_R16UI:
- case GL_R16I:
- case GL_R32UI:
- case GL_R32I:
- case GL_RG8UI:
- case GL_RG8I:
- case GL_RG16UI:
- case GL_RG16I:
- case GL_RG32UI:
- case GL_RG32I:
- case GL_SRGB8_ALPHA8:
- case GL_RGB10_A2:
- case GL_RGBA8UI:
- case GL_RGBA8I:
- case GL_RGB10_A2UI:
- case GL_RGBA16UI:
- case GL_RGBA16I:
- case GL_RGBA32I:
- case GL_RGBA32UI:
- case GL_R11F_G11F_B10F:
- return true;
- case GL_R8_SNORM:
- case GL_RG8_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGBA8_SNORM:
- case GL_ALPHA8_EXT:
- case GL_LUMINANCE8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_COMPONENT32F:
- case GL_DEPTH32F_STENCIL8:
- case GL_DEPTH_COMPONENT16:
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- return false;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
- }
-
- bool IsDepthRenderable(GLint internalformat)
- {
- if(IsCompressed(internalformat))
- {
- return false;
- }
-
- switch(internalformat)
- {
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH24_STENCIL8_OES: // GL_OES_packed_depth_stencil
- case GL_DEPTH_COMPONENT32_OES: // GL_OES_depth32
- case GL_DEPTH32F_STENCIL8:
- case GL_DEPTH_COMPONENT32F:
- return true;
- case GL_STENCIL_INDEX8:
- case GL_R8:
- case GL_R8UI:
- case GL_R8I:
- case GL_R16UI:
- case GL_R16I:
- case GL_R32UI:
- case GL_R32I:
- case GL_RG8:
- case GL_RG8UI:
- case GL_RG8I:
- case GL_RG16UI:
- case GL_RG16I:
- case GL_RG32UI:
- case GL_RG32I:
- case GL_SRGB8_ALPHA8:
- case GL_RGB10_A2:
- case GL_RGBA8UI:
- case GL_RGBA8I:
- case GL_RGB10_A2UI:
- case GL_RGBA16UI:
- case GL_RGBA16I:
- case GL_RGBA32I:
- case GL_RGBA32UI:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8:
- case GL_RGBA8:
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_RGBA:
- case GL_R16F:
- case GL_RG16F:
- case GL_R11F_G11F_B10F:
- case GL_RGB16F:
- case GL_RGBA16F:
- case GL_R32F:
- case GL_RG32F:
- case GL_RGB32F:
- case GL_RGBA32F:
- case GL_R8_SNORM:
- case GL_RG8_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGBA8_SNORM:
- return false;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
- }
-
- bool IsStencilRenderable(GLint internalformat)
- {
- if(IsCompressed(internalformat))
- {
- return false;
- }
-
- switch(internalformat)
- {
- case GL_STENCIL_INDEX8:
- case GL_DEPTH24_STENCIL8_OES:
- case GL_DEPTH32F_STENCIL8:
- return true;
- case GL_R8:
- case GL_R8UI:
- case GL_R8I:
- case GL_R16UI:
- case GL_R16I:
- case GL_R32UI:
- case GL_R32I:
- case GL_RG8:
- case GL_RG8UI:
- case GL_RG8I:
- case GL_RG16UI:
- case GL_RG16I:
- case GL_RG32UI:
- case GL_RG32I:
- case GL_SRGB8_ALPHA8:
- case GL_RGB10_A2:
- case GL_RGBA8UI:
- case GL_RGBA8I:
- case GL_RGB10_A2UI:
- case GL_RGBA16UI:
- case GL_RGBA16I:
- case GL_RGBA32I:
- case GL_RGBA32UI:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8:
- case GL_RGBA8:
- case GL_RED:
- case GL_RG:
- case GL_RGB:
- case GL_RGBA:
- case GL_R16F:
- case GL_RG16F:
- case GL_R11F_G11F_B10F:
- case GL_RGB16F:
- case GL_RGBA16F:
- case GL_R32F:
- case GL_RG32F:
- case GL_RGB32F:
- case GL_RGBA32F:
- case GL_DEPTH_COMPONENT16:
- case GL_DEPTH_COMPONENT24:
- case GL_DEPTH_COMPONENT32_OES:
- case GL_DEPTH_COMPONENT32F:
- case GL_R8_SNORM:
- case GL_RG8_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGBA8_SNORM:
- return false;
- default:
- UNIMPLEMENTED();
- }
-
- return false;
- }
-
- bool IsMipmappable(GLint internalformat)
- {
- if(internalformat == GL_NONE)
- {
- return true; // Image unspecified. Not an error.
- }
-
- if(IsNonNormalizedInteger(internalformat))
- {
- return false;
- }
-
- switch(internalformat)
- {
- case GL_ALPHA8_EXT:
- case GL_LUMINANCE8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- return true;
- default:
- return IsColorRenderable(internalformat);
- }
- }
-
- GLuint GetAlphaSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_NONE: return 0;
- case GL_RGBA4: return 4;
- case GL_RGB5_A1: return 1;
- case GL_RGB565: return 0;
- case GL_R8: return 0;
- case GL_RG8: return 0;
- case GL_RGB8: return 0;
- case GL_RGBA8: return 8;
- case GL_R16F: return 0;
- case GL_RG16F: return 0;
- case GL_RGB16F: return 0;
- case GL_RGBA16F: return 16;
- case GL_R32F: return 0;
- case GL_RG32F: return 0;
- case GL_RGB32F: return 0;
- case GL_RGBA32F: return 32;
- case GL_BGRA8_EXT: return 8;
- case GL_R8UI: return 0;
- case GL_R8I: return 0;
- case GL_R16UI: return 0;
- case GL_R16I: return 0;
- case GL_R32UI: return 0;
- case GL_R32I: return 0;
- case GL_RG8UI: return 0;
- case GL_RG8I: return 0;
- case GL_RG16UI: return 0;
- case GL_RG16I: return 0;
- case GL_RG32UI: return 0;
- case GL_RG32I: return 0;
- case GL_SRGB8_ALPHA8: return 8;
- case GL_RGB10_A2: return 2;
- case GL_RGBA8UI: return 8;
- case GL_RGBA8I: return 8;
- case GL_RGB10_A2UI: return 2;
- case GL_RGBA16UI: return 16;
- case GL_RGBA16I: return 16;
- case GL_RGBA32I: return 32;
- case GL_RGBA32UI: return 32;
- case GL_R11F_G11F_B10F: return 0;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLuint GetRedSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_NONE: return 0;
- case GL_RGBA4: return 4;
- case GL_RGB5_A1: return 5;
- case GL_RGB565: return 5;
- case GL_R8: return 8;
- case GL_RG8: return 8;
- case GL_RGB8: return 8;
- case GL_RGBA8: return 8;
- case GL_R16F: return 16;
- case GL_RG16F: return 16;
- case GL_RGB16F: return 16;
- case GL_RGBA16F: return 16;
- case GL_R32F: return 32;
- case GL_RG32F: return 32;
- case GL_RGB32F: return 32;
- case GL_RGBA32F: return 32;
- case GL_BGRA8_EXT: return 8;
- case GL_R8UI: return 8;
- case GL_R8I: return 8;
- case GL_R16UI: return 16;
- case GL_R16I: return 16;
- case GL_R32UI: return 32;
- case GL_R32I: return 32;
- case GL_RG8UI: return 8;
- case GL_RG8I: return 8;
- case GL_RG16UI: return 16;
- case GL_RG16I: return 16;
- case GL_RG32UI: return 32;
- case GL_RG32I: return 32;
- case GL_SRGB8_ALPHA8: return 8;
- case GL_RGB10_A2: return 10;
- case GL_RGBA8UI: return 8;
- case GL_RGBA8I: return 8;
- case GL_RGB10_A2UI: return 10;
- case GL_RGBA16UI: return 16;
- case GL_RGBA16I: return 16;
- case GL_RGBA32I: return 32;
- case GL_RGBA32UI: return 32;
- case GL_R11F_G11F_B10F: return 11;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLuint GetGreenSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_NONE: return 0;
- case GL_RGBA4: return 4;
- case GL_RGB5_A1: return 5;
- case GL_RGB565: return 6;
- case GL_R8: return 0;
- case GL_RG8: return 8;
- case GL_RGB8: return 8;
- case GL_RGBA8: return 8;
- case GL_R16F: return 0;
- case GL_RG16F: return 16;
- case GL_RGB16F: return 16;
- case GL_RGBA16F: return 16;
- case GL_R32F: return 0;
- case GL_RG32F: return 32;
- case GL_RGB32F: return 32;
- case GL_RGBA32F: return 32;
- case GL_BGRA8_EXT: return 8;
- case GL_R8UI: return 0;
- case GL_R8I: return 0;
- case GL_R16UI: return 0;
- case GL_R16I: return 0;
- case GL_R32UI: return 0;
- case GL_R32I: return 0;
- case GL_RG8UI: return 8;
- case GL_RG8I: return 8;
- case GL_RG16UI: return 16;
- case GL_RG16I: return 16;
- case GL_RG32UI: return 32;
- case GL_RG32I: return 32;
- case GL_SRGB8_ALPHA8: return 8;
- case GL_RGB10_A2: return 10;
- case GL_RGBA8UI: return 8;
- case GL_RGBA8I: return 8;
- case GL_RGB10_A2UI: return 10;
- case GL_RGBA16UI: return 16;
- case GL_RGBA16I: return 16;
- case GL_RGBA32I: return 32;
- case GL_RGBA32UI: return 32;
- case GL_R11F_G11F_B10F: return 11;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLuint GetBlueSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_NONE: return 0;
- case GL_RGBA4: return 4;
- case GL_RGB5_A1: return 5;
- case GL_RGB565: return 5;
- case GL_R8: return 0;
- case GL_RG8: return 0;
- case GL_RGB8: return 8;
- case GL_RGBA8: return 8;
- case GL_R16F: return 0;
- case GL_RG16F: return 0;
- case GL_RGB16F: return 16;
- case GL_RGBA16F: return 16;
- case GL_R32F: return 0;
- case GL_RG32F: return 0;
- case GL_RGB32F: return 32;
- case GL_RGBA32F: return 32;
- case GL_BGRA8_EXT: return 8;
- case GL_R8UI: return 0;
- case GL_R8I: return 0;
- case GL_R16UI: return 0;
- case GL_R16I: return 0;
- case GL_R32UI: return 0;
- case GL_R32I: return 0;
- case GL_RG8UI: return 0;
- case GL_RG8I: return 0;
- case GL_RG16UI: return 0;
- case GL_RG16I: return 0;
- case GL_RG32UI: return 0;
- case GL_RG32I: return 0;
- case GL_SRGB8_ALPHA8: return 8;
- case GL_RGB10_A2: return 10;
- case GL_RGBA8UI: return 8;
- case GL_RGBA8I: return 8;
- case GL_RGB10_A2UI: return 10;
- case GL_RGBA16UI: return 16;
- case GL_RGBA16I: return 16;
- case GL_RGBA32I: return 32;
- case GL_RGBA32UI: return 32;
- case GL_R11F_G11F_B10F: return 10;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLuint GetDepthSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_STENCIL_INDEX8: return 0;
- case GL_DEPTH_COMPONENT16: return 16;
- case GL_DEPTH_COMPONENT24: return 24;
- case GL_DEPTH_COMPONENT32_OES: return 32;
- case GL_DEPTH_COMPONENT32F: return 32;
- case GL_DEPTH24_STENCIL8: return 24;
- case GL_DEPTH32F_STENCIL8: return 32;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLuint GetStencilSize(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_STENCIL_INDEX8: return 8;
- case GL_DEPTH_COMPONENT16: return 0;
- case GL_DEPTH_COMPONENT24: return 0;
- case GL_DEPTH_COMPONENT32_OES: return 0;
- case GL_DEPTH_COMPONENT32F: return 0;
- case GL_DEPTH24_STENCIL8: return 8;
- case GL_DEPTH32F_STENCIL8: return 8;
- default:
- // UNREACHABLE(internalformat);
- return 0;
- }
- }
-
- GLenum GetColorComponentType(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_ALPHA8_EXT:
- case GL_LUMINANCE8_ALPHA8_EXT:
- case GL_LUMINANCE8_EXT:
- case GL_R8:
- case GL_RG8:
- case GL_SRGB8_ALPHA8:
- case GL_RGB10_A2:
- case GL_RGBA4:
- case GL_RGB5_A1:
- case GL_RGB565:
- case GL_RGB8:
- case GL_RGBA8:
- case GL_SRGB8:
- case GL_BGRA8_EXT:
- return GL_UNSIGNED_NORMALIZED;
- case GL_R8_SNORM:
- case GL_RG8_SNORM:
- case GL_RGB8_SNORM:
- case GL_RGBA8_SNORM:
- return GL_SIGNED_NORMALIZED;
- case GL_R8UI:
- case GL_R16UI:
- case GL_R32UI:
- case GL_RG8UI:
- case GL_RG16UI:
- case GL_RG32UI:
- case GL_RGB8UI:
- case GL_RGB16UI:
- case GL_RGB32UI:
- case GL_RGB10_A2UI:
- case GL_RGBA16UI:
- case GL_RGBA32UI:
- case GL_RGBA8UI:
- return GL_UNSIGNED_INT;
- case GL_R8I:
- case GL_R16I:
- case GL_R32I:
- case GL_RG8I:
- case GL_RG16I:
- case GL_RG32I:
- case GL_RGB8I:
- case GL_RGB16I:
- case GL_RGB32I:
- case GL_RGBA8I:
- case GL_RGBA16I:
- case GL_RGBA32I:
- return GL_INT;
- case GL_ALPHA32F_EXT:
- case GL_LUMINANCE32F_EXT:
- case GL_LUMINANCE_ALPHA32F_EXT:
- case GL_ALPHA16F_EXT:
- case GL_LUMINANCE16F_EXT:
- case GL_LUMINANCE_ALPHA16F_EXT:
- case GL_R16F:
- case GL_RG16F:
- case GL_R11F_G11F_B10F:
- case GL_RGB16F:
- case GL_RGBA16F:
- case GL_R32F:
- case GL_RG32F:
- case GL_RGB32F:
- case GL_RGBA32F:
- case GL_RGB9_E5:
- return GL_FLOAT;
- default:
- // UNREACHABLE(internalformat);
- return GL_NONE;
- }
- }
-
- GLenum GetComponentType(GLint internalformat, GLenum attachment)
- {
- // Can be one of GL_FLOAT, GL_INT, GL_UNSIGNED_INT, GL_SIGNED_NORMALIZED, or GL_UNSIGNED_NORMALIZED
- switch(attachment)
- {
- case GL_COLOR_ATTACHMENT0:
- case GL_COLOR_ATTACHMENT1:
- case GL_COLOR_ATTACHMENT2:
- case GL_COLOR_ATTACHMENT3:
- case GL_COLOR_ATTACHMENT4:
- case GL_COLOR_ATTACHMENT5:
- case GL_COLOR_ATTACHMENT6:
- case GL_COLOR_ATTACHMENT7:
- case GL_COLOR_ATTACHMENT8:
- case GL_COLOR_ATTACHMENT9:
- case GL_COLOR_ATTACHMENT10:
- case GL_COLOR_ATTACHMENT11:
- case GL_COLOR_ATTACHMENT12:
- case GL_COLOR_ATTACHMENT13:
- case GL_COLOR_ATTACHMENT14:
- case GL_COLOR_ATTACHMENT15:
- case GL_COLOR_ATTACHMENT16:
- case GL_COLOR_ATTACHMENT17:
- case GL_COLOR_ATTACHMENT18:
- case GL_COLOR_ATTACHMENT19:
- case GL_COLOR_ATTACHMENT20:
- case GL_COLOR_ATTACHMENT21:
- case GL_COLOR_ATTACHMENT22:
- case GL_COLOR_ATTACHMENT23:
- case GL_COLOR_ATTACHMENT24:
- case GL_COLOR_ATTACHMENT25:
- case GL_COLOR_ATTACHMENT26:
- case GL_COLOR_ATTACHMENT27:
- case GL_COLOR_ATTACHMENT28:
- case GL_COLOR_ATTACHMENT29:
- case GL_COLOR_ATTACHMENT30:
- case GL_COLOR_ATTACHMENT31:
- return GetColorComponentType(internalformat);
- case GL_DEPTH_ATTACHMENT:
- case GL_STENCIL_ATTACHMENT:
- // Only color buffers may have integer components.
- return GL_FLOAT;
- default:
- UNREACHABLE(attachment);
- return GL_NONE;
- }
- }
-
- bool IsNormalizedInteger(GLint internalformat)
- {
- GLenum type = GetColorComponentType(internalformat);
-
- return type == GL_UNSIGNED_NORMALIZED || type == GL_SIGNED_NORMALIZED;
- }
-
- bool IsNonNormalizedInteger(GLint internalformat)
- {
- GLenum type = GetColorComponentType(internalformat);
-
- return type == GL_UNSIGNED_INT || type == GL_INT;
- }
-
- bool IsFloatFormat(GLint internalformat)
- {
- return GetColorComponentType(internalformat) == GL_FLOAT;
- }
-
- bool IsSignedNonNormalizedInteger(GLint internalformat)
- {
- return GetColorComponentType(internalformat) == GL_INT;
- }
-
- bool IsUnsignedNonNormalizedInteger(GLint internalformat)
- {
- return GetColorComponentType(internalformat) == GL_UNSIGNED_INT;
- }
-
- GLenum GetColorEncoding(GLint internalformat)
- {
- switch(internalformat)
- {
- case GL_SRGB8:
- case GL_SRGB8_ALPHA8:
- return GL_SRGB;
- default:
- // [OpenGL ES 3.0.5] section 6.1.13 page 242:
- // If attachment is not a color attachment, or no data storage or texture image
- // has been specified for the attachment, params will contain the value LINEAR.
- return GL_LINEAR;
- }
- }
-
- std::string ParseUniformName(const std::string &name, unsigned int *outSubscript)
- {
- // Strip any trailing array operator and retrieve the subscript
- size_t open = name.find_last_of('[');
- size_t close = name.find_last_of(']');
- bool hasIndex = (open != std::string::npos) && (close == name.length() - 1);
- if(!hasIndex)
- {
- if(outSubscript)
- {
- *outSubscript = GL_INVALID_INDEX;
- }
- return name;
- }
-
- if(outSubscript)
- {
- int index = atoi(name.substr(open + 1).c_str());
- if(index >= 0)
- {
- *outSubscript = index;
- }
- else
- {
- *outSubscript = GL_INVALID_INDEX;
- }
- }
-
- return name.substr(0, open);
- }
-
- bool FloatFitsInInt(float f)
- {
- // We can't just do a raw comparison of "f > (float) INT32_MAX",
- // because "(float) INT32_MAX" is unrepresentable as an integer.
- //
- // So instead I subtracted an ULP from "(float) INT32_MAX", cast that
- // to an int, and do the comparison with that value. That value is
- // 2147483520, and can be found with the following code:
- // float f_max = static_cast<float>(INT32_MAX);
- // int32_t f_bits = *static_cast<int32_t *>((void *)&f_max);
- // f_bits -= 1;
- // float f_next = *static_cast<float *>((void *)&f_bits);
- // int32_t out = static_cast<int32_t>(f_next);
- return std::isfinite(f) && (-2147483520.f < f) && (f < 2147483520.f);
- }
-}
-
-namespace es2sw
-{
- sw::DepthCompareMode ConvertDepthComparison(GLenum comparison)
- {
- switch(comparison)
- {
- case GL_NEVER: return sw::DEPTH_NEVER;
- case GL_ALWAYS: return sw::DEPTH_ALWAYS;
- case GL_LESS: return sw::DEPTH_LESS;
- case GL_LEQUAL: return sw::DEPTH_LESSEQUAL;
- case GL_EQUAL: return sw::DEPTH_EQUAL;
- case GL_GREATER: return sw::DEPTH_GREATER;
- case GL_GEQUAL: return sw::DEPTH_GREATEREQUAL;
- case GL_NOTEQUAL: return sw::DEPTH_NOTEQUAL;
- default: UNREACHABLE(comparison);
- }
-
- return sw::DEPTH_ALWAYS;
- }
-
- sw::StencilCompareMode ConvertStencilComparison(GLenum comparison)
- {
- switch(comparison)
- {
- case GL_NEVER: return sw::STENCIL_NEVER;
- case GL_ALWAYS: return sw::STENCIL_ALWAYS;
- case GL_LESS: return sw::STENCIL_LESS;
- case GL_LEQUAL: return sw::STENCIL_LESSEQUAL;
- case GL_EQUAL: return sw::STENCIL_EQUAL;
- case GL_GREATER: return sw::STENCIL_GREATER;
- case GL_GEQUAL: return sw::STENCIL_GREATEREQUAL;
- case GL_NOTEQUAL: return sw::STENCIL_NOTEQUAL;
- default: UNREACHABLE(comparison);
- }
-
- return sw::STENCIL_ALWAYS;
- }
-
- sw::Color<float> ConvertColor(es2::Color color)
- {
- return sw::Color<float>(color.red, color.green, color.blue, color.alpha);
- }
-
- sw::BlendFactor ConvertBlendFunc(GLenum blend)
- {
- switch(blend)
- {
- case GL_ZERO: return sw::BLEND_ZERO;
- case GL_ONE: return sw::BLEND_ONE;
- case GL_SRC_COLOR: return sw::BLEND_SOURCE;
- case GL_ONE_MINUS_SRC_COLOR: return sw::BLEND_INVSOURCE;
- case GL_DST_COLOR: return sw::BLEND_DEST;
- case GL_ONE_MINUS_DST_COLOR: return sw::BLEND_INVDEST;
- case GL_SRC_ALPHA: return sw::BLEND_SOURCEALPHA;
- case GL_ONE_MINUS_SRC_ALPHA: return sw::BLEND_INVSOURCEALPHA;
- case GL_DST_ALPHA: return sw::BLEND_DESTALPHA;
- case GL_ONE_MINUS_DST_ALPHA: return sw::BLEND_INVDESTALPHA;
- case GL_CONSTANT_COLOR: return sw::BLEND_CONSTANT;
- case GL_ONE_MINUS_CONSTANT_COLOR: return sw::BLEND_INVCONSTANT;
- case GL_CONSTANT_ALPHA: return sw::BLEND_CONSTANTALPHA;
- case GL_ONE_MINUS_CONSTANT_ALPHA: return sw::BLEND_INVCONSTANTALPHA;
- case GL_SRC_ALPHA_SATURATE: return sw::BLEND_SRCALPHASAT;
- default: UNREACHABLE(blend);
- }
-
- return sw::BLEND_ZERO;
- }
-
- sw::BlendOperation ConvertBlendOp(GLenum blendOp)
- {
- switch(blendOp)
- {
- case GL_FUNC_ADD: return sw::BLENDOP_ADD;
- case GL_FUNC_SUBTRACT: return sw::BLENDOP_SUB;
- case GL_FUNC_REVERSE_SUBTRACT: return sw::BLENDOP_INVSUB;
- case GL_MIN_EXT: return sw::BLENDOP_MIN;
- case GL_MAX_EXT: return sw::BLENDOP_MAX;
- default: UNREACHABLE(blendOp);
- }
-
- return sw::BLENDOP_ADD;
- }
-
- sw::StencilOperation ConvertStencilOp(GLenum stencilOp)
- {
- switch(stencilOp)
- {
- case GL_ZERO: return sw::OPERATION_ZERO;
- case GL_KEEP: return sw::OPERATION_KEEP;
- case GL_REPLACE: return sw::OPERATION_REPLACE;
- case GL_INCR: return sw::OPERATION_INCRSAT;
- case GL_DECR: return sw::OPERATION_DECRSAT;
- case GL_INVERT: return sw::OPERATION_INVERT;
- case GL_INCR_WRAP: return sw::OPERATION_INCR;
- case GL_DECR_WRAP: return sw::OPERATION_DECR;
- default: UNREACHABLE(stencilOp);
- }
-
- return sw::OPERATION_KEEP;
- }
-
- sw::AddressingMode ConvertTextureWrap(GLenum wrap)
- {
- switch(wrap)
- {
- case GL_REPEAT: return sw::ADDRESSING_WRAP;
- case GL_CLAMP_TO_EDGE: return sw::ADDRESSING_CLAMP;
- case GL_MIRRORED_REPEAT: return sw::ADDRESSING_MIRROR;
- default: UNREACHABLE(wrap);
- }
-
- return sw::ADDRESSING_WRAP;
- }
-
- sw::CompareFunc ConvertCompareFunc(GLenum compareFunc, GLenum compareMode)
- {
- if(compareMode == GL_COMPARE_REF_TO_TEXTURE)
- {
- switch(compareFunc)
- {
- case GL_LEQUAL: return sw::COMPARE_LESSEQUAL;
- case GL_GEQUAL: return sw::COMPARE_GREATEREQUAL;
- case GL_LESS: return sw::COMPARE_LESS;
- case GL_GREATER: return sw::COMPARE_GREATER;
- case GL_EQUAL: return sw::COMPARE_EQUAL;
- case GL_NOTEQUAL: return sw::COMPARE_NOTEQUAL;
- case GL_ALWAYS: return sw::COMPARE_ALWAYS;
- case GL_NEVER: return sw::COMPARE_NEVER;
- default: UNREACHABLE(compareFunc);
- }
- }
- else if(compareMode == GL_NONE)
- {
- return sw::COMPARE_BYPASS;
- }
- else UNREACHABLE(compareMode);
-
- return sw::COMPARE_BYPASS;
- }
-
- sw::SwizzleType ConvertSwizzleType(GLenum swizzleType)
- {
- switch(swizzleType)
- {
- case GL_RED: return sw::SWIZZLE_RED;
- case GL_GREEN: return sw::SWIZZLE_GREEN;
- case GL_BLUE: return sw::SWIZZLE_BLUE;
- case GL_ALPHA: return sw::SWIZZLE_ALPHA;
- case GL_ZERO: return sw::SWIZZLE_ZERO;
- case GL_ONE: return sw::SWIZZLE_ONE;
- default: UNREACHABLE(swizzleType);
- }
-
- return sw::SWIZZLE_RED;
- }
-
- sw::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace)
- {
- switch(cullFace)
- {
- case GL_FRONT:
- return (frontFace == GL_CCW ? sw::CULL_CLOCKWISE : sw::CULL_COUNTERCLOCKWISE);
- case GL_BACK:
- return (frontFace == GL_CCW ? sw::CULL_COUNTERCLOCKWISE : sw::CULL_CLOCKWISE);
- case GL_FRONT_AND_BACK:
- return sw::CULL_NONE; // culling will be handled during draw
- default: UNREACHABLE(cullFace);
- }
-
- return sw::CULL_COUNTERCLOCKWISE;
- }
-
- unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha)
- {
- return (red ? 0x00000001 : 0) |
- (green ? 0x00000002 : 0) |
- (blue ? 0x00000004 : 0) |
- (alpha ? 0x00000008 : 0);
- }
-
- sw::MipmapType ConvertMipMapFilter(GLenum minFilter)
- {
- switch(minFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- return sw::MIPMAP_NONE;
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_NEAREST:
- return sw::MIPMAP_POINT;
- case GL_NEAREST_MIPMAP_LINEAR:
- case GL_LINEAR_MIPMAP_LINEAR:
- return sw::MIPMAP_LINEAR;
- default:
- UNREACHABLE(minFilter);
- return sw::MIPMAP_NONE;
- }
- }
-
- sw::FilterType ConvertTextureFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy)
- {
- if(maxAnisotropy > 1.0f)
- {
- return sw::FILTER_ANISOTROPIC;
- }
-
- switch(magFilter)
- {
- case GL_NEAREST:
- case GL_LINEAR:
- break;
- default:
- UNREACHABLE(magFilter);
- }
-
- switch(minFilter)
- {
- case GL_NEAREST:
- case GL_NEAREST_MIPMAP_NEAREST:
- case GL_NEAREST_MIPMAP_LINEAR:
- return (magFilter == GL_NEAREST) ? sw::FILTER_POINT : sw::FILTER_MIN_POINT_MAG_LINEAR;
- case GL_LINEAR:
- case GL_LINEAR_MIPMAP_NEAREST:
- case GL_LINEAR_MIPMAP_LINEAR:
- return (magFilter == GL_NEAREST) ? sw::FILTER_MIN_LINEAR_MAG_POINT : sw::FILTER_LINEAR;
- default:
- UNREACHABLE(minFilter);
- return sw::FILTER_POINT;
- }
- }
-
- bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &drawType, int &primitiveCount, int &verticesPerPrimitive)
- {
- switch(primitiveType)
- {
- case GL_POINTS:
- drawType = sw::DRAW_POINTLIST;
- primitiveCount = elementCount;
- verticesPerPrimitive = 1;
- break;
- case GL_LINES:
- drawType = sw::DRAW_LINELIST;
- primitiveCount = elementCount / 2;
- verticesPerPrimitive = 2;
- break;
- case GL_LINE_LOOP:
- drawType = sw::DRAW_LINELOOP;
- primitiveCount = elementCount;
- verticesPerPrimitive = 2;
- break;
- case GL_LINE_STRIP:
- drawType = sw::DRAW_LINESTRIP;
- primitiveCount = elementCount - 1;
- verticesPerPrimitive = 2;
- break;
- case GL_TRIANGLES:
- drawType = sw::DRAW_TRIANGLELIST;
- primitiveCount = elementCount / 3;
- verticesPerPrimitive = 3;
- break;
- case GL_TRIANGLE_STRIP:
- drawType = sw::DRAW_TRIANGLESTRIP;
- primitiveCount = elementCount - 2;
- verticesPerPrimitive = 3;
- break;
- case GL_TRIANGLE_FAN:
- drawType = sw::DRAW_TRIANGLEFAN;
- primitiveCount = elementCount - 2;
- verticesPerPrimitive = 3;
- break;
- default:
- return false;
- }
-
- sw::DrawType elementSize;
- switch(elementType)
- {
- case GL_NONE: elementSize = sw::DRAW_NONINDEXED; break;
- case GL_UNSIGNED_BYTE: elementSize = sw::DRAW_INDEXED8; break;
- case GL_UNSIGNED_SHORT: elementSize = sw::DRAW_INDEXED16; break;
- case GL_UNSIGNED_INT: elementSize = sw::DRAW_INDEXED32; break;
- default: return false;
- }
-
- drawType = sw::DrawType(drawType | elementSize);
-
- return true;
- }
-}
-
-namespace sw2es
-{
- GLenum ConvertBackBufferFormat(sw::Format format)
- {
- switch(format)
- {
- case sw::FORMAT_A4R4G4B4: return GL_RGBA4;
- case sw::FORMAT_A8R8G8B8: return GL_RGBA8;
- case sw::FORMAT_A8B8G8R8: return GL_RGBA8;
- case sw::FORMAT_A1R5G5B5: return GL_RGB5_A1;
- case sw::FORMAT_R5G6B5: return GL_RGB565;
- case sw::FORMAT_X8R8G8B8: return GL_RGB8;
- case sw::FORMAT_X8B8G8R8: return GL_RGB8;
- case sw::FORMAT_SRGB8_A8: return GL_RGBA8;
- case sw::FORMAT_SRGB8_X8: return GL_RGB8;
- default:
- UNREACHABLE(format);
- }
-
- return GL_RGBA4;
- }
-
- GLenum ConvertDepthStencilFormat(sw::Format format)
- {
- switch(format)
- {
- case sw::FORMAT_D16: return GL_DEPTH_COMPONENT16;
- case sw::FORMAT_D24X8: return GL_DEPTH_COMPONENT24;
- case sw::FORMAT_D32: return GL_DEPTH_COMPONENT32_OES;
- case sw::FORMAT_D24S8: return GL_DEPTH24_STENCIL8_OES;
- case sw::FORMAT_D32F: return GL_DEPTH_COMPONENT32F;
- case sw::FORMAT_D32FS8: return GL_DEPTH32F_STENCIL8;
- case sw::FORMAT_S8: return GL_STENCIL_INDEX8;
- default:
- UNREACHABLE(format);
- }
-
- return GL_DEPTH24_STENCIL8_OES;
- }
-}
diff --git a/src/OpenGL/libGLESv2/utilities.h b/src/OpenGL/libGLESv2/utilities.h
deleted file mode 100644
index d469d74f2..000000000
--- a/src/OpenGL/libGLESv2/utilities.h
+++ /dev/null
@@ -1,118 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// utilities.h: Conversion functions and other utility routines.
-
-#ifndef LIBGLESV2_UTILITIES_H
-#define LIBGLESV2_UTILITIES_H
-
-#include "Device.hpp"
-#include "common/Image.hpp"
-#include "Texture.h"
-
-#include <GLES2/gl2.h>
-#include <GLES2/gl2ext.h>
-#include <GL/glcorearb.h>
-#include <GL/glext.h>
-
-#include <string>
-
-namespace es2
-{
- struct Color;
- class Framebuffer;
-
- unsigned int UniformComponentCount(GLenum type);
- GLenum UniformComponentType(GLenum type);
- size_t UniformTypeSize(GLenum type);
- bool IsSamplerUniform(GLenum type);
- int VariableRowCount(GLenum type);
- int VariableColumnCount(GLenum type);
- int VariableRegisterCount(GLenum type);
- int VariableRegisterSize(GLenum type);
-
- int AllocateFirstFreeBits(unsigned int *bits, unsigned int allocationSize, unsigned int bitsSize);
-
- bool IsCompressed(GLint intenalformat);
- bool IsSizedInternalFormat(GLint internalformat); // Not compressed.
- GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset,
- GLsizei width, GLsizei height, GLenum format, GLenum type, Texture *texture);
- GLenum ValidateSubImageParams(bool compressed, bool copy, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset,
- GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, Texture *texture);
- bool ValidateCopyFormats(GLenum textureFormat, GLenum colorbufferFormat);
- bool ValidateReadPixelsFormatType(const Framebuffer *framebuffer, GLenum format, GLenum type);
- bool IsDepthTexture(GLint format);
- bool IsStencilTexture(GLint format);
- bool IsCubemapTextureTarget(GLenum target);
- int CubeFaceIndex(GLenum cubeTarget);
- bool IsTexImageTarget(GLenum target);
- bool IsTextureTarget(GLenum target);
- GLenum ValidateTextureFormatType(GLenum format, GLenum type, GLint internalformat, GLenum target);
- size_t GetTypeSize(GLenum type);
- sw::Format ConvertReadFormatType(GLenum format, GLenum type);
-
- bool IsColorRenderable(GLint internalformat);
- bool IsDepthRenderable(GLint internalformat);
- bool IsStencilRenderable(GLint internalformat);
- bool IsMipmappable(GLint internalformat);
-
- GLuint GetAlphaSize(GLint internalformat);
- GLuint GetRedSize(GLint internalformat);
- GLuint GetGreenSize(GLint internalformat);
- GLuint GetBlueSize(GLint internalformat);
- GLuint GetDepthSize(GLint internalformat);
- GLuint GetStencilSize(GLint internalformat);
-
- GLenum GetColorComponentType(GLint internalformat);
- GLenum GetComponentType(GLint internalformat, GLenum attachment);
- bool IsNormalizedInteger(GLint internalformat);
- bool IsNonNormalizedInteger(GLint internalformat);
- bool IsFloatFormat(GLint internalformat);
- bool IsSignedNonNormalizedInteger(GLint internalformat);
- bool IsUnsignedNonNormalizedInteger(GLint internalformat);
- GLenum GetColorEncoding(GLint internalformat);
-
- // Parse the base uniform name and array index. Returns the base name of the uniform. outSubscript is
- // set to GL_INVALID_INDEX if the provided name is not an array or the array index is invalid.
- std::string ParseUniformName(const std::string &name, unsigned int *outSubscript);
-
- bool FloatFitsInInt(float f);
-}
-
-namespace es2sw
-{
- sw::DepthCompareMode ConvertDepthComparison(GLenum comparison);
- sw::StencilCompareMode ConvertStencilComparison(GLenum comparison);
- sw::Color<float> ConvertColor(es2::Color color);
- sw::BlendFactor ConvertBlendFunc(GLenum blend);
- sw::BlendOperation ConvertBlendOp(GLenum blendOp);
- sw::LogicalOperation ConvertLogicalOperation(GLenum logicalOperation);
- sw::StencilOperation ConvertStencilOp(GLenum stencilOp);
- sw::AddressingMode ConvertTextureWrap(GLenum wrap);
- sw::CompareFunc ConvertCompareFunc(GLenum compareFunc, GLenum compareMode);
- sw::SwizzleType ConvertSwizzleType(GLenum swizzleType);
- sw::CullMode ConvertCullMode(GLenum cullFace, GLenum frontFace);
- unsigned int ConvertColorMask(bool red, bool green, bool blue, bool alpha);
- sw::MipmapType ConvertMipMapFilter(GLenum minFilter);
- sw::FilterType ConvertTextureFilter(GLenum minFilter, GLenum magFilter, float maxAnisotropy);
- bool ConvertPrimitiveType(GLenum primitiveType, GLsizei elementCount, GLenum elementType, sw::DrawType &swPrimitiveType, int &primitiveCount, int &verticesPerPrimitive);
-}
-
-namespace sw2es
-{
- GLenum ConvertBackBufferFormat(sw::Format format);
- GLenum ConvertDepthStencilFormat(sw::Format format);
-}
-
-#endif // LIBGLESV2_UTILITIES_H
diff --git a/src/Renderer/Blitter.cpp b/src/Renderer/Blitter.cpp
deleted file mode 100644
index d4edbfab5..000000000
--- a/src/Renderer/Blitter.cpp
+++ /dev/null
@@ -1,1483 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Blitter.hpp"
-
-#include "Shader/ShaderCore.hpp"
-#include "Reactor/Reactor.hpp"
-#include "Common/Memory.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- using namespace rr;
-
- Blitter::Blitter()
- {
- blitCache = new RoutineCache<State>(1024);
- }
-
- Blitter::~Blitter()
- {
- delete blitCache;
- }
-
- void Blitter::clear(void *pixel, sw::Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask)
- {
- if(fastClear(pixel, format, dest, dRect, rgbaMask))
- {
- return;
- }
-
- sw::Surface *color = sw::Surface::create(1, 1, 1, format, pixel, sw::Surface::bytes(format), sw::Surface::bytes(format));
- SliceRectF sRect(0.5f, 0.5f, 0.5f, 0.5f, 0); // Sample from the middle.
- blit(color, sRect, dest, dRect, {rgbaMask});
- delete color;
- }
-
- bool Blitter::fastClear(void *pixel, sw::Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask)
- {
- if(format != FORMAT_A32B32G32R32F)
- {
- return false;
- }
-
- float *color = (float*)pixel;
- float r = color[0];
- float g = color[1];
- float b = color[2];
- float a = color[3];
-
- uint32_t packed;
-
- switch(dest->getFormat())
- {
- case FORMAT_R5G6B5:
- if((rgbaMask & 0x7) != 0x7) return false;
- packed = ((uint16_t)(31 * b + 0.5f) << 0) |
- ((uint16_t)(63 * g + 0.5f) << 5) |
- ((uint16_t)(31 * r + 0.5f) << 11);
- break;
- case FORMAT_X8B8G8R8:
- if((rgbaMask & 0x7) != 0x7) return false;
- packed = ((uint32_t)(255) << 24) |
- ((uint32_t)(255 * b + 0.5f) << 16) |
- ((uint32_t)(255 * g + 0.5f) << 8) |
- ((uint32_t)(255 * r + 0.5f) << 0);
- break;
- case FORMAT_A8B8G8R8:
- if((rgbaMask & 0xF) != 0xF) return false;
- packed = ((uint32_t)(255 * a + 0.5f) << 24) |
- ((uint32_t)(255 * b + 0.5f) << 16) |
- ((uint32_t)(255 * g + 0.5f) << 8) |
- ((uint32_t)(255 * r + 0.5f) << 0);
- break;
- case FORMAT_X8R8G8B8:
- if((rgbaMask & 0x7) != 0x7) return false;
- packed = ((uint32_t)(255) << 24) |
- ((uint32_t)(255 * r + 0.5f) << 16) |
- ((uint32_t)(255 * g + 0.5f) << 8) |
- ((uint32_t)(255 * b + 0.5f) << 0);
- break;
- case FORMAT_A8R8G8B8:
- if((rgbaMask & 0xF) != 0xF) return false;
- packed = ((uint32_t)(255 * a + 0.5f) << 24) |
- ((uint32_t)(255 * r + 0.5f) << 16) |
- ((uint32_t)(255 * g + 0.5f) << 8) |
- ((uint32_t)(255 * b + 0.5f) << 0);
- break;
- default:
- return false;
- }
-
- bool useDestInternal = !dest->isExternalDirty();
- uint8_t *slice = (uint8_t*)dest->lock(dRect.x0, dRect.y0, dRect.slice, sw::LOCK_WRITEONLY, sw::PUBLIC, useDestInternal);
-
- for(int j = 0; j < dest->getSamples(); j++)
- {
- uint8_t *d = slice;
-
- switch(Surface::bytes(dest->getFormat()))
- {
- case 2:
- for(int i = dRect.y0; i < dRect.y1; i++)
- {
- sw::clear((uint16_t*)d, packed, dRect.x1 - dRect.x0);
- d += dest->getPitchB(useDestInternal);
- }
- break;
- case 4:
- for(int i = dRect.y0; i < dRect.y1; i++)
- {
- sw::clear((uint32_t*)d, packed, dRect.x1 - dRect.x0);
- d += dest->getPitchB(useDestInternal);
- }
- break;
- default:
- assert(false);
- }
-
- slice += dest->getSliceB(useDestInternal);
- }
-
- dest->unlock(useDestInternal);
-
- return true;
- }
-
- void Blitter::blit(Surface *source, const SliceRectF &sourceRect, Surface *dest, const SliceRect &destRect, const Blitter::Options& options)
- {
- if(dest->getInternalFormat() == FORMAT_NULL)
- {
- return;
- }
-
- if(blitReactor(source, sourceRect, dest, destRect, options))
- {
- return;
- }
-
- SliceRectF sRect = sourceRect;
- SliceRect dRect = destRect;
-
- bool flipX = destRect.x0 > destRect.x1;
- bool flipY = destRect.y0 > destRect.y1;
-
- if(flipX)
- {
- swap(dRect.x0, dRect.x1);
- swap(sRect.x0, sRect.x1);
- }
- if(flipY)
- {
- swap(dRect.y0, dRect.y1);
- swap(sRect.y0, sRect.y1);
- }
-
- source->lockInternal(0, 0, sRect.slice, sw::LOCK_READONLY, sw::PUBLIC);
- dest->lockInternal(0, 0, dRect.slice, sw::LOCK_WRITEONLY, sw::PUBLIC);
-
- float w = sRect.width() / dRect.width();
- float h = sRect.height() / dRect.height();
-
- float xStart = sRect.x0 + (0.5f - dRect.x0) * w;
- float yStart = sRect.y0 + (0.5f - dRect.y0) * h;
-
- for(int j = dRect.y0; j < dRect.y1; j++)
- {
- float y = yStart + j * h;
-
- for(int i = dRect.x0; i < dRect.x1; i++)
- {
- float x = xStart + i * w;
-
- // FIXME: Support RGBA mask
- dest->copyInternal(source, i, j, x, y, options.filter);
- }
- }
-
- source->unlockInternal();
- dest->unlockInternal();
- }
-
- void Blitter::blit3D(Surface *source, Surface *dest)
- {
- source->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PUBLIC);
- dest->lockInternal(0, 0, 0, sw::LOCK_WRITEONLY, sw::PUBLIC);
-
- float w = static_cast<float>(source->getWidth()) / static_cast<float>(dest->getWidth());
- float h = static_cast<float>(source->getHeight()) / static_cast<float>(dest->getHeight());
- float d = static_cast<float>(source->getDepth()) / static_cast<float>(dest->getDepth());
-
- for(int k = 0; k < dest->getDepth(); k++)
- {
- float z = (k + 0.5f) * d;
-
- for(int j = 0; j < dest->getHeight(); j++)
- {
- float y = (j + 0.5f) * h;
-
- for(int i = 0; i < dest->getWidth(); i++)
- {
- float x = (i + 0.5f) * w;
-
- dest->copyInternal(source, i, j, k, x, y, z, true);
- }
- }
- }
-
- source->unlockInternal();
- dest->unlockInternal();
- }
-
- bool Blitter::read(Float4 &c, Pointer<Byte> element, const State &state)
- {
- c = Float4(0.0f, 0.0f, 0.0f, 1.0f);
-
- switch(state.sourceFormat)
- {
- case FORMAT_L8:
- c.xyz = Float(Int(*Pointer<Byte>(element)));
- c.w = float(0xFF);
- break;
- case FORMAT_A8:
- c.w = Float(Int(*Pointer<Byte>(element)));
- break;
- case FORMAT_R8I:
- case FORMAT_R8_SNORM:
- c.x = Float(Int(*Pointer<SByte>(element)));
- c.w = float(0x7F);
- break;
- case FORMAT_R8:
- case FORMAT_R8UI:
- c.x = Float(Int(*Pointer<Byte>(element)));
- c.w = float(0xFF);
- break;
- case FORMAT_R16I:
- c.x = Float(Int(*Pointer<Short>(element)));
- c.w = float(0x7FFF);
- break;
- case FORMAT_R16UI:
- c.x = Float(Int(*Pointer<UShort>(element)));
- c.w = float(0xFFFF);
- break;
- case FORMAT_R32I:
- c.x = Float(*Pointer<Int>(element));
- c.w = float(0x7FFFFFFF);
- break;
- case FORMAT_R32UI:
- c.x = Float(*Pointer<UInt>(element));
- c.w = float(0xFFFFFFFF);
- break;
- case FORMAT_A8R8G8B8:
- c = Float4(*Pointer<Byte4>(element)).zyxw;
- break;
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8_SNORM:
- c = Float4(*Pointer<SByte4>(element));
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_SRGB8_A8:
- c = Float4(*Pointer<Byte4>(element));
- break;
- case FORMAT_X8R8G8B8:
- c = Float4(*Pointer<Byte4>(element)).zyxw;
- c.w = float(0xFF);
- break;
- case FORMAT_R8G8B8:
- c.z = Float(Int(*Pointer<Byte>(element + 0)));
- c.y = Float(Int(*Pointer<Byte>(element + 1)));
- c.x = Float(Int(*Pointer<Byte>(element + 2)));
- c.w = float(0xFF);
- break;
- case FORMAT_B8G8R8:
- c.x = Float(Int(*Pointer<Byte>(element + 0)));
- c.y = Float(Int(*Pointer<Byte>(element + 1)));
- c.z = Float(Int(*Pointer<Byte>(element + 2)));
- c.w = float(0xFF);
- break;
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8_SNORM:
- c = Float4(*Pointer<SByte4>(element));
- c.w = float(0x7F);
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_SRGB8_X8:
- c = Float4(*Pointer<Byte4>(element));
- c.w = float(0xFF);
- break;
- case FORMAT_A16B16G16R16I:
- c = Float4(*Pointer<Short4>(element));
- break;
- case FORMAT_A16B16G16R16:
- case FORMAT_A16B16G16R16UI:
- c = Float4(*Pointer<UShort4>(element));
- break;
- case FORMAT_X16B16G16R16I:
- c = Float4(*Pointer<Short4>(element));
- c.w = float(0x7FFF);
- break;
- case FORMAT_X16B16G16R16UI:
- c = Float4(*Pointer<UShort4>(element));
- c.w = float(0xFFFF);
- break;
- case FORMAT_A32B32G32R32I:
- c = Float4(*Pointer<Int4>(element));
- break;
- case FORMAT_A32B32G32R32UI:
- c = Float4(*Pointer<UInt4>(element));
- break;
- case FORMAT_X32B32G32R32I:
- c = Float4(*Pointer<Int4>(element));
- c.w = float(0x7FFFFFFF);
- break;
- case FORMAT_X32B32G32R32UI:
- c = Float4(*Pointer<UInt4>(element));
- c.w = float(0xFFFFFFFF);
- break;
- case FORMAT_G8R8I:
- case FORMAT_G8R8_SNORM:
- c.x = Float(Int(*Pointer<SByte>(element + 0)));
- c.y = Float(Int(*Pointer<SByte>(element + 1)));
- c.w = float(0x7F);
- break;
- case FORMAT_G8R8:
- case FORMAT_G8R8UI:
- c.x = Float(Int(*Pointer<Byte>(element + 0)));
- c.y = Float(Int(*Pointer<Byte>(element + 1)));
- c.w = float(0xFF);
- break;
- case FORMAT_G16R16I:
- c.x = Float(Int(*Pointer<Short>(element + 0)));
- c.y = Float(Int(*Pointer<Short>(element + 2)));
- c.w = float(0x7FFF);
- break;
- case FORMAT_G16R16:
- case FORMAT_G16R16UI:
- c.x = Float(Int(*Pointer<UShort>(element + 0)));
- c.y = Float(Int(*Pointer<UShort>(element + 2)));
- c.w = float(0xFFFF);
- break;
- case FORMAT_G32R32I:
- c.x = Float(*Pointer<Int>(element + 0));
- c.y = Float(*Pointer<Int>(element + 4));
- c.w = float(0x7FFFFFFF);
- break;
- case FORMAT_G32R32UI:
- c.x = Float(*Pointer<UInt>(element + 0));
- c.y = Float(*Pointer<UInt>(element + 4));
- c.w = float(0xFFFFFFFF);
- break;
- case FORMAT_A32B32G32R32F:
- c = *Pointer<Float4>(element);
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_B32G32R32F:
- c.z = *Pointer<Float>(element + 8);
- case FORMAT_G32R32F:
- c.x = *Pointer<Float>(element + 0);
- c.y = *Pointer<Float>(element + 4);
- break;
- case FORMAT_R32F:
- c.x = *Pointer<Float>(element);
- break;
- case FORMAT_R5G6B5:
- c.x = Float(Int((*Pointer<UShort>(element) & UShort(0xF800)) >> UShort(11)));
- c.y = Float(Int((*Pointer<UShort>(element) & UShort(0x07E0)) >> UShort(5)));
- c.z = Float(Int(*Pointer<UShort>(element) & UShort(0x001F)));
- break;
- case FORMAT_A2B10G10R10:
- case FORMAT_A2B10G10R10UI:
- c.x = Float(Int((*Pointer<UInt>(element) & UInt(0x000003FF))));
- c.y = Float(Int((*Pointer<UInt>(element) & UInt(0x000FFC00)) >> 10));
- c.z = Float(Int((*Pointer<UInt>(element) & UInt(0x3FF00000)) >> 20));
- c.w = Float(Int((*Pointer<UInt>(element) & UInt(0xC0000000)) >> 30));
- break;
- case FORMAT_D16:
- c.x = Float(Int((*Pointer<UShort>(element))));
- break;
- case FORMAT_D24S8:
- case FORMAT_D24X8:
- c.x = Float(Int((*Pointer<UInt>(element) & UInt(0xFFFFFF00)) >> 8));
- break;
- case FORMAT_D32:
- c.x = Float(Int((*Pointer<UInt>(element))));
- break;
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- c.x = 1.0f - *Pointer<Float>(element);
- break;
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- c.x = *Pointer<Float>(element);
- break;
- case FORMAT_S8:
- c.x = Float(Int(*Pointer<Byte>(element)));
- break;
- default:
- return false;
- }
-
- return true;
- }
-
- bool Blitter::write(Float4 &c, Pointer<Byte> element, const State &state)
- {
- bool writeR = state.writeRed;
- bool writeG = state.writeGreen;
- bool writeB = state.writeBlue;
- bool writeA = state.writeAlpha;
- bool writeRGBA = writeR && writeG && writeB && writeA;
-
- switch(state.destFormat)
- {
- case FORMAT_L8:
- *Pointer<Byte>(element) = Byte(RoundInt(Float(c.x)));
- break;
- case FORMAT_A8:
- if(writeA) { *Pointer<Byte>(element) = Byte(RoundInt(Float(c.w))); }
- break;
- case FORMAT_A8R8G8B8:
- if(writeRGBA)
- {
- Short4 c0 = RoundShort4(c.zyxw);
- *Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
- }
- else
- {
- if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
- }
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_A8:
- if(writeRGBA)
- {
- Short4 c0 = RoundShort4(c);
- *Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
- }
- else
- {
- if(writeR) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
- }
- break;
- case FORMAT_X8R8G8B8:
- if(writeRGBA)
- {
- Short4 c0 = RoundShort4(c.zyxw) | Short4(0x0000, 0x0000, 0x0000, 0x00FF);
- *Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
- }
- else
- {
- if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(0xFF); }
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- if(writeRGBA)
- {
- Short4 c0 = RoundShort4(c) | Short4(0x0000, 0x0000, 0x0000, 0x00FF);
- *Pointer<Byte4>(element) = Byte4(PackUnsigned(c0, c0));
- }
- else
- {
- if(writeR) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(0xFF); }
- }
- break;
- case FORMAT_R8G8B8:
- if(writeR) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.z))); }
- break;
- case FORMAT_B8G8R8:
- if(writeR) { *Pointer<Byte>(element + 0) = Byte(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
- break;
- case FORMAT_A32B32G32R32F:
- if(writeRGBA)
- {
- *Pointer<Float4>(element) = c;
- }
- else
- {
- if(writeR) { *Pointer<Float>(element) = c.x; }
- if(writeG) { *Pointer<Float>(element + 4) = c.y; }
- if(writeB) { *Pointer<Float>(element + 8) = c.z; }
- if(writeA) { *Pointer<Float>(element + 12) = c.w; }
- }
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- if(writeA) { *Pointer<Float>(element + 12) = 1.0f; }
- case FORMAT_B32G32R32F:
- if(writeR) { *Pointer<Float>(element) = c.x; }
- if(writeG) { *Pointer<Float>(element + 4) = c.y; }
- if(writeB) { *Pointer<Float>(element + 8) = c.z; }
- break;
- case FORMAT_G32R32F:
- if(writeR && writeG)
- {
- *Pointer<Float2>(element) = Float2(c);
- }
- else
- {
- if(writeR) { *Pointer<Float>(element) = c.x; }
- if(writeG) { *Pointer<Float>(element + 4) = c.y; }
- }
- break;
- case FORMAT_R32F:
- if(writeR) { *Pointer<Float>(element) = c.x; }
- break;
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8_SNORM:
- if(writeA) { *Pointer<SByte>(element + 3) = SByte(RoundInt(Float(c.w))); }
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8_SNORM:
- if(writeA && (state.destFormat == FORMAT_X8B8G8R8I || state.destFormat == FORMAT_X8B8G8R8_SNORM))
- {
- *Pointer<SByte>(element + 3) = SByte(0x7F);
- }
- if(writeB) { *Pointer<SByte>(element + 2) = SByte(RoundInt(Float(c.z))); }
- case FORMAT_G8R8I:
- case FORMAT_G8R8_SNORM:
- if(writeG) { *Pointer<SByte>(element + 1) = SByte(RoundInt(Float(c.y))); }
- case FORMAT_R8I:
- case FORMAT_R8_SNORM:
- if(writeR) { *Pointer<SByte>(element) = SByte(RoundInt(Float(c.x))); }
- break;
- case FORMAT_A8B8G8R8UI:
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(RoundInt(Float(c.w))); }
- case FORMAT_X8B8G8R8UI:
- if(writeA && (state.destFormat == FORMAT_X8B8G8R8UI))
- {
- *Pointer<Byte>(element + 3) = Byte(0xFF);
- }
- if(writeB) { *Pointer<Byte>(element + 2) = Byte(RoundInt(Float(c.z))); }
- case FORMAT_G8R8UI:
- case FORMAT_G8R8:
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(RoundInt(Float(c.y))); }
- case FORMAT_R8UI:
- case FORMAT_R8:
- if(writeR) { *Pointer<Byte>(element) = Byte(RoundInt(Float(c.x))); }
- break;
- case FORMAT_A16B16G16R16I:
- if(writeRGBA)
- {
- *Pointer<Short4>(element) = Short4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Short>(element + 4) = Short(RoundInt(Float(c.z))); }
- if(writeA) { *Pointer<Short>(element + 6) = Short(RoundInt(Float(c.w))); }
- }
- break;
- case FORMAT_X16B16G16R16I:
- if(writeRGBA)
- {
- *Pointer<Short4>(element) = Short4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<Short>(element + 4) = Short(RoundInt(Float(c.z))); }
- }
- if(writeA) { *Pointer<Short>(element + 6) = Short(0x7F); }
- break;
- case FORMAT_G16R16I:
- if(writeR && writeG)
- {
- *Pointer<Short2>(element) = Short2(Short4(RoundInt(c)));
- }
- else
- {
- if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<Short>(element + 2) = Short(RoundInt(Float(c.y))); }
- }
- break;
- case FORMAT_R16I:
- if(writeR) { *Pointer<Short>(element) = Short(RoundInt(Float(c.x))); }
- break;
- case FORMAT_A16B16G16R16UI:
- case FORMAT_A16B16G16R16:
- if(writeRGBA)
- {
- *Pointer<UShort4>(element) = UShort4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<UShort>(element + 4) = UShort(RoundInt(Float(c.z))); }
- if(writeA) { *Pointer<UShort>(element + 6) = UShort(RoundInt(Float(c.w))); }
- }
- break;
- case FORMAT_X16B16G16R16UI:
- if(writeRGBA)
- {
- *Pointer<UShort4>(element) = UShort4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<UShort>(element + 4) = UShort(RoundInt(Float(c.z))); }
- }
- if(writeA) { *Pointer<UShort>(element + 6) = UShort(0xFF); }
- break;
- case FORMAT_G16R16UI:
- case FORMAT_G16R16:
- if(writeR && writeG)
- {
- *Pointer<UShort2>(element) = UShort2(UShort4(RoundInt(c)));
- }
- else
- {
- if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<UShort>(element + 2) = UShort(RoundInt(Float(c.y))); }
- }
- break;
- case FORMAT_R16UI:
- if(writeR) { *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x))); }
- break;
- case FORMAT_A32B32G32R32I:
- if(writeRGBA)
- {
- *Pointer<Int4>(element) = RoundInt(c);
- }
- else
- {
- if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
- if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
- if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
- if(writeA) { *Pointer<Int>(element + 12) = RoundInt(Float(c.w)); }
- }
- break;
- case FORMAT_X32B32G32R32I:
- if(writeRGBA)
- {
- *Pointer<Int4>(element) = RoundInt(c);
- }
- else
- {
- if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
- if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
- if(writeB) { *Pointer<Int>(element + 8) = RoundInt(Float(c.z)); }
- }
- if(writeA) { *Pointer<Int>(element + 12) = Int(0x7FFFFFFF); }
- break;
- case FORMAT_G32R32I:
- if(writeG) { *Pointer<Int>(element + 4) = RoundInt(Float(c.y)); }
- case FORMAT_R32I:
- if(writeR) { *Pointer<Int>(element) = RoundInt(Float(c.x)); }
- break;
- case FORMAT_A32B32G32R32UI:
- if(writeRGBA)
- {
- *Pointer<UInt4>(element) = UInt4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
- if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(RoundInt(Float(c.w))); }
- }
- break;
- case FORMAT_X32B32G32R32UI:
- if(writeRGBA)
- {
- *Pointer<UInt4>(element) = UInt4(RoundInt(c));
- }
- else
- {
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
- if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(RoundInt(Float(c.z))); }
- }
- if(writeA) { *Pointer<UInt4>(element + 12) = UInt4(0xFFFFFFFF); }
- break;
- case FORMAT_G32R32UI:
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(RoundInt(Float(c.y))); }
- case FORMAT_R32UI:
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(RoundInt(Float(c.x))); }
- break;
- case FORMAT_R5G6B5:
- if(writeR && writeG && writeB)
- {
- *Pointer<UShort>(element) = UShort(RoundInt(Float(c.z)) |
- (RoundInt(Float(c.y)) << Int(5)) |
- (RoundInt(Float(c.x)) << Int(11)));
- }
- else
- {
- unsigned short mask = (writeB ? 0x001F : 0x0000) | (writeG ? 0x07E0 : 0x0000) | (writeR ? 0xF800 : 0x0000);
- unsigned short unmask = ~mask;
- *Pointer<UShort>(element) = (*Pointer<UShort>(element) & UShort(unmask)) |
- (UShort(RoundInt(Float(c.z)) |
- (RoundInt(Float(c.y)) << Int(5)) |
- (RoundInt(Float(c.x)) << Int(11))) & UShort(mask));
- }
- break;
- case FORMAT_A2B10G10R10:
- case FORMAT_A2B10G10R10UI:
- if(writeRGBA)
- {
- *Pointer<UInt>(element) = UInt(RoundInt(Float(c.x)) |
- (RoundInt(Float(c.y)) << 10) |
- (RoundInt(Float(c.z)) << 20) |
- (RoundInt(Float(c.w)) << 30));
- }
- else
- {
- unsigned int mask = (writeA ? 0xC0000000 : 0x0000) |
- (writeB ? 0x3FF00000 : 0x0000) |
- (writeG ? 0x000FFC00 : 0x0000) |
- (writeR ? 0x000003FF : 0x0000);
- unsigned int unmask = ~mask;
- *Pointer<UInt>(element) = (*Pointer<UInt>(element) & UInt(unmask)) |
- (UInt(RoundInt(Float(c.x)) |
- (RoundInt(Float(c.y)) << 10) |
- (RoundInt(Float(c.z)) << 20) |
- (RoundInt(Float(c.w)) << 30)) & UInt(mask));
- }
- break;
- case FORMAT_D16:
- *Pointer<UShort>(element) = UShort(RoundInt(Float(c.x)));
- break;
- case FORMAT_D24S8:
- case FORMAT_D24X8:
- *Pointer<UInt>(element) = UInt(RoundInt(Float(c.x)) << 8);
- break;
- case FORMAT_D32:
- *Pointer<UInt>(element) = UInt(RoundInt(Float(c.x)));
- break;
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- *Pointer<Float>(element) = 1.0f - c.x;
- break;
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- *Pointer<Float>(element) = c.x;
- break;
- case FORMAT_S8:
- *Pointer<Byte>(element) = Byte(RoundInt(Float(c.x)));
- break;
- default:
- return false;
- }
- return true;
- }
-
- bool Blitter::read(Int4 &c, Pointer<Byte> element, const State &state)
- {
- c = Int4(0, 0, 0, 1);
-
- switch(state.sourceFormat)
- {
- case FORMAT_A8B8G8R8I:
- c = Insert(c, Int(*Pointer<SByte>(element + 3)), 3);
- case FORMAT_X8B8G8R8I:
- c = Insert(c, Int(*Pointer<SByte>(element + 2)), 2);
- case FORMAT_G8R8I:
- c = Insert(c, Int(*Pointer<SByte>(element + 1)), 1);
- case FORMAT_R8I:
- c = Insert(c, Int(*Pointer<SByte>(element)), 0);
- break;
- case FORMAT_A8B8G8R8UI:
- c = Insert(c, Int(*Pointer<Byte>(element + 3)), 3);
- case FORMAT_X8B8G8R8UI:
- c = Insert(c, Int(*Pointer<Byte>(element + 2)), 2);
- case FORMAT_G8R8UI:
- c = Insert(c, Int(*Pointer<Byte>(element + 1)), 1);
- case FORMAT_R8UI:
- c = Insert(c, Int(*Pointer<Byte>(element)), 0);
- break;
- case FORMAT_A16B16G16R16I:
- c = Insert(c, Int(*Pointer<Short>(element + 6)), 3);
- case FORMAT_X16B16G16R16I:
- c = Insert(c, Int(*Pointer<Short>(element + 4)), 2);
- case FORMAT_G16R16I:
- c = Insert(c, Int(*Pointer<Short>(element + 2)), 1);
- case FORMAT_R16I:
- c = Insert(c, Int(*Pointer<Short>(element)), 0);
- break;
- case FORMAT_A16B16G16R16UI:
- c = Insert(c, Int(*Pointer<UShort>(element + 6)), 3);
- case FORMAT_X16B16G16R16UI:
- c = Insert(c, Int(*Pointer<UShort>(element + 4)), 2);
- case FORMAT_G16R16UI:
- c = Insert(c, Int(*Pointer<UShort>(element + 2)), 1);
- case FORMAT_R16UI:
- c = Insert(c, Int(*Pointer<UShort>(element)), 0);
- break;
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- c = *Pointer<Int4>(element);
- break;
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- c = Insert(c, *Pointer<Int>(element + 8), 2);
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- c = Insert(c, *Pointer<Int>(element + 4), 1);
- case FORMAT_R32I:
- case FORMAT_R32UI:
- c = Insert(c, *Pointer<Int>(element), 0);
- break;
- default:
- return false;
- }
-
- return true;
- }
-
- bool Blitter::write(Int4 &c, Pointer<Byte> element, const State &state)
- {
- bool writeR = state.writeRed;
- bool writeG = state.writeGreen;
- bool writeB = state.writeBlue;
- bool writeA = state.writeAlpha;
- bool writeRGBA = writeR && writeG && writeB && writeA;
-
- switch(state.destFormat)
- {
- case FORMAT_A8B8G8R8I:
- if(writeA) { *Pointer<SByte>(element + 3) = SByte(Extract(c, 3)); }
- case FORMAT_X8B8G8R8I:
- if(writeA && (state.destFormat != FORMAT_A8B8G8R8I))
- {
- *Pointer<SByte>(element + 3) = SByte(0x7F);
- }
- if(writeB) { *Pointer<SByte>(element + 2) = SByte(Extract(c, 2)); }
- case FORMAT_G8R8I:
- if(writeG) { *Pointer<SByte>(element + 1) = SByte(Extract(c, 1)); }
- case FORMAT_R8I:
- if(writeR) { *Pointer<SByte>(element) = SByte(Extract(c, 0)); }
- break;
- case FORMAT_A8B8G8R8UI:
- if(writeA) { *Pointer<Byte>(element + 3) = Byte(Extract(c, 3)); }
- case FORMAT_X8B8G8R8UI:
- if(writeA && (state.destFormat != FORMAT_A8B8G8R8UI))
- {
- *Pointer<Byte>(element + 3) = Byte(0xFF);
- }
- if(writeB) { *Pointer<Byte>(element + 2) = Byte(Extract(c, 2)); }
- case FORMAT_G8R8UI:
- if(writeG) { *Pointer<Byte>(element + 1) = Byte(Extract(c, 1)); }
- case FORMAT_R8UI:
- if(writeR) { *Pointer<Byte>(element) = Byte(Extract(c, 0)); }
- break;
- case FORMAT_A16B16G16R16I:
- if(writeA) { *Pointer<Short>(element + 6) = Short(Extract(c, 3)); }
- case FORMAT_X16B16G16R16I:
- if(writeA && (state.destFormat != FORMAT_A16B16G16R16I))
- {
- *Pointer<Short>(element + 6) = Short(0x7FFF);
- }
- if(writeB) { *Pointer<Short>(element + 4) = Short(Extract(c, 2)); }
- case FORMAT_G16R16I:
- if(writeG) { *Pointer<Short>(element + 2) = Short(Extract(c, 1)); }
- case FORMAT_R16I:
- if(writeR) { *Pointer<Short>(element) = Short(Extract(c, 0)); }
- break;
- case FORMAT_A16B16G16R16UI:
- if(writeA) { *Pointer<UShort>(element + 6) = UShort(Extract(c, 3)); }
- case FORMAT_X16B16G16R16UI:
- if(writeA && (state.destFormat != FORMAT_A16B16G16R16UI))
- {
- *Pointer<UShort>(element + 6) = UShort(0xFFFF);
- }
- if(writeB) { *Pointer<UShort>(element + 4) = UShort(Extract(c, 2)); }
- case FORMAT_G16R16UI:
- if(writeG) { *Pointer<UShort>(element + 2) = UShort(Extract(c, 1)); }
- case FORMAT_R16UI:
- if(writeR) { *Pointer<UShort>(element) = UShort(Extract(c, 0)); }
- break;
- case FORMAT_A32B32G32R32I:
- if(writeRGBA)
- {
- *Pointer<Int4>(element) = c;
- }
- else
- {
- if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
- if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
- if(writeB) { *Pointer<Int>(element + 8) = Extract(c, 2); }
- if(writeA) { *Pointer<Int>(element + 12) = Extract(c, 3); }
- }
- break;
- case FORMAT_X32B32G32R32I:
- if(writeRGBA)
- {
- *Pointer<Int4>(element) = c;
- }
- else
- {
- if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
- if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
- if(writeB) { *Pointer<Int>(element + 8) = Extract(c, 2); }
- }
- if(writeA) { *Pointer<Int>(element + 12) = Int(0x7FFFFFFF); }
- break;
- case FORMAT_G32R32I:
- if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
- if(writeG) { *Pointer<Int>(element + 4) = Extract(c, 1); }
- break;
- case FORMAT_R32I:
- if(writeR) { *Pointer<Int>(element) = Extract(c, 0); }
- break;
- case FORMAT_A32B32G32R32UI:
- if(writeRGBA)
- {
- *Pointer<UInt4>(element) = As<UInt4>(c);
- }
- else
- {
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
- if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
- if(writeA) { *Pointer<UInt>(element + 12) = As<UInt>(Extract(c, 3)); }
- }
- break;
- case FORMAT_X32B32G32R32UI:
- if(writeRGBA)
- {
- *Pointer<UInt4>(element) = As<UInt4>(c);
- }
- else
- {
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
- if(writeB) { *Pointer<UInt>(element + 8) = As<UInt>(Extract(c, 2)); }
- }
- if(writeA) { *Pointer<UInt>(element + 3) = UInt(0xFFFFFFFF); }
- break;
- case FORMAT_G32R32UI:
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
- if(writeG) { *Pointer<UInt>(element + 4) = As<UInt>(Extract(c, 1)); }
- break;
- case FORMAT_R32UI:
- if(writeR) { *Pointer<UInt>(element) = As<UInt>(Extract(c, 0)); }
- break;
- default:
- return false;
- }
-
- return true;
- }
-
- bool Blitter::GetScale(float4 &scale, Format format)
- {
- switch(format)
- {
- case FORMAT_L8:
- case FORMAT_A8:
- case FORMAT_A8R8G8B8:
- case FORMAT_X8R8G8B8:
- case FORMAT_R8:
- case FORMAT_G8R8:
- case FORMAT_R8G8B8:
- case FORMAT_B8G8R8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- scale = vector(0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- scale = vector(0x7F, 0x7F, 0x7F, 0x7F);
- break;
- case FORMAT_A16B16G16R16:
- scale = vector(0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF);
- break;
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_B32G32R32F:
- case FORMAT_G32R32F:
- case FORMAT_R32F:
- case FORMAT_A2B10G10R10UI:
- scale = vector(1.0f, 1.0f, 1.0f, 1.0f);
- break;
- case FORMAT_R5G6B5:
- scale = vector(0x1F, 0x3F, 0x1F, 1.0f);
- break;
- case FORMAT_A2B10G10R10:
- scale = vector(0x3FF, 0x3FF, 0x3FF, 0x03);
- break;
- case FORMAT_D16:
- scale = vector(0xFFFF, 0.0f, 0.0f, 0.0f);
- break;
- case FORMAT_D24S8:
- case FORMAT_D24X8:
- scale = vector(0xFFFFFF, 0.0f, 0.0f, 0.0f);
- break;
- case FORMAT_D32:
- scale = vector(static_cast<float>(0xFFFFFFFF), 0.0f, 0.0f, 0.0f);
- break;
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_S8:
- scale = vector(1.0f, 1.0f, 1.0f, 1.0f);
- break;
- default:
- return false;
- }
-
- return true;
- }
-
- bool Blitter::ApplyScaleAndClamp(Float4 &value, const State &state, bool preScaled)
- {
- float4 scale, unscale;
- if(state.clearOperation &&
- Surface::isNonNormalizedInteger(state.sourceFormat) &&
- !Surface::isNonNormalizedInteger(state.destFormat))
- {
- // If we're clearing a buffer from an int or uint color into a normalized color,
- // then the whole range of the int or uint color must be scaled between 0 and 1.
- switch(state.sourceFormat)
- {
- case FORMAT_A32B32G32R32I:
- unscale = replicate(static_cast<float>(0x7FFFFFFF));
- break;
- case FORMAT_A32B32G32R32UI:
- unscale = replicate(static_cast<float>(0xFFFFFFFF));
- break;
- default:
- return false;
- }
- }
- else if(!GetScale(unscale, state.sourceFormat))
- {
- return false;
- }
-
- if(!GetScale(scale, state.destFormat))
- {
- return false;
- }
-
- bool srcSRGB = Surface::isSRGBformat(state.sourceFormat);
- bool dstSRGB = Surface::isSRGBformat(state.destFormat);
-
- if(state.convertSRGB && ((srcSRGB && !preScaled) || dstSRGB)) // One of the formats is sRGB encoded.
- {
- value *= preScaled ? Float4(1.0f / scale.x, 1.0f / scale.y, 1.0f / scale.z, 1.0f / scale.w) : // Unapply scale
- Float4(1.0f / unscale.x, 1.0f / unscale.y, 1.0f / unscale.z, 1.0f / unscale.w); // Apply unscale
- value = (srcSRGB && !preScaled) ? sRGBtoLinear(value) : LinearToSRGB(value);
- value *= Float4(scale.x, scale.y, scale.z, scale.w); // Apply scale
- }
- else if(unscale != scale)
- {
- value *= Float4(scale.x / unscale.x, scale.y / unscale.y, scale.z / unscale.z, scale.w / unscale.w);
- }
-
- if(state.destFormat == FORMAT_X32B32G32R32F_UNSIGNED)
- {
- value = Max(value, Float4(0.0f)); // TODO: Only necessary if source is signed.
- }
- else if(Surface::isFloatFormat(state.sourceFormat) && !Surface::isFloatFormat(state.destFormat))
- {
- value = Min(value, Float4(scale.x, scale.y, scale.z, scale.w));
-
- value = Max(value, Float4(Surface::isUnsignedComponent(state.destFormat, 0) ? 0.0f : -scale.x,
- Surface::isUnsignedComponent(state.destFormat, 1) ? 0.0f : -scale.y,
- Surface::isUnsignedComponent(state.destFormat, 2) ? 0.0f : -scale.z,
- Surface::isUnsignedComponent(state.destFormat, 3) ? 0.0f : -scale.w));
- }
-
- return true;
- }
-
- Int Blitter::ComputeOffset(Int &x, Int &y, Int &pitchB, int bytes, bool quadLayout)
- {
- if(!quadLayout)
- {
- return y * pitchB + x * bytes;
- }
- else
- {
- // (x & ~1) * 2 + (x & 1) == (x - (x & 1)) * 2 + (x & 1) == x * 2 - (x & 1) * 2 + (x & 1) == x * 2 - (x & 1)
- return (y & Int(~1)) * pitchB +
- ((y & Int(1)) * 2 + x * 2 - (x & Int(1))) * bytes;
- }
- }
-
- Float4 Blitter::LinearToSRGB(Float4 &c)
- {
- Float4 lc = Min(c, Float4(0.0031308f)) * Float4(12.92f);
- Float4 ec = Float4(1.055f) * power(c, Float4(1.0f / 2.4f)) - Float4(0.055f);
-
- Float4 s = c;
- s.xyz = Max(lc, ec);
-
- return s;
- }
-
- Float4 Blitter::sRGBtoLinear(Float4 &c)
- {
- Float4 lc = c * Float4(1.0f / 12.92f);
- Float4 ec = power((c + Float4(0.055f)) * Float4(1.0f / 1.055f), Float4(2.4f));
-
- Int4 linear = CmpLT(c, Float4(0.04045f));
-
- Float4 s = c;
- s.xyz = As<Float4>((linear & As<Int4>(lc)) | (~linear & As<Int4>(ec))); // TODO: IfThenElse()
-
- return s;
- }
-
- std::shared_ptr<Routine> Blitter::generate(const State &state)
- {
- Function<Void(Pointer<Byte>)> function;
- {
- Pointer<Byte> blit(function.Arg<0>());
-
- Pointer<Byte> source = *Pointer<Pointer<Byte>>(blit + OFFSET(BlitData,source));
- Pointer<Byte> dest = *Pointer<Pointer<Byte>>(blit + OFFSET(BlitData,dest));
- Int sPitchB = *Pointer<Int>(blit + OFFSET(BlitData,sPitchB));
- Int dPitchB = *Pointer<Int>(blit + OFFSET(BlitData,dPitchB));
-
- Float x0 = *Pointer<Float>(blit + OFFSET(BlitData,x0));
- Float y0 = *Pointer<Float>(blit + OFFSET(BlitData,y0));
- Float w = *Pointer<Float>(blit + OFFSET(BlitData,w));
- Float h = *Pointer<Float>(blit + OFFSET(BlitData,h));
-
- Int x0d = *Pointer<Int>(blit + OFFSET(BlitData,x0d));
- Int x1d = *Pointer<Int>(blit + OFFSET(BlitData,x1d));
- Int y0d = *Pointer<Int>(blit + OFFSET(BlitData,y0d));
- Int y1d = *Pointer<Int>(blit + OFFSET(BlitData,y1d));
-
- Int sWidth = *Pointer<Int>(blit + OFFSET(BlitData,sWidth));
- Int sHeight = *Pointer<Int>(blit + OFFSET(BlitData,sHeight));
-
- bool intSrc = Surface::isNonNormalizedInteger(state.sourceFormat);
- bool intDst = Surface::isNonNormalizedInteger(state.destFormat);
- bool intBoth = intSrc && intDst;
- bool srcQuadLayout = Surface::hasQuadLayout(state.sourceFormat);
- bool dstQuadLayout = Surface::hasQuadLayout(state.destFormat);
- int srcBytes = Surface::bytes(state.sourceFormat);
- int dstBytes = Surface::bytes(state.destFormat);
-
- bool hasConstantColorI = false;
- Int4 constantColorI;
- bool hasConstantColorF = false;
- Float4 constantColorF;
- if(state.clearOperation)
- {
- if(intBoth) // Integer types
- {
- if(!read(constantColorI, source, state))
- {
- return nullptr;
- }
- hasConstantColorI = true;
- }
- else
- {
- if(!read(constantColorF, source, state))
- {
- return nullptr;
- }
- hasConstantColorF = true;
-
- if(!ApplyScaleAndClamp(constantColorF, state))
- {
- return nullptr;
- }
- }
- }
-
- For(Int j = y0d, j < y1d, j++)
- {
- Float y = state.clearOperation ? RValue<Float>(y0) : y0 + Float(j) * h;
- Pointer<Byte> destLine = dest + (dstQuadLayout ? j & Int(~1) : RValue<Int>(j)) * dPitchB;
-
- For(Int i = x0d, i < x1d, i++)
- {
- Float x = state.clearOperation ? RValue<Float>(x0) : x0 + Float(i) * w;
- Pointer<Byte> d = destLine + (dstQuadLayout ? (((j & Int(1)) << 1) + (i * 2) - (i & Int(1))) : RValue<Int>(i)) * dstBytes;
-
- if(hasConstantColorI)
- {
- if(!write(constantColorI, d, state))
- {
- return nullptr;
- }
- }
- else if(hasConstantColorF)
- {
- for(int s = 0; s < state.destSamples; s++)
- {
- if(!write(constantColorF, d, state))
- {
- return nullptr;
- }
-
- d += *Pointer<Int>(blit + OFFSET(BlitData, dSliceB));
- }
- }
- else if(intBoth) // Integer types do not support filtering
- {
- Int4 color; // When both formats are true integer types, we don't go to float to avoid losing precision
- Int X = Int(x);
- Int Y = Int(y);
-
- if(state.clampToEdge)
- {
- X = Clamp(X, 0, sWidth - 1);
- Y = Clamp(Y, 0, sHeight - 1);
- }
-
- Pointer<Byte> s = source + ComputeOffset(X, Y, sPitchB, srcBytes, srcQuadLayout);
-
- if(!read(color, s, state))
- {
- return nullptr;
- }
-
- if(!write(color, d, state))
- {
- return nullptr;
- }
- }
- else
- {
- Float4 color;
-
- bool preScaled = false;
- if(!state.filter || intSrc)
- {
- Int X = Int(x);
- Int Y = Int(y);
-
- if(state.clampToEdge)
- {
- X = Clamp(X, 0, sWidth - 1);
- Y = Clamp(Y, 0, sHeight - 1);
- }
-
- Pointer<Byte> s = source + ComputeOffset(X, Y, sPitchB, srcBytes, srcQuadLayout);
-
- if(!read(color, s, state))
- {
- return nullptr;
- }
- }
- else // Bilinear filtering
- {
- Float X = x;
- Float Y = y;
-
- if(state.clampToEdge)
- {
- X = Min(Max(x, 0.5f), Float(sWidth) - 0.5f);
- Y = Min(Max(y, 0.5f), Float(sHeight) - 0.5f);
- }
-
- Float x0 = X - 0.5f;
- Float y0 = Y - 0.5f;
-
- Int X0 = Max(Int(x0), 0);
- Int Y0 = Max(Int(y0), 0);
-
- Int X1 = X0 + 1;
- Int Y1 = Y0 + 1;
- X1 = IfThenElse(X1 >= sWidth, X0, X1);
- Y1 = IfThenElse(Y1 >= sHeight, Y0, Y1);
-
- Pointer<Byte> s00 = source + ComputeOffset(X0, Y0, sPitchB, srcBytes, srcQuadLayout);
- Pointer<Byte> s01 = source + ComputeOffset(X1, Y0, sPitchB, srcBytes, srcQuadLayout);
- Pointer<Byte> s10 = source + ComputeOffset(X0, Y1, sPitchB, srcBytes, srcQuadLayout);
- Pointer<Byte> s11 = source + ComputeOffset(X1, Y1, sPitchB, srcBytes, srcQuadLayout);
-
- Float4 c00; if(!read(c00, s00, state)) return nullptr;
- Float4 c01; if(!read(c01, s01, state)) return nullptr;
- Float4 c10; if(!read(c10, s10, state)) return nullptr;
- Float4 c11; if(!read(c11, s11, state)) return nullptr;
-
- if(state.convertSRGB && Surface::isSRGBformat(state.sourceFormat)) // sRGB -> RGB
- {
- if(!ApplyScaleAndClamp(c00, state)) return nullptr;
- if(!ApplyScaleAndClamp(c01, state)) return nullptr;
- if(!ApplyScaleAndClamp(c10, state)) return nullptr;
- if(!ApplyScaleAndClamp(c11, state)) return nullptr;
- preScaled = true;
- }
-
- Float4 fx = Float4(x0 - Float(X0));
- Float4 fy = Float4(y0 - Float(Y0));
- Float4 ix = Float4(1.0f) - fx;
- Float4 iy = Float4(1.0f) - fy;
-
- color = (c00 * ix + c01 * fx) * iy +
- (c10 * ix + c11 * fx) * fy;
- }
-
- if(!ApplyScaleAndClamp(color, state, preScaled))
- {
- return nullptr;
- }
-
- for(int s = 0; s < state.destSamples; s++)
- {
- if(!write(color, d, state))
- {
- return nullptr;
- }
-
- d += *Pointer<Int>(blit + OFFSET(BlitData,dSliceB));
- }
- }
- }
- }
- }
-
- return function("BlitRoutine");
- }
-
- bool Blitter::blitReactor(Surface *source, const SliceRectF &sourceRect, Surface *dest, const SliceRect &destRect, const Blitter::Options &options)
- {
- ASSERT(!options.clearOperation || ((source->getWidth() == 1) && (source->getHeight() == 1) && (source->getDepth() == 1)));
-
- Rect dRect = destRect;
- RectF sRect = sourceRect;
- if(destRect.x0 > destRect.x1)
- {
- swap(dRect.x0, dRect.x1);
- swap(sRect.x0, sRect.x1);
- }
- if(destRect.y0 > destRect.y1)
- {
- swap(dRect.y0, dRect.y1);
- swap(sRect.y0, sRect.y1);
- }
-
- State state(options);
- state.clampToEdge = (sourceRect.x0 < 0.0f) ||
- (sourceRect.y0 < 0.0f) ||
- (sourceRect.x1 > (float)source->getWidth()) ||
- (sourceRect.y1 > (float)source->getHeight());
-
- bool useSourceInternal = !source->isExternalDirty();
- bool useDestInternal = !dest->isExternalDirty();
- bool isStencil = options.useStencil;
-
- state.sourceFormat = isStencil ? source->getStencilFormat() : source->getFormat(useSourceInternal);
- state.destFormat = isStencil ? dest->getStencilFormat() : dest->getFormat(useDestInternal);
- state.destSamples = dest->getSamples();
-
- criticalSection.lock();
- auto blitRoutine = blitCache->query(state);
-
- if(!blitRoutine)
- {
- blitRoutine = generate(state);
-
- if(!blitRoutine)
- {
- criticalSection.unlock();
- return false;
- }
-
- blitCache->add(state, blitRoutine);
- }
-
- criticalSection.unlock();
-
- void (*blitFunction)(const BlitData *data) = (void(*)(const BlitData*))blitRoutine->getEntry();
-
- BlitData data;
-
- bool isRGBA = options.writeMask == 0xF;
- bool isEntireDest = dest->isEntire(destRect);
-
- data.source = isStencil ? source->lockStencil(0, 0, 0, sw::PUBLIC) :
- source->lock(0, 0, sourceRect.slice, sw::LOCK_READONLY, sw::PUBLIC, useSourceInternal);
- data.dest = isStencil ? dest->lockStencil(0, 0, 0, sw::PUBLIC) :
- dest->lock(0, 0, destRect.slice, isRGBA ? (isEntireDest ? sw::LOCK_DISCARD : sw::LOCK_WRITEONLY) : sw::LOCK_READWRITE, sw::PUBLIC, useDestInternal);
- data.sPitchB = isStencil ? source->getStencilPitchB() : source->getPitchB(useSourceInternal);
- data.dPitchB = isStencil ? dest->getStencilPitchB() : dest->getPitchB(useDestInternal);
- data.dSliceB = isStencil ? dest->getStencilSliceB() : dest->getSliceB(useDestInternal);
-
- data.w = sRect.width() / dRect.width();
- data.h = sRect.height() / dRect.height();
- data.x0 = sRect.x0 + (0.5f - dRect.x0) * data.w;
- data.y0 = sRect.y0 + (0.5f - dRect.y0) * data.h;
-
- data.x0d = dRect.x0;
- data.x1d = dRect.x1;
- data.y0d = dRect.y0;
- data.y1d = dRect.y1;
-
- data.sWidth = source->getWidth();
- data.sHeight = source->getHeight();
-
- blitFunction(&data);
-
- if(isStencil)
- {
- source->unlockStencil();
- dest->unlockStencil();
- }
- else
- {
- source->unlock(useSourceInternal);
- dest->unlock(useDestInternal);
- }
-
- return true;
- }
-}
diff --git a/src/Renderer/Blitter.hpp b/src/Renderer/Blitter.hpp
deleted file mode 100644
index c54606073..000000000
--- a/src/Renderer/Blitter.hpp
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Blitter_hpp
-#define sw_Blitter_hpp
-
-#include "Surface.hpp"
-#include "RoutineCache.hpp"
-#include "Reactor/Reactor.hpp"
-
-#include <string.h>
-
-namespace sw
-{
- class Blitter
- {
- struct Options
- {
- Options() = default;
- Options(bool filter, bool useStencil, bool convertSRGB)
- : writeMask(0xF), clearOperation(false), filter(filter), useStencil(useStencil), convertSRGB(convertSRGB), clampToEdge(false) {}
- Options(unsigned int writeMask)
- : writeMask(writeMask), clearOperation(true), filter(false), useStencil(false), convertSRGB(true), clampToEdge(false) {}
-
- union
- {
- struct
- {
- bool writeRed : 1;
- bool writeGreen : 1;
- bool writeBlue : 1;
- bool writeAlpha : 1;
- };
-
- unsigned char writeMask;
- };
-
- bool clearOperation : 1;
- bool filter : 1;
- bool useStencil : 1;
- bool convertSRGB : 1;
- bool clampToEdge : 1;
- };
-
- struct State : Memset<State>, Options
- {
- State() : Memset(this, 0) {}
- State(const Options &options) : Memset(this, 0), Options(options) {}
-
- bool operator==(const State &state) const
- {
- static_assert(is_memcmparable<State>::value, "Cannot memcmp State");
- return memcmp(this, &state, sizeof(State)) == 0;
- }
-
- Format sourceFormat;
- Format destFormat;
- int destSamples;
- };
-
- struct BlitData
- {
- void *source;
- void *dest;
- int sPitchB;
- int dPitchB;
- int dSliceB;
-
- float x0;
- float y0;
- float w;
- float h;
-
- int y0d;
- int y1d;
- int x0d;
- int x1d;
-
- int sWidth;
- int sHeight;
- };
-
- public:
- Blitter();
- virtual ~Blitter();
-
- void clear(void *pixel, sw::Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask);
- void blit(Surface *source, const SliceRectF &sRect, Surface *dest, const SliceRect &dRect, const Options &options);
- void blit3D(Surface *source, Surface *dest);
-
- private:
- bool fastClear(void *pixel, sw::Format format, Surface *dest, const SliceRect &dRect, unsigned int rgbaMask);
-
- bool read(Float4 &color, Pointer<Byte> element, const State &state);
- bool write(Float4 &color, Pointer<Byte> element, const State &state);
- bool read(Int4 &color, Pointer<Byte> element, const State &state);
- bool write(Int4 &color, Pointer<Byte> element, const State &state);
- static bool GetScale(float4& scale, Format format);
- static bool ApplyScaleAndClamp(Float4 &value, const State &state, bool preScaled = false);
- static Int ComputeOffset(Int &x, Int &y, Int &pitchB, int bytes, bool quadLayout);
- static Float4 LinearToSRGB(Float4 &color);
- static Float4 sRGBtoLinear(Float4 &color);
- bool blitReactor(Surface *source, const SliceRectF &sRect, Surface *dest, const SliceRect &dRect, const Options &options);
- std::shared_ptr<Routine> generate(const State &state);
-
- RoutineCache<State> *blitCache;
- MutexLock criticalSection;
- };
-}
-
-#endif // sw_Blitter_hpp
diff --git a/src/Renderer/Clipper.cpp b/src/Renderer/Clipper.cpp
deleted file mode 100644
index a100f0592..000000000
--- a/src/Renderer/Clipper.cpp
+++ /dev/null
@@ -1,359 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Clipper.hpp"
-
-#include "Polygon.hpp"
-#include "Renderer.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- Clipper::Clipper(bool symmetricNormalizedDepth)
- {
- n = symmetricNormalizedDepth ? -1.0f : 0.0f;
- }
-
- Clipper::~Clipper()
- {
- }
-
- unsigned int Clipper::computeClipFlags(const float4 &v)
- {
- return ((v.x > v.w) ? CLIP_RIGHT : 0) |
- ((v.y > v.w) ? CLIP_TOP : 0) |
- ((v.z > v.w) ? CLIP_FAR : 0) |
- ((v.x < -v.w) ? CLIP_LEFT : 0) |
- ((v.y < -v.w) ? CLIP_BOTTOM : 0) |
- ((v.z < n * v.w) ? CLIP_NEAR : 0) |
- Clipper::CLIP_FINITE; // FIXME: xyz finite
- }
-
- bool Clipper::clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw)
- {
- if(clipFlagsOr & CLIP_FRUSTUM)
- {
- if(clipFlagsOr & CLIP_NEAR) clipNear(polygon);
- if(polygon.n >= 3) {
- if(clipFlagsOr & CLIP_FAR) clipFar(polygon);
- if(polygon.n >= 3) {
- if(clipFlagsOr & CLIP_LEFT) clipLeft(polygon);
- if(polygon.n >= 3) {
- if(clipFlagsOr & CLIP_RIGHT) clipRight(polygon);
- if(polygon.n >= 3) {
- if(clipFlagsOr & CLIP_TOP) clipTop(polygon);
- if(polygon.n >= 3) {
- if(clipFlagsOr & CLIP_BOTTOM) clipBottom(polygon);
- }}}}}
- }
-
- if(clipFlagsOr & CLIP_USER)
- {
- int clipFlags = draw.clipFlags;
- DrawData &data = *draw.data;
-
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE0) clipPlane(polygon, data.clipPlane[0]);
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE1) clipPlane(polygon, data.clipPlane[1]);
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE2) clipPlane(polygon, data.clipPlane[2]);
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE3) clipPlane(polygon, data.clipPlane[3]);
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE4) clipPlane(polygon, data.clipPlane[4]);
- if(polygon.n >= 3) {
- if(clipFlags & CLIP_PLANE5) clipPlane(polygon, data.clipPlane[5]);
- }}}}}}
- }
-
- return polygon.n >= 3;
- }
-
- void Clipper::clipNear(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->z - n * V[i]->w;
- float dj = V[j]->z - n * V[j]->w;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipFar(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->w - V[i]->z;
- float dj = V[j]->w - V[j]->z;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipLeft(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->w + V[i]->x;
- float dj = V[j]->w + V[j]->x;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipRight(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->w - V[i]->x;
- float dj = V[j]->w - V[j]->x;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipTop(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->w - V[i]->y;
- float dj = V[j]->w - V[j]->y;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipBottom(Polygon &polygon)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = V[i]->w + V[i]->y;
- float dj = V[j]->w + V[j]->y;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- void Clipper::clipPlane(Polygon &polygon, const Plane &p)
- {
- const float4 **V = polygon.P[polygon.i];
- const float4 **T = polygon.P[polygon.i + 1];
-
- int t = 0;
-
- for(int i = 0; i < polygon.n; i++)
- {
- int j = i == polygon.n - 1 ? 0 : i + 1;
-
- float di = p.A * V[i]->x + p.B * V[i]->y + p.C * V[i]->z + p.D * V[i]->w;
- float dj = p.A * V[j]->x + p.B * V[j]->y + p.C * V[j]->z + p.D * V[j]->w;
-
- if(di >= 0)
- {
- T[t++] = V[i];
-
- if(dj < 0)
- {
- clipEdge(polygon.B[polygon.b], *V[i], *V[j], di, dj);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- else
- {
- if(dj > 0)
- {
- clipEdge(polygon.B[polygon.b], *V[j], *V[i], dj, di);
- T[t++] = &polygon.B[polygon.b++];
- }
- }
- }
-
- polygon.n = t;
- polygon.i += 1;
- }
-
- inline void Clipper::clipEdge(float4 &Vo, const float4 &Vi, const float4 &Vj, float di, float dj) const
- {
- float D = 1.0f / (dj - di);
-
- Vo.x = (dj * Vi.x - di * Vj.x) * D;
- Vo.y = (dj * Vi.y - di * Vj.y) * D;
- Vo.z = (dj * Vi.z - di * Vj.z) * D;
- Vo.w = (dj * Vi.w - di * Vj.w) * D;
- }
-}
diff --git a/src/Renderer/Clipper.hpp b/src/Renderer/Clipper.hpp
deleted file mode 100644
index 057153a9a..000000000
--- a/src/Renderer/Clipper.hpp
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Clipper_hpp
-#define sw_Clipper_hpp
-
-#include "Plane.hpp"
-#include "Common/Types.hpp"
-
-namespace sw
-{
- struct Polygon;
- struct DrawCall;
- struct DrawData;
-
- class Clipper
- {
- public:
- enum ClipFlags
- {
- // Indicates the vertex is outside the respective frustum plane
- CLIP_RIGHT = 1 << 0,
- CLIP_TOP = 1 << 1,
- CLIP_FAR = 1 << 2,
- CLIP_LEFT = 1 << 3,
- CLIP_BOTTOM = 1 << 4,
- CLIP_NEAR = 1 << 5,
-
- CLIP_FRUSTUM = 0x003F,
-
- CLIP_FINITE = 1 << 7, // All position coordinates are finite
-
- // User-defined clipping planes
- CLIP_PLANE0 = 1 << 8,
- CLIP_PLANE1 = 1 << 9,
- CLIP_PLANE2 = 1 << 10,
- CLIP_PLANE3 = 1 << 11,
- CLIP_PLANE4 = 1 << 12,
- CLIP_PLANE5 = 1 << 13,
-
- CLIP_USER = 0x3F00
- };
-
- Clipper(bool symmetricNormalizedDepth);
-
- ~Clipper();
-
- unsigned int computeClipFlags(const float4 &v);
- bool clip(Polygon &polygon, int clipFlagsOr, const DrawCall &draw);
-
- private:
- void clipNear(Polygon &polygon);
- void clipFar(Polygon &polygon);
- void clipLeft(Polygon &polygon);
- void clipRight(Polygon &polygon);
- void clipTop(Polygon &polygon);
- void clipBottom(Polygon &polygon);
- void clipPlane(Polygon &polygon, const Plane &plane);
-
- void clipEdge(float4 &Vo, const float4 &Vi, const float4 &Vj, float di, float dj) const;
-
- float n; // Near clip plane distance
- };
-}
-
-#endif // sw_Clipper_hpp
diff --git a/src/Renderer/Color.cpp b/src/Renderer/Color.cpp
deleted file mode 100644
index 9ad6767cb..000000000
--- a/src/Renderer/Color.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Color.hpp"
-
-namespace sw
-{
-}
diff --git a/src/Renderer/Color.hpp b/src/Renderer/Color.hpp
deleted file mode 100644
index 7afe61f14..000000000
--- a/src/Renderer/Color.hpp
+++ /dev/null
@@ -1,472 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Color_hpp
-#define sw_Color_hpp
-
-#include "Common/Types.hpp"
-#include "Common/Math.hpp"
-
-namespace sw
-{
- template<class T>
- struct Color
- {
- Color();
-
- Color(const Color<byte> &c);
- Color(const Color<short> &c);
- Color(const Color<float> &c);
-
- Color(int c);
- Color(unsigned short c);
- Color(unsigned long c);
- Color(unsigned int c);
-
- Color(T r, T g, T b, T a = 1);
-
- operator unsigned int() const;
-
- T &operator[](int i);
- const T &operator[](int i) const;
-
- Color<T> operator+() const;
- Color<T> operator-() const;
-
- Color<T>& operator=(const Color<T>& c);
-
- Color<T> &operator+=(const Color<T> &c);
- Color<T> &operator*=(float l);
-
- static Color<T> gradient(const Color<T> &c1, const Color<T> &c2, float d);
- static Color<T> shade(const Color<T> &c1, const Color<T> &c2, float d);
-
- template<class S>
- friend Color<S> operator+(const Color<S> &c1, const Color<S> &c2);
- template<class S>
- friend Color<S> operator-(const Color<S> &c1, const Color<S> &c2);
-
- template<class S>
- friend Color<S> operator*(float l, const Color<S> &c);
- template<class S>
- friend Color<S> operator*(const Color<S> &c1, const Color<S> &c2);
- template<class S>
- friend Color<S> operator/(const Color<S> &c, float l);
-
- T r;
- T g;
- T b;
- T a;
- };
-}
-
-#include "Common/Math.hpp"
-
-namespace sw
-{
- template<class T>
- inline Color<T>::Color()
- {
- }
-
- template<>
- inline Color<byte>::Color(const Color<byte> &c)
- {
- r = c.r;
- g = c.g;
- b = c.b;
- a = c.a;
- }
-
- template<>
- inline Color<byte>::Color(const Color<short> &c)
- {
- r = clamp(c.r >> 4, 0, 255);
- g = clamp(c.g >> 4, 0, 255);
- b = clamp(c.b >> 4, 0, 255);
- a = clamp(c.a >> 4, 0, 255);
- }
-
- template<>
- inline Color<byte>::Color(const Color<float> &c)
- {
- r = ifloor(clamp(c.r * 256.0f, 0.0f, 255.0f));
- g = ifloor(clamp(c.g * 256.0f, 0.0f, 255.0f));
- b = ifloor(clamp(c.b * 256.0f, 0.0f, 255.0f));
- a = ifloor(clamp(c.a * 256.0f, 0.0f, 255.0f));
- }
-
- template<>
- inline Color<short>::Color(const Color<short> &c)
- {
- r = c.r;
- g = c.g;
- b = c.b;
- a = c.a;
- }
-
- template<>
- inline Color<short>::Color(const Color<byte> &c)
- {
- r = c.r << 4;
- g = c.g << 4;
- b = c.b << 4;
- a = c.a << 4;
- }
-
- template<>
- inline Color<float>::Color(const Color<float> &c)
- {
- r = c.r;
- g = c.g;
- b = c.b;
- a = c.a;
- }
-
- template<>
- inline Color<short>::Color(const Color<float> &c)
- {
- r = iround(clamp(c.r * 4095.0f, -4096.0f, 4095.0f));
- g = iround(clamp(c.g * 4095.0f, -4096.0f, 4095.0f));
- b = iround(clamp(c.b * 4095.0f, -4096.0f, 4095.0f));
- a = iround(clamp(c.a * 4095.0f, -4096.0f, 4095.0f));
- }
-
- template<>
- inline Color<float>::Color(const Color<byte> &c)
- {
- r = c.r / 255.0f;
- g = c.g / 255.0f;
- b = c.b / 255.0f;
- a = c.a / 255.0f;
- }
-
- template<>
- inline Color<float>::Color(const Color<short> &c)
- {
- r = c.r / 4095.0f;
- g = c.g / 4095.0f;
- b = c.b / 4095.0f;
- a = c.a / 4095.0f;
- }
-
- template<>
- inline Color<float>::Color(unsigned short c)
- {
- r = (float)(c & 0xF800) / (float)0xF800;
- g = (float)(c & 0x07E0) / (float)0x07E0;
- b = (float)(c & 0x001F) / (float)0x001F;
- a = 1;
- }
-
- template<>
- inline Color<short>::Color(unsigned short c)
- {
- // 4.12 fixed-point format
- r = ((c & 0xF800) >> 4) + ((c & 0xF800) >> 9) + ((c & 0xF800) >> 14);
- g = ((c & 0x07E0) << 1) + ((c & 0x07E0) >> 5);
- b = ((c & 0x001F) << 7) + ((c & 0x001F) << 2) + ((c & 0x001F) >> 3);
- a = 0x1000;
- }
-
- template<>
- inline Color<byte>::Color(unsigned short c)
- {
- r = (byte)(((c & 0xF800) >> 8) + ((c & 0xE000) >> 13));
- g = (byte)(((c & 0x07E0) >> 3) + ((c & 0x0600) >> 9));
- b = (byte)(((c & 0x001F) << 3) + ((c & 0x001C) >> 2));
- a = 0xFF;
- }
-
- template<>
- inline Color<float>::Color(int c)
- {
- const float d = 1.0f / 255.0f;
-
- r = (float)((c & 0x00FF0000) >> 16) * d;
- g = (float)((c & 0x0000FF00) >> 8) * d;
- b = (float)((c & 0x000000FF) >> 0) * d;
- a = (float)((c & 0xFF000000) >> 24) * d;
- }
-
- template<>
- inline Color<short>::Color(int c)
- {
- // 4.12 fixed-point format
- r = (short)((c & 0x00FF0000) >> 12);
- g = (short)((c & 0x0000FF00) >> 4);
- b = (short)((c & 0x000000FF) << 4);
- a = (short)((c & 0xFF000000) >> 20);
- }
-
- template<>
- inline Color<byte>::Color(int c)
- {
- r = (byte)((c & 0x00FF0000) >> 16);
- g = (byte)((c & 0x0000FF00) >> 8);
- b = (byte)((c & 0x000000FF) >> 0);
- a = (byte)((c & 0xFF000000) >> 24);
- }
-
- template<>
- inline Color<float>::Color(unsigned int c)
- {
- const float d = 1.0f / 255.0f;
-
- r = (float)((c & 0x00FF0000) >> 16) * d;
- g = (float)((c & 0x0000FF00) >> 8) * d;
- b = (float)((c & 0x000000FF) >> 0) * d;
- a = (float)((c & 0xFF000000) >> 24) * d;
- }
-
- template<>
- inline Color<short>::Color(unsigned int c)
- {
- // 4.12 fixed-point format
- r = (short)((c & 0x00FF0000) >> 12);
- g = (short)((c & 0x0000FF00) >> 4);
- b = (short)((c & 0x000000FF) << 4);
- a = (short)((c & 0xFF000000) >> 20);
- }
-
- template<>
- inline Color<byte>::Color(unsigned int c)
- {
- r = (byte)((c & 0x00FF0000) >> 16);
- g = (byte)((c & 0x0000FF00) >> 8);
- b = (byte)((c & 0x000000FF) >> 0);
- a = (byte)((c & 0xFF000000) >> 24);
- }
-
- template<>
- inline Color<float>::Color(unsigned long c)
- {
- const float d = 1.0f / 255.0f;
-
- r = (float)((c & 0x00FF0000) >> 16) * d;
- g = (float)((c & 0x0000FF00) >> 8) * d;
- b = (float)((c & 0x000000FF) >> 0) * d;
- a = (float)((c & 0xFF000000) >> 24) * d;
- }
-
- template<>
- inline Color<short>::Color(unsigned long c)
- {
- // 4.12 fixed-point format
- r = (short)((c & 0x00FF0000) >> 12);
- g = (short)((c & 0x0000FF00) >> 4);
- b = (short)((c & 0x000000FF) << 4);
- a = (short)((c & 0xFF000000) >> 20);
- }
-
- template<>
- inline Color<byte>::Color(unsigned long c)
- {
- r = (byte)((c & 0x00FF0000) >> 16);
- g = (byte)((c & 0x0000FF00) >> 8);
- b = (byte)((c & 0x000000FF) >> 0);
- a = (byte)((c & 0xFF000000) >> 24);
- }
-
- template<class T>
- inline Color<T>::Color(T r_, T g_, T b_, T a_)
- {
- r = r_;
- g = g_;
- b = b_;
- a = a_;
- }
-
- template<>
- inline Color<float>::operator unsigned int() const
- {
- return ((unsigned int)min(b * 255.0f, 255.0f) << 0) |
- ((unsigned int)min(g * 255.0f, 255.0f) << 8) |
- ((unsigned int)min(r * 255.0f, 255.0f) << 16) |
- ((unsigned int)min(a * 255.0f, 255.0f) << 24);
- }
-
- template<>
- inline Color<short>::operator unsigned int() const
- {
- return ((unsigned int)min(b >> 4, 255) << 0) |
- ((unsigned int)min(g >> 4, 255) << 8) |
- ((unsigned int)min(r >> 4, 255) << 16) |
- ((unsigned int)min(a >> 4, 255) << 24);
- }
-
- template<>
- inline Color<byte>::operator unsigned int() const
- {
- return (b << 0) +
- (g << 8) +
- (r << 16) +
- (a << 24);
- }
-
- template<class T>
- inline T &Color<T>::operator[](int i)
- {
- return (&r)[i];
- }
-
- template<class T>
- inline const T &Color<T>::operator[](int i) const
- {
- return (&r)[i];
- }
-
- template<class T>
- inline Color<T> Color<T>::operator+() const
- {
- return *this;
- }
-
- template<class T>
- inline Color<T> Color<T>::operator-() const
- {
- return Color(-r, -g, -b, -a);
- }
-
- template<class T>
- inline Color<T> &Color<T>::operator=(const Color& c)
- {
- r = c.r;
- g = c.g;
- b = c.b;
- a = c.a;
-
- return *this;
- }
-
- template<class T>
- inline Color<T> &Color<T>::operator+=(const Color &c)
- {
- r += c.r;
- g += c.g;
- b += c.b;
- a += c.a;
-
- return *this;
- }
-
- template<class T>
- inline Color<T> &Color<T>::operator*=(float l)
- {
- *this = l * *this;
-
- return *this;
- }
-
- template<class T>
- inline Color<T> operator+(const Color<T> &c1, const Color<T> &c2)
- {
- return Color<T>(c1.r + c2.r,
- c1.g + c2.g,
- c1.b + c2.b,
- c1.a + c2.a);
- }
-
- template<class T>
- inline Color<T> operator-(const Color<T> &c1, const Color<T> &c2)
- {
- return Color<T>(c1.r - c2.r,
- c1.g - c2.g,
- c1.b - c2.b,
- c1.a - c2.a);
- }
-
- template<class T>
- inline Color<T> operator*(float l, const Color<T> &c)
- {
- T r = (T)(l * c.r);
- T g = (T)(l * c.g);
- T b = (T)(l * c.b);
- T a = (T)(l * c.a);
-
- return Color<T>(r, g, b, a);
- }
-
- template<class T>
- inline Color<T> operator*(const Color<T> &c1, const Color<T> &c2)
- {
- T r = c1.r * c2.r;
- T g = c1.g * c2.g;
- T b = c1.b * c2.b;
- T a = c1.a * c2.a;
-
- return Color<T>(r, g, b, a);
- }
-
- template<>
- inline Color<short> operator*(const Color<short> &c1, const Color<short> &c2)
- {
- short r = c1.r * c2.r >> 12;
- short g = c1.g * c2.g >> 12;
- short b = c1.b * c2.b >> 12;
- short a = c1.a * c2.a >> 12;
-
- return Color<short>(r, g, b, a);
- }
-
- template<>
- inline Color<byte> operator*(const Color<byte> &c1, const Color<byte> &c2)
- {
- byte r = c1.r * c2.r >> 8;
- byte g = c1.g * c2.g >> 8;
- byte b = c1.b * c2.b >> 8;
- byte a = c1.a * c2.a >> 8;
-
- return Color<byte>(r, g, b, a);
- }
-
- template<class T>
- inline Color<T> operator/(const Color<T> &c, float l)
- {
- l = 1.0f / l;
-
- T r = (T)(l * c.r);
- T g = (T)(l * c.g);
- T b = (T)(l * c.b);
- T a = (T)(l * c.a);
-
- return Color<T>(r, g, b, a);
- }
-
- template<class T>
- inline Color<T> Color<T>::gradient(const Color<T> &c1, const Color<T> &c2, float d)
- {
- d = 1.0f / d;
-
- T r = (c2.r - c1.r) * d;
- T g = (c2.g - c1.g) * d;
- T b = (c2.b - c1.b) * d;
- T a = (c2.a - c1.a) * d;
-
- return Color<T>(r, g, b, a);
- }
-
- template<class T>
- inline Color<T> Color<T>::shade(const Color<T> &c1, const Color<T> &c2, float d)
- {
- T r = c1.r + (T)(d * (c2.r - c1.r));
- T g = c1.g + (T)(d * (c2.g - c1.g));
- T b = c1.b + (T)(d * (c2.b - c1.b));
- T a = c1.a + (T)(d * (c2.a - c1.a));
-
- return Color<T>(r, g, b, a);
- }
-}
-
-#endif // sw_Color_hpp
diff --git a/src/Renderer/Context.cpp b/src/Renderer/Context.cpp
deleted file mode 100644
index ab54d0bb7..000000000
--- a/src/Renderer/Context.cpp
+++ /dev/null
@@ -1,1504 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Context.hpp"
-
-#include "Primitive.hpp"
-#include "Surface.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Shader/VertexShader.hpp"
-#include "Common/Memory.hpp"
-#include "Common/Debug.hpp"
-
-#include <string.h>
-
-namespace sw
-{
- extern bool perspectiveCorrection;
-
- bool halfIntegerCoordinates = false; // Pixel centers are not at integer coordinates
- bool symmetricNormalizedDepth = false; // [-1, 1] instead of [0, 1]
- bool booleanFaceRegister = false;
- bool fullPixelPositionRegister = false;
- bool leadingVertexFirst = false; // Flat shading uses first vertex, else last
- bool secondaryColor = false; // Specular lighting is applied after texturing
- bool colorsDefaultToZero = false;
-
- bool forceWindowed = false;
- bool quadLayoutEnabled = false;
- bool veryEarlyDepthTest = true;
- bool complementaryDepthBuffer = false;
- bool postBlendSRGB = false;
- bool exactColorRounding = false;
- TransparencyAntialiasing transparencyAntialiasing = TRANSPARENCY_NONE;
- bool forceClearRegisters = false;
-
- Context::Context()
- {
- init();
- }
-
- Context::~Context()
- {
- }
-
- void *Context::operator new(size_t bytes)
- {
- return allocate((unsigned int)bytes);
- }
-
- void Context::operator delete(void *pointer, size_t bytes)
- {
- deallocate(pointer);
- }
-
- bool Context::isDrawPoint(bool fillModeAware) const
- {
- switch(drawType)
- {
- case DRAW_POINTLIST:
- case DRAW_INDEXEDPOINTLIST8:
- case DRAW_INDEXEDPOINTLIST16:
- case DRAW_INDEXEDPOINTLIST32:
- return true;
- case DRAW_LINELIST:
- case DRAW_LINESTRIP:
- case DRAW_LINELOOP:
- case DRAW_INDEXEDLINELIST8:
- case DRAW_INDEXEDLINESTRIP8:
- case DRAW_INDEXEDLINELOOP8:
- case DRAW_INDEXEDLINELIST16:
- case DRAW_INDEXEDLINESTRIP16:
- case DRAW_INDEXEDLINELOOP16:
- case DRAW_INDEXEDLINELIST32:
- case DRAW_INDEXEDLINESTRIP32:
- case DRAW_INDEXEDLINELOOP32:
- return false;
- case DRAW_TRIANGLELIST:
- case DRAW_TRIANGLESTRIP:
- case DRAW_TRIANGLEFAN:
- case DRAW_INDEXEDTRIANGLELIST8:
- case DRAW_INDEXEDTRIANGLESTRIP8:
- case DRAW_INDEXEDTRIANGLEFAN8:
- case DRAW_INDEXEDTRIANGLELIST16:
- case DRAW_INDEXEDTRIANGLESTRIP16:
- case DRAW_INDEXEDTRIANGLEFAN16:
- case DRAW_INDEXEDTRIANGLELIST32:
- case DRAW_INDEXEDTRIANGLESTRIP32:
- case DRAW_INDEXEDTRIANGLEFAN32:
- return fillModeAware ? fillMode == FILL_VERTEX : false;
- case DRAW_QUADLIST:
- return false;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool Context::isDrawLine(bool fillModeAware) const
- {
- switch(drawType)
- {
- case DRAW_POINTLIST:
- case DRAW_INDEXEDPOINTLIST8:
- case DRAW_INDEXEDPOINTLIST16:
- case DRAW_INDEXEDPOINTLIST32:
- return false;
- case DRAW_LINELIST:
- case DRAW_LINESTRIP:
- case DRAW_LINELOOP:
- case DRAW_INDEXEDLINELIST8:
- case DRAW_INDEXEDLINESTRIP8:
- case DRAW_INDEXEDLINELOOP8:
- case DRAW_INDEXEDLINELIST16:
- case DRAW_INDEXEDLINESTRIP16:
- case DRAW_INDEXEDLINELOOP16:
- case DRAW_INDEXEDLINELIST32:
- case DRAW_INDEXEDLINESTRIP32:
- case DRAW_INDEXEDLINELOOP32:
- return true;
- case DRAW_TRIANGLELIST:
- case DRAW_TRIANGLESTRIP:
- case DRAW_TRIANGLEFAN:
- case DRAW_INDEXEDTRIANGLELIST8:
- case DRAW_INDEXEDTRIANGLESTRIP8:
- case DRAW_INDEXEDTRIANGLEFAN8:
- case DRAW_INDEXEDTRIANGLELIST16:
- case DRAW_INDEXEDTRIANGLESTRIP16:
- case DRAW_INDEXEDTRIANGLEFAN16:
- case DRAW_INDEXEDTRIANGLELIST32:
- case DRAW_INDEXEDTRIANGLESTRIP32:
- case DRAW_INDEXEDTRIANGLEFAN32:
- return fillModeAware ? fillMode == FILL_WIREFRAME : false;
- case DRAW_QUADLIST:
- return false;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool Context::isDrawTriangle(bool fillModeAware) const
- {
- switch(drawType)
- {
- case DRAW_POINTLIST:
- case DRAW_INDEXEDPOINTLIST8:
- case DRAW_INDEXEDPOINTLIST16:
- case DRAW_INDEXEDPOINTLIST32:
- return false;
- case DRAW_LINELIST:
- case DRAW_LINESTRIP:
- case DRAW_LINELOOP:
- case DRAW_INDEXEDLINELIST8:
- case DRAW_INDEXEDLINESTRIP8:
- case DRAW_INDEXEDLINELOOP8:
- case DRAW_INDEXEDLINELIST16:
- case DRAW_INDEXEDLINESTRIP16:
- case DRAW_INDEXEDLINELOOP16:
- case DRAW_INDEXEDLINELIST32:
- case DRAW_INDEXEDLINESTRIP32:
- case DRAW_INDEXEDLINELOOP32:
- return false;
- case DRAW_TRIANGLELIST:
- case DRAW_TRIANGLESTRIP:
- case DRAW_TRIANGLEFAN:
- case DRAW_INDEXEDTRIANGLELIST8:
- case DRAW_INDEXEDTRIANGLESTRIP8:
- case DRAW_INDEXEDTRIANGLEFAN8:
- case DRAW_INDEXEDTRIANGLELIST16:
- case DRAW_INDEXEDTRIANGLESTRIP16:
- case DRAW_INDEXEDTRIANGLEFAN16:
- case DRAW_INDEXEDTRIANGLELIST32:
- case DRAW_INDEXEDTRIANGLESTRIP32:
- case DRAW_INDEXEDTRIANGLEFAN32:
- return fillModeAware ? fillMode == FILL_SOLID : true;
- case DRAW_QUADLIST:
- // Quads are broken up into triangles
- return fillModeAware ? fillMode == FILL_SOLID : true;
- default:
- ASSERT(false);
- }
-
- return true;
- }
-
- void Context::init()
- {
- for(int i = 0; i < 8; i++)
- {
- textureStage[i].init(i, &sampler[i], (i >= 1) ? &textureStage[i - 1] : 0);
- }
-
- // Set vertex streams to null stream
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- input[i].defaults();
- }
-
- fogStart = 0.0f;
- fogEnd = 1.0f;
-
- for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++) textureWrap[i] = 0;
- for(int i = 0; i < 8; i++) texGen[i] = TEXGEN_PASSTHRU;
- for(int i = 0; i < 8; i++) textureTransformCount[i] = 0;
- for(int i = 0; i < 8; i++) textureTransformProject[i] = false;
- textureWrapActive = false;
- localViewer = true;
- normalizeNormals = false;
-
- for(int i = 0; i < RENDERTARGETS; ++i)
- {
- renderTarget[i] = nullptr;
- }
- depthBuffer = nullptr;
- stencilBuffer = nullptr;
-
- stencilEnable = false;
- stencilCompareMode = STENCIL_ALWAYS;
- stencilReference = 0;
- stencilMask = 0xFFFFFFFF;
- stencilFailOperation = OPERATION_KEEP;
- stencilPassOperation = OPERATION_KEEP;
- stencilZFailOperation = OPERATION_KEEP;
- stencilWriteMask = 0xFFFFFFFF;
-
- twoSidedStencil = false;
- stencilCompareModeCCW = STENCIL_ALWAYS;
- stencilReferenceCCW = 0;
- stencilMaskCCW = 0xFFFFFFFF;
- stencilFailOperationCCW = OPERATION_KEEP;
- stencilPassOperationCCW = OPERATION_KEEP;
- stencilZFailOperationCCW = OPERATION_KEEP;
- stencilWriteMaskCCW = 0xFFFFFFFF;
-
- setGlobalMipmapBias(0);
-
- lightingEnable = true;
- specularEnable = false;
- for(int i = 0; i < 8; i++) lightEnable[i] = false;
- for(int i = 0; i < 8; i++) worldLightPosition[i] = 0;
-
- alphaCompareMode = ALPHA_ALWAYS;
- alphaTestEnable = false;
- fillMode = FILL_SOLID;
- shadingMode = SHADING_GOURAUD;
-
- rasterizerDiscard = false;
-
- depthCompareMode = DEPTH_LESS;
- depthBufferEnable = true;
- depthWriteEnable = true;
-
- alphaBlendEnable = false;
- sourceBlendFactorState = BLEND_ONE;
- destBlendFactorState = BLEND_ZERO;
- blendOperationState = BLENDOP_ADD;
-
- separateAlphaBlendEnable = false;
- sourceBlendFactorStateAlpha = BLEND_ONE;
- destBlendFactorStateAlpha = BLEND_ZERO;
- blendOperationStateAlpha = BLENDOP_ADD;
-
- cullMode = CULL_CLOCKWISE;
- frontFacingCCW = true;
- alphaReference = 0.0f;
-
- depthBias = 0.0f;
- slopeDepthBias = 0.0f;
-
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- colorWriteMask[i] = 0x0000000F;
- }
-
- ambientMaterialSource = MATERIAL_MATERIAL;
- diffuseMaterialSource = MATERIAL_COLOR1;
- specularMaterialSource = MATERIAL_COLOR2;
- emissiveMaterialSource = MATERIAL_MATERIAL;
- colorVertexEnable = true;
-
- fogEnable = false;
- pixelFogMode = FOG_NONE;
- vertexFogMode = FOG_NONE;
- wBasedFog = false;
- rangeFogEnable = false;
-
- indexedVertexBlendEnable = false;
- vertexBlendMatrixCount = 0;
-
- pixelShader = 0;
- vertexShader = 0;
-
- instanceID = 0;
-
- occlusionEnabled = false;
- transformFeedbackQueryEnabled = false;
- transformFeedbackEnabled = 0;
-
- pointSpriteEnable = false;
- pointScaleEnable = false;
- lineWidth = 1.0f;
-
- writeSRGB = false;
- sampleMask = 0xFFFFFFFF;
-
- colorLogicOpEnabled = false;
- logicalOperation = LOGICALOP_COPY;
- }
-
- const float &Context::exp2Bias()
- {
- return bias;
- }
-
- const Point &Context::getLightPosition(int light)
- {
- return worldLightPosition[light];
- }
-
- void Context::setGlobalMipmapBias(float bias)
- {
- this->bias = exp2(bias + 0.5f);
- }
-
- void Context::setLightingEnable(bool lightingEnable)
- {
- this->lightingEnable = lightingEnable;
- }
-
- void Context::setSpecularEnable(bool specularEnable)
- {
- Context::specularEnable = specularEnable;
- }
-
- void Context::setLightEnable(int light, bool lightEnable)
- {
- Context::lightEnable[light] = lightEnable;
- }
-
- void Context::setLightPosition(int light, Point worldLightPosition)
- {
- Context::worldLightPosition[light] = worldLightPosition;
- }
-
- void Context::setAmbientMaterialSource(MaterialSource ambientMaterialSource)
- {
- Context::ambientMaterialSource = ambientMaterialSource;
- }
-
- void Context::setDiffuseMaterialSource(MaterialSource diffuseMaterialSource)
- {
- Context::diffuseMaterialSource = diffuseMaterialSource;
- }
-
- void Context::setSpecularMaterialSource(MaterialSource specularMaterialSource)
- {
- Context::specularMaterialSource = specularMaterialSource;
- }
-
- void Context::setEmissiveMaterialSource(MaterialSource emissiveMaterialSource)
- {
- Context::emissiveMaterialSource = emissiveMaterialSource;
- }
-
- void Context::setPointSpriteEnable(bool pointSpriteEnable)
- {
- Context::pointSpriteEnable = pointSpriteEnable;
- }
-
- void Context::setPointScaleEnable(bool pointScaleEnable)
- {
- Context::pointScaleEnable = pointScaleEnable;
- }
-
- bool Context::setDepthBufferEnable(bool depthBufferEnable)
- {
- bool modified = (Context::depthBufferEnable != depthBufferEnable);
- Context::depthBufferEnable = depthBufferEnable;
- return modified;
- }
-
- bool Context::setAlphaBlendEnable(bool alphaBlendEnable)
- {
- bool modified = (Context::alphaBlendEnable != alphaBlendEnable);
- Context::alphaBlendEnable = alphaBlendEnable;
- return modified;
- }
-
- bool Context::setSourceBlendFactor(BlendFactor sourceBlendFactor)
- {
- bool modified = (Context::sourceBlendFactorState != sourceBlendFactor);
- Context::sourceBlendFactorState = sourceBlendFactor;
- return modified;
- }
-
- bool Context::setDestBlendFactor(BlendFactor destBlendFactor)
- {
- bool modified = (Context::destBlendFactorState != destBlendFactor);
- Context::destBlendFactorState = destBlendFactor;
- return modified;
- }
-
- bool Context::setBlendOperation(BlendOperation blendOperation)
- {
- bool modified = (Context::blendOperationState != blendOperation);
- Context::blendOperationState = blendOperation;
- return modified;
- }
-
- bool Context::setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable)
- {
- bool modified = (Context::separateAlphaBlendEnable != separateAlphaBlendEnable);
- Context::separateAlphaBlendEnable = separateAlphaBlendEnable;
- return modified;
- }
-
- bool Context::setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha)
- {
- bool modified = (Context::sourceBlendFactorStateAlpha != sourceBlendFactorAlpha);
- Context::sourceBlendFactorStateAlpha = sourceBlendFactorAlpha;
- return modified;
- }
-
- bool Context::setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha)
- {
- bool modified = (Context::destBlendFactorStateAlpha != destBlendFactorAlpha);
- Context::destBlendFactorStateAlpha = destBlendFactorAlpha;
- return modified;
- }
-
- bool Context::setBlendOperationAlpha(BlendOperation blendOperationAlpha)
- {
- bool modified = (Context::blendOperationStateAlpha != blendOperationAlpha);
- Context::blendOperationStateAlpha = blendOperationAlpha;
- return modified;
- }
-
- bool Context::setColorWriteMask(int index, int colorWriteMask)
- {
- bool modified = (Context::colorWriteMask[index] != colorWriteMask);
- Context::colorWriteMask[index] = colorWriteMask;
- return modified;
- }
-
- bool Context::setWriteSRGB(bool sRGB)
- {
- bool modified = (Context::writeSRGB != sRGB);
- Context::writeSRGB = sRGB;
- return modified;
- }
-
- bool Context::setColorLogicOpEnabled(bool enabled)
- {
- bool modified = (Context::colorLogicOpEnabled != enabled);
- Context::colorLogicOpEnabled = enabled;
- return modified;
- }
-
- bool Context::setLogicalOperation(LogicalOperation logicalOperation)
- {
- bool modified = (Context::logicalOperation != logicalOperation);
- Context::logicalOperation = logicalOperation;
- return modified;
- }
-
- void Context::setColorVertexEnable(bool colorVertexEnable)
- {
- Context::colorVertexEnable = colorVertexEnable;
- }
-
- bool Context::fogActive()
- {
- if(!colorUsed()) return false;
-
- if(pixelShaderModel() >= 0x0300) return false;
-
- return fogEnable;
- }
-
- bool Context::pointSizeActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return isDrawPoint(true) && (input[PointSize] || (!preTransformed && pointScaleActive()));
- }
-
- FogMode Context::pixelFogActive()
- {
- if(fogActive())
- {
- return pixelFogMode;
- }
-
- return FOG_NONE;
- }
-
- bool Context::depthWriteActive()
- {
- if(!depthBufferActive()) return false;
-
- return depthWriteEnable;
- }
-
- bool Context::alphaTestActive()
- {
- if(transparencyAntialiasing != TRANSPARENCY_NONE) return true;
- if(!alphaTestEnable) return false;
- if(alphaCompareMode == ALPHA_ALWAYS) return false;
- if(alphaReference == 0.0f && alphaCompareMode == ALPHA_GREATEREQUAL) return false;
-
- return true;
- }
-
- bool Context::depthBufferActive()
- {
- return depthBuffer && depthBufferEnable;
- }
-
- bool Context::stencilActive()
- {
- return stencilBuffer && stencilEnable;
- }
-
- bool Context::vertexLightingActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return lightingEnable && !preTransformed;
- }
-
- bool Context::texCoordActive(int coordinate, int component)
- {
- bool hasTexture = pointSpriteActive();
-
- if(vertexShader)
- {
- if(!preTransformed)
- {
- if(vertexShader->getOutput(T0 + coordinate, component).usage == Shader::USAGE_TEXCOORD)
- {
- hasTexture = true;
- }
- }
- else
- {
- hasTexture = true; // FIXME: Check vertex buffer streams
- }
- }
- else
- {
- switch(texGen[coordinate])
- {
- case TEXGEN_NONE:
- hasTexture = true;
- break;
- case TEXGEN_PASSTHRU:
- hasTexture = hasTexture || (component < input[TexCoord0 + textureStage[coordinate].texCoordIndex].count);
- break;
- case TEXGEN_NORMAL:
- hasTexture = hasTexture || (component <= 2);
- break;
- case TEXGEN_POSITION:
- hasTexture = hasTexture || (component <= 2);
- break;
- case TEXGEN_REFLECTION:
- hasTexture = hasTexture || (component <= 2);
- break;
- case TEXGEN_SPHEREMAP:
- hasTexture = hasTexture || (component <= 1);
- break;
- default:
- ASSERT(false);
- }
- }
-
- bool project = isProjectionComponent(coordinate, component);
- bool usesTexture = false;
-
- if(pixelShader)
- {
- usesTexture = pixelShader->usesTexture(coordinate, component) || project;
- }
- else
- {
- usesTexture = textureStage[coordinate].usesTexture() || project;
- }
-
- return hasTexture && usesTexture;
- }
-
- bool Context::texCoordActive(int coordinate)
- {
- return texCoordActive(coordinate, 0) ||
- texCoordActive(coordinate, 1) ||
- texCoordActive(coordinate, 2) ||
- texCoordActive(coordinate, 3);
- }
-
- bool Context::isProjectionComponent(unsigned int coordinate, int component)
- {
- if(pixelShaderModel() <= 0x0103 && coordinate < 8 && textureTransformProject[coordinate])
- {
- if(textureTransformCount[coordinate] == 2)
- {
- if(component == 1) return true;
- }
- else if(textureTransformCount[coordinate] == 3)
- {
- if(component == 2) return true;
- }
- else if(textureTransformCount[coordinate] == 4 || textureTransformCount[coordinate] == 0)
- {
- if(component == 3) return true;
- }
- }
-
- return false;
- }
-
- bool Context::vertexSpecularActive()
- {
- return vertexLightingActive() && specularEnable && vertexNormalActive();
- }
-
- bool Context::vertexNormalActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return input[Normal];
- }
-
- bool Context::vertexLightActive(int i)
- {
- if(vertexShader)
- {
- return false;
- }
-
- return lightingEnable && lightEnable[i];
- }
-
- MaterialSource Context::vertexDiffuseMaterialSourceActive()
- {
- if(vertexShader)
- {
- return MATERIAL_MATERIAL;
- }
-
- if(diffuseMaterialSource == MATERIAL_MATERIAL || !colorVertexEnable ||
- (diffuseMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
- (diffuseMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
- {
- return MATERIAL_MATERIAL;
- }
-
- return diffuseMaterialSource;
- }
-
- MaterialSource Context::vertexSpecularMaterialSourceActive()
- {
- if(vertexShader)
- {
- return MATERIAL_MATERIAL;
- }
-
- if(!colorVertexEnable ||
- (specularMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
- (specularMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
- {
- return MATERIAL_MATERIAL;
- }
-
- return specularMaterialSource;
- }
-
- MaterialSource Context::vertexAmbientMaterialSourceActive()
- {
- if(vertexShader)
- {
- return MATERIAL_MATERIAL;
- }
-
- if(!colorVertexEnable ||
- (ambientMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
- (ambientMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
- {
- return MATERIAL_MATERIAL;
- }
-
- return ambientMaterialSource;
- }
-
- MaterialSource Context::vertexEmissiveMaterialSourceActive()
- {
- if(vertexShader)
- {
- return MATERIAL_MATERIAL;
- }
-
- if(!colorVertexEnable ||
- (emissiveMaterialSource == MATERIAL_COLOR1 && !input[Color0]) ||
- (emissiveMaterialSource == MATERIAL_COLOR2 && !input[Color1]))
- {
- return MATERIAL_MATERIAL;
- }
-
- return emissiveMaterialSource;
- }
-
- bool Context::pointSpriteActive()
- {
- return isDrawPoint(true) && pointSpriteEnable;
- }
-
- bool Context::pointScaleActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return isDrawPoint(true) && pointScaleEnable;
- }
-
- bool Context::alphaBlendActive()
- {
- if(!alphaBlendEnable)
- {
- return false;
- }
-
- if(!colorUsed())
- {
- return false;
- }
-
- bool colorBlend = !(blendOperation() == BLENDOP_SOURCE && sourceBlendFactor() == BLEND_ONE);
- bool alphaBlend = separateAlphaBlendEnable ? !(blendOperationAlpha() == BLENDOP_SOURCE && sourceBlendFactorAlpha() == BLEND_ONE) : colorBlend;
-
- return colorBlend || alphaBlend;
- }
-
- LogicalOperation Context::colorLogicOp()
- {
- return colorLogicOpEnabled ? logicalOperation : LOGICALOP_COPY;
- }
-
- BlendFactor Context::sourceBlendFactor()
- {
- if(!alphaBlendEnable) return BLEND_ONE;
-
- switch(blendOperationState)
- {
- case BLENDOP_ADD:
- case BLENDOP_SUB:
- case BLENDOP_INVSUB:
- return sourceBlendFactorState;
- case BLENDOP_MIN:
- return BLEND_ONE;
- case BLENDOP_MAX:
- return BLEND_ONE;
- default:
- ASSERT(false);
- }
-
- return sourceBlendFactorState;
- }
-
- BlendFactor Context::destBlendFactor()
- {
- if(!alphaBlendEnable) return BLEND_ZERO;
-
- switch(blendOperationState)
- {
- case BLENDOP_ADD:
- case BLENDOP_SUB:
- case BLENDOP_INVSUB:
- return destBlendFactorState;
- case BLENDOP_MIN:
- return BLEND_ONE;
- case BLENDOP_MAX:
- return BLEND_ONE;
- default:
- ASSERT(false);
- }
-
- return destBlendFactorState;
- }
-
- BlendOperation Context::blendOperation()
- {
- if(!alphaBlendEnable) return BLENDOP_SOURCE;
-
- switch(blendOperationState)
- {
- case BLENDOP_ADD:
- if(sourceBlendFactor() == BLEND_ZERO)
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_NULL;
- }
- else
- {
- return BLENDOP_DEST;
- }
- }
- else if(sourceBlendFactor() == BLEND_ONE)
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_ADD;
- }
- }
- else
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_ADD;
- }
- }
- case BLENDOP_SUB:
- if(sourceBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else if(sourceBlendFactor() == BLEND_ONE)
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_SUB;
- }
- }
- else
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_SUB;
- }
- }
- case BLENDOP_INVSUB:
- if(sourceBlendFactor() == BLEND_ZERO)
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_NULL;
- }
- else
- {
- return BLENDOP_DEST;
- }
- }
- else if(sourceBlendFactor() == BLEND_ONE)
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else
- {
- return BLENDOP_INVSUB;
- }
- }
- else
- {
- if(destBlendFactor() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else
- {
- return BLENDOP_INVSUB;
- }
- }
- case BLENDOP_MIN:
- return BLENDOP_MIN;
- case BLENDOP_MAX:
- return BLENDOP_MAX;
- default:
- ASSERT(false);
- }
-
- return blendOperationState;
- }
-
- BlendFactor Context::sourceBlendFactorAlpha()
- {
- if(!separateAlphaBlendEnable)
- {
- return sourceBlendFactor();
- }
- else
- {
- switch(blendOperationStateAlpha)
- {
- case BLENDOP_ADD:
- case BLENDOP_SUB:
- case BLENDOP_INVSUB:
- return sourceBlendFactorStateAlpha;
- case BLENDOP_MIN:
- return BLEND_ONE;
- case BLENDOP_MAX:
- return BLEND_ONE;
- default:
- ASSERT(false);
- }
-
- return sourceBlendFactorStateAlpha;
- }
- }
-
- BlendFactor Context::destBlendFactorAlpha()
- {
- if(!separateAlphaBlendEnable)
- {
- return destBlendFactor();
- }
- else
- {
- switch(blendOperationStateAlpha)
- {
- case BLENDOP_ADD:
- case BLENDOP_SUB:
- case BLENDOP_INVSUB:
- return destBlendFactorStateAlpha;
- case BLENDOP_MIN:
- return BLEND_ONE;
- case BLENDOP_MAX:
- return BLEND_ONE;
- default:
- ASSERT(false);
- }
-
- return destBlendFactorStateAlpha;
- }
- }
-
- BlendOperation Context::blendOperationAlpha()
- {
- if(!separateAlphaBlendEnable)
- {
- return blendOperation();
- }
- else
- {
- switch(blendOperationStateAlpha)
- {
- case BLENDOP_ADD:
- if(sourceBlendFactorAlpha() == BLEND_ZERO)
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_NULL;
- }
- else
- {
- return BLENDOP_DEST;
- }
- }
- else if(sourceBlendFactorAlpha() == BLEND_ONE)
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_ADD;
- }
- }
- else
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_ADD;
- }
- }
- case BLENDOP_SUB:
- if(sourceBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else if(sourceBlendFactorAlpha() == BLEND_ONE)
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_SUB;
- }
- }
- else
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_SOURCE;
- }
- else
- {
- return BLENDOP_SUB;
- }
- }
- case BLENDOP_INVSUB:
- if(sourceBlendFactorAlpha() == BLEND_ZERO)
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_NULL;
- }
- else
- {
- return BLENDOP_DEST;
- }
- }
- else if(sourceBlendFactorAlpha() == BLEND_ONE)
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else
- {
- return BLENDOP_INVSUB;
- }
- }
- else
- {
- if(destBlendFactorAlpha() == BLEND_ZERO)
- {
- return BLENDOP_NULL; // Negative, clamped to zero
- }
- else
- {
- return BLENDOP_INVSUB;
- }
- }
- case BLENDOP_MIN:
- return BLENDOP_MIN;
- case BLENDOP_MAX:
- return BLENDOP_MAX;
- default:
- ASSERT(false);
- }
-
- return blendOperationStateAlpha;
- }
- }
-
- bool Context::indexedVertexBlendActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return indexedVertexBlendEnable;
- }
-
- int Context::vertexBlendMatrixCountActive()
- {
- if(vertexShader)
- {
- return 0;
- }
-
- return vertexBlendMatrixCount;
- }
-
- bool Context::localViewerActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return localViewer;
- }
-
- bool Context::normalizeNormalsActive()
- {
- if(vertexShader)
- {
- return false;
- }
-
- return normalizeNormals;
- }
-
- FogMode Context::vertexFogModeActive()
- {
- if(vertexShader || !fogActive())
- {
- return FOG_NONE;
- }
-
- return vertexFogMode;
- }
-
- bool Context::rangeFogActive()
- {
- if(vertexShader || !fogActive())
- {
- return false;
- }
-
- return rangeFogEnable;
- }
-
- TexGen Context::texGenActive(int stage)
- {
- if(vertexShader || !texCoordActive(stage))
- {
- return TEXGEN_PASSTHRU;
- }
-
- return texGen[stage];
- }
-
- int Context::textureTransformCountActive(int stage)
- {
- if(vertexShader || !texCoordActive(stage))
- {
- return 0;
- }
-
- return textureTransformCount[stage];
- }
-
- int Context::texCoordIndexActive(int stage)
- {
- if(vertexShader || !texCoordActive(stage))
- {
- return stage;
- }
-
- return textureStage[stage].texCoordIndex;
- }
-
- bool Context::perspectiveActive()
- {
- if(!colorUsed())
- {
- return false;
- }
-
- if(!perspectiveCorrection)
- {
- return false;
- }
-
- if(isDrawPoint(true))
- {
- return false;
- }
-
- return true;
- }
-
- bool Context::diffuseUsed()
- {
- return diffuseUsed(0) || diffuseUsed(1) || diffuseUsed(2) || diffuseUsed(3);
- }
-
- bool Context::diffuseUsed(int component)
- {
- if(!colorUsed())
- {
- return false;
- }
-
- if(pixelShader)
- {
- return pixelShader->usesDiffuse(component);
- }
-
- // Directly using the diffuse input color
- for(int i = 0; i < 8; i++)
- {
- if(textureStage[i].isStageDisabled())
- {
- break;
- }
-
- if(textureStage[i].usesDiffuse())
- {
- return true;
- }
- }
-
- // Using the current color (initialized to diffuse) before it's overwritten
- for(int i = 0; i < 8; i++)
- {
- if(textureStage[i].usesCurrent() || textureStage[i].isStageDisabled()) // Current color contains diffuse before being overwritten
- {
- return true;
- }
-
- if(textureStage[i].writesCurrent())
- {
- return false;
- }
- }
-
- return true;
- }
-
- bool Context::diffuseActive()
- {
- return diffuseActive(0) || diffuseActive(1) || diffuseActive(2) || diffuseActive(3);
- }
-
- bool Context::diffuseActive(int component)
- {
- if(!colorUsed())
- {
- return false;
- }
-
- // Vertex processor provides diffuse component
- bool vertexDiffuse;
-
- if(vertexShader)
- {
- vertexDiffuse = vertexShader->getOutput(C0, component).active();
- }
- else if(!preTransformed)
- {
- vertexDiffuse = input[Color0] || lightingEnable;
- }
- else
- {
- vertexDiffuse = input[Color0];
- }
-
- // Pixel processor requires diffuse component
- bool pixelDiffuse = diffuseUsed(component);
-
- return vertexDiffuse && pixelDiffuse;
- }
-
- bool Context::specularUsed()
- {
- return Context::specularUsed(0) || Context::specularUsed(1) || Context::specularUsed(2) || Context::specularUsed(3);
- }
-
- bool Context::specularUsed(int component)
- {
- if(!colorUsed())
- {
- return false;
- }
-
- if(pixelShader)
- {
- return pixelShader->usesSpecular(component);
- }
-
- bool pixelSpecular = specularEnable;
-
- for(int i = 0; i < 8; i++)
- {
- if(textureStage[i].isStageDisabled()) break;
-
- pixelSpecular = pixelSpecular || textureStage[i].usesSpecular();
- }
-
- return pixelSpecular;
- }
-
- bool Context::specularActive()
- {
- return specularActive(0) || specularActive(1) || specularActive(2) || specularActive(3);
- }
-
- bool Context::specularActive(int component)
- {
- if(!colorUsed())
- {
- return false;
- }
-
- // Vertex processor provides specular component
- bool vertexSpecular;
-
- if(!vertexShader)
- {
- vertexSpecular = input[Color1] || (lightingEnable && specularEnable);
- }
- else
- {
- vertexSpecular = vertexShader->getOutput(C1, component).active();
- }
-
- // Pixel processor requires specular component
- bool pixelSpecular = specularUsed(component);
-
- return vertexSpecular && pixelSpecular;
- }
-
- bool Context::colorActive(int color, int component)
- {
- if(color == 0)
- {
- return diffuseActive(component);
- }
- else
- {
- return specularActive(component);
- }
- }
-
- bool Context::textureActive()
- {
- for(int i = 0; i < 8; i++)
- {
- if(textureActive(i))
- {
- return true;
- }
- }
-
- return false;
- }
-
- bool Context::textureActive(int coordinate)
- {
- return textureActive(coordinate, 0) || textureActive(coordinate, 1) || textureActive(coordinate, 2) || textureActive(coordinate, 3);
- }
-
- bool Context::textureActive(int coordinate, int component)
- {
- if(!colorUsed())
- {
- return false;
- }
-
- if(!texCoordActive(coordinate, component))
- {
- return false;
- }
-
- if(textureTransformProject[coordinate] && pixelShaderModel() <= 0x0103)
- {
- if(textureTransformCount[coordinate] == 2)
- {
- if(component == 1) return true;
- }
- else if(textureTransformCount[coordinate] == 3)
- {
- if(component == 2) return true;
- }
- else if(textureTransformCount[coordinate] == 4 || textureTransformCount[coordinate] == 0)
- {
- if(component == 3) return true;
- }
- }
-
- if(!pixelShader)
- {
- bool texture = textureStage[coordinate].usesTexture();
- bool cube = sampler[coordinate].hasCubeTexture();
- bool volume = sampler[coordinate].hasVolumeTexture();
-
- if(texture)
- {
- for(int i = coordinate; i >= 0; i--)
- {
- if(textureStage[i].stageOperation == TextureStage::STAGE_DISABLE)
- {
- return false;
- }
- }
- }
-
- switch(component)
- {
- case 0:
- return texture;
- case 1:
- return texture;
- case 2:
- return (texture && (cube || volume));
- case 3:
- return false;
- }
- }
- else
- {
- return pixelShader->usesTexture(coordinate, component);
- }
-
- return false;
- }
-
- unsigned short Context::pixelShaderModel() const
- {
- return pixelShader ? pixelShader->getShaderModel() : 0x0000;
- }
-
- unsigned short Context::vertexShaderModel() const
- {
- return vertexShader ? vertexShader->getShaderModel() : 0x0000;
- }
-
- int Context::getMultiSampleCount() const
- {
- return renderTarget[0] ? renderTarget[0]->getMultiSampleCount() : 1;
- }
-
- int Context::getSuperSampleCount() const
- {
- return renderTarget[0] ? renderTarget[0]->getSuperSampleCount() : 1;
- }
-
- Format Context::renderTargetInternalFormat(int index)
- {
- if(renderTarget[index])
- {
- return renderTarget[index]->getInternalFormat();
- }
- else
- {
- return FORMAT_NULL;
- }
- }
-
- bool Context::colorWriteActive()
- {
- for (int i = 0; i < RENDERTARGETS; i++)
- {
- if (colorWriteActive(i))
- {
- return true;
- }
- }
-
- return false;
- }
-
- int Context::colorWriteActive(int index)
- {
- if(!renderTarget[index] || renderTarget[index]->getInternalFormat() == FORMAT_NULL)
- {
- return 0;
- }
-
- if(blendOperation() == BLENDOP_DEST && destBlendFactor() == BLEND_ONE &&
- (!separateAlphaBlendEnable || (blendOperationAlpha() == BLENDOP_DEST && destBlendFactorAlpha() == BLEND_ONE)))
- {
- return 0;
- }
-
- return colorWriteMask[index];
- }
-
- bool Context::colorUsed()
- {
- return colorWriteActive() || alphaTestActive() || (pixelShader && pixelShader->containsKill());
- }
-}
diff --git a/src/Renderer/Context.hpp b/src/Renderer/Context.hpp
deleted file mode 100644
index 9aec6ea08..000000000
--- a/src/Renderer/Context.hpp
+++ /dev/null
@@ -1,540 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Context_hpp
-#define sw_Context_hpp
-
-#include "Sampler.hpp"
-#include "TextureStage.hpp"
-#include "Stream.hpp"
-#include "Point.hpp"
-#include "Vertex.hpp"
-#include "Common/Types.hpp"
-
-namespace sw
-{
- class Sampler;
- class Surface;
- class PixelShader;
- class VertexShader;
- struct Triangle;
- struct Primitive;
- struct Vertex;
- class Resource;
-
- enum In // Default input stream semantic
- {
- Position = 0,
- BlendWeight = 1,
- BlendIndices = 2,
- Normal = 3,
- PointSize = 4,
- Color0 = 5,
- Color1 = 6,
- TexCoord0 = 7,
- TexCoord1 = 8,
- TexCoord2 = 9,
- TexCoord3 = 10,
- TexCoord4 = 11,
- TexCoord5 = 12,
- TexCoord6 = 13,
- TexCoord7 = 14,
- PositionT = 15
- };
-
- enum DrawType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- // These types must stay ordered by vertices per primitive. Also, if these basic types
- // are modified, verify the value assigned to task->verticesPerPrimitive in Renderer.cpp
- DRAW_POINTLIST = 0x00,
- DRAW_LINELIST = 0x01,
- DRAW_LINESTRIP = 0x02,
- DRAW_LINELOOP = 0x03,
- DRAW_TRIANGLELIST = 0x04,
- DRAW_TRIANGLESTRIP = 0x05,
- DRAW_TRIANGLEFAN = 0x06,
- DRAW_QUADLIST = 0x07,
-
- DRAW_NONINDEXED = 0x00,
- DRAW_INDEXED8 = 0x10,
- DRAW_INDEXED16 = 0x20,
- DRAW_INDEXED32 = 0x30,
-
- DRAW_INDEXEDPOINTLIST8 = DRAW_POINTLIST | DRAW_INDEXED8,
- DRAW_INDEXEDLINELIST8 = DRAW_LINELIST | DRAW_INDEXED8,
- DRAW_INDEXEDLINESTRIP8 = DRAW_LINESTRIP | DRAW_INDEXED8,
- DRAW_INDEXEDLINELOOP8 = DRAW_LINELOOP | DRAW_INDEXED8,
- DRAW_INDEXEDTRIANGLELIST8 = DRAW_TRIANGLELIST | DRAW_INDEXED8,
- DRAW_INDEXEDTRIANGLESTRIP8 = DRAW_TRIANGLESTRIP | DRAW_INDEXED8,
- DRAW_INDEXEDTRIANGLEFAN8 = DRAW_TRIANGLEFAN | DRAW_INDEXED8,
-
- DRAW_INDEXEDPOINTLIST16 = DRAW_POINTLIST | DRAW_INDEXED16,
- DRAW_INDEXEDLINELIST16 = DRAW_LINELIST | DRAW_INDEXED16,
- DRAW_INDEXEDLINESTRIP16 = DRAW_LINESTRIP | DRAW_INDEXED16,
- DRAW_INDEXEDLINELOOP16 = DRAW_LINELOOP | DRAW_INDEXED16,
- DRAW_INDEXEDTRIANGLELIST16 = DRAW_TRIANGLELIST | DRAW_INDEXED16,
- DRAW_INDEXEDTRIANGLESTRIP16 = DRAW_TRIANGLESTRIP | DRAW_INDEXED16,
- DRAW_INDEXEDTRIANGLEFAN16 = DRAW_TRIANGLEFAN | DRAW_INDEXED16,
-
- DRAW_INDEXEDPOINTLIST32 = DRAW_POINTLIST | DRAW_INDEXED32,
- DRAW_INDEXEDLINELIST32 = DRAW_LINELIST | DRAW_INDEXED32,
- DRAW_INDEXEDLINESTRIP32 = DRAW_LINESTRIP | DRAW_INDEXED32,
- DRAW_INDEXEDLINELOOP32 = DRAW_LINELOOP | DRAW_INDEXED32,
- DRAW_INDEXEDTRIANGLELIST32 = DRAW_TRIANGLELIST | DRAW_INDEXED32,
- DRAW_INDEXEDTRIANGLESTRIP32 = DRAW_TRIANGLESTRIP | DRAW_INDEXED32,
- DRAW_INDEXEDTRIANGLEFAN32 = DRAW_TRIANGLEFAN | DRAW_INDEXED32,
-
- DRAW_LAST = DRAW_INDEXEDTRIANGLEFAN32
- };
-
- enum FillMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- FILL_SOLID,
- FILL_WIREFRAME,
- FILL_VERTEX,
-
- FILL_LAST = FILL_VERTEX
- };
-
- enum ShadingMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- SHADING_FLAT,
- SHADING_GOURAUD,
-
- SHADING_LAST = SHADING_GOURAUD
- };
-
- enum DepthCompareMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- DEPTH_ALWAYS,
- DEPTH_NEVER,
- DEPTH_EQUAL,
- DEPTH_NOTEQUAL,
- DEPTH_LESS,
- DEPTH_LESSEQUAL,
- DEPTH_GREATER,
- DEPTH_GREATEREQUAL,
-
- DEPTH_LAST = DEPTH_GREATEREQUAL
- };
-
- enum StencilCompareMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- STENCIL_ALWAYS,
- STENCIL_NEVER,
- STENCIL_EQUAL,
- STENCIL_NOTEQUAL,
- STENCIL_LESS,
- STENCIL_LESSEQUAL,
- STENCIL_GREATER,
- STENCIL_GREATEREQUAL,
-
- STENCIL_LAST = STENCIL_GREATEREQUAL
- };
-
- enum StencilOperation ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- OPERATION_KEEP,
- OPERATION_ZERO,
- OPERATION_REPLACE,
- OPERATION_INCRSAT,
- OPERATION_DECRSAT,
- OPERATION_INVERT,
- OPERATION_INCR,
- OPERATION_DECR,
-
- OPERATION_LAST = OPERATION_DECR
- };
-
- enum AlphaCompareMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- ALPHA_ALWAYS,
- ALPHA_NEVER,
- ALPHA_EQUAL,
- ALPHA_NOTEQUAL,
- ALPHA_LESS,
- ALPHA_LESSEQUAL,
- ALPHA_GREATER,
- ALPHA_GREATEREQUAL,
-
- ALPHA_LAST = ALPHA_GREATEREQUAL
- };
-
- enum CullMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- CULL_NONE,
- CULL_CLOCKWISE,
- CULL_COUNTERCLOCKWISE,
-
- CULL_LAST = CULL_COUNTERCLOCKWISE
- };
-
- enum BlendFactor ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- BLEND_ZERO,
- BLEND_ONE,
- BLEND_SOURCE,
- BLEND_INVSOURCE,
- BLEND_DEST,
- BLEND_INVDEST,
- BLEND_SOURCEALPHA,
- BLEND_INVSOURCEALPHA,
- BLEND_DESTALPHA,
- BLEND_INVDESTALPHA,
- BLEND_SRCALPHASAT,
- BLEND_CONSTANT,
- BLEND_INVCONSTANT,
- BLEND_CONSTANTALPHA,
- BLEND_INVCONSTANTALPHA,
-
- BLEND_LAST = BLEND_INVCONSTANTALPHA
- };
-
- enum BlendOperation ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- BLENDOP_ADD,
- BLENDOP_SUB,
- BLENDOP_INVSUB,
- BLENDOP_MIN,
- BLENDOP_MAX,
-
- BLENDOP_SOURCE, // Copy source
- BLENDOP_DEST, // Copy dest
- BLENDOP_NULL, // Nullify result
-
- BLENDOP_LAST = BLENDOP_NULL
- };
-
- enum LogicalOperation ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- LOGICALOP_CLEAR,
- LOGICALOP_SET,
- LOGICALOP_COPY,
- LOGICALOP_COPY_INVERTED,
- LOGICALOP_NOOP,
- LOGICALOP_INVERT,
- LOGICALOP_AND,
- LOGICALOP_NAND,
- LOGICALOP_OR,
- LOGICALOP_NOR,
- LOGICALOP_XOR,
- LOGICALOP_EQUIV,
- LOGICALOP_AND_REVERSE,
- LOGICALOP_AND_INVERTED,
- LOGICALOP_OR_REVERSE,
- LOGICALOP_OR_INVERTED,
-
- LOGICALOP_LAST = LOGICALOP_OR_INVERTED
- };
-
- enum MaterialSource ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- MATERIAL_MATERIAL,
- MATERIAL_COLOR1,
- MATERIAL_COLOR2,
-
- MATERIAL_LAST = MATERIAL_COLOR2
- };
-
- enum FogMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- FOG_NONE,
- FOG_LINEAR,
- FOG_EXP,
- FOG_EXP2,
-
- FOG_LAST = FOG_EXP2
- };
-
- enum TexGen ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- TEXGEN_PASSTHRU,
- TEXGEN_NORMAL,
- TEXGEN_POSITION,
- TEXGEN_REFLECTION,
- TEXGEN_SPHEREMAP,
- TEXGEN_NONE,
-
- TEXGEN_LAST = TEXGEN_NONE
- };
-
- enum TransparencyAntialiasing ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- TRANSPARENCY_NONE,
- TRANSPARENCY_ALPHA_TO_COVERAGE,
-
- TRANSPARENCY_LAST = TRANSPARENCY_ALPHA_TO_COVERAGE
- };
-
- class Context
- {
- public:
- Context();
-
- ~Context();
-
- void *operator new(size_t bytes);
- void operator delete(void *pointer, size_t bytes);
-
- bool isDrawPoint(bool fillModeAware = false) const;
- bool isDrawLine(bool fillModeAware = false) const;
- bool isDrawTriangle(bool fillModeAware = false) const;
-
- void init();
-
- const float &exp2Bias(); // NOTE: Needs address for JIT
-
- const Point &getLightPosition(int light);
-
- void setGlobalMipmapBias(float bias);
-
- // Set fixed-function vertex pipeline states
- void setLightingEnable(bool lightingEnable);
- void setSpecularEnable(bool specularEnable);
- void setLightEnable(int light, bool lightEnable);
- void setLightPosition(int light, Point worldLightPosition);
-
- void setColorVertexEnable(bool colorVertexEnable);
- void setAmbientMaterialSource(MaterialSource ambientMaterialSource);
- void setDiffuseMaterialSource(MaterialSource diffuseMaterialSource);
- void setSpecularMaterialSource(MaterialSource specularMaterialSource);
- void setEmissiveMaterialSource(MaterialSource emissiveMaterialSource);
-
- void setPointSpriteEnable(bool pointSpriteEnable);
- void setPointScaleEnable(bool pointScaleEnable);
-
- // Set fixed-function pixel pipeline states, return true when modified
- bool setDepthBufferEnable(bool depthBufferEnable);
-
- bool setAlphaBlendEnable(bool alphaBlendEnable);
- bool setSourceBlendFactor(BlendFactor sourceBlendFactor);
- bool setDestBlendFactor(BlendFactor destBlendFactor);
- bool setBlendOperation(BlendOperation blendOperation);
-
- bool setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable);
- bool setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha);
- bool setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha);
- bool setBlendOperationAlpha(BlendOperation blendOperationAlpha);
-
- bool setColorWriteMask(int index, int colorWriteMask);
- bool setWriteSRGB(bool sRGB);
-
- bool setColorLogicOpEnabled(bool colorLogicOpEnabled);
- bool setLogicalOperation(LogicalOperation logicalOperation);
-
- // Active fixed-function pixel pipeline states
- bool fogActive();
- bool pointSizeActive();
- FogMode pixelFogActive();
- bool depthWriteActive();
- bool alphaTestActive();
- bool depthBufferActive();
- bool stencilActive();
-
- bool perspectiveActive();
-
- // Active fixed-function vertex pipeline states
- bool vertexLightingActive();
- bool texCoordActive(int coordinate, int component);
- bool texCoordActive(int coordinate);
- bool isProjectionComponent(unsigned int coordinate, int component);
- bool vertexSpecularInputActive();
- bool vertexSpecularActive();
- bool vertexNormalActive();
- bool vertexLightActive();
- bool vertexLightActive(int i);
- MaterialSource vertexDiffuseMaterialSourceActive();
- MaterialSource vertexSpecularMaterialSourceActive();
- MaterialSource vertexAmbientMaterialSourceActive();
- MaterialSource vertexEmissiveMaterialSourceActive();
-
- bool pointSpriteActive();
- bool pointScaleActive();
-
- bool alphaBlendActive();
- BlendFactor sourceBlendFactor();
- BlendFactor destBlendFactor();
- BlendOperation blendOperation();
-
- BlendFactor sourceBlendFactorAlpha();
- BlendFactor destBlendFactorAlpha();
- BlendOperation blendOperationAlpha();
-
- LogicalOperation colorLogicOp();
- LogicalOperation indexLogicOp();
-
- bool indexedVertexBlendActive();
- int vertexBlendMatrixCountActive();
- bool localViewerActive();
- bool normalizeNormalsActive();
- FogMode vertexFogModeActive();
- bool rangeFogActive();
-
- TexGen texGenActive(int stage);
- int textureTransformCountActive(int stage);
- int texCoordIndexActive(int stage);
-
- // Active context states
- bool diffuseUsed(); // Used by pixel processor but not provided by vertex processor
- bool diffuseUsed(int component); // Used by pixel processor but not provided by vertex processor
- bool diffuseActive();
- bool diffuseActive(int component);
- bool specularUsed();
- bool specularUsed(int component);
- bool specularActive();
- bool specularActive(int component);
- bool colorActive(int color, int component);
- bool textureActive();
- bool textureActive(int coordinate);
- bool textureActive(int coordinate, int component);
-
- unsigned short pixelShaderModel() const;
- unsigned short vertexShaderModel() const;
-
- int getMultiSampleCount() const;
- int getSuperSampleCount() const;
-
- DrawType drawType;
-
- bool stencilEnable;
- StencilCompareMode stencilCompareMode;
- int stencilReference;
- int stencilMask;
- StencilOperation stencilFailOperation;
- StencilOperation stencilPassOperation;
- StencilOperation stencilZFailOperation;
- int stencilWriteMask;
-
- bool twoSidedStencil;
- StencilCompareMode stencilCompareModeCCW;
- int stencilReferenceCCW;
- int stencilMaskCCW;
- StencilOperation stencilFailOperationCCW;
- StencilOperation stencilPassOperationCCW;
- StencilOperation stencilZFailOperationCCW;
- int stencilWriteMaskCCW;
-
- // Pixel processor states
- AlphaCompareMode alphaCompareMode;
- bool alphaTestEnable;
- FillMode fillMode;
- ShadingMode shadingMode;
-
- CullMode cullMode;
- bool frontFacingCCW;
- float alphaReference;
-
- float depthBias;
- float slopeDepthBias;
-
- TextureStage textureStage[8];
- Sampler sampler[TOTAL_IMAGE_UNITS];
-
- Format renderTargetInternalFormat(int index);
- bool colorWriteActive();
- int colorWriteActive(int index);
- bool colorUsed();
-
- Resource *texture[TOTAL_IMAGE_UNITS];
- Stream input[MAX_VERTEX_INPUTS];
- Resource *indexBuffer;
-
- bool preTransformed; // FIXME: Private
-
- float fogStart;
- float fogEnd;
-
- bool textureWrapActive;
- unsigned char textureWrap[TEXTURE_IMAGE_UNITS];
- TexGen texGen[8];
- bool localViewer;
- bool normalizeNormals;
- int textureTransformCount[8];
- bool textureTransformProject[8];
-
- Surface *renderTarget[RENDERTARGETS];
- unsigned int renderTargetLayer[RENDERTARGETS];
- Surface *depthBuffer;
- unsigned int depthBufferLayer;
- Surface *stencilBuffer;
- unsigned int stencilBufferLayer;
-
- // Fog
- bool fogEnable;
- FogMode pixelFogMode;
- FogMode vertexFogMode;
- bool wBasedFog;
- bool rangeFogEnable;
-
- // Vertex blending
- bool indexedVertexBlendEnable;
- int vertexBlendMatrixCount;
-
- // Shaders
- const PixelShader *pixelShader;
- const VertexShader *vertexShader;
-
- // Global mipmap bias
- float bias;
-
- // Instancing
- int instanceID;
-
- // Fixed-function vertex pipeline state
- bool lightingEnable;
- bool specularEnable;
- bool lightEnable[8];
- Point worldLightPosition[8];
-
- MaterialSource ambientMaterialSource;
- MaterialSource diffuseMaterialSource;
- MaterialSource specularMaterialSource;
- MaterialSource emissiveMaterialSource;
- bool colorVertexEnable;
-
- bool occlusionEnabled;
- bool transformFeedbackQueryEnabled;
- uint64_t transformFeedbackEnabled;
-
- // Pixel processor states
- bool rasterizerDiscard;
- bool depthBufferEnable;
- DepthCompareMode depthCompareMode;
- bool depthWriteEnable;
-
- bool alphaBlendEnable;
- BlendFactor sourceBlendFactorState;
- BlendFactor destBlendFactorState;
- BlendOperation blendOperationState;
-
- bool separateAlphaBlendEnable;
- BlendFactor sourceBlendFactorStateAlpha;
- BlendFactor destBlendFactorStateAlpha;
- BlendOperation blendOperationStateAlpha;
-
- bool pointSpriteEnable;
- bool pointScaleEnable;
- float lineWidth;
-
- int colorWriteMask[RENDERTARGETS]; // RGBA
- bool writeSRGB;
- unsigned int sampleMask;
- unsigned int multiSampleMask;
-
- bool colorLogicOpEnabled;
- LogicalOperation logicalOperation;
- };
-}
-
-#endif // sw_Context_hpp
diff --git a/src/Renderer/ETC_Decoder.cpp b/src/Renderer/ETC_Decoder.cpp
deleted file mode 100644
index dbc6276a4..000000000
--- a/src/Renderer/ETC_Decoder.cpp
+++ /dev/null
@@ -1,741 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ETC_Decoder.hpp"
-
-namespace
-{
- inline int clampByte(int value)
- {
- return (value < 0) ? 0 : ((value > 255) ? 255 : value);
- }
-
- inline int clampSByte(int value)
- {
- return (value < -128) ? -128 : ((value > 127) ? 127 : value);
- }
-
- inline int clampEAC(int value, bool isSigned)
- {
- int min = isSigned ? -1023 : 0;
- int max = isSigned ? 1023 : 2047;
- return (value < min) ? min : ((value > max) ? max : value);
- }
-
- struct bgra8
- {
- unsigned char b;
- unsigned char g;
- unsigned char r;
- unsigned char a;
-
- inline bgra8()
- {
- }
-
- inline void set(int red, int green, int blue)
- {
- r = static_cast<unsigned char>(clampByte(red));
- g = static_cast<unsigned char>(clampByte(green));
- b = static_cast<unsigned char>(clampByte(blue));
- }
-
- inline void set(int red, int green, int blue, int alpha)
- {
- r = static_cast<unsigned char>(clampByte(red));
- g = static_cast<unsigned char>(clampByte(green));
- b = static_cast<unsigned char>(clampByte(blue));
- a = static_cast<unsigned char>(clampByte(alpha));
- }
-
- const bgra8& addA(int alpha)
- {
- a = alpha;
- return *this;
- }
- };
-
- inline int extend_4to8bits(int x)
- {
- return (x << 4) | x;
- }
-
- inline int extend_5to8bits(int x)
- {
- return (x << 3) | (x >> 2);
- }
-
- inline int extend_6to8bits(int x)
- {
- return (x << 2) | (x >> 4);
- }
-
- inline int extend_7to8bits(int x)
- {
- return (x << 1) | (x >> 6);
- }
-
- struct ETC2
- {
- // Decodes unsigned single or dual channel block to bytes
- static void DecodeBlock(const ETC2** sources, unsigned char *dest, int nbChannels, int x, int y, int w, int h, int pitch, bool isSigned, bool isEAC)
- {
- if(isEAC)
- {
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- int* sDst = reinterpret_cast<int*>(dest);
- for(int i = 0; i < 4 && (x + i) < w; i++)
- {
- for(int c = nbChannels - 1; c >= 0; c--)
- {
- sDst[i * nbChannels + c] = clampEAC(sources[c]->getSingleChannel(i, j, isSigned, true), isSigned);
- }
- }
- dest += pitch;
- }
- }
- else
- {
- if(isSigned)
- {
- signed char* sDst = reinterpret_cast<signed char*>(dest);
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- for(int i = 0; i < 4 && (x + i) < w; i++)
- {
- for(int c = nbChannels - 1; c >= 0; c--)
- {
- sDst[i * nbChannels + c] = clampSByte(sources[c]->getSingleChannel(i, j, isSigned, false));
- }
- }
- sDst += pitch;
- }
- }
- else
- {
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- for(int i = 0; i < 4 && (x + i) < w; i++)
- {
- for(int c = nbChannels - 1; c >= 0; c--)
- {
- dest[i * nbChannels + c] = clampByte(sources[c]->getSingleChannel(i, j, isSigned, false));
- }
- }
- dest += pitch;
- }
- }
- }
- }
-
- // Decodes RGB block to bgra8
- void decodeBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4], bool punchThroughAlpha) const
- {
- bool opaqueBit = diffbit;
- bool nonOpaquePunchThroughAlpha = punchThroughAlpha && !opaqueBit;
-
- // Select mode
- if(diffbit || punchThroughAlpha)
- {
- int r = (R + dR);
- int g = (G + dG);
- int b = (B + dB);
- if(r < 0 || r > 31)
- {
- decodeTBlock(dest, x, y, w, h, pitch, alphaValues, nonOpaquePunchThroughAlpha);
- }
- else if(g < 0 || g > 31)
- {
- decodeHBlock(dest, x, y, w, h, pitch, alphaValues, nonOpaquePunchThroughAlpha);
- }
- else if(b < 0 || b > 31)
- {
- decodePlanarBlock(dest, x, y, w, h, pitch, alphaValues);
- }
- else
- {
- decodeDifferentialBlock(dest, x, y, w, h, pitch, alphaValues, nonOpaquePunchThroughAlpha);
- }
- }
- else
- {
- decodeIndividualBlock(dest, x, y, w, h, pitch, alphaValues, nonOpaquePunchThroughAlpha);
- }
- }
-
- private:
- struct
- {
- union
- {
- // Individual, differential, H and T modes
- struct
- {
- union
- {
- // Individual and differential modes
- struct
- {
- union
- {
- struct // Individual colors
- {
- unsigned char R2 : 4;
- unsigned char R1 : 4;
- unsigned char G2 : 4;
- unsigned char G1 : 4;
- unsigned char B2 : 4;
- unsigned char B1 : 4;
- };
-
- struct // Differential colors
- {
- signed char dR : 3;
- unsigned char R : 5;
- signed char dG : 3;
- unsigned char G : 5;
- signed char dB : 3;
- unsigned char B : 5;
- };
- };
-
- bool flipbit : 1;
- bool diffbit : 1;
- unsigned char cw2 : 3;
- unsigned char cw1 : 3;
- };
-
- // T mode
- struct
- {
- // Byte 1
- unsigned char TR1b : 2;
- unsigned char TdummyB : 1;
- unsigned char TR1a : 2;
- unsigned char TdummyA : 3;
-
- // Byte 2
- unsigned char TB1 : 4;
- unsigned char TG1 : 4;
-
- // Byte 3
- unsigned char TG2 : 4;
- unsigned char TR2 : 4;
-
- // Byte 4
- unsigned char Tdb : 1;
- bool Tflipbit : 1;
- unsigned char Tda : 2;
- unsigned char TB2 : 4;
- };
-
- // H mode
- struct
- {
- // Byte 1
- unsigned char HG1a : 3;
- unsigned char HR1 : 4;
- unsigned char HdummyA : 1;
-
- // Byte 2
- unsigned char HB1b : 2;
- unsigned char HdummyC : 1;
- unsigned char HB1a : 1;
- unsigned char HG1b : 1;
- unsigned char HdummyB : 3;
-
- // Byte 3
- unsigned char HG2a : 3;
- unsigned char HR2 : 4;
- unsigned char HB1c : 1;
-
- // Byte 4
- unsigned char Hdb : 1;
- bool Hflipbit : 1;
- unsigned char Hda : 1;
- unsigned char HB2 : 4;
- unsigned char HG2b : 1;
- };
- };
-
- unsigned char pixelIndexMSB[2];
- unsigned char pixelIndexLSB[2];
- };
-
- // planar mode
- struct
- {
- // Byte 1
- unsigned char GO1 : 1;
- unsigned char RO : 6;
- unsigned char PdummyA : 1;
-
- // Byte 2
- unsigned char BO1 : 1;
- unsigned char GO2 : 6;
- unsigned char PdummyB : 1;
-
- // Byte 3
- unsigned char BO3a : 2;
- unsigned char PdummyD : 1;
- unsigned char BO2 : 2;
- unsigned char PdummyC : 3;
-
- // Byte 4
- unsigned char RH2 : 1;
- bool Pflipbit : 1;
- unsigned char RH1 : 5;
- unsigned char BO3b : 1;
-
- // Byte 5
- unsigned char BHa : 1;
- unsigned char GH : 7;
-
- // Byte 6
- unsigned char RVa : 3;
- unsigned char BHb : 5;
-
- // Byte 7
- unsigned char GVa : 5;
- unsigned char RVb : 3;
-
- // Byte 8
- unsigned char BV : 6;
- unsigned char GVb : 2;
- };
-
- // Single channel block
- struct
- {
- union
- {
- unsigned char base_codeword;
- signed char signed_base_codeword;
- };
-
- unsigned char table_index : 4;
- unsigned char multiplier : 4;
-
- unsigned char mc1 : 2;
- unsigned char mb : 3;
- unsigned char ma : 3;
-
- unsigned char mf1 : 1;
- unsigned char me : 3;
- unsigned char md : 3;
- unsigned char mc2 : 1;
-
- unsigned char mh : 3;
- unsigned char mg : 3;
- unsigned char mf2 : 2;
-
- unsigned char mk1 : 2;
- unsigned char mj : 3;
- unsigned char mi : 3;
-
- unsigned char mn1 : 1;
- unsigned char mm : 3;
- unsigned char ml : 3;
- unsigned char mk2 : 1;
-
- unsigned char mp : 3;
- unsigned char mo : 3;
- unsigned char mn2 : 2;
- };
- };
- };
-
- void decodeIndividualBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4], bool nonOpaquePunchThroughAlpha) const
- {
- int r1 = extend_4to8bits(R1);
- int g1 = extend_4to8bits(G1);
- int b1 = extend_4to8bits(B1);
-
- int r2 = extend_4to8bits(R2);
- int g2 = extend_4to8bits(G2);
- int b2 = extend_4to8bits(B2);
-
- decodeIndividualOrDifferentialBlock(dest, x, y, w, h, pitch, r1, g1, b1, r2, g2, b2, alphaValues, nonOpaquePunchThroughAlpha);
- }
-
- void decodeDifferentialBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4], bool nonOpaquePunchThroughAlpha) const
- {
- int b1 = extend_5to8bits(B);
- int g1 = extend_5to8bits(G);
- int r1 = extend_5to8bits(R);
-
- int r2 = extend_5to8bits(R + dR);
- int g2 = extend_5to8bits(G + dG);
- int b2 = extend_5to8bits(B + dB);
-
- decodeIndividualOrDifferentialBlock(dest, x, y, w, h, pitch, r1, g1, b1, r2, g2, b2, alphaValues, nonOpaquePunchThroughAlpha);
- }
-
- void decodeIndividualOrDifferentialBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, int r1, int g1, int b1, int r2, int g2, int b2, unsigned char alphaValues[4][4], bool nonOpaquePunchThroughAlpha) const
- {
- // Table 3.17.2 sorted according to table 3.17.3
- static const int intensityModifierDefault[8][4] =
- {
- { 2, 8, -2, -8 },
- { 5, 17, -5, -17 },
- { 9, 29, -9, -29 },
- { 13, 42, -13, -42 },
- { 18, 60, -18, -60 },
- { 24, 80, -24, -80 },
- { 33, 106, -33, -106 },
- { 47, 183, -47, -183 }
- };
-
- // Table C.12, intensity modifier for non opaque punchthrough alpha
- static const int intensityModifierNonOpaque[8][4] =
- {
- { 0, 8, 0, -8 },
- { 0, 17, 0, -17 },
- { 0, 29, 0, -29 },
- { 0, 42, 0, -42 },
- { 0, 60, 0, -60 },
- { 0, 80, 0, -80 },
- { 0, 106, 0, -106 },
- { 0, 183, 0, -183 }
- };
-
- const int(&intensityModifier)[8][4] = nonOpaquePunchThroughAlpha ? intensityModifierNonOpaque : intensityModifierDefault;
-
- bgra8 subblockColors0[4];
- bgra8 subblockColors1[4];
-
- const int i10 = intensityModifier[cw1][0];
- const int i11 = intensityModifier[cw1][1];
- const int i12 = intensityModifier[cw1][2];
- const int i13 = intensityModifier[cw1][3];
-
- subblockColors0[0].set(r1 + i10, g1 + i10, b1 + i10);
- subblockColors0[1].set(r1 + i11, g1 + i11, b1 + i11);
- subblockColors0[2].set(r1 + i12, g1 + i12, b1 + i12);
- subblockColors0[3].set(r1 + i13, g1 + i13, b1 + i13);
-
- const int i20 = intensityModifier[cw2][0];
- const int i21 = intensityModifier[cw2][1];
- const int i22 = intensityModifier[cw2][2];
- const int i23 = intensityModifier[cw2][3];
-
- subblockColors1[0].set(r2 + i20, g2 + i20, b2 + i20);
- subblockColors1[1].set(r2 + i21, g2 + i21, b2 + i21);
- subblockColors1[2].set(r2 + i22, g2 + i22, b2 + i22);
- subblockColors1[3].set(r2 + i23, g2 + i23, b2 + i23);
-
- unsigned char* destStart = dest;
-
- if(flipbit)
- {
- for(int j = 0; j < 2 && (y + j) < h; j++)
- {
- bgra8* color = (bgra8*)dest;
- if((x + 0) < w) color[0] = subblockColors0[getIndex(0, j)].addA(alphaValues[j][0]);
- if((x + 1) < w) color[1] = subblockColors0[getIndex(1, j)].addA(alphaValues[j][1]);
- if((x + 2) < w) color[2] = subblockColors0[getIndex(2, j)].addA(alphaValues[j][2]);
- if((x + 3) < w) color[3] = subblockColors0[getIndex(3, j)].addA(alphaValues[j][3]);
- dest += pitch;
- }
-
- for(int j = 2; j < 4 && (y + j) < h; j++)
- {
- bgra8* color = (bgra8*)dest;
- if((x + 0) < w) color[0] = subblockColors1[getIndex(0, j)].addA(alphaValues[j][0]);
- if((x + 1) < w) color[1] = subblockColors1[getIndex(1, j)].addA(alphaValues[j][1]);
- if((x + 2) < w) color[2] = subblockColors1[getIndex(2, j)].addA(alphaValues[j][2]);
- if((x + 3) < w) color[3] = subblockColors1[getIndex(3, j)].addA(alphaValues[j][3]);
- dest += pitch;
- }
- }
- else
- {
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- bgra8* color = (bgra8*)dest;
- if((x + 0) < w) color[0] = subblockColors0[getIndex(0, j)].addA(alphaValues[j][0]);
- if((x + 1) < w) color[1] = subblockColors0[getIndex(1, j)].addA(alphaValues[j][1]);
- if((x + 2) < w) color[2] = subblockColors1[getIndex(2, j)].addA(alphaValues[j][2]);
- if((x + 3) < w) color[3] = subblockColors1[getIndex(3, j)].addA(alphaValues[j][3]);
- dest += pitch;
- }
- }
-
- if(nonOpaquePunchThroughAlpha)
- {
- decodePunchThroughAlphaBlock(destStart, x, y, w, h, pitch);
- }
- }
-
- void decodeTBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4], bool nonOpaquePunchThroughAlpha) const
- {
- // Table C.8, distance index fot T and H modes
- static const int distance[8] = { 3, 6, 11, 16, 23, 32, 41, 64 };
-
- bgra8 paintColors[4];
-
- int r1 = extend_4to8bits(TR1a << 2 | TR1b);
- int g1 = extend_4to8bits(TG1);
- int b1 = extend_4to8bits(TB1);
-
- int r2 = extend_4to8bits(TR2);
- int g2 = extend_4to8bits(TG2);
- int b2 = extend_4to8bits(TB2);
-
- const int d = distance[Tda << 1 | Tdb];
-
- paintColors[0].set(r1, g1, b1);
- paintColors[1].set(r2 + d, g2 + d, b2 + d);
- paintColors[2].set(r2, g2, b2);
- paintColors[3].set(r2 - d, g2 - d, b2 - d);
-
- unsigned char* destStart = dest;
-
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- bgra8* color = (bgra8*)dest;
- if((x + 0) < w) color[0] = paintColors[getIndex(0, j)].addA(alphaValues[j][0]);
- if((x + 1) < w) color[1] = paintColors[getIndex(1, j)].addA(alphaValues[j][1]);
- if((x + 2) < w) color[2] = paintColors[getIndex(2, j)].addA(alphaValues[j][2]);
- if((x + 3) < w) color[3] = paintColors[getIndex(3, j)].addA(alphaValues[j][3]);
- dest += pitch;
- }
-
- if(nonOpaquePunchThroughAlpha)
- {
- decodePunchThroughAlphaBlock(destStart, x, y, w, h, pitch);
- }
- }
-
- void decodeHBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4], bool nonOpaquePunchThroughAlpha) const
- {
- // Table C.8, distance index fot T and H modes
- static const int distance[8] = { 3, 6, 11, 16, 23, 32, 41, 64 };
-
- bgra8 paintColors[4];
-
- int r1 = extend_4to8bits(HR1);
- int g1 = extend_4to8bits(HG1a << 1 | HG1b);
- int b1 = extend_4to8bits(HB1a << 3 | HB1b << 1 | HB1c);
-
- int r2 = extend_4to8bits(HR2);
- int g2 = extend_4to8bits(HG2a << 1 | HG2b);
- int b2 = extend_4to8bits(HB2);
-
- const int d = distance[(Hda << 2) | (Hdb << 1) | ((r1 << 16 | g1 << 8 | b1) >= (r2 << 16 | g2 << 8 | b2) ? 1 : 0)];
-
- paintColors[0].set(r1 + d, g1 + d, b1 + d);
- paintColors[1].set(r1 - d, g1 - d, b1 - d);
- paintColors[2].set(r2 + d, g2 + d, b2 + d);
- paintColors[3].set(r2 - d, g2 - d, b2 - d);
-
- unsigned char* destStart = dest;
-
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- bgra8* color = (bgra8*)dest;
- if((x + 0) < w) color[0] = paintColors[getIndex(0, j)].addA(alphaValues[j][0]);
- if((x + 1) < w) color[1] = paintColors[getIndex(1, j)].addA(alphaValues[j][1]);
- if((x + 2) < w) color[2] = paintColors[getIndex(2, j)].addA(alphaValues[j][2]);
- if((x + 3) < w) color[3] = paintColors[getIndex(3, j)].addA(alphaValues[j][3]);
- dest += pitch;
- }
-
- if(nonOpaquePunchThroughAlpha)
- {
- decodePunchThroughAlphaBlock(destStart, x, y, w, h, pitch);
- }
- }
-
- void decodePlanarBlock(unsigned char *dest, int x, int y, int w, int h, int pitch, unsigned char alphaValues[4][4]) const
- {
- int ro = extend_6to8bits(RO);
- int go = extend_7to8bits(GO1 << 6 | GO2);
- int bo = extend_6to8bits(BO1 << 5 | BO2 << 3 | BO3a << 1 | BO3b);
-
- int rh = extend_6to8bits(RH1 << 1 | RH2);
- int gh = extend_7to8bits(GH);
- int bh = extend_6to8bits(BHa << 5 | BHb);
-
- int rv = extend_6to8bits(RVa << 3 | RVb);
- int gv = extend_7to8bits(GVa << 2 | GVb);
- int bv = extend_6to8bits(BV);
-
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- int ry = j * (rv - ro) + 2;
- int gy = j * (gv - go) + 2;
- int by = j * (bv - bo) + 2;
- for(int i = 0; i < 4 && (x + i) < w; i++)
- {
- ((bgra8*)(dest))[i].set(((i * (rh - ro) + ry) >> 2) + ro,
- ((i * (gh - go) + gy) >> 2) + go,
- ((i * (bh - bo) + by) >> 2) + bo,
- alphaValues[j][i]);
- }
- dest += pitch;
- }
- }
-
- // Index for individual, differential, H and T modes
- inline int getIndex(int x, int y) const
- {
- int bitIndex = x * 4 + y;
- int bitOffset = bitIndex & 7;
- int lsb = (pixelIndexLSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
- int msb = (pixelIndexMSB[1 - (bitIndex >> 3)] >> bitOffset) & 1;
-
- return (msb << 1) | lsb;
- }
-
- void decodePunchThroughAlphaBlock(unsigned char *dest, int x, int y, int w, int h, int pitch) const
- {
- for(int j = 0; j < 4 && (y + j) < h; j++)
- {
- for(int i = 0; i < 4 && (x + i) < w; i++)
- {
- if(getIndex(i, j) == 2) // msb == 1 && lsb == 0
- {
- ((bgra8*)dest)[i].set(0, 0, 0, 0);
- }
- }
- dest += pitch;
- }
- }
-
- // Single channel utility functions
- inline int getSingleChannel(int x, int y, bool isSigned, bool isEAC) const
- {
- int codeword = isSigned ? signed_base_codeword : base_codeword;
- return isEAC ?
- ((multiplier == 0) ?
- (codeword * 8 + 4 + getSingleChannelModifier(x, y)) :
- (codeword * 8 + 4 + getSingleChannelModifier(x, y) * multiplier * 8)) :
- codeword + getSingleChannelModifier(x, y) * multiplier;
- }
-
- inline int getSingleChannelIndex(int x, int y) const
- {
- switch(x * 4 + y)
- {
- case 0: return ma;
- case 1: return mb;
- case 2: return mc1 << 1 | mc2;
- case 3: return md;
- case 4: return me;
- case 5: return mf1 << 2 | mf2;
- case 6: return mg;
- case 7: return mh;
- case 8: return mi;
- case 9: return mj;
- case 10: return mk1 << 1 | mk2;
- case 11: return ml;
- case 12: return mm;
- case 13: return mn1 << 2 | mn2;
- case 14: return mo;
- default: return mp; // 15
- }
- }
-
- inline int getSingleChannelModifier(int x, int y) const
- {
- static const int modifierTable[16][8] = { { -3, -6, -9, -15, 2, 5, 8, 14 },
- { -3, -7, -10, -13, 2, 6, 9, 12 },
- { -2, -5, -8, -13, 1, 4, 7, 12 },
- { -2, -4, -6, -13, 1, 3, 5, 12 },
- { -3, -6, -8, -12, 2, 5, 7, 11 },
- { -3, -7, -9, -11, 2, 6, 8, 10 },
- { -4, -7, -8, -11, 3, 6, 7, 10 },
- { -3, -5, -8, -11, 2, 4, 7, 10 },
- { -2, -6, -8, -10, 1, 5, 7, 9 },
- { -2, -5, -8, -10, 1, 4, 7, 9 },
- { -2, -4, -8, -10, 1, 3, 7, 9 },
- { -2, -5, -7, -10, 1, 4, 6, 9 },
- { -3, -4, -7, -10, 2, 3, 6, 9 },
- { -1, -2, -3, -10, 0, 1, 2, 9 },
- { -4, -6, -8, -9, 3, 5, 7, 8 },
- { -3, -5, -7, -9, 2, 4, 6, 8 } };
-
- return modifierTable[table_index][getSingleChannelIndex(x, y)];
- }
- };
-}
-
-// Decodes 1 to 4 channel images to 8 bit output
-bool ETC_Decoder::Decode(const unsigned char* src, unsigned char *dst, int w, int h, int dstW, int dstH, int dstPitch, int dstBpp, InputType inputType)
-{
- const ETC2* sources[2];
- sources[0] = (const ETC2*)src;
-
- unsigned char alphaValues[4][4] = { { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 }, { 255, 255, 255, 255 } };
-
- switch(inputType)
- {
- case ETC_R_SIGNED:
- case ETC_R_UNSIGNED:
- for(int y = 0; y < h; y += 4)
- {
- unsigned char *dstRow = dst + (y * dstPitch);
- for(int x = 0; x < w; x += 4, sources[0]++)
- {
- ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 1, x, y, dstW, dstH, dstPitch, inputType == ETC_R_SIGNED, true);
- }
- }
- break;
- case ETC_RG_SIGNED:
- case ETC_RG_UNSIGNED:
- sources[1] = sources[0] + 1;
- for(int y = 0; y < h; y += 4)
- {
- unsigned char *dstRow = dst + (y * dstPitch);
- for(int x = 0; x < w; x += 4, sources[0] += 2, sources[1] += 2)
- {
- ETC2::DecodeBlock(sources, dstRow + (x * dstBpp), 2, x, y, dstW, dstH, dstPitch, inputType == ETC_RG_SIGNED, true);
- }
- }
- break;
- case ETC_RGB:
- case ETC_RGB_PUNCHTHROUGH_ALPHA:
- for(int y = 0; y < h; y += 4)
- {
- unsigned char *dstRow = dst + (y * dstPitch);
- for(int x = 0; x < w; x += 4, sources[0]++)
- {
- sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, dstW, dstH, dstPitch, alphaValues, inputType == ETC_RGB_PUNCHTHROUGH_ALPHA);
- }
- }
- break;
- case ETC_RGBA:
- for(int y = 0; y < h; y += 4)
- {
- unsigned char *dstRow = dst + (y * dstPitch);
- for(int x = 0; x < w; x += 4)
- {
- // Decode Alpha
- ETC2::DecodeBlock(&sources[0], &(alphaValues[0][0]), 1, x, y, dstW, dstH, 4, false, false);
- sources[0]++; // RGBA packets are 128 bits, so move on to the next 64 bit packet to decode the RGB color
-
- // Decode RGB
- sources[0]->decodeBlock(dstRow + (x * dstBpp), x, y, dstW, dstH, dstPitch, alphaValues, false);
- sources[0]++;
- }
- }
- break;
- default:
- return false;
- }
-
- return true;
-}
diff --git a/src/Renderer/ETC_Decoder.hpp b/src/Renderer/ETC_Decoder.hpp
deleted file mode 100644
index 1039b3745..000000000
--- a/src/Renderer/ETC_Decoder.hpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-class ETC_Decoder
-{
-public:
- enum InputType
- {
- ETC_R_SIGNED,
- ETC_R_UNSIGNED,
- ETC_RG_SIGNED,
- ETC_RG_UNSIGNED,
- ETC_RGB,
- ETC_RGB_PUNCHTHROUGH_ALPHA,
- ETC_RGBA
- };
-
- /// ETC_Decoder::Decode - Decodes 1 to 4 channel images to 8 bit output
- /// @param src Pointer to ETC2 encoded image
- /// @param dst Pointer to BGRA, 8 bit output
- /// @param w src image width
- /// @param h src image height
- /// @param dstW dst image width
- /// @param dstH dst image height
- /// @param dstPitch dst image pitch (bytes per row)
- /// @param dstBpp dst image bytes per pixel
- /// @param inputType src's format
- /// @return true if the decoding was performed
- static bool Decode(const unsigned char* src, unsigned char *dst, int w, int h, int dstW, int dstH, int dstPitch, int dstBpp, InputType inputType);
-};
diff --git a/src/Renderer/LRUCache.hpp b/src/Renderer/LRUCache.hpp
deleted file mode 100644
index ebbf9b257..000000000
--- a/src/Renderer/LRUCache.hpp
+++ /dev/null
@@ -1,169 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_LRUCache_hpp
-#define sw_LRUCache_hpp
-
-#include "Common/Math.hpp"
-
-#include <cstring>
-#include <type_traits>
-
-namespace sw
-{
- template<class Key, class Data>
- class LRUCache
- {
- public:
- LRUCache(int n);
-
- ~LRUCache();
-
- Data query(const Key &key) const;
- Data add(const Key &key, const Data &data);
-
- int getSize() {return size;}
- Key &getKey(int i) {return key[i];}
-
- private:
- int size;
- int mask;
- int top;
- int fill;
-
- Key *key;
- Key **ref;
- Data *data;
- };
-
- // Helper class for clearing the memory of objects at construction.
- // Useful as the first base class of cache keys which may contain padding bytes or bits otherwise left uninitialized.
- template<class T>
- struct Memset
- {
- Memset(T *object, int val)
- {
- static_assert(std::is_base_of<Memset<T>, T>::value, "Memset<T> must only clear the memory of a type of which it is a base class");
-
- // GCC 8+ warns that
- // "‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘T’;
- // use assignment or value-initialization instead [-Werror=class-memaccess]"
- // This is benign iff it happens before any of the base or member constructrs are called.
- #if defined(__GNUC__) && (__GNUC__ >= 8)
- #pragma GCC diagnostic push
- #pragma GCC diagnostic ignored "-Wclass-memaccess"
- #endif
-
- memset(object, 0, sizeof(T));
-
- #if defined(__GNUC__) && (__GNUC__ >= 8)
- #pragma GCC diagnostic pop
- #endif
- }
- };
-
- // Traits-like helper class for checking if objects can be compared using memcmp().
- // Useful for statically asserting if a cache key can implement operator==() with memcmp().
- template<typename T>
- struct is_memcmparable
- {
- // std::is_trivially_copyable is not available in older GCC versions.
- #if !defined(__GNUC__) || __GNUC__ > 5
- static const bool value = std::is_trivially_copyable<T>::value;
- #else
- // At least check it doesn't have virtual methods.
- static const bool value = !std::is_polymorphic<T>::value;
- #endif
- };
-}
-
-namespace sw
-{
- template<class Key, class Data>
- LRUCache<Key, Data>::LRUCache(int n)
- {
- size = ceilPow2(n);
- mask = size - 1;
- top = 0;
- fill = 0;
-
- key = new Key[size];
- ref = new Key*[size];
- data = new Data[size];
-
- for(int i = 0; i < size; i++)
- {
- ref[i] = &key[i];
- }
- }
-
- template<class Key, class Data>
- LRUCache<Key, Data>::~LRUCache()
- {
- delete[] key;
- key = nullptr;
-
- delete[] ref;
- ref = nullptr;
-
- delete[] data;
- data = nullptr;
- }
-
- template<class Key, class Data>
- Data LRUCache<Key, Data>::query(const Key &key) const
- {
- for(int i = top; i > top - fill; i--)
- {
- int j = i & mask;
-
- if(key == *ref[j])
- {
- Data hit = data[j];
-
- if(i != top)
- {
- // Move one up
- int k = (j + 1) & mask;
-
- Data swapD = data[k];
- data[k] = data[j];
- data[j] = swapD;
-
- Key *swapK = ref[k];
- ref[k] = ref[j];
- ref[j] = swapK;
- }
-
- return hit;
- }
- }
-
- return nullptr; // Not found
- }
-
- template<class Key, class Data>
- Data LRUCache<Key, Data>::add(const Key &key, const Data &data)
- {
- top = (top + 1) & mask;
- fill = fill + 1 < size ? fill + 1 : size;
-
- *ref[top] = key;
- this->data[top] = data;
-
- return data;
- }
-}
-
-#endif // sw_LRUCache_hpp
diff --git a/src/Renderer/Matrix.cpp b/src/Renderer/Matrix.cpp
deleted file mode 100644
index 0da07e553..000000000
--- a/src/Renderer/Matrix.cpp
+++ /dev/null
@@ -1,402 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Matrix.hpp"
-
-#include "Point.hpp"
-#include "Common/Math.hpp"
-
-namespace sw
-{
- Matrix Matrix::diag(float m11, float m22, float m33, float m44)
- {
- return Matrix(m11, 0, 0, 0,
- 0, m22, 0, 0,
- 0, 0, m33, 0,
- 0, 0, 0, m44);
- }
-
- Matrix::operator float*()
- {
- return &(*this)(1, 1);
- }
-
- Matrix Matrix::operator+() const
- {
- return *this;
- }
-
- Matrix Matrix::operator-() const
- {
- const Matrix &M = *this;
-
- return Matrix(-M(1, 1), -M(1, 2), -M(1, 3), -M(1, 4),
- -M(2, 1), -M(2, 2), -M(2, 3), -M(2, 4),
- -M(3, 1), -M(3, 2), -M(3, 3), -M(3, 4),
- -M(4, 1), -M(4, 2), -M(4, 3), -M(4, 4));
- }
-
- Matrix Matrix::operator!() const
- {
- const Matrix &M = *this;
- Matrix I;
-
- float M3344 = M(3, 3) * M(4, 4) - M(4, 3) * M(3, 4);
- float M2344 = M(2, 3) * M(4, 4) - M(4, 3) * M(2, 4);
- float M2334 = M(2, 3) * M(3, 4) - M(3, 3) * M(2, 4);
- float M3244 = M(3, 2) * M(4, 4) - M(4, 2) * M(3, 4);
- float M2244 = M(2, 2) * M(4, 4) - M(4, 2) * M(2, 4);
- float M2234 = M(2, 2) * M(3, 4) - M(3, 2) * M(2, 4);
- float M3243 = M(3, 2) * M(4, 3) - M(4, 2) * M(3, 3);
- float M2243 = M(2, 2) * M(4, 3) - M(4, 2) * M(2, 3);
- float M2233 = M(2, 2) * M(3, 3) - M(3, 2) * M(2, 3);
- float M1344 = M(1, 3) * M(4, 4) - M(4, 3) * M(1, 4);
- float M1334 = M(1, 3) * M(3, 4) - M(3, 3) * M(1, 4);
- float M1244 = M(1, 2) * M(4, 4) - M(4, 2) * M(1, 4);
- float M1234 = M(1, 2) * M(3, 4) - M(3, 2) * M(1, 4);
- float M1243 = M(1, 2) * M(4, 3) - M(4, 2) * M(1, 3);
- float M1233 = M(1, 2) * M(3, 3) - M(3, 2) * M(1, 3);
- float M1324 = M(1, 3) * M(2, 4) - M(2, 3) * M(1, 4);
- float M1224 = M(1, 2) * M(2, 4) - M(2, 2) * M(1, 4);
- float M1223 = M(1, 2) * M(2, 3) - M(2, 2) * M(1, 3);
-
- // Adjoint Matrix
- I(1, 1) = M(2, 2) * M3344 - M(3, 2) * M2344 + M(4, 2) * M2334;
- I(2, 1) = -M(2, 1) * M3344 + M(3, 1) * M2344 - M(4, 1) * M2334;
- I(3, 1) = M(2, 1) * M3244 - M(3, 1) * M2244 + M(4, 1) * M2234;
- I(4, 1) = -M(2, 1) * M3243 + M(3, 1) * M2243 - M(4, 1) * M2233;
-
- I(1, 2) = -M(1, 2) * M3344 + M(3, 2) * M1344 - M(4, 2) * M1334;
- I(2, 2) = M(1, 1) * M3344 - M(3, 1) * M1344 + M(4, 1) * M1334;
- I(3, 2) = -M(1, 1) * M3244 + M(3, 1) * M1244 - M(4, 1) * M1234;
- I(4, 2) = M(1, 1) * M3243 - M(3, 1) * M1243 + M(4, 1) * M1233;
-
- I(1, 3) = M(1, 2) * M2344 - M(2, 2) * M1344 + M(4, 2) * M1324;
- I(2, 3) = -M(1, 1) * M2344 + M(2, 1) * M1344 - M(4, 1) * M1324;
- I(3, 3) = M(1, 1) * M2244 - M(2, 1) * M1244 + M(4, 1) * M1224;
- I(4, 3) = -M(1, 1) * M2243 + M(2, 1) * M1243 - M(4, 1) * M1223;
-
- I(1, 4) = -M(1, 2) * M2334 + M(2, 2) * M1334 - M(3, 2) * M1324;
- I(2, 4) = M(1, 1) * M2334 - M(2, 1) * M1334 + M(3, 1) * M1324;
- I(3, 4) = -M(1, 1) * M2234 + M(2, 1) * M1234 - M(3, 1) * M1224;
- I(4, 4) = M(1, 1) * M2233 - M(2, 1) * M1233 + M(3, 1) * M1223;
-
- // Division by determinant
- I /= M(1, 1) * I(1, 1) +
- M(2, 1) * I(1, 2) +
- M(3, 1) * I(1, 3) +
- M(4, 1) * I(1, 4);
-
- return I;
- }
-
- Matrix Matrix::operator~() const
- {
- const Matrix &M = *this;
-
- return Matrix(M(1, 1), M(2, 1), M(3, 1), M(4, 1),
- M(1, 2), M(2, 2), M(3, 2), M(4, 2),
- M(1, 3), M(2, 3), M(3, 3), M(4, 3),
- M(1, 4), M(2, 4), M(3, 4), M(4, 4));
- }
-
- Matrix &Matrix::operator+=(const Matrix &N)
- {
- Matrix &M = *this;
-
- M(1, 1) += N(1, 1); M(1, 2) += N(1, 2); M(1, 3) += N(1, 3); M(1, 4) += N(1, 4);
- M(2, 1) += N(2, 1); M(2, 2) += N(2, 2); M(2, 3) += N(2, 3); M(2, 4) += N(2, 4);
- M(3, 1) += N(3, 1); M(3, 2) += N(3, 2); M(3, 3) += N(3, 3); M(3, 4) += N(3, 4);
- M(4, 1) += N(4, 1); M(4, 2) += N(4, 2); M(4, 3) += N(4, 3); M(4, 4) += N(4, 4);
-
- return M;
- }
-
- Matrix &Matrix::operator-=(const Matrix &N)
- {
- Matrix &M = *this;
-
- M(1, 1) -= N(1, 1); M(1, 2) -= N(1, 2); M(1, 3) -= N(1, 3); M(1, 4) -= N(1, 4);
- M(2, 1) -= N(2, 1); M(2, 2) -= N(2, 2); M(2, 3) -= N(2, 3); M(2, 4) -= N(2, 4);
- M(3, 1) -= N(3, 1); M(3, 2) -= N(3, 2); M(3, 3) -= N(3, 3); M(3, 4) -= N(3, 4);
- M(4, 1) -= N(4, 1); M(4, 2) -= N(4, 2); M(4, 3) -= N(4, 3); M(4, 4) -= N(4, 4);
-
- return M;
- }
-
- Matrix &Matrix::operator*=(float s)
- {
- Matrix &M = *this;
-
- M(1, 1) *= s; M(1, 2) *= s; M(1, 3) *= s; M(1, 4) *= s;
- M(2, 1) *= s; M(2, 2) *= s; M(2, 3) *= s; M(2, 4) *= s;
- M(3, 1) *= s; M(3, 2) *= s; M(3, 3) *= s; M(3, 4) *= s;
- M(4, 1) *= s; M(4, 2) *= s; M(4, 3) *= s; M(4, 4) *= s;
-
- return M;
- }
-
- Matrix &Matrix::operator*=(const Matrix &M)
- {
- return *this = *this * M;
- }
-
- Matrix &Matrix::operator/=(float s)
- {
- float r = 1.0f / s;
-
- return *this *= r;
- }
-
- bool operator==(const Matrix &M, const Matrix &N)
- {
- if(M(1, 1) == N(1, 1) && M(1, 2) == N(1, 2) && M(1, 3) == N(1, 3) && M(1, 4) == N(1, 4) &&
- M(2, 1) == N(2, 1) && M(2, 2) == N(2, 2) && M(2, 3) == N(2, 3) && M(2, 4) == N(2, 4) &&
- M(3, 1) == N(3, 1) && M(3, 2) == N(3, 2) && M(3, 3) == N(3, 3) && M(3, 4) == N(3, 4) &&
- M(4, 1) == N(4, 1) && M(4, 2) == N(4, 2) && M(4, 3) == N(4, 3) && M(4, 4) == N(4, 4))
- return true;
- else
- return false;
- }
-
- bool operator!=(const Matrix &M, const Matrix &N)
- {
- if(M(1, 1) != N(1, 1) || M(1, 2) != N(1, 2) || M(1, 3) != N(1, 3) || M(1, 4) != N(1, 4) ||
- M(2, 1) != N(2, 1) || M(2, 2) != N(2, 2) || M(2, 3) != N(2, 3) || M(2, 4) != N(2, 4) ||
- M(3, 1) != N(3, 1) || M(3, 2) != N(3, 2) || M(3, 3) != N(3, 3) || M(3, 4) != N(3, 4) ||
- M(4, 1) != N(4, 1) || M(4, 2) != N(4, 2) || M(4, 3) != N(4, 3) || M(4, 4) != N(4, 4))
- return true;
- else
- return false;
- }
-
- Matrix operator+(const Matrix &M, const Matrix &N)
- {
- return Matrix(M(1, 1) + N(1, 1), M(1, 2) + N(1, 2), M(1, 3) + N(1, 3), M(1, 4) + N(1, 4),
- M(2, 1) + N(2, 1), M(2, 2) + N(2, 2), M(2, 3) + N(2, 3), M(2, 4) + N(2, 4),
- M(3, 1) + N(3, 1), M(3, 2) + N(3, 2), M(3, 3) + N(3, 3), M(3, 4) + N(3, 4),
- M(4, 1) + N(4, 1), M(4, 2) + N(4, 2), M(4, 3) + N(4, 3), M(4, 4) + N(4, 4));
- }
-
- Matrix operator-(const Matrix &M, const Matrix &N)
- {
- return Matrix(M(1, 1) - N(1, 1), M(1, 2) - N(1, 2), M(1, 3) - N(1, 3), M(1, 4) - N(1, 4),
- M(2, 1) - N(2, 1), M(2, 2) - N(2, 2), M(2, 3) - N(2, 3), M(2, 4) - N(2, 4),
- M(3, 1) - N(3, 1), M(3, 2) - N(3, 2), M(3, 3) - N(3, 3), M(3, 4) - N(3, 4),
- M(4, 1) - N(4, 1), M(4, 2) - N(4, 2), M(4, 3) - N(4, 3), M(4, 4) - N(4, 4));
- }
-
- Matrix operator*(float s, const Matrix &M)
- {
- return Matrix(s * M(1, 1), s * M(1, 2), s * M(1, 3), s * M(1, 4),
- s * M(2, 1), s * M(2, 2), s * M(2, 3), s * M(2, 4),
- s * M(3, 1), s * M(3, 2), s * M(3, 3), s * M(3, 4),
- s * M(4, 1), s * M(4, 2), s * M(4, 3), s * M(4, 4));
- }
-
- Matrix operator*(const Matrix &M, float s)
- {
- return Matrix(M(1, 1) * s, M(1, 2) * s, M(1, 3) * s, M(1, 4) * s,
- M(2, 1) * s, M(2, 2) * s, M(2, 3) * s, M(2, 4) * s,
- M(3, 1) * s, M(3, 2) * s, M(3, 3) * s, M(3, 4) * s,
- M(4, 1) * s, M(4, 2) * s, M(4, 3) * s, M(4, 4) * s);
- }
-
- Matrix operator*(const Matrix &M, const Matrix &N)
- {
- return Matrix(M(1, 1) * N(1, 1) + M(1, 2) * N(2, 1) + M(1, 3) * N(3, 1) + M(1, 4) * N(4, 1), M(1, 1) * N(1, 2) + M(1, 2) * N(2, 2) + M(1, 3) * N(3, 2) + M(1, 4) * N(4, 2), M(1, 1) * N(1, 3) + M(1, 2) * N(2, 3) + M(1, 3) * N(3, 3) + M(1, 4) * N(4, 3), M(1, 1) * N(1, 4) + M(1, 2) * N(2, 4) + M(1, 3) * N(3, 4) + M(1, 4) * N(4, 4),
- M(2, 1) * N(1, 1) + M(2, 2) * N(2, 1) + M(2, 3) * N(3, 1) + M(2, 4) * N(4, 1), M(2, 1) * N(1, 2) + M(2, 2) * N(2, 2) + M(2, 3) * N(3, 2) + M(2, 4) * N(4, 2), M(2, 1) * N(1, 3) + M(2, 2) * N(2, 3) + M(2, 3) * N(3, 3) + M(2, 4) * N(4, 3), M(2, 1) * N(1, 4) + M(2, 2) * N(2, 4) + M(2, 3) * N(3, 4) + M(2, 4) * N(4, 4),
- M(3, 1) * N(1, 1) + M(3, 2) * N(2, 1) + M(3, 3) * N(3, 1) + M(3, 4) * N(4, 1), M(3, 1) * N(1, 2) + M(3, 2) * N(2, 2) + M(3, 3) * N(3, 2) + M(3, 4) * N(4, 2), M(3, 1) * N(1, 3) + M(3, 2) * N(2, 3) + M(3, 3) * N(3, 3) + M(3, 4) * N(4, 3), M(3, 1) * N(1, 4) + M(3, 2) * N(2, 4) + M(3, 3) * N(3, 4) + M(3, 4) * N(4, 4),
- M(4, 1) * N(1, 1) + M(4, 2) * N(2, 1) + M(4, 3) * N(3, 1) + M(4, 4) * N(4, 1), M(4, 1) * N(1, 2) + M(4, 2) * N(2, 2) + M(4, 3) * N(3, 2) + M(4, 4) * N(4, 2), M(4, 1) * N(1, 3) + M(4, 2) * N(2, 3) + M(4, 3) * N(3, 3) + M(4, 4) * N(4, 3), M(4, 1) * N(1, 4) + M(4, 2) * N(2, 4) + M(4, 3) * N(3, 4) + M(4, 4) * N(4, 4));
- }
-
- Matrix operator/(const Matrix &M, float s)
- {
- float r = 1.0f / s;
-
- return M * r;
- }
-
- float4 Matrix::operator*(const float4 &v) const
- {
- const Matrix &M = *this;
- float Mx = M(1, 1) * v.x + M(1, 2) * v.y + M(1, 3) * v.z + M(1, 4) * v.w;
- float My = M(2, 1) * v.x + M(2, 2) * v.y + M(2, 3) * v.z + M(2, 4) * v.w;
- float Mz = M(3, 1) * v.x + M(3, 2) * v.y + M(3, 3) * v.z + M(3, 4) * v.w;
- float Mw = M(4, 1) * v.x + M(4, 2) * v.y + M(4, 3) * v.z + M(4, 4) * v.w;
-
- return {Mx, My, Mz, Mw};
- }
-
- float Matrix::det(const Matrix &M)
- {
- float M3344 = M(3, 3) * M(4, 4) - M(4, 3) * M(3, 4);
- float M2344 = M(2, 3) * M(4, 4) - M(4, 3) * M(2, 4);
- float M2334 = M(2, 3) * M(3, 4) - M(3, 3) * M(2, 4);
- float M1344 = M(1, 3) * M(4, 4) - M(4, 3) * M(1, 4);
- float M1334 = M(1, 3) * M(3, 4) - M(3, 3) * M(1, 4);
- float M1324 = M(1, 3) * M(2, 4) - M(2, 3) * M(1, 4);
-
- return M(1, 1) * (M(2, 2) * M3344 - M(3, 2) * M2344 + M(4, 2) * M2334) -
- M(2, 1) * (M(1, 2) * M3344 - M(3, 2) * M1344 + M(4, 2) * M1334) +
- M(3, 1) * (M(1, 2) * M2344 - M(2, 2) * M1344 + M(4, 2) * M1324) -
- M(4, 1) * (M(1, 2) * M2334 - M(2, 2) * M1334 + M(3, 2) * M1324);
- }
-
- float Matrix::det(float m11)
- {
- return m11;
- }
-
- float Matrix::det(float m11, float m12,
- float m21, float m22)
- {
- return m11 * m22 - m12 * m21;
- }
-
- float Matrix::det(float m11, float m12, float m13,
- float m21, float m22, float m23,
- float m31, float m32, float m33)
- {
- return m11 * (m22 * m33 - m32 * m23) -
- m21 * (m12 * m33 - m32 * m13) +
- m31 * (m12 * m23 - m22 * m13);
- }
-
- float Matrix::det(float m11, float m12, float m13, float m14,
- float m21, float m22, float m23, float m24,
- float m31, float m32, float m33, float m34,
- float m41, float m42, float m43, float m44)
- {
- float M3344 = m33 * m44 - m43 * m34;
- float M2344 = m23 * m44 - m43 * m24;
- float M2334 = m23 * m34 - m33 * m24;
- float M1344 = m13 * m44 - m43 * m14;
- float M1334 = m13 * m34 - m33 * m14;
- float M1324 = m13 * m24 - m23 * m14;
-
- return m11 * (m22 * M3344 - m32 * M2344 + m42 * M2334) -
- m21 * (m12 * M3344 - m32 * M1344 + m42 * M1334) +
- m31 * (m12 * M2344 - m22 * M1344 + m42 * M1324) -
- m41 * (m12 * M2334 - m22 * M1334 + m32 * M1324);
- }
-
- float Matrix::det(const Vector &v1, const Vector &v2, const Vector &v3)
- {
- return v1 * (v2 % v3);
- }
-
- float Matrix::det3(const Matrix &M)
- {
- return M(1, 1) * (M(2, 2) * M(3, 3) - M(3, 2) * M(2, 3)) -
- M(2, 1) * (M(1, 2) * M(3, 3) - M(3, 2) * M(1, 3)) +
- M(3, 1) * (M(1, 2) * M(2, 3) - M(2, 2) * M(1, 3));
- }
-
- float Matrix::tr(const Matrix &M)
- {
- return M(1, 1) + M(2, 2) + M(3, 3) + M(4, 4);
- }
-
- Matrix &Matrix::orthogonalise()
- {
- // NOTE: Numnerically instable, won't return exact the same result when already orhtogonal
-
- Matrix &M = *this;
-
- Vector v1(M(1, 1), M(2, 1), M(3, 1));
- Vector v2(M(1, 2), M(2, 2), M(3, 2));
- Vector v3(M(1, 3), M(2, 3), M(3, 3));
-
- v2 -= v1 * (v1 * v2) / (v1 * v1);
- v3 -= v1 * (v1 * v3) / (v1 * v1);
- v3 -= v2 * (v2 * v3) / (v2 * v2);
-
- v1 /= Vector::N(v1);
- v2 /= Vector::N(v2);
- v3 /= Vector::N(v3);
-
- M(1, 1) = v1.x; M(1, 2) = v2.x; M(1, 3) = v3.x;
- M(2, 1) = v1.y; M(2, 2) = v2.y; M(2, 3) = v3.y;
- M(3, 1) = v1.z; M(3, 2) = v2.z; M(3, 3) = v3.z;
-
- return *this;
- }
-
- Matrix Matrix::eulerRotate(const Vector &v)
- {
- float cz = cos(v.z);
- float sz = sin(v.z);
- float cx = cos(v.x);
- float sx = sin(v.x);
- float cy = cos(v.y);
- float sy = sin(v.y);
-
- float sxsy = sx * sy;
- float sxcy = sx * cy;
-
- return Matrix(cy * cz - sxsy * sz, -cy * sz - sxsy * cz, -sy * cx,
- cx * sz, cx * cz, -sx,
- sy * cz + sxcy * sz, -sy * sz + sxcy * cz, cy * cx);
- }
-
- Matrix Matrix::eulerRotate(float x, float y, float z)
- {
- return eulerRotate(Vector(x, y, z));
- }
-
- Matrix Matrix::translate(const Vector &v)
- {
- return Matrix(1, 0, 0, v.x,
- 0, 1, 0, v.y,
- 0, 0, 1, v.z,
- 0, 0, 0, 1);
- }
-
- Matrix Matrix::translate(float x, float y, float z)
- {
- return translate(Vector(x, y, z));
- }
-
- Matrix Matrix::scale(const Vector &v)
- {
- return Matrix(v.x, 0, 0,
- 0, v.y, 0,
- 0, 0, v.z);
- }
-
- Matrix Matrix::scale(float x, float y, float z)
- {
- return scale(Vector(x, y, z));
- }
-
- Matrix Matrix::lookAt(const Vector &v)
- {
- Vector y = v;
- y /= Vector::N(y);
-
- Vector x = y % Vector(0, 0, 1);
- x /= Vector::N(x);
-
- Vector z = x % y;
- z /= Vector::N(z);
-
- return ~Matrix(x, y, z);
- }
-
- Matrix Matrix::lookAt(float x, float y, float z)
- {
- return translate(Vector(x, y, z));
- }
-}
diff --git a/src/Renderer/Matrix.hpp b/src/Renderer/Matrix.hpp
deleted file mode 100644
index bec05d032..000000000
--- a/src/Renderer/Matrix.hpp
+++ /dev/null
@@ -1,203 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Matrix_hpp
-#define Matrix_hpp
-
-namespace sw
-{
- struct Vector;
- struct Point;
- struct float4;
-
- struct Matrix
- {
- Matrix();
- Matrix(const int i);
- Matrix(const float m[16]);
- Matrix(const float m[4][4]);
- Matrix(float m11, float m12, float m13,
- float m21, float m22, float m23,
- float m31, float m32, float m33);
- Matrix(float m11, float m12, float m13, float m14,
- float m21, float m22, float m23, float m24,
- float m31, float m32, float m33, float m34,
- float m41, float m42, float m43, float m44);
- Matrix(const Vector &v1, const Vector &v2, const Vector &v3); // Column vectors
-
- // Row major order
- float m[4][4];
-
- static Matrix diag(float m11, float m22, float m33, float m44);
-
- operator float*();
-
- Matrix operator+() const;
- Matrix operator-() const;
-
- Matrix operator!() const; // Inverse
- Matrix operator~() const; // Transpose
-
- Matrix &operator+=(const Matrix &N);
- Matrix &operator-=(const Matrix &N);
- Matrix &operator*=(float s);
- Matrix &operator*=(const Matrix &N);
- Matrix &operator/=(float s);
-
- float *operator[](int i); // Access element [row][col], starting with [0][0]
- const float *operator[](int i) const;
-
- float &operator()(int i, int j); // Access element (row, col), starting with (1, 1)
- const float &operator()(int i, int j) const;
-
- friend bool operator==(const Matrix &M, const Matrix &N);
- friend bool operator!=(const Matrix &M, const Matrix &N);
-
- friend Matrix operator+(const Matrix &M, const Matrix &N);
- friend Matrix operator-(const Matrix &M, const Matrix &N);
- friend Matrix operator*(float s, const Matrix &M);
- friend Matrix operator*(const Matrix &M, const Matrix &N);
- friend Matrix operator/(const Matrix &M, float s);
-
- float4 operator*(const float4 &v) const;
-
- static float det(const Matrix &M);
- static float det(float m11);
- static float det(float m11, float m12,
- float m21, float m22);
- static float det(float m11, float m12, float m13,
- float m21, float m22, float m23,
- float m31, float m32, float m33);
- static float det(float m11, float m12, float m13, float m14,
- float m21, float m22, float m23, float m24,
- float m31, float m32, float m33, float m34,
- float m41, float m42, float m43, float m44);
- static float det(const Vector &v1, const Vector &v2, const Vector &v3);
- static float det3(const Matrix &M);
-
- static float tr(const Matrix &M);
-
- Matrix &orthogonalise(); // Gram-Schmidt orthogonalisation of 3x3 submatrix
-
- static Matrix eulerRotate(const Vector &v);
- static Matrix eulerRotate(float x, float y, float z);
-
- static Matrix translate(const Vector &v);
- static Matrix translate(float x, float y, float z);
-
- static Matrix scale(const Vector &v);
- static Matrix scale(float x, float y, float z);
-
- static Matrix lookAt(const Vector &v);
- static Matrix lookAt(float x, float y, float z);
- };
-}
-
-#include "Vector.hpp"
-
-namespace sw
-{
- inline Matrix::Matrix()
- {
- }
-
- inline Matrix::Matrix(const int i)
- {
- const float s = (float)i;
-
- Matrix &M = *this;
-
- M(1, 1) = s; M(1, 2) = 0; M(1, 3) = 0; M(1, 4) = 0;
- M(2, 1) = 0; M(2, 2) = s; M(2, 3) = 0; M(2, 4) = 0;
- M(3, 1) = 0; M(3, 2) = 0; M(3, 3) = s; M(3, 4) = 0;
- M(4, 1) = 0; M(4, 2) = 0; M(4, 3) = 0; M(4, 4) = s;
- }
-
- inline Matrix::Matrix(const float m[16])
- {
- Matrix &M = *this;
-
- M(1, 1) = m[0]; M(1, 2) = m[1]; M(1, 3) = m[2]; M(1, 4) = m[3];
- M(2, 1) = m[4]; M(2, 2) = m[5]; M(2, 3) = m[6]; M(2, 4) = m[7];
- M(3, 1) = m[8]; M(3, 2) = m[8]; M(3, 3) = m[10]; M(3, 4) = m[11];
- M(4, 1) = m[12]; M(4, 2) = m[13]; M(4, 3) = m[14]; M(4, 4) = m[15];
- }
-
- inline Matrix::Matrix(const float m[4][4])
- {
- Matrix &M = *this;
-
- M[0][0] = m[0][0]; M[0][1] = m[0][1]; M[0][2] = m[0][2]; M[0][3] = m[0][3];
- M[1][0] = m[1][0]; M[1][1] = m[1][1]; M[1][2] = m[1][2]; M[1][3] = m[1][3];
- M[2][0] = m[2][0]; M[2][1] = m[2][1]; M[2][2] = m[2][2]; M[2][3] = m[2][3];
- M[3][0] = m[3][0]; M[3][1] = m[3][1]; M[3][2] = m[3][2]; M[3][3] = m[3][3];
- }
-
- inline Matrix::Matrix(float m11, float m12, float m13,
- float m21, float m22, float m23,
- float m31, float m32, float m33)
- {
- Matrix &M = *this;
-
- M(1, 1) = m11; M(1, 2) = m12; M(1, 3) = m13; M(1, 4) = 0;
- M(2, 1) = m21; M(2, 2) = m22; M(2, 3) = m23; M(2, 4) = 0;
- M(3, 1) = m31; M(3, 2) = m32; M(3, 3) = m33; M(3, 4) = 0;
- M(4, 1) = 0; M(4, 2) = 0; M(4, 3) = 0; M(4, 4) = 1;
- }
-
- inline Matrix::Matrix(float m11, float m12, float m13, float m14,
- float m21, float m22, float m23, float m24,
- float m31, float m32, float m33, float m34,
- float m41, float m42, float m43, float m44)
- {
- Matrix &M = *this;
-
- M(1, 1) = m11; M(1, 2) = m12; M(1, 3) = m13; M(1, 4) = m14;
- M(2, 1) = m21; M(2, 2) = m22; M(2, 3) = m23; M(2, 4) = m24;
- M(3, 1) = m31; M(3, 2) = m32; M(3, 3) = m33; M(3, 4) = m34;
- M(4, 1) = m41; M(4, 2) = m42; M(4, 3) = m43; M(4, 4) = m44;
- }
-
- inline Matrix::Matrix(const Vector &v1, const Vector &v2, const Vector &v3)
- {
- Matrix &M = *this;
-
- M(1, 1) = v1.x; M(1, 2) = v2.x; M(1, 3) = v3.x; M(1, 4) = 0;
- M(2, 1) = v1.y; M(2, 2) = v2.y; M(2, 3) = v3.y; M(2, 4) = 0;
- M(3, 1) = v1.z; M(3, 2) = v2.z; M(3, 3) = v3.z; M(3, 4) = 0;
- M(4, 1) = 0; M(4, 2) = 0; M(4, 3) = 0; M(4, 4) = 1;
- }
-
- inline float *Matrix::operator[](int i)
- {
- return m[i];
- }
-
- inline const float *Matrix::operator[](int i) const
- {
- return m[i];
- }
-
- inline float &Matrix::operator()(int i, int j)
- {
- return m[i - 1][j - 1];
- }
-
- inline const float &Matrix::operator()(int i, int j) const
- {
- return m[i - 1][j - 1];
- }
-}
-
-#endif // Matrix_hpp
diff --git a/src/Renderer/PixelProcessor.cpp b/src/Renderer/PixelProcessor.cpp
deleted file mode 100644
index 080258058..000000000
--- a/src/Renderer/PixelProcessor.cpp
+++ /dev/null
@@ -1,1221 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PixelProcessor.hpp"
-
-#include "Surface.hpp"
-#include "Primitive.hpp"
-#include "Shader/PixelPipeline.hpp"
-#include "Shader/PixelProgram.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Shader/Constants.hpp"
-#include "Common/Debug.hpp"
-#include "Common/Memory.hpp"
-
-#include <cstring>
-
-namespace sw
-{
- extern bool complementaryDepthBuffer;
- extern TransparencyAntialiasing transparencyAntialiasing;
- extern bool perspectiveCorrection;
-
- bool precachePixel = false;
-
- uint32_t PixelProcessor::States::computeHash()
- {
- uint32_t *state = reinterpret_cast<uint32_t*>(this);
- uint32_t hash = 0;
-
- for(unsigned int i = 0; i < sizeof(States) / sizeof(uint32_t); i++)
- {
- hash ^= state[i];
- }
-
- return hash;
- }
-
- bool PixelProcessor::State::operator==(const State &state) const
- {
- if(hash != state.hash)
- {
- return false;
- }
-
- static_assert(is_memcmparable<State>::value, "Cannot memcmp State");
- return memcmp(static_cast<const States*>(this), static_cast<const States*>(&state), sizeof(States)) == 0;
- }
-
- PixelProcessor::UniformBufferInfo::UniformBufferInfo()
- {
- buffer = nullptr;
- offset = 0;
- }
-
- PixelProcessor::PixelProcessor(Context *context) : context(context)
- {
- setGlobalMipmapBias(0.0f); // Round to highest LOD [0.5, 1.0]: -0.5
- // Round to nearest LOD [0.7, 1.4]: 0.0
- // Round to lowest LOD [1.0, 2.0]: 0.5
-
- routineCache = 0;
- setRoutineCacheSize(1024);
- }
-
- PixelProcessor::~PixelProcessor()
- {
- delete routineCache;
- routineCache = nullptr;
- }
-
- // This object has to be mem aligned
- void *PixelProcessor::operator new(size_t size)
- {
- ASSERT(size == sizeof(PixelProcessor)); // This operator can't be called from a derived class
- return sw::allocate(sizeof(PixelProcessor), 16);
- }
-
- void PixelProcessor::operator delete(void *mem)
- {
- sw::deallocate(mem);
- }
-
- void PixelProcessor::setFloatConstant(unsigned int index, const float value[4])
- {
- if(index < FRAGMENT_UNIFORM_VECTORS)
- {
- c[index][0] = value[0];
- c[index][1] = value[1];
- c[index][2] = value[2];
- c[index][3] = value[3];
- }
- else ASSERT(false);
-
- if(index < 8) // ps_1_x constants
- {
- // TODO: Compact into generic function
- short x = iround(4095 * clamp_s(value[0], -1.0f, 1.0f));
- short y = iround(4095 * clamp_s(value[1], -1.0f, 1.0f));
- short z = iround(4095 * clamp_s(value[2], -1.0f, 1.0f));
- short w = iround(4095 * clamp_s(value[3], -1.0f, 1.0f));
-
- cW[index][0][0] = x;
- cW[index][0][1] = x;
- cW[index][0][2] = x;
- cW[index][0][3] = x;
-
- cW[index][1][0] = y;
- cW[index][1][1] = y;
- cW[index][1][2] = y;
- cW[index][1][3] = y;
-
- cW[index][2][0] = z;
- cW[index][2][1] = z;
- cW[index][2][2] = z;
- cW[index][2][3] = z;
-
- cW[index][3][0] = w;
- cW[index][3][1] = w;
- cW[index][3][2] = w;
- cW[index][3][3] = w;
- }
- }
-
- void PixelProcessor::setIntegerConstant(unsigned int index, const int value[4])
- {
- if(index < 16)
- {
- i[index][0] = value[0];
- i[index][1] = value[1];
- i[index][2] = value[2];
- i[index][3] = value[3];
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setBooleanConstant(unsigned int index, int boolean)
- {
- if(index < 16)
- {
- b[index] = boolean != 0;
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setUniformBuffer(int index, sw::Resource* buffer, int offset)
- {
- uniformBufferInfo[index].buffer = buffer;
- uniformBufferInfo[index].offset = offset;
- }
-
- void PixelProcessor::lockUniformBuffers(byte** u, sw::Resource* uniformBuffers[])
- {
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; ++i)
- {
- u[i] = uniformBufferInfo[i].buffer ? static_cast<byte*>(uniformBufferInfo[i].buffer->lock(PUBLIC, PRIVATE)) + uniformBufferInfo[i].offset : nullptr;
- uniformBuffers[i] = uniformBufferInfo[i].buffer;
- }
- }
-
- void PixelProcessor::setRenderTarget(int index, Surface *renderTarget, unsigned int layer)
- {
- context->renderTarget[index] = renderTarget;
- context->renderTargetLayer[index] = layer;
- }
-
- void PixelProcessor::setDepthBuffer(Surface *depthBuffer, unsigned int layer)
- {
- context->depthBuffer = depthBuffer;
- context->depthBufferLayer = layer;
- }
-
- void PixelProcessor::setStencilBuffer(Surface *stencilBuffer, unsigned int layer)
- {
- context->stencilBuffer = stencilBuffer;
- context->stencilBufferLayer = layer;
- }
-
- void PixelProcessor::setTexCoordIndex(unsigned int stage, int texCoordIndex)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setTexCoordIndex(texCoordIndex);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setStageOperation(unsigned int stage, TextureStage::StageOperation stageOperation)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setStageOperation(stageOperation);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setFirstArgument(unsigned int stage, TextureStage::SourceArgument firstArgument)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setFirstArgument(firstArgument);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSecondArgument(unsigned int stage, TextureStage::SourceArgument secondArgument)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setSecondArgument(secondArgument);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setThirdArgument(unsigned int stage, TextureStage::SourceArgument thirdArgument)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setThirdArgument(thirdArgument);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setStageOperationAlpha(unsigned int stage, TextureStage::StageOperation stageOperationAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setStageOperationAlpha(stageOperationAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setFirstArgumentAlpha(unsigned int stage, TextureStage::SourceArgument firstArgumentAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setFirstArgumentAlpha(firstArgumentAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSecondArgumentAlpha(unsigned int stage, TextureStage::SourceArgument secondArgumentAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setSecondArgumentAlpha(secondArgumentAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setThirdArgumentAlpha(unsigned int stage, TextureStage::SourceArgument thirdArgumentAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setThirdArgumentAlpha(thirdArgumentAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setFirstModifier(unsigned int stage, TextureStage::ArgumentModifier firstModifier)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setFirstModifier(firstModifier);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSecondModifier(unsigned int stage, TextureStage::ArgumentModifier secondModifier)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setSecondModifier(secondModifier);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setThirdModifier(unsigned int stage, TextureStage::ArgumentModifier thirdModifier)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setThirdModifier(thirdModifier);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setFirstModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier firstModifierAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setFirstModifierAlpha(firstModifierAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSecondModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier secondModifierAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setSecondModifierAlpha(secondModifierAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setThirdModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier thirdModifierAlpha)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setThirdModifierAlpha(thirdModifierAlpha);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setDestinationArgument(unsigned int stage, TextureStage::DestinationArgument destinationArgument)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setDestinationArgument(destinationArgument);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setConstantColor(unsigned int stage, const Color<float> &constantColor)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setConstantColor(constantColor);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setBumpmapMatrix(unsigned int stage, int element, float value)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setBumpmapMatrix(element, value);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setLuminanceScale(unsigned int stage, float value)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setLuminanceScale(value);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setLuminanceOffset(unsigned int stage, float value)
- {
- if(stage < 8)
- {
- context->textureStage[stage].setLuminanceOffset(value);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setTextureFilter(unsigned int sampler, FilterType textureFilter)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setTextureFilter(textureFilter);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMipmapFilter(unsigned int sampler, MipmapType mipmapFilter)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMipmapFilter(mipmapFilter);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setGatherEnable(unsigned int sampler, bool enable)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setGatherEnable(enable);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setAddressingModeU(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setAddressingModeU(addressMode);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setAddressingModeV(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setAddressingModeV(addressMode);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setAddressingModeW(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setAddressingModeW(addressMode);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setReadSRGB(unsigned int sampler, bool sRGB)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setReadSRGB(sRGB);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMipmapLOD(unsigned int sampler, float bias)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMipmapLOD(bias);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setBorderColor(unsigned int sampler, const Color<float> &borderColor)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setBorderColor(borderColor);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMaxAnisotropy(maxAnisotropy);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setHighPrecisionFiltering(unsigned int sampler, bool highPrecisionFiltering)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setHighPrecisionFiltering(highPrecisionFiltering);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSwizzleR(unsigned int sampler, SwizzleType swizzleR)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSwizzleR(swizzleR);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSwizzleG(unsigned int sampler, SwizzleType swizzleG)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSwizzleG(swizzleG);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSwizzleB(unsigned int sampler, SwizzleType swizzleB)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSwizzleB(swizzleB);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSwizzleA(unsigned int sampler, SwizzleType swizzleA)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSwizzleA(swizzleA);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setCompareFunc(unsigned int sampler, CompareFunc compFunc)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setCompareFunc(compFunc);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setBaseLevel(unsigned int sampler, int baseLevel)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setBaseLevel(baseLevel);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMaxLevel(unsigned int sampler, int maxLevel)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMaxLevel(maxLevel);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMinLod(unsigned int sampler, float minLod)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMinLod(minLod);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setMaxLod(unsigned int sampler, float maxLod)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setMaxLod(maxLod);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setSyncRequired(unsigned int sampler, bool isSincRequired)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSyncRequired(isSincRequired);
- }
- else ASSERT(false);
- }
-
- void PixelProcessor::setWriteSRGB(bool sRGB)
- {
- context->setWriteSRGB(sRGB);
- }
-
- void PixelProcessor::setColorLogicOpEnabled(bool colorLogicOpEnabled)
- {
- context->setColorLogicOpEnabled(colorLogicOpEnabled);
- }
-
- void PixelProcessor::setLogicalOperation(LogicalOperation logicalOperation)
- {
- context->setLogicalOperation(logicalOperation);
- }
-
- void PixelProcessor::setDepthBufferEnable(bool depthBufferEnable)
- {
- context->setDepthBufferEnable(depthBufferEnable);
- }
-
- void PixelProcessor::setDepthCompare(DepthCompareMode depthCompareMode)
- {
- context->depthCompareMode = depthCompareMode;
- }
-
- void PixelProcessor::setAlphaCompare(AlphaCompareMode alphaCompareMode)
- {
- context->alphaCompareMode = alphaCompareMode;
- }
-
- void PixelProcessor::setDepthWriteEnable(bool depthWriteEnable)
- {
- context->depthWriteEnable = depthWriteEnable;
- }
-
- void PixelProcessor::setAlphaTestEnable(bool alphaTestEnable)
- {
- context->alphaTestEnable = alphaTestEnable;
- }
-
- void PixelProcessor::setCullMode(CullMode cullMode, bool frontFacingCCW)
- {
- context->cullMode = cullMode;
- context->frontFacingCCW = frontFacingCCW;
- }
-
- void PixelProcessor::setColorWriteMask(int index, int rgbaMask)
- {
- context->setColorWriteMask(index, rgbaMask);
- }
-
- void PixelProcessor::setStencilEnable(bool stencilEnable)
- {
- context->stencilEnable = stencilEnable;
- }
-
- void PixelProcessor::setStencilCompare(StencilCompareMode stencilCompareMode)
- {
- context->stencilCompareMode = stencilCompareMode;
- }
-
- void PixelProcessor::setStencilReference(int stencilReference)
- {
- context->stencilReference = stencilReference;
- stencil.set(stencilReference, context->stencilMask, context->stencilWriteMask);
- }
-
- void PixelProcessor::setStencilReferenceCCW(int stencilReferenceCCW)
- {
- context->stencilReferenceCCW = stencilReferenceCCW;
- stencilCCW.set(stencilReferenceCCW, context->stencilMaskCCW, context->stencilWriteMaskCCW);
- }
-
- void PixelProcessor::setStencilMask(int stencilMask)
- {
- context->stencilMask = stencilMask;
- stencil.set(context->stencilReference, stencilMask, context->stencilWriteMask);
- }
-
- void PixelProcessor::setStencilMaskCCW(int stencilMaskCCW)
- {
- context->stencilMaskCCW = stencilMaskCCW;
- stencilCCW.set(context->stencilReferenceCCW, stencilMaskCCW, context->stencilWriteMaskCCW);
- }
-
- void PixelProcessor::setStencilFailOperation(StencilOperation stencilFailOperation)
- {
- context->stencilFailOperation = stencilFailOperation;
- }
-
- void PixelProcessor::setStencilPassOperation(StencilOperation stencilPassOperation)
- {
- context->stencilPassOperation = stencilPassOperation;
- }
-
- void PixelProcessor::setStencilZFailOperation(StencilOperation stencilZFailOperation)
- {
- context->stencilZFailOperation = stencilZFailOperation;
- }
-
- void PixelProcessor::setStencilWriteMask(int stencilWriteMask)
- {
- context->stencilWriteMask = stencilWriteMask;
- stencil.set(context->stencilReference, context->stencilMask, stencilWriteMask);
- }
-
- void PixelProcessor::setStencilWriteMaskCCW(int stencilWriteMaskCCW)
- {
- context->stencilWriteMaskCCW = stencilWriteMaskCCW;
- stencilCCW.set(context->stencilReferenceCCW, context->stencilMaskCCW, stencilWriteMaskCCW);
- }
-
- void PixelProcessor::setTwoSidedStencil(bool enable)
- {
- context->twoSidedStencil = enable;
- }
-
- void PixelProcessor::setStencilCompareCCW(StencilCompareMode stencilCompareMode)
- {
- context->stencilCompareModeCCW = stencilCompareMode;
- }
-
- void PixelProcessor::setStencilFailOperationCCW(StencilOperation stencilFailOperation)
- {
- context->stencilFailOperationCCW = stencilFailOperation;
- }
-
- void PixelProcessor::setStencilPassOperationCCW(StencilOperation stencilPassOperation)
- {
- context->stencilPassOperationCCW = stencilPassOperation;
- }
-
- void PixelProcessor::setStencilZFailOperationCCW(StencilOperation stencilZFailOperation)
- {
- context->stencilZFailOperationCCW = stencilZFailOperation;
- }
-
- void PixelProcessor::setTextureFactor(const Color<float> &textureFactor)
- {
- // FIXME: Compact into generic function // FIXME: Clamp
- short textureFactorR = iround(4095 * textureFactor.r);
- short textureFactorG = iround(4095 * textureFactor.g);
- short textureFactorB = iround(4095 * textureFactor.b);
- short textureFactorA = iround(4095 * textureFactor.a);
-
- factor.textureFactor4[0][0] = textureFactorR;
- factor.textureFactor4[0][1] = textureFactorR;
- factor.textureFactor4[0][2] = textureFactorR;
- factor.textureFactor4[0][3] = textureFactorR;
-
- factor.textureFactor4[1][0] = textureFactorG;
- factor.textureFactor4[1][1] = textureFactorG;
- factor.textureFactor4[1][2] = textureFactorG;
- factor.textureFactor4[1][3] = textureFactorG;
-
- factor.textureFactor4[2][0] = textureFactorB;
- factor.textureFactor4[2][1] = textureFactorB;
- factor.textureFactor4[2][2] = textureFactorB;
- factor.textureFactor4[2][3] = textureFactorB;
-
- factor.textureFactor4[3][0] = textureFactorA;
- factor.textureFactor4[3][1] = textureFactorA;
- factor.textureFactor4[3][2] = textureFactorA;
- factor.textureFactor4[3][3] = textureFactorA;
- }
-
- void PixelProcessor::setBlendConstant(const Color<float> &blendConstant)
- {
- // FIXME: Compact into generic function // FIXME: Clamp
- short blendConstantR = iround(65535 * blendConstant.r);
- short blendConstantG = iround(65535 * blendConstant.g);
- short blendConstantB = iround(65535 * blendConstant.b);
- short blendConstantA = iround(65535 * blendConstant.a);
-
- factor.blendConstant4W[0][0] = blendConstantR;
- factor.blendConstant4W[0][1] = blendConstantR;
- factor.blendConstant4W[0][2] = blendConstantR;
- factor.blendConstant4W[0][3] = blendConstantR;
-
- factor.blendConstant4W[1][0] = blendConstantG;
- factor.blendConstant4W[1][1] = blendConstantG;
- factor.blendConstant4W[1][2] = blendConstantG;
- factor.blendConstant4W[1][3] = blendConstantG;
-
- factor.blendConstant4W[2][0] = blendConstantB;
- factor.blendConstant4W[2][1] = blendConstantB;
- factor.blendConstant4W[2][2] = blendConstantB;
- factor.blendConstant4W[2][3] = blendConstantB;
-
- factor.blendConstant4W[3][0] = blendConstantA;
- factor.blendConstant4W[3][1] = blendConstantA;
- factor.blendConstant4W[3][2] = blendConstantA;
- factor.blendConstant4W[3][3] = blendConstantA;
-
- // FIXME: Compact into generic function // FIXME: Clamp
- short invBlendConstantR = iround(65535 * (1 - blendConstant.r));
- short invBlendConstantG = iround(65535 * (1 - blendConstant.g));
- short invBlendConstantB = iround(65535 * (1 - blendConstant.b));
- short invBlendConstantA = iround(65535 * (1 - blendConstant.a));
-
- factor.invBlendConstant4W[0][0] = invBlendConstantR;
- factor.invBlendConstant4W[0][1] = invBlendConstantR;
- factor.invBlendConstant4W[0][2] = invBlendConstantR;
- factor.invBlendConstant4W[0][3] = invBlendConstantR;
-
- factor.invBlendConstant4W[1][0] = invBlendConstantG;
- factor.invBlendConstant4W[1][1] = invBlendConstantG;
- factor.invBlendConstant4W[1][2] = invBlendConstantG;
- factor.invBlendConstant4W[1][3] = invBlendConstantG;
-
- factor.invBlendConstant4W[2][0] = invBlendConstantB;
- factor.invBlendConstant4W[2][1] = invBlendConstantB;
- factor.invBlendConstant4W[2][2] = invBlendConstantB;
- factor.invBlendConstant4W[2][3] = invBlendConstantB;
-
- factor.invBlendConstant4W[3][0] = invBlendConstantA;
- factor.invBlendConstant4W[3][1] = invBlendConstantA;
- factor.invBlendConstant4W[3][2] = invBlendConstantA;
- factor.invBlendConstant4W[3][3] = invBlendConstantA;
-
- factor.blendConstant4F[0][0] = blendConstant.r;
- factor.blendConstant4F[0][1] = blendConstant.r;
- factor.blendConstant4F[0][2] = blendConstant.r;
- factor.blendConstant4F[0][3] = blendConstant.r;
-
- factor.blendConstant4F[1][0] = blendConstant.g;
- factor.blendConstant4F[1][1] = blendConstant.g;
- factor.blendConstant4F[1][2] = blendConstant.g;
- factor.blendConstant4F[1][3] = blendConstant.g;
-
- factor.blendConstant4F[2][0] = blendConstant.b;
- factor.blendConstant4F[2][1] = blendConstant.b;
- factor.blendConstant4F[2][2] = blendConstant.b;
- factor.blendConstant4F[2][3] = blendConstant.b;
-
- factor.blendConstant4F[3][0] = blendConstant.a;
- factor.blendConstant4F[3][1] = blendConstant.a;
- factor.blendConstant4F[3][2] = blendConstant.a;
- factor.blendConstant4F[3][3] = blendConstant.a;
-
- factor.invBlendConstant4F[0][0] = 1 - blendConstant.r;
- factor.invBlendConstant4F[0][1] = 1 - blendConstant.r;
- factor.invBlendConstant4F[0][2] = 1 - blendConstant.r;
- factor.invBlendConstant4F[0][3] = 1 - blendConstant.r;
-
- factor.invBlendConstant4F[1][0] = 1 - blendConstant.g;
- factor.invBlendConstant4F[1][1] = 1 - blendConstant.g;
- factor.invBlendConstant4F[1][2] = 1 - blendConstant.g;
- factor.invBlendConstant4F[1][3] = 1 - blendConstant.g;
-
- factor.invBlendConstant4F[2][0] = 1 - blendConstant.b;
- factor.invBlendConstant4F[2][1] = 1 - blendConstant.b;
- factor.invBlendConstant4F[2][2] = 1 - blendConstant.b;
- factor.invBlendConstant4F[2][3] = 1 - blendConstant.b;
-
- factor.invBlendConstant4F[3][0] = 1 - blendConstant.a;
- factor.invBlendConstant4F[3][1] = 1 - blendConstant.a;
- factor.invBlendConstant4F[3][2] = 1 - blendConstant.a;
- factor.invBlendConstant4F[3][3] = 1 - blendConstant.a;
- }
-
- void PixelProcessor::setFillMode(FillMode fillMode)
- {
- context->fillMode = fillMode;
- }
-
- void PixelProcessor::setShadingMode(ShadingMode shadingMode)
- {
- context->shadingMode = shadingMode;
- }
-
- void PixelProcessor::setAlphaBlendEnable(bool alphaBlendEnable)
- {
- context->setAlphaBlendEnable(alphaBlendEnable);
- }
-
- void PixelProcessor::setSourceBlendFactor(BlendFactor sourceBlendFactor)
- {
- context->setSourceBlendFactor(sourceBlendFactor);
- }
-
- void PixelProcessor::setDestBlendFactor(BlendFactor destBlendFactor)
- {
- context->setDestBlendFactor(destBlendFactor);
- }
-
- void PixelProcessor::setBlendOperation(BlendOperation blendOperation)
- {
- context->setBlendOperation(blendOperation);
- }
-
- void PixelProcessor::setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable)
- {
- context->setSeparateAlphaBlendEnable(separateAlphaBlendEnable);
- }
-
- void PixelProcessor::setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha)
- {
- context->setSourceBlendFactorAlpha(sourceBlendFactorAlpha);
- }
-
- void PixelProcessor::setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha)
- {
- context->setDestBlendFactorAlpha(destBlendFactorAlpha);
- }
-
- void PixelProcessor::setBlendOperationAlpha(BlendOperation blendOperationAlpha)
- {
- context->setBlendOperationAlpha(blendOperationAlpha);
- }
-
- void PixelProcessor::setAlphaReference(float alphaReference)
- {
- context->alphaReference = alphaReference;
-
- factor.alphaReference4[0] = (word)iround(alphaReference * 0x1000 / 0xFF);
- factor.alphaReference4[1] = (word)iround(alphaReference * 0x1000 / 0xFF);
- factor.alphaReference4[2] = (word)iround(alphaReference * 0x1000 / 0xFF);
- factor.alphaReference4[3] = (word)iround(alphaReference * 0x1000 / 0xFF);
- }
-
- void PixelProcessor::setGlobalMipmapBias(float bias)
- {
- context->setGlobalMipmapBias(bias);
- }
-
- void PixelProcessor::setFogStart(float start)
- {
- setFogRanges(start, context->fogEnd);
- }
-
- void PixelProcessor::setFogEnd(float end)
- {
- setFogRanges(context->fogStart, end);
- }
-
- void PixelProcessor::setFogColor(Color<float> fogColor)
- {
- // TODO: Compact into generic function
- word fogR = (unsigned short)(65535 * fogColor.r);
- word fogG = (unsigned short)(65535 * fogColor.g);
- word fogB = (unsigned short)(65535 * fogColor.b);
-
- fog.color4[0][0] = fogR;
- fog.color4[0][1] = fogR;
- fog.color4[0][2] = fogR;
- fog.color4[0][3] = fogR;
-
- fog.color4[1][0] = fogG;
- fog.color4[1][1] = fogG;
- fog.color4[1][2] = fogG;
- fog.color4[1][3] = fogG;
-
- fog.color4[2][0] = fogB;
- fog.color4[2][1] = fogB;
- fog.color4[2][2] = fogB;
- fog.color4[2][3] = fogB;
-
- fog.colorF[0] = replicate(fogColor.r);
- fog.colorF[1] = replicate(fogColor.g);
- fog.colorF[2] = replicate(fogColor.b);
- }
-
- void PixelProcessor::setFogDensity(float fogDensity)
- {
- fog.densityE = replicate(-fogDensity * 1.442695f); // 1/e^x = 2^(-x*1.44)
- fog.density2E = replicate(-fogDensity * fogDensity * 1.442695f);
- }
-
- void PixelProcessor::setPixelFogMode(FogMode fogMode)
- {
- context->pixelFogMode = fogMode;
- }
-
- void PixelProcessor::setPerspectiveCorrection(bool perspectiveEnable)
- {
- perspectiveCorrection = perspectiveEnable;
- }
-
- void PixelProcessor::setOcclusionEnabled(bool enable)
- {
- context->occlusionEnabled = enable;
- }
-
- void PixelProcessor::setRoutineCacheSize(int cacheSize)
- {
- delete routineCache;
- routineCache = new RoutineCache<State>(clamp(cacheSize, 1, 65536));
- }
-
- void PixelProcessor::setFogRanges(float start, float end)
- {
- context->fogStart = start;
- context->fogEnd = end;
-
- if(start == end)
- {
- end += 0.001f; // Hack: ensure there is a small range
- }
-
- float fogScale = -1.0f / (end - start);
- float fogOffset = end * -fogScale;
-
- fog.scale = replicate(fogScale);
- fog.offset = replicate(fogOffset);
- }
-
- const PixelProcessor::State PixelProcessor::update() const
- {
- State state;
-
- if(context->pixelShader)
- {
- state.shaderID = context->pixelShader->getSerialID();
- }
- else
- {
- state.shaderID = 0;
- }
-
- state.depthOverride = context->pixelShader && context->pixelShader->depthOverride();
- state.shaderContainsKill = context->pixelShader ? context->pixelShader->containsKill() : false;
-
- if(context->alphaTestActive())
- {
- state.alphaCompareMode = context->alphaCompareMode;
-
- state.transparencyAntialiasing = context->getMultiSampleCount() > 1 ? transparencyAntialiasing : TRANSPARENCY_NONE;
- }
-
- state.depthWriteEnable = context->depthWriteActive();
-
- if(context->stencilActive())
- {
- state.stencilActive = true;
- state.stencilCompareMode = context->stencilCompareMode;
- state.stencilFailOperation = context->stencilFailOperation;
- state.stencilPassOperation = context->stencilPassOperation;
- state.stencilZFailOperation = context->stencilZFailOperation;
- state.noStencilMask = (context->stencilMask == 0xFF);
- state.noStencilWriteMask = (context->stencilWriteMask == 0xFF);
- state.stencilWriteMasked = (context->stencilWriteMask == 0x00);
-
- state.twoSidedStencil = context->twoSidedStencil;
- state.stencilCompareModeCCW = context->twoSidedStencil ? context->stencilCompareModeCCW : state.stencilCompareMode;
- state.stencilFailOperationCCW = context->twoSidedStencil ? context->stencilFailOperationCCW : state.stencilFailOperation;
- state.stencilPassOperationCCW = context->twoSidedStencil ? context->stencilPassOperationCCW : state.stencilPassOperation;
- state.stencilZFailOperationCCW = context->twoSidedStencil ? context->stencilZFailOperationCCW : state.stencilZFailOperation;
- state.noStencilMaskCCW = context->twoSidedStencil ? (context->stencilMaskCCW == 0xFF) : state.noStencilMask;
- state.noStencilWriteMaskCCW = context->twoSidedStencil ? (context->stencilWriteMaskCCW == 0xFF) : state.noStencilWriteMask;
- state.stencilWriteMaskedCCW = context->twoSidedStencil ? (context->stencilWriteMaskCCW == 0x00) : state.stencilWriteMasked;
- }
-
- if(context->depthBufferActive())
- {
- state.depthTestActive = true;
- state.depthCompareMode = context->depthCompareMode;
- state.quadLayoutDepthBuffer = Surface::hasQuadLayout(context->depthBuffer->getInternalFormat());
- }
-
- state.occlusionEnabled = context->occlusionEnabled;
-
- state.fogActive = context->fogActive();
- state.pixelFogMode = context->pixelFogActive();
- state.wBasedFog = context->wBasedFog && context->pixelFogActive() != FOG_NONE;
- state.perspective = context->perspectiveActive();
- state.depthClamp = (context->depthBias != 0.0f) || (context->slopeDepthBias != 0.0f);
-
- if(context->alphaBlendActive())
- {
- state.alphaBlendActive = true;
- state.sourceBlendFactor = context->sourceBlendFactor();
- state.destBlendFactor = context->destBlendFactor();
- state.blendOperation = context->blendOperation();
- state.sourceBlendFactorAlpha = context->sourceBlendFactorAlpha();
- state.destBlendFactorAlpha = context->destBlendFactorAlpha();
- state.blendOperationAlpha = context->blendOperationAlpha();
- }
-
- state.logicalOperation = context->colorLogicOp();
-
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- state.colorWriteMask |= context->colorWriteActive(i) << (4 * i);
- state.targetFormat[i] = context->renderTargetInternalFormat(i);
- }
-
- state.writeSRGB = context->writeSRGB && context->renderTarget[0] && Surface::isSRGBwritable(context->renderTarget[0]->getExternalFormat());
- state.multiSample = context->getMultiSampleCount();
- state.multiSampleMask = context->multiSampleMask;
-
- if(state.multiSample > 1 && context->pixelShader)
- {
- state.centroid = context->pixelShader->containsCentroid();
- }
-
- state.frontFaceCCW = context->frontFacingCCW;
-
- if(!context->pixelShader)
- {
- for(unsigned int i = 0; i < 8; i++)
- {
- state.textureStage[i] = context->textureStage[i].textureStageState();
- }
-
- state.specularAdd = context->specularActive() && context->specularEnable;
- }
-
- for(unsigned int i = 0; i < 16; i++)
- {
- if(context->pixelShader)
- {
- if(context->pixelShader->usesSampler(i))
- {
- state.sampler[i] = context->sampler[i].samplerState();
- }
- }
- else
- {
- if(i < 8 && state.textureStage[i].stageOperation != TextureStage::STAGE_DISABLE)
- {
- state.sampler[i] = context->sampler[i].samplerState();
- }
- else break;
- }
- }
-
- const bool point = context->isDrawPoint(true);
- const bool sprite = context->pointSpriteActive();
- const bool flatShading = (context->shadingMode == SHADING_FLAT) || point;
-
- if(context->pixelShaderModel() < 0x0300)
- {
- for(int coordinate = 0; coordinate < 8; coordinate++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(context->textureActive(coordinate, component))
- {
- state.texture[coordinate].component |= 1 << component;
-
- if(point && !sprite)
- {
- state.texture[coordinate].flat |= 1 << component;
- }
- }
- }
-
- if(context->textureTransformProject[coordinate] && context->pixelShaderModel() <= 0x0103)
- {
- if(context->textureTransformCount[coordinate] == 2)
- {
- state.texture[coordinate].project = 1;
- }
- else if(context->textureTransformCount[coordinate] == 3)
- {
- state.texture[coordinate].project = 2;
- }
- else if(context->textureTransformCount[coordinate] == 4 || context->textureTransformCount[coordinate] == 0)
- {
- state.texture[coordinate].project = 3;
- }
- }
- }
-
- for(int color = 0; color < 2; color++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(context->colorActive(color, component))
- {
- state.color[color].component |= 1 << component;
-
- if(point || flatShading)
- {
- state.color[color].flat |= 1 << component;
- }
- }
- }
- }
-
- if(context->fogActive())
- {
- state.fog.component = true;
-
- if(point)
- {
- state.fog.flat = true;
- }
- }
- }
- else
- {
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- const Shader::Semantic &semantic = context->pixelShader->getInput(interpolant, component);
-
- if(semantic.active())
- {
- bool flat = point;
-
- switch(semantic.usage)
- {
- case Shader::USAGE_TEXCOORD: flat = point && !sprite; break;
- case Shader::USAGE_COLOR: flat = semantic.flat || flatShading; break;
- }
-
- state.interpolant[interpolant].component |= 1 << component;
-
- if(flat)
- {
- state.interpolant[interpolant].flat |= 1 << component;
- }
- }
- }
- }
- }
-
- if(state.centroid)
- {
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- state.interpolant[interpolant].centroid = context->pixelShader->getInput(interpolant, 0).centroid;
- }
- }
- }
-
- state.hash = state.computeHash();
-
- return state;
- }
-
- std::shared_ptr<Routine> PixelProcessor::routine(const State &state)
- {
- auto routine = routineCache->query(state);
-
- if(!routine)
- {
- const bool integerPipeline = (context->pixelShaderModel() <= 0x0104);
- QuadRasterizer *generator = nullptr;
-
- if(integerPipeline)
- {
- generator = new PixelPipeline(state, context->pixelShader);
- }
- else
- {
- generator = new PixelProgram(state, context->pixelShader);
- }
-
- generator->generate();
- routine = (*generator)("PixelRoutine_%0.8X", state.shaderID);
- delete generator;
-
- routineCache->add(state, routine);
- }
-
- return routine;
- }
-}
diff --git a/src/Renderer/PixelProcessor.hpp b/src/Renderer/PixelProcessor.hpp
deleted file mode 100644
index 2c543982a..000000000
--- a/src/Renderer/PixelProcessor.hpp
+++ /dev/null
@@ -1,346 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_PixelProcessor_hpp
-#define sw_PixelProcessor_hpp
-
-#include "Context.hpp"
-#include "RoutineCache.hpp"
-
-namespace sw
-{
- class PixelShader;
- class Rasterizer;
- struct Texture;
- struct DrawData;
-
- class PixelProcessor
- {
- public:
- struct States : Memset<States>
- {
- States() : Memset(this, 0) {}
-
- uint32_t computeHash();
-
- int shaderID;
-
- bool depthOverride : 1; // TODO: Eliminate by querying shader.
- bool shaderContainsKill : 1; // TODO: Eliminate by querying shader.
-
- DepthCompareMode depthCompareMode : BITS(DEPTH_LAST);
- AlphaCompareMode alphaCompareMode : BITS(ALPHA_LAST);
- bool depthWriteEnable : 1;
- bool quadLayoutDepthBuffer : 1;
-
- bool stencilActive : 1;
- StencilCompareMode stencilCompareMode : BITS(STENCIL_LAST);
- StencilOperation stencilFailOperation : BITS(OPERATION_LAST);
- StencilOperation stencilPassOperation : BITS(OPERATION_LAST);
- StencilOperation stencilZFailOperation : BITS(OPERATION_LAST);
- bool noStencilMask : 1;
- bool noStencilWriteMask : 1;
- bool stencilWriteMasked : 1;
- bool twoSidedStencil : 1;
- StencilCompareMode stencilCompareModeCCW : BITS(STENCIL_LAST);
- StencilOperation stencilFailOperationCCW : BITS(OPERATION_LAST);
- StencilOperation stencilPassOperationCCW : BITS(OPERATION_LAST);
- StencilOperation stencilZFailOperationCCW : BITS(OPERATION_LAST);
- bool noStencilMaskCCW : 1;
- bool noStencilWriteMaskCCW : 1;
- bool stencilWriteMaskedCCW : 1;
-
- bool depthTestActive : 1;
- bool depthBoundsTestActive : 1;
- bool fogActive : 1;
- FogMode pixelFogMode : BITS(FOG_LAST);
- bool specularAdd : 1;
- bool occlusionEnabled : 1;
- bool wBasedFog : 1;
- bool perspective : 1;
- bool depthClamp : 1;
-
- bool alphaBlendActive : 1;
- BlendFactor sourceBlendFactor : BITS(BLEND_LAST);
- BlendFactor destBlendFactor : BITS(BLEND_LAST);
- BlendOperation blendOperation : BITS(BLENDOP_LAST);
- BlendFactor sourceBlendFactorAlpha : BITS(BLEND_LAST);
- BlendFactor destBlendFactorAlpha : BITS(BLEND_LAST);
- BlendOperation blendOperationAlpha : BITS(BLENDOP_LAST);
-
- unsigned int colorWriteMask : RENDERTARGETS * 4; // Four component bit masks
- Format targetFormat[RENDERTARGETS];
- bool writeSRGB : 1;
- unsigned int multiSample : 3;
- unsigned int multiSampleMask : 4;
- TransparencyAntialiasing transparencyAntialiasing : BITS(TRANSPARENCY_LAST);
- bool centroid : 1;
- bool frontFaceCCW : 1;
-
- LogicalOperation logicalOperation : BITS(LOGICALOP_LAST);
-
- Sampler::State sampler[TEXTURE_IMAGE_UNITS];
- TextureStage::State textureStage[8];
-
- struct Interpolant
- {
- unsigned char component : 4;
- unsigned char flat : 4;
- unsigned char project : 2;
- bool centroid : 1;
- };
-
- union
- {
- struct
- {
- Interpolant color[2];
- Interpolant texture[8];
- Interpolant fog;
- };
-
- Interpolant interpolant[MAX_FRAGMENT_INPUTS];
- };
- };
-
- struct State : States
- {
- bool operator==(const State &state) const;
-
- int colorWriteActive(int index) const
- {
- return (colorWriteMask >> (index * 4)) & 0xF;
- }
-
- bool alphaTestActive() const
- {
- return (alphaCompareMode != ALPHA_ALWAYS) || (transparencyAntialiasing != TRANSPARENCY_NONE);
- }
-
- bool pixelFogActive() const
- {
- return pixelFogMode != FOG_NONE;
- }
-
- uint32_t hash;
- };
-
- struct Stencil
- {
- int64_t testMaskQ;
- int64_t referenceMaskedQ;
- int64_t referenceMaskedSignedQ;
- int64_t writeMaskQ;
- int64_t invWriteMaskQ;
- int64_t referenceQ;
-
- void set(int reference, int testMask, int writeMask)
- {
- referenceQ = replicate(reference);
- testMaskQ = replicate(testMask);
- writeMaskQ = replicate(writeMask);
- invWriteMaskQ = ~writeMaskQ;
- referenceMaskedQ = referenceQ & testMaskQ;
- referenceMaskedSignedQ = replicate(((reference & testMask) + 0x80) & 0xFF);
- }
-
- static int64_t replicate(int b)
- {
- int64_t w = b & 0xFF;
-
- return (w << 0) | (w << 8) | (w << 16) | (w << 24) | (w << 32) | (w << 40) | (w << 48) | (w << 56);
- }
- };
-
- struct Fog
- {
- float4 scale;
- float4 offset;
- word4 color4[3];
- float4 colorF[3];
- float4 densityE;
- float4 density2E;
- };
-
- struct Factor
- {
- word4 textureFactor4[4];
-
- word4 alphaReference4;
-
- word4 blendConstant4W[4];
- float4 blendConstant4F[4];
- word4 invBlendConstant4W[4];
- float4 invBlendConstant4F[4];
- };
-
- public:
- typedef void (*RoutinePointer)(const Primitive *primitive, int count, int thread, DrawData *draw);
-
- PixelProcessor(Context *context);
-
- virtual ~PixelProcessor();
-
- void *operator new(size_t size);
- void operator delete(void *mem);
-
- void setFloatConstant(unsigned int index, const float value[4]);
- void setIntegerConstant(unsigned int index, const int value[4]);
- void setBooleanConstant(unsigned int index, int boolean);
-
- void setUniformBuffer(int index, sw::Resource* buffer, int offset);
- void lockUniformBuffers(byte** u, sw::Resource* uniformBuffers[]);
-
- void setRenderTarget(int index, Surface *renderTarget, unsigned int layer = 0);
- void setDepthBuffer(Surface *depthBuffer, unsigned int layer = 0);
- void setStencilBuffer(Surface *stencilBuffer, unsigned int layer = 0);
-
- void setTexCoordIndex(unsigned int stage, int texCoordIndex);
- void setStageOperation(unsigned int stage, TextureStage::StageOperation stageOperation);
- void setFirstArgument(unsigned int stage, TextureStage::SourceArgument firstArgument);
- void setSecondArgument(unsigned int stage, TextureStage::SourceArgument secondArgument);
- void setThirdArgument(unsigned int stage, TextureStage::SourceArgument thirdArgument);
- void setStageOperationAlpha(unsigned int stage, TextureStage::StageOperation stageOperationAlpha);
- void setFirstArgumentAlpha(unsigned int stage, TextureStage::SourceArgument firstArgumentAlpha);
- void setSecondArgumentAlpha(unsigned int stage, TextureStage::SourceArgument secondArgumentAlpha);
- void setThirdArgumentAlpha(unsigned int stage, TextureStage::SourceArgument thirdArgumentAlpha);
- void setFirstModifier(unsigned int stage, TextureStage::ArgumentModifier firstModifier);
- void setSecondModifier(unsigned int stage, TextureStage::ArgumentModifier secondModifier);
- void setThirdModifier(unsigned int stage, TextureStage::ArgumentModifier thirdModifier);
- void setFirstModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier firstModifierAlpha);
- void setSecondModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier secondModifierAlpha);
- void setThirdModifierAlpha(unsigned int stage, TextureStage::ArgumentModifier thirdModifierAlpha);
- void setDestinationArgument(unsigned int stage, TextureStage::DestinationArgument destinationArgument);
- void setConstantColor(unsigned int stage, const Color<float> &constantColor);
- void setBumpmapMatrix(unsigned int stage, int element, float value);
- void setLuminanceScale(unsigned int stage, float value);
- void setLuminanceOffset(unsigned int stage, float value);
-
- void setTextureFilter(unsigned int sampler, FilterType textureFilter);
- void setMipmapFilter(unsigned int sampler, MipmapType mipmapFilter);
- void setGatherEnable(unsigned int sampler, bool enable);
- void setAddressingModeU(unsigned int sampler, AddressingMode addressingMode);
- void setAddressingModeV(unsigned int sampler, AddressingMode addressingMode);
- void setAddressingModeW(unsigned int sampler, AddressingMode addressingMode);
- void setReadSRGB(unsigned int sampler, bool sRGB);
- void setMipmapLOD(unsigned int sampler, float bias);
- void setBorderColor(unsigned int sampler, const Color<float> &borderColor);
- void setMaxAnisotropy(unsigned int sampler, float maxAnisotropy);
- void setHighPrecisionFiltering(unsigned int sampler, bool highPrecisionFiltering);
- void setSwizzleR(unsigned int sampler, SwizzleType swizzleR);
- void setSwizzleG(unsigned int sampler, SwizzleType swizzleG);
- void setSwizzleB(unsigned int sampler, SwizzleType swizzleB);
- void setSwizzleA(unsigned int sampler, SwizzleType swizzleA);
- void setCompareFunc(unsigned int sampler, CompareFunc compare);
- void setBaseLevel(unsigned int sampler, int baseLevel);
- void setMaxLevel(unsigned int sampler, int maxLevel);
- void setMinLod(unsigned int sampler, float minLod);
- void setMaxLod(unsigned int sampler, float maxLod);
- void setSyncRequired(unsigned int sampler, bool isSincRequired);
-
- void setWriteSRGB(bool sRGB);
- void setDepthBufferEnable(bool depthBufferEnable);
- void setDepthCompare(DepthCompareMode depthCompareMode);
- void setAlphaCompare(AlphaCompareMode alphaCompareMode);
- void setDepthWriteEnable(bool depthWriteEnable);
- void setAlphaTestEnable(bool alphaTestEnable);
- void setCullMode(CullMode cullMode, bool frontFacingCCW);
- void setColorWriteMask(int index, int rgbaMask);
-
- void setColorLogicOpEnabled(bool colorLogicOpEnabled);
- void setLogicalOperation(LogicalOperation logicalOperation);
-
- void setStencilEnable(bool stencilEnable);
- void setStencilCompare(StencilCompareMode stencilCompareMode);
- void setStencilReference(int stencilReference);
- void setStencilMask(int stencilMask);
- void setStencilFailOperation(StencilOperation stencilFailOperation);
- void setStencilPassOperation(StencilOperation stencilPassOperation);
- void setStencilZFailOperation(StencilOperation stencilZFailOperation);
- void setStencilWriteMask(int stencilWriteMask);
- void setTwoSidedStencil(bool enable);
- void setStencilCompareCCW(StencilCompareMode stencilCompareMode);
- void setStencilReferenceCCW(int stencilReference);
- void setStencilMaskCCW(int stencilMask);
- void setStencilFailOperationCCW(StencilOperation stencilFailOperation);
- void setStencilPassOperationCCW(StencilOperation stencilPassOperation);
- void setStencilZFailOperationCCW(StencilOperation stencilZFailOperation);
- void setStencilWriteMaskCCW(int stencilWriteMask);
-
- void setTextureFactor(const Color<float> &textureFactor);
- void setBlendConstant(const Color<float> &blendConstant);
-
- void setFillMode(FillMode fillMode);
- void setShadingMode(ShadingMode shadingMode);
-
- void setAlphaBlendEnable(bool alphaBlendEnable);
- void setSourceBlendFactor(BlendFactor sourceBlendFactor);
- void setDestBlendFactor(BlendFactor destBlendFactor);
- void setBlendOperation(BlendOperation blendOperation);
-
- void setSeparateAlphaBlendEnable(bool separateAlphaBlendEnable);
- void setSourceBlendFactorAlpha(BlendFactor sourceBlendFactorAlpha);
- void setDestBlendFactorAlpha(BlendFactor destBlendFactorAlpha);
- void setBlendOperationAlpha(BlendOperation blendOperationAlpha);
-
- void setAlphaReference(float alphaReference);
-
- void setGlobalMipmapBias(float bias);
-
- void setFogStart(float start);
- void setFogEnd(float end);
- void setFogColor(Color<float> fogColor);
- void setFogDensity(float fogDensity);
- void setPixelFogMode(FogMode fogMode);
-
- void setPerspectiveCorrection(bool perspectiveCorrection);
-
- void setOcclusionEnabled(bool enable);
-
- protected:
- const State update() const;
- std::shared_ptr<Routine> routine(const State &state);
- void setRoutineCacheSize(int routineCacheSize);
-
- // Shader constants
- word4 cW[8][4];
- float4 c[FRAGMENT_UNIFORM_VECTORS];
- int4 i[16];
- bool b[16];
-
- // Other semi-constants
- Stencil stencil;
- Stencil stencilCCW;
- Fog fog;
- Factor factor;
-
- private:
- struct UniformBufferInfo
- {
- UniformBufferInfo();
-
- Resource* buffer;
- int offset;
- };
- UniformBufferInfo uniformBufferInfo[MAX_UNIFORM_BUFFER_BINDINGS];
-
- void setFogRanges(float start, float end);
-
- Context *const context;
-
- RoutineCache<State> *routineCache;
- };
-}
-
-#endif // sw_PixelProcessor_hpp
diff --git a/src/Renderer/Plane.cpp b/src/Renderer/Plane.cpp
deleted file mode 100644
index 095b7f2e6..000000000
--- a/src/Renderer/Plane.cpp
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Plane.hpp"
-
-#include "Matrix.hpp"
-
-namespace sw
-{
- Plane::Plane()
- {
- }
-
- Plane::Plane(float p_A, float p_B, float p_C, float p_D)
- {
- A = p_A;
- B = p_B;
- C = p_C;
- D = p_D;
- }
-
- Plane::Plane(const float ABCD[4])
- {
- A = ABCD[0];
- B = ABCD[1];
- C = ABCD[2];
- D = ABCD[3];
- }
-
- Plane operator*(const Plane &p, const Matrix &T)
- {
- Matrix M = !T;
-
- return Plane(p.A * M(1, 1) + p.B * M(1, 2) + p.C * M(1, 3) + p.D * M(1, 4),
- p.A * M(2, 1) + p.B * M(2, 2) + p.C * M(2, 3) + p.D * M(2, 4),
- p.A * M(3, 1) + p.B * M(3, 2) + p.C * M(3, 3) + p.D * M(3, 4),
- p.A * M(4, 1) + p.B * M(4, 2) + p.C * M(4, 3) + p.D * M(4, 4));
- }
-
- Plane operator*(const Matrix &T, const Plane &p)
- {
- Matrix M = !T;
-
- return Plane(M(1, 1) * p.A + M(2, 1) * p.B + M(3, 1) * p.C + M(4, 1) * p.D,
- M(1, 2) * p.A + M(2, 2) * p.B + M(3, 2) * p.C + M(4, 2) * p.D,
- M(1, 3) * p.A + M(2, 3) * p.B + M(3, 3) * p.C + M(4, 3) * p.D,
- M(1, 4) * p.A + M(2, 4) * p.B + M(3, 4) * p.C + M(4, 4) * p.D);
- }
-}
diff --git a/src/Renderer/Plane.hpp b/src/Renderer/Plane.hpp
deleted file mode 100644
index 962b9aee0..000000000
--- a/src/Renderer/Plane.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Plane_hpp
-#define Plane_hpp
-
-#include "Vector.hpp"
-
-namespace sw
-{
- struct Matrix;
-
- struct Plane
- {
- float A;
- float B;
- float C;
- float D;
-
- Plane();
- Plane(float A, float B, float C, float D); // Plane equation
- Plane(const float ABCD[4]);
-
- friend Plane operator*(const Plane &p, const Matrix &A); // Transform plane by matrix (post-multiply)
- friend Plane operator*(const Matrix &A, const Plane &p); // Transform plane by matrix (pre-multiply)
- };
-}
-
-#endif // Plane_hpp
diff --git a/src/Renderer/Point.cpp b/src/Renderer/Point.cpp
deleted file mode 100644
index e7e33dd27..000000000
--- a/src/Renderer/Point.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Point.hpp"
-
-#include "Matrix.hpp"
-
-namespace sw
-{
- Point &Point::operator+=(const Vector &v)
- {
- x += v.x;
- y += v.y;
- z += v.z;
-
- return *this;
- }
-
- Point &Point::operator-=(const Vector &v)
- {
- x -= v.x;
- y -= v.y;
- z -= v.z;
-
- return *this;
- }
-
- Point operator+(const Point &P, const Vector &v)
- {
- return Point(P.x + v.x, P.y + v.y, P.z + v.z);
- }
-
- Point operator-(const Point &P, const Vector &v)
- {
- return Point(P.x - v.x, P.y - v.y, P.z - v.z);
- }
-
- Vector operator-(const Point &P, const Point &Q)
- {
- return Vector(P.x - Q.x, P.y - Q.y, P.z - Q.z);
- }
-
- Point operator*(const Matrix &M, const Point &P)
- {
- return Point(M(1, 1) * P.x + M(1, 2) * P.y + M(1, 3) * P.z + M(1, 4),
- M(2, 1) * P.x + M(2, 2) * P.y + M(2, 3) * P.z + M(2, 4),
- M(3, 1) * P.x + M(3, 2) * P.y + M(3, 3) * P.z + M(3, 4));
- }
-
- Point operator*(const Point &P, const Matrix &M)
- {
- return Point(P.x * M(1, 1) + P.y * M(2, 1) + P.z * M(3, 1),
- P.x * M(1, 2) + P.y * M(2, 2) + P.z * M(3, 2),
- P.x * M(1, 3) + P.y * M(2, 3) + P.z * M(3, 3));
- }
-
- Point &operator*=(Point &P, const Matrix &M)
- {
- return P = P * M;
- }
-
- float Point::d(const Point &P) const
- {
- return Vector::N(*this - P);
- }
-
- float Point::d2(const Point &P) const
- {
- return Vector::N2(*this - P);
- }
-
- float Point::d(const Point &P, const Point &Q)
- {
- return Vector::N(P - Q);
- }
-
- float Point::d2(const Point &P, const Point &Q)
- {
- return Vector::N2(P - Q);
- }
-}
diff --git a/src/Renderer/Point.hpp b/src/Renderer/Point.hpp
deleted file mode 100644
index 85198c5f4..000000000
--- a/src/Renderer/Point.hpp
+++ /dev/null
@@ -1,139 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Point_hpp
-#define Point_hpp
-
-namespace sw
-{
- struct Vector;
- struct Matrix;
-
- struct Point
- {
- Point();
- Point(const int i);
- Point(const Point &P);
- Point(const Vector &v);
- Point(float Px, float Py, float Pz);
-
- Point &operator=(const Point &P);
-
- union
- {
- float p[3];
-
- struct
- {
- float x;
- float y;
- float z;
- };
- };
-
- float &operator[](int i);
- float &operator()(int i);
-
- const float &operator[](int i) const;
- const float &operator()(int i) const;
-
- Point &operator+=(const Vector &v);
- Point &operator-=(const Vector &v);
-
- friend Point operator+(const Point &P, const Vector &v);
- friend Point operator-(const Point &P, const Vector &v);
-
- friend Vector operator-(const Point &P, const Point &Q);
-
- friend Point operator*(const Matrix &M, const Point& P);
- friend Point operator*(const Point &P, const Matrix &M);
- friend Point &operator*=(Point &P, const Matrix &M);
-
- float d(const Point &P) const; // Distance between two points
- float d2(const Point &P) const; // Squared distance between two points
-
- static float d(const Point &P, const Point &Q); // Distance between two points
- static float d2(const Point &P, const Point &Q); // Squared distance between two points
- };
-}
-
-#include "Vector.hpp"
-
-namespace sw
-{
- inline Point::Point()
- {
- }
-
- inline Point::Point(const int i)
- {
- const float s = (float)i;
-
- x = s;
- y = s;
- z = s;
- }
-
- inline Point::Point(const Point &P)
- {
- x = P.x;
- y = P.y;
- z = P.z;
- }
-
- inline Point::Point(const Vector &v)
- {
- x = v.x;
- y = v.y;
- z = v.z;
- }
-
- inline Point::Point(float P_x, float P_y, float P_z)
- {
- x = P_x;
- y = P_y;
- z = P_z;
- }
-
- inline Point &Point::operator=(const Point &P)
- {
- x = P.x;
- y = P.y;
- z = P.z;
-
- return *this;
- }
-
- inline float &Point::operator()(int i)
- {
- return p[i];
- }
-
- inline float &Point::operator[](int i)
- {
- return p[i];
- }
-
- inline const float &Point::operator()(int i) const
- {
- return p[i];
- }
-
- inline const float &Point::operator[](int i) const
- {
- return p[i];
- }
-}
-
-#endif // Point_hpp
diff --git a/src/Renderer/Polygon.hpp b/src/Renderer/Polygon.hpp
deleted file mode 100644
index 8ee856279..000000000
--- a/src/Renderer/Polygon.hpp
+++ /dev/null
@@ -1,56 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Polygon_hpp
-#define sw_Polygon_hpp
-
-#include "Vertex.hpp"
-
-namespace sw
-{
- struct Polygon
- {
- Polygon(const float4 *P0, const float4 *P1, const float4 *P2)
- {
- P[0][0] = P0;
- P[0][1] = P1;
- P[0][2] = P2;
-
- n = 3;
- i = 0;
- b = 0;
- }
-
- Polygon(const float4 *P, int n)
- {
- for(int i = 0; i < n; i++)
- {
- this->P[0][i] = &P[i];
- }
-
- this->n = n;
- this->i = 0;
- this->b = 0;
- }
-
- float4 B[16]; // Buffer for clipped vertices
- const float4 *P[16][16]; // Pointers to clipped polygon's vertices
-
- int n; // Number of vertices
- int i; // Level of P to use
- int b; // Next available new vertex
- };
-}
-
-#endif // sw_Polygon_hpp
diff --git a/src/Renderer/Primitive.hpp b/src/Renderer/Primitive.hpp
deleted file mode 100644
index 52daa1849..000000000
--- a/src/Renderer/Primitive.hpp
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Primitive_hpp
-#define sw_Primitive_hpp
-
-#include "Vertex.hpp"
-#include "Main/Config.hpp"
-
-namespace sw
-{
- struct Triangle
- {
- Vertex v0;
- Vertex v1;
- Vertex v2;
- };
-
- struct PlaneEquation // z = A * x + B * y + C
- {
- float4 A;
- float4 B;
- float4 C;
- };
-
- struct Primitive
- {
- int yMin;
- int yMax;
-
- float4 xQuad;
- float4 yQuad;
-
- PlaneEquation z;
- PlaneEquation w;
-
- union
- {
- struct
- {
- PlaneEquation C[2][4];
- PlaneEquation T[8][4];
- PlaneEquation f;
- };
-
- PlaneEquation V[MAX_FRAGMENT_INPUTS][4];
- };
-
- float area;
-
- // Masks for two-sided stencil
- int64_t clockwiseMask;
- int64_t invClockwiseMask;
-
- struct Span
- {
- unsigned short left;
- unsigned short right;
- };
-
- // The rasterizer adds a zero length span to the top and bottom of the polygon to allow
- // for 2x2 pixel processing. We need an even number of spans to keep accesses aligned.
- Span outlineUnderflow[2];
- Span outline[OUTLINE_RESOLUTION];
- Span outlineOverflow[2];
- };
-}
-
-#endif // sw_Primitive_hpp
diff --git a/src/Renderer/QuadRasterizer.cpp b/src/Renderer/QuadRasterizer.cpp
deleted file mode 100644
index 3f711c0df..000000000
--- a/src/Renderer/QuadRasterizer.cpp
+++ /dev/null
@@ -1,350 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "QuadRasterizer.hpp"
-
-#include "Primitive.hpp"
-#include "Renderer.hpp"
-#include "Shader/Constants.hpp"
-#include "Common/Math.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- extern bool veryEarlyDepthTest;
- extern bool complementaryDepthBuffer;
- extern bool fullPixelPositionRegister;
-
- extern int clusterCount;
-
- QuadRasterizer::QuadRasterizer(const PixelProcessor::State &state, const PixelShader *pixelShader) : state(state), shader(pixelShader)
- {
- }
-
- QuadRasterizer::~QuadRasterizer()
- {
- }
-
- void QuadRasterizer::generate()
- {
- #if PERF_PROFILE
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- cycles[i] = 0;
- }
-
- Long pixelTime = Ticks();
- #endif
-
- constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
- occlusion = 0;
- int clusterCount = Renderer::getClusterCount();
-
- Do
- {
- yMin = *Pointer<Int>(primitive + OFFSET(Primitive,yMin));
- yMax = *Pointer<Int>(primitive + OFFSET(Primitive,yMax));
-
- Int cluster2 = cluster + cluster;
- yMin += clusterCount * 2 - 2 - cluster2;
- yMin &= -clusterCount * 2;
- yMin += cluster2;
-
- If(yMin < yMax)
- {
- rasterize();
- }
-
- primitive += sizeof(Primitive) * state.multiSample;
- count--;
- }
- Until(count == 0);
-
- if(state.occlusionEnabled)
- {
- UInt clusterOcclusion = *Pointer<UInt>(data + OFFSET(DrawData,occlusion) + 4 * cluster);
- clusterOcclusion += occlusion;
- *Pointer<UInt>(data + OFFSET(DrawData,occlusion) + 4 * cluster) = clusterOcclusion;
- }
-
- #if PERF_PROFILE
- cycles[PERF_PIXEL] = Ticks() - pixelTime;
-
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- *Pointer<Long>(data + OFFSET(DrawData,cycles[i]) + 8 * cluster) += cycles[i];
- }
- #endif
-
- Return();
- }
-
- void QuadRasterizer::rasterize()
- {
- Pointer<Byte> cBuffer[RENDERTARGETS];
- Pointer<Byte> zBuffer;
- Pointer<Byte> sBuffer;
-
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- if(state.colorWriteActive(index))
- {
- cBuffer[index] = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,colorBuffer[index])) + yMin * *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- }
- }
-
- if(state.depthTestActive)
- {
- zBuffer = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,depthBuffer)) + yMin * *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
- }
-
- if(state.stencilActive)
- {
- sBuffer = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,stencilBuffer)) + yMin * *Pointer<Int>(data + OFFSET(DrawData,stencilPitchB));
- }
-
- y = yMin;
-
- Do
- {
- Int x0a = Int(*Pointer<Short>(primitive + OFFSET(Primitive,outline->left) + (y + 0) * sizeof(Primitive::Span)));
- Int x0b = Int(*Pointer<Short>(primitive + OFFSET(Primitive,outline->left) + (y + 1) * sizeof(Primitive::Span)));
- Int x0 = Min(x0a, x0b);
-
- for(unsigned int q = 1; q < state.multiSample; q++)
- {
- x0a = Int(*Pointer<Short>(primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->left) + (y + 0) * sizeof(Primitive::Span)));
- x0b = Int(*Pointer<Short>(primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->left) + (y + 1) * sizeof(Primitive::Span)));
- x0 = Min(x0, Min(x0a, x0b));
- }
-
- x0 &= 0xFFFFFFFE;
-
- Int x1a = Int(*Pointer<Short>(primitive + OFFSET(Primitive,outline->right) + (y + 0) * sizeof(Primitive::Span)));
- Int x1b = Int(*Pointer<Short>(primitive + OFFSET(Primitive,outline->right) + (y + 1) * sizeof(Primitive::Span)));
- Int x1 = Max(x1a, x1b);
-
- for(unsigned int q = 1; q < state.multiSample; q++)
- {
- x1a = Int(*Pointer<Short>(primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->right) + (y + 0) * sizeof(Primitive::Span)));
- x1b = Int(*Pointer<Short>(primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->right) + (y + 1) * sizeof(Primitive::Span)));
- x1 = Max(x1, Max(x1a, x1b));
- }
-
- Float4 yyyy = Float4(Float(y)) + *Pointer<Float4>(primitive + OFFSET(Primitive,yQuad), 16);
-
- if(interpolateZ())
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Float4 y = yyyy;
-
- if(state.multiSample > 1)
- {
- y -= *Pointer<Float4>(constants + OFFSET(Constants,Y) + q * sizeof(float4));
- }
-
- Dz[q] = *Pointer<Float4>(primitive + OFFSET(Primitive,z.C), 16) + y * *Pointer<Float4>(primitive + OFFSET(Primitive,z.B), 16);
- }
- }
-
- if(veryEarlyDepthTest && state.multiSample == 1 && !state.depthOverride)
- {
- if(!state.stencilActive && state.depthTestActive && (state.depthCompareMode == DEPTH_LESSEQUAL || state.depthCompareMode == DEPTH_LESS)) // FIXME: Both modes ok?
- {
- Float4 xxxx = Float4(Float(x0)) + *Pointer<Float4>(primitive + OFFSET(Primitive,xQuad), 16);
-
- Pointer<Byte> buffer;
- Int pitch;
-
- if(!state.quadLayoutDepthBuffer)
- {
- buffer = zBuffer + 4 * x0;
- pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
- }
- else
- {
- buffer = zBuffer + 8 * x0;
- }
-
- For(Int x = x0, x < x1, x += 2)
- {
- Float4 z = interpolate(xxxx, Dz[0], z, primitive + OFFSET(Primitive,z), false, false, state.depthClamp);
-
- Float4 zValue;
-
- if(!state.quadLayoutDepthBuffer)
- {
- // FIXME: Properly optimizes?
- zValue.xy = *Pointer<Float4>(buffer);
- zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
- }
- else
- {
- zValue = *Pointer<Float4>(buffer, 16);
- }
-
- Int4 zTest;
-
- if(complementaryDepthBuffer)
- {
- zTest = CmpLE(zValue, z);
- }
- else
- {
- zTest = CmpNLT(zValue, z);
- }
-
- Int zMask = SignMask(zTest);
-
- If(zMask == 0)
- {
- x0 += 2;
- }
- Else
- {
- x = x1;
- }
-
- xxxx += Float4(2);
-
- if(!state.quadLayoutDepthBuffer)
- {
- buffer += 8;
- }
- else
- {
- buffer += 16;
- }
- }
- }
- }
-
- If(x0 < x1)
- {
- if(interpolateW())
- {
- Dw = *Pointer<Float4>(primitive + OFFSET(Primitive,w.C), 16) + yyyy * *Pointer<Float4>(primitive + OFFSET(Primitive,w.B), 16);
- }
-
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(state.interpolant[interpolant].component & (1 << component))
- {
- Dv[interpolant][component] = *Pointer<Float4>(primitive + OFFSET(Primitive,V[interpolant][component].C), 16);
-
- if(!(state.interpolant[interpolant].flat & (1 << component)))
- {
- Dv[interpolant][component] += yyyy * *Pointer<Float4>(primitive + OFFSET(Primitive,V[interpolant][component].B), 16);
- }
- }
- }
- }
-
- if(state.fog.component)
- {
- Df = *Pointer<Float4>(primitive + OFFSET(Primitive,f.C), 16);
-
- if(!state.fog.flat)
- {
- Df += yyyy * *Pointer<Float4>(primitive + OFFSET(Primitive,f.B), 16);
- }
- }
-
- Short4 xLeft[4];
- Short4 xRight[4];
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- xLeft[q] = *Pointer<Short4>(primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline) + y * sizeof(Primitive::Span));
- xRight[q] = xLeft[q];
-
- xLeft[q] = Swizzle(xLeft[q], 0x0022) - Short4(1, 2, 1, 2);
- xRight[q] = Swizzle(xRight[q], 0x1133) - Short4(0, 1, 0, 1);
- }
-
- For(Int x = x0, x < x1, x += 2)
- {
- Short4 xxxx = Short4(x);
- Int cMask[4];
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Short4 mask = CmpGT(xxxx, xLeft[q]) & CmpGT(xRight[q], xxxx);
- cMask[q] = SignMask(PackSigned(mask, mask)) & 0x0000000F;
- }
-
- quad(cBuffer, zBuffer, sBuffer, cMask, x);
- }
- }
-
- int clusterCount = Renderer::getClusterCount();
-
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- if(state.colorWriteActive(index))
- {
- cBuffer[index] += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index])) << (1 + sw::log2(clusterCount)); // FIXME: Precompute
- }
- }
-
- if(state.depthTestActive)
- {
- zBuffer += *Pointer<Int>(data + OFFSET(DrawData,depthPitchB)) << (1 + sw::log2(clusterCount)); // FIXME: Precompute
- }
-
- if(state.stencilActive)
- {
- sBuffer += *Pointer<Int>(data + OFFSET(DrawData,stencilPitchB)) << (1 + sw::log2(clusterCount)); // FIXME: Precompute
- }
-
- y += 2 * clusterCount;
- }
- Until(y >= yMax);
- }
-
- Float4 QuadRasterizer::interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp)
- {
- Float4 interpolant = D;
-
- if(!flat)
- {
- interpolant += x * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation, A), 16);
-
- if(perspective)
- {
- interpolant *= rhw;
- }
- }
-
- if(clamp)
- {
- interpolant = Min(Max(interpolant, Float4(0.0f)), Float4(1.0f));
- }
-
- return interpolant;
- }
-
- bool QuadRasterizer::interpolateZ() const
- {
- return state.depthTestActive || state.pixelFogActive() || (shader && shader->isVPosDeclared() && fullPixelPositionRegister);
- }
-
- bool QuadRasterizer::interpolateW() const
- {
- return state.perspective || (shader && shader->isVPosDeclared() && fullPixelPositionRegister);
- }
-}
diff --git a/src/Renderer/QuadRasterizer.hpp b/src/Renderer/QuadRasterizer.hpp
deleted file mode 100644
index 77bbce15d..000000000
--- a/src/Renderer/QuadRasterizer.hpp
+++ /dev/null
@@ -1,65 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_QuadRasterizer_hpp
-#define sw_QuadRasterizer_hpp
-
-#include "Rasterizer.hpp"
-#include "Shader/ShaderCore.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Common/Types.hpp"
-
-namespace sw
-{
- class QuadRasterizer : public Rasterizer
- {
- public:
- QuadRasterizer(const PixelProcessor::State &state, const PixelShader *shader);
- virtual ~QuadRasterizer();
-
- void generate();
-
- protected:
- Pointer<Byte> constants;
-
- Float4 Dz[4];
- Float4 Dw;
- Float4 Dv[MAX_FRAGMENT_INPUTS][4];
- Float4 Df;
-
- UInt occlusion;
-
- Int y;
- Int yMin;
- Int yMax;
-
-#if PERF_PROFILE
- Long cycles[PERF_TIMERS];
-#endif
-
- virtual void quad(Pointer<Byte> cBuffer[4], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x) = 0;
-
- bool interpolateZ() const;
- bool interpolateW() const;
- Float4 interpolate(Float4 &x, Float4 &D, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective, bool clamp);
-
- const PixelProcessor::State &state;
- const PixelShader *const shader;
-
- private:
- void rasterize();
- };
-}
-
-#endif // sw_QuadRasterizer_hpp
diff --git a/src/Renderer/Rasterizer.hpp b/src/Renderer/Rasterizer.hpp
deleted file mode 100644
index 7150e17bf..000000000
--- a/src/Renderer/Rasterizer.hpp
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Rasterizer_hpp
-#define sw_Rasterizer_hpp
-
-#include "Context.hpp"
-#include "PixelProcessor.hpp"
-#include "Main/Config.hpp"
-
-namespace sw
-{
- using namespace rr;
-
- class Rasterizer : public Function<Void(Pointer<Byte>, Int, Int, Pointer<Byte>)>
- {
- public:
- Rasterizer() : primitive(Arg<0>()), count(Arg<1>()), cluster(Arg<2>()), data(Arg<3>()) {}
- virtual ~Rasterizer() {}
-
- protected:
- Pointer<Byte> primitive;
- Int count;
- Int cluster;
- Pointer<Byte> data;
- };
-}
-
-#endif // sw_Rasterizer_hpp
diff --git a/src/Renderer/Renderer.cpp b/src/Renderer/Renderer.cpp
deleted file mode 100644
index de1ab7b90..000000000
--- a/src/Renderer/Renderer.cpp
+++ /dev/null
@@ -1,2976 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Renderer.hpp"
-
-#include "Clipper.hpp"
-#include "Surface.hpp"
-#include "Primitive.hpp"
-#include "Polygon.hpp"
-#include "Main/FrameBuffer.hpp"
-#include "Main/SwiftConfig.hpp"
-#include "Reactor/Reactor.hpp"
-#include "Shader/Constants.hpp"
-#include "Common/MutexLock.hpp"
-#include "Common/CPUID.hpp"
-#include "Common/Memory.hpp"
-#include "Common/Resource.hpp"
-#include "Common/Half.hpp"
-#include "Common/Math.hpp"
-#include "Common/Timer.hpp"
-#include "Common/Debug.hpp"
-
-#undef max
-
-bool disableServer = true;
-
-#ifndef NDEBUG
-unsigned int minPrimitives = 1;
-unsigned int maxPrimitives = 1 << 21;
-#endif
-
-namespace sw
-{
- extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
- extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
- extern bool booleanFaceRegister;
- extern bool fullPixelPositionRegister;
- extern bool leadingVertexFirst; // Flat shading uses first vertex, else last
- extern bool secondaryColor; // Specular lighting is applied after texturing
- extern bool colorsDefaultToZero;
-
- extern bool forceWindowed;
- extern bool complementaryDepthBuffer;
- extern bool postBlendSRGB;
- extern bool exactColorRounding;
- extern TransparencyAntialiasing transparencyAntialiasing;
- extern bool forceClearRegisters;
-
- extern bool precacheVertex;
- extern bool precacheSetup;
- extern bool precachePixel;
-
- static const int batchSize = 128;
- AtomicInt threadCount(1);
- AtomicInt Renderer::unitCount(1);
- AtomicInt Renderer::clusterCount(1);
-
- TranscendentalPrecision logPrecision = ACCURATE;
- TranscendentalPrecision expPrecision = ACCURATE;
- TranscendentalPrecision rcpPrecision = ACCURATE;
- TranscendentalPrecision rsqPrecision = ACCURATE;
- bool perspectiveCorrection = true;
-
- static void setGlobalRenderingSettings(Conventions conventions, bool exactColorRounding)
- {
- static bool initialized = false;
-
- if(!initialized)
- {
- sw::halfIntegerCoordinates = conventions.halfIntegerCoordinates;
- sw::symmetricNormalizedDepth = conventions.symmetricNormalizedDepth;
- sw::booleanFaceRegister = conventions.booleanFaceRegister;
- sw::fullPixelPositionRegister = conventions.fullPixelPositionRegister;
- sw::leadingVertexFirst = conventions.leadingVertexFirst;
- sw::secondaryColor = conventions.secondaryColor;
- sw::colorsDefaultToZero = conventions.colorsDefaultToZero;
- sw::exactColorRounding = exactColorRounding;
- initialized = true;
- }
- }
-
- struct Parameters
- {
- Renderer *renderer;
- int threadIndex;
- };
-
- Query::Query(Type type) : building(false), data(0), type(type), reference(1)
- {
- }
-
- void Query::addRef()
- {
- ++reference; // Atomic
- }
-
- void Query::release()
- {
- int ref = reference--; // Atomic
-
- ASSERT(ref >= 0);
-
- if(ref == 0)
- {
- delete this;
- }
- }
-
- DrawCall::DrawCall()
- {
- queries = 0;
-
- vsDirtyConstF = VERTEX_UNIFORM_VECTORS + 1;
- vsDirtyConstI = 16;
- vsDirtyConstB = 16;
-
- psDirtyConstF = FRAGMENT_UNIFORM_VECTORS;
- psDirtyConstI = 16;
- psDirtyConstB = 16;
-
- references = -1;
-
- data = (DrawData*)allocate(sizeof(DrawData));
- data->constants = &constants;
- }
-
- DrawCall::~DrawCall()
- {
- delete queries;
-
- deallocate(data);
- }
-
- Renderer::Renderer(Context *context, Conventions conventions, bool exactColorRounding) : VertexProcessor(context), PixelProcessor(context), SetupProcessor(context), context(context), viewport()
- {
- setGlobalRenderingSettings(conventions, exactColorRounding);
-
- setRenderTarget(0, 0);
- clipper = new Clipper(symmetricNormalizedDepth);
- blitter = new Blitter;
-
- updateViewMatrix = true;
- updateBaseMatrix = true;
- updateProjectionMatrix = true;
- updateClipPlanes = true;
-
- #if PERF_HUD
- resetTimers();
- #endif
-
- for(int i = 0; i < 16; i++)
- {
- vertexTask[i] = 0;
-
- worker[i] = 0;
- resume[i] = 0;
- suspend[i] = 0;
- }
-
- threadsAwake = 0;
- resumeApp = new Event();
-
- currentDraw = 0;
- nextDraw = 0;
-
- qHead = 0;
- qSize = 0;
-
- for(int i = 0; i < 16; i++)
- {
- triangleBatch[i] = 0;
- primitiveBatch[i] = 0;
- }
-
- for(int draw = 0; draw < DRAW_COUNT; draw++)
- {
- drawCall[draw] = new DrawCall();
- drawList[draw] = drawCall[draw];
- }
-
- for(int unit = 0; unit < 16; unit++)
- {
- primitiveProgress[unit].init();
- }
-
- for(int cluster = 0; cluster < 16; cluster++)
- {
- pixelProgress[cluster].init();
- }
-
- clipFlags = 0;
-
- swiftConfig = new SwiftConfig(disableServer);
- updateConfiguration(true);
-
- sync = new Resource(0);
- }
-
- Renderer::~Renderer()
- {
- sync->lock(EXCLUSIVE);
- sync->destruct();
- terminateThreads();
- sync->unlock();
-
- delete clipper;
- clipper = nullptr;
-
- delete blitter;
- blitter = nullptr;
-
- delete resumeApp;
- resumeApp = nullptr;
-
- for(int draw = 0; draw < DRAW_COUNT; draw++)
- {
- delete drawCall[draw];
- drawCall[draw] = nullptr;
- }
-
- delete swiftConfig;
- swiftConfig = nullptr;
- }
-
- // This object has to be mem aligned
- void* Renderer::operator new(size_t size)
- {
- ASSERT(size == sizeof(Renderer)); // This operator can't be called from a derived class
- return sw::allocate(sizeof(Renderer), 16);
- }
-
- void Renderer::operator delete(void * mem)
- {
- sw::deallocate(mem);
- }
-
- void Renderer::draw(DrawType drawType, unsigned int indexOffset, unsigned int count, bool update)
- {
- #ifndef NDEBUG
- if(count < minPrimitives || count > maxPrimitives)
- {
- return;
- }
- #endif
-
- context->drawType = drawType;
-
- updateConfiguration();
- updateClipper();
-
- int ss = context->getSuperSampleCount();
- int ms = context->getMultiSampleCount();
- bool requiresSync = false;
-
- for(int q = 0; q < ss; q++)
- {
- unsigned int oldMultiSampleMask = context->multiSampleMask;
- context->multiSampleMask = (context->sampleMask >> (ms * q)) & ((unsigned)0xFFFFFFFF >> (32 - ms));
-
- if(!context->multiSampleMask)
- {
- continue;
- }
-
- sync->lock(sw::PRIVATE);
-
- if(update || oldMultiSampleMask != context->multiSampleMask)
- {
- vertexState = VertexProcessor::update(drawType);
- setupState = SetupProcessor::update();
- pixelState = PixelProcessor::update();
-
- vertexRoutine = VertexProcessor::routine(vertexState);
- setupRoutine = SetupProcessor::routine(setupState);
- pixelRoutine = PixelProcessor::routine(pixelState);
- }
-
- int batch = batchSize / ms;
-
- int (Renderer::*setupPrimitives)(int batch, int count);
-
- if(context->isDrawTriangle())
- {
- switch(context->fillMode)
- {
- case FILL_SOLID:
- setupPrimitives = &Renderer::setupSolidTriangles;
- break;
- case FILL_WIREFRAME:
- setupPrimitives = &Renderer::setupWireframeTriangle;
- batch = 1;
- break;
- case FILL_VERTEX:
- setupPrimitives = &Renderer::setupVertexTriangle;
- batch = 1;
- break;
- default:
- ASSERT(false);
- return;
- }
- }
- else if(context->isDrawLine())
- {
- setupPrimitives = &Renderer::setupLines;
- }
- else // Point draw
- {
- setupPrimitives = &Renderer::setupPoints;
- }
-
- DrawCall *draw = nullptr;
-
- do
- {
- for(int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->references == -1)
- {
- draw = drawCall[i];
- drawList[nextDraw & DRAW_COUNT_BITS] = draw;
-
- break;
- }
- }
-
- if(!draw)
- {
- resumeApp->wait();
- }
- }
- while(!draw);
-
- DrawData *data = draw->data;
-
- if(queries.size() != 0)
- {
- draw->queries = new std::list<Query*>();
- bool includePrimitivesWrittenQueries = vertexState.transformFeedbackQueryEnabled && vertexState.transformFeedbackEnabled;
- for(auto &query : queries)
- {
- if(includePrimitivesWrittenQueries || (query->type != Query::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN))
- {
- query->addRef();
- draw->queries->push_back(query);
- }
- }
- }
-
- draw->drawType = drawType;
- draw->batchSize = batch;
-
- draw->vertexRoutine = vertexRoutine;
- draw->setupRoutine = setupRoutine;
- draw->pixelRoutine = pixelRoutine;
- draw->vertexPointer = (VertexProcessor::RoutinePointer)vertexRoutine->getEntry();
- draw->setupPointer = (SetupProcessor::RoutinePointer)setupRoutine->getEntry();
- draw->pixelPointer = (PixelProcessor::RoutinePointer)pixelRoutine->getEntry();
- draw->setupPrimitives = setupPrimitives;
- draw->setupState = setupState;
-
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- draw->vertexStream[i] = context->input[i].resource;
- data->input[i] = context->input[i].buffer;
- data->stride[i] = context->input[i].stride;
-
- if(draw->vertexStream[i])
- {
- draw->vertexStream[i]->lock(PUBLIC, PRIVATE);
- }
- }
-
- if(context->indexBuffer)
- {
- data->indices = (unsigned char*)context->indexBuffer->lock(PUBLIC, PRIVATE) + indexOffset;
- }
-
- draw->indexBuffer = context->indexBuffer;
-
- for(int sampler = 0; sampler < TOTAL_IMAGE_UNITS; sampler++)
- {
- draw->texture[sampler] = 0;
- }
-
- for(int sampler = 0; sampler < TEXTURE_IMAGE_UNITS; sampler++)
- {
- if(pixelState.sampler[sampler].textureType != TEXTURE_NULL)
- {
- draw->texture[sampler] = context->texture[sampler];
- draw->texture[sampler]->lock(PUBLIC, isReadWriteTexture(sampler) ? MANAGED : PRIVATE); // If the texure is both read and written, use the same read/write lock as render targets
-
- data->mipmap[sampler] = context->sampler[sampler].getTextureData();
-
- requiresSync |= context->sampler[sampler].requiresSync();
- }
- }
-
- if(context->pixelShader)
- {
- if(draw->psDirtyConstF)
- {
- memcpy(&data->ps.cW, PixelProcessor::cW, sizeof(word4) * 4 * (draw->psDirtyConstF < 8 ? draw->psDirtyConstF : 8));
- memcpy(&data->ps.c, PixelProcessor::c, sizeof(float4) * draw->psDirtyConstF);
- draw->psDirtyConstF = 0;
- }
-
- if(draw->psDirtyConstI)
- {
- memcpy(&data->ps.i, PixelProcessor::i, sizeof(int4) * draw->psDirtyConstI);
- draw->psDirtyConstI = 0;
- }
-
- if(draw->psDirtyConstB)
- {
- memcpy(&data->ps.b, PixelProcessor::b, sizeof(bool) * draw->psDirtyConstB);
- draw->psDirtyConstB = 0;
- }
-
- PixelProcessor::lockUniformBuffers(data->ps.u, draw->pUniformBuffers);
- }
- else
- {
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; i++)
- {
- draw->pUniformBuffers[i] = nullptr;
- }
- }
-
- if(context->pixelShaderModel() <= 0x0104)
- {
- for(int stage = 0; stage < 8; stage++)
- {
- if(pixelState.textureStage[stage].stageOperation != TextureStage::STAGE_DISABLE || context->pixelShader)
- {
- data->textureStage[stage] = context->textureStage[stage].uniforms;
- }
- else break;
- }
- }
-
- if(context->vertexShader)
- {
- if(context->vertexShader->getShaderModel() >= 0x0300)
- {
- for(int sampler = 0; sampler < VERTEX_TEXTURE_IMAGE_UNITS; sampler++)
- {
- if(vertexState.sampler[sampler].textureType != TEXTURE_NULL)
- {
- draw->texture[TEXTURE_IMAGE_UNITS + sampler] = context->texture[TEXTURE_IMAGE_UNITS + sampler];
- draw->texture[TEXTURE_IMAGE_UNITS + sampler]->lock(PUBLIC, PRIVATE);
-
- data->mipmap[TEXTURE_IMAGE_UNITS + sampler] = context->sampler[TEXTURE_IMAGE_UNITS + sampler].getTextureData();
-
- requiresSync |= context->sampler[TEXTURE_IMAGE_UNITS + sampler].requiresSync();
- }
- }
- }
-
- if(draw->vsDirtyConstF)
- {
- memcpy(&data->vs.c, VertexProcessor::c, sizeof(float4) * draw->vsDirtyConstF);
- draw->vsDirtyConstF = 0;
- }
-
- if(draw->vsDirtyConstI)
- {
- memcpy(&data->vs.i, VertexProcessor::i, sizeof(int4) * draw->vsDirtyConstI);
- draw->vsDirtyConstI = 0;
- }
-
- if(draw->vsDirtyConstB)
- {
- memcpy(&data->vs.b, VertexProcessor::b, sizeof(bool) * draw->vsDirtyConstB);
- draw->vsDirtyConstB = 0;
- }
-
- if(context->vertexShader->isInstanceIdDeclared())
- {
- data->instanceID = context->instanceID;
- }
-
- VertexProcessor::lockUniformBuffers(data->vs.u, draw->vUniformBuffers);
- VertexProcessor::lockTransformFeedbackBuffers(data->vs.t, data->vs.reg, data->vs.row, data->vs.col, data->vs.str, draw->transformFeedbackBuffers);
- }
- else
- {
- data->ff = ff;
-
- draw->vsDirtyConstF = VERTEX_UNIFORM_VECTORS + 1;
- draw->vsDirtyConstI = 16;
- draw->vsDirtyConstB = 16;
-
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; i++)
- {
- draw->vUniformBuffers[i] = nullptr;
- }
-
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; i++)
- {
- draw->transformFeedbackBuffers[i] = nullptr;
- }
- }
-
- if(pixelState.stencilActive)
- {
- data->stencil[0] = stencil;
- data->stencil[1] = stencilCCW;
- }
-
- if(pixelState.fogActive)
- {
- data->fog = fog;
- }
-
- if(setupState.isDrawPoint)
- {
- data->point = point;
- }
-
- data->lineWidth = context->lineWidth;
-
- data->factor = factor;
-
- if(pixelState.transparencyAntialiasing == TRANSPARENCY_ALPHA_TO_COVERAGE)
- {
- float ref = context->alphaReference * (1.0f / 255.0f);
- float margin = sw::min(ref, 1.0f - ref);
-
- if(ms == 4)
- {
- data->a2c0 = replicate(ref - margin * 0.6f);
- data->a2c1 = replicate(ref - margin * 0.2f);
- data->a2c2 = replicate(ref + margin * 0.2f);
- data->a2c3 = replicate(ref + margin * 0.6f);
- }
- else if(ms == 2)
- {
- data->a2c0 = replicate(ref - margin * 0.3f);
- data->a2c1 = replicate(ref + margin * 0.3f);
- }
- else ASSERT(false);
- }
-
- if(pixelState.occlusionEnabled)
- {
- for(int cluster = 0; cluster < clusterCount; cluster++)
- {
- data->occlusion[cluster] = 0;
- }
- }
-
- #if PERF_PROFILE
- for(int cluster = 0; cluster < clusterCount; cluster++)
- {
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- data->cycles[i][cluster] = 0;
- }
- }
- #endif
-
- // Viewport
- {
- float W = 0.5f * viewport.width;
- float H = 0.5f * viewport.height;
- float X0 = viewport.x0 + W;
- float Y0 = viewport.y0 + H;
- float N = viewport.minZ;
- float F = viewport.maxZ;
- float Z = F - N;
-
- if(context->isDrawTriangle(false))
- {
- N += context->depthBias;
- }
-
- if(complementaryDepthBuffer)
- {
- Z = -Z;
- N = 1 - N;
- }
-
- static const float X[5][16] = // Fragment offsets
- {
- {+0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 1 sample
- {-0.2500f, +0.2500f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 2 samples
- {-0.3000f, +0.1000f, +0.3000f, -0.1000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 4 samples
- {+0.1875f, -0.3125f, +0.3125f, -0.4375f, -0.0625f, +0.4375f, +0.0625f, -0.1875f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 8 samples
- {+0.2553f, -0.1155f, +0.1661f, -0.1828f, +0.2293f, -0.4132f, -0.1773f, -0.0577f, +0.3891f, -0.4656f, +0.4103f, +0.4248f, -0.2109f, +0.3966f, -0.2664f, -0.3872f} // 16 samples
- };
-
- static const float Y[5][16] = // Fragment offsets
- {
- {+0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 1 sample
- {-0.2500f, +0.2500f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 2 samples
- {-0.1000f, -0.3000f, +0.1000f, +0.3000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 4 samples
- {-0.4375f, -0.3125f, -0.1875f, -0.0625f, +0.0625f, +0.1875f, +0.3125f, +0.4375f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f, +0.0000f}, // 8 samples
- {-0.4503f, +0.1883f, +0.3684f, -0.4668f, -0.0690f, -0.1315f, +0.4999f, +0.0728f, +0.1070f, -0.3086f, +0.3725f, -0.1547f, -0.1102f, -0.3588f, +0.1789f, +0.0269f} // 16 samples
- };
-
- int s = sw::log2(ss);
-
- data->Wx16 = replicate(W * 16);
- data->Hx16 = replicate(H * 16);
- data->X0x16 = replicate(X0 * 16 - 8);
- data->Y0x16 = replicate(Y0 * 16 - 8);
- data->XXXX = replicate(X[s][q] / W);
- data->YYYY = replicate(Y[s][q] / H);
- data->halfPixelX = replicate(0.5f / W);
- data->halfPixelY = replicate(0.5f / H);
- data->viewportHeight = abs(viewport.height);
- data->slopeDepthBias = context->slopeDepthBias;
- data->depthRange = Z;
- data->depthNear = N;
- draw->clipFlags = clipFlags;
-
- if(clipFlags)
- {
- if(clipFlags & Clipper::CLIP_PLANE0) data->clipPlane[0] = clipPlane[0];
- if(clipFlags & Clipper::CLIP_PLANE1) data->clipPlane[1] = clipPlane[1];
- if(clipFlags & Clipper::CLIP_PLANE2) data->clipPlane[2] = clipPlane[2];
- if(clipFlags & Clipper::CLIP_PLANE3) data->clipPlane[3] = clipPlane[3];
- if(clipFlags & Clipper::CLIP_PLANE4) data->clipPlane[4] = clipPlane[4];
- if(clipFlags & Clipper::CLIP_PLANE5) data->clipPlane[5] = clipPlane[5];
- }
- }
-
- // Target
- {
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- draw->renderTarget[index] = context->renderTarget[index];
-
- if(draw->renderTarget[index])
- {
- unsigned int layer = context->renderTargetLayer[index];
- requiresSync |= context->renderTarget[index]->requiresSync();
- data->colorBuffer[index] = (unsigned int*)context->renderTarget[index]->lockInternal(0, 0, layer, LOCK_READWRITE, MANAGED);
- data->colorBuffer[index] += q * ms * context->renderTarget[index]->getSliceB(true);
- data->colorPitchB[index] = context->renderTarget[index]->getInternalPitchB();
- data->colorSliceB[index] = context->renderTarget[index]->getInternalSliceB();
- }
- }
-
- draw->depthBuffer = context->depthBuffer;
- draw->stencilBuffer = context->stencilBuffer;
-
- if(draw->depthBuffer)
- {
- unsigned int layer = context->depthBufferLayer;
- requiresSync |= context->depthBuffer->requiresSync();
- data->depthBuffer = (float*)context->depthBuffer->lockInternal(0, 0, layer, LOCK_READWRITE, MANAGED);
- data->depthBuffer += q * ms * context->depthBuffer->getSliceB(true);
- data->depthPitchB = context->depthBuffer->getInternalPitchB();
- data->depthSliceB = context->depthBuffer->getInternalSliceB();
- }
-
- if(draw->stencilBuffer)
- {
- unsigned int layer = context->stencilBufferLayer;
- requiresSync |= context->stencilBuffer->requiresSync();
- data->stencilBuffer = (unsigned char*)context->stencilBuffer->lockStencil(0, 0, layer, MANAGED);
- data->stencilBuffer += q * ms * context->stencilBuffer->getSliceB(true);
- data->stencilPitchB = context->stencilBuffer->getStencilPitchB();
- data->stencilSliceB = context->stencilBuffer->getStencilSliceB();
- }
- }
-
- // Scissor
- {
- data->scissorX0 = scissor.x0;
- data->scissorX1 = scissor.x1;
- data->scissorY0 = scissor.y0;
- data->scissorY1 = scissor.y1;
- }
-
- draw->primitive = 0;
- draw->count = count;
-
- draw->references = (count + batch - 1) / batch;
-
- schedulerMutex.lock();
- ++nextDraw; // Atomic
- schedulerMutex.unlock();
-
- #ifndef NDEBUG
- if(threadCount == 1) // Use main thread for draw execution
- {
- threadsAwake = 1;
- task[0].type = Task::RESUME;
-
- taskLoop(0);
- }
- else
- #endif
- {
- if(!threadsAwake)
- {
- suspend[0]->wait();
-
- threadsAwake = 1;
- task[0].type = Task::RESUME;
-
- resume[0]->signal();
- }
- }
- }
-
- // TODO(sugoi): This is a temporary brute-force workaround to ensure IOSurface synchronization.
- if(requiresSync)
- {
- synchronize();
- }
- }
-
- void Renderer::clear(void *value, Format format, Surface *dest, const Rect &clearRect, unsigned int rgbaMask)
- {
- blitter->clear(value, format, dest, clearRect, rgbaMask);
- }
-
- void Renderer::blit(Surface *source, const SliceRectF &sRect, Surface *dest, const SliceRect &dRect, bool filter, bool isStencil, bool sRGBconversion)
- {
- blitter->blit(source, sRect, dest, dRect, {filter, isStencil, sRGBconversion});
- }
-
- void Renderer::blit3D(Surface *source, Surface *dest)
- {
- blitter->blit3D(source, dest);
- }
-
- void Renderer::threadFunction(void *parameters)
- {
- Renderer *renderer = static_cast<Parameters*>(parameters)->renderer;
- int threadIndex = static_cast<Parameters*>(parameters)->threadIndex;
-
- if(logPrecision < IEEE)
- {
- CPUID::setFlushToZero(true);
- CPUID::setDenormalsAreZero(true);
- }
-
- renderer->threadLoop(threadIndex);
- }
-
- void Renderer::threadLoop(int threadIndex)
- {
- while(!exitThreads)
- {
- taskLoop(threadIndex);
-
- suspend[threadIndex]->signal();
- resume[threadIndex]->wait();
- }
- }
-
- void Renderer::taskLoop(int threadIndex)
- {
- while(task[threadIndex].type != Task::SUSPEND)
- {
- scheduleTask(threadIndex);
- executeTask(threadIndex);
- }
- }
-
- void Renderer::findAvailableTasks()
- {
- // Find pixel tasks
- for(int cluster = 0; cluster < clusterCount; cluster++)
- {
- if(!pixelProgress[cluster].executing)
- {
- for(int unit = 0; unit < unitCount; unit++)
- {
- if(primitiveProgress[unit].references > 0) // Contains processed primitives
- {
- if(pixelProgress[cluster].drawCall == primitiveProgress[unit].drawCall)
- {
- if(pixelProgress[cluster].processedPrimitives == primitiveProgress[unit].firstPrimitive) // Previous primitives have been rendered
- {
- Task &task = taskQueue[qHead];
- task.type = Task::PIXELS;
- task.primitiveUnit = unit;
- task.pixelCluster = cluster;
-
- pixelProgress[cluster].executing = true;
-
- // Commit to the task queue
- qHead = (qHead + 1) & TASK_COUNT_BITS;
- qSize++;
-
- break;
- }
- }
- }
- }
- }
- }
-
- // Find primitive tasks
- if(currentDraw == nextDraw)
- {
- return; // No more primitives to process
- }
-
- for(int unit = 0; unit < unitCount; unit++)
- {
- DrawCall *draw = drawList[currentDraw & DRAW_COUNT_BITS];
-
- int primitive = draw->primitive;
- int count = draw->count;
-
- if(primitive >= count)
- {
- ++currentDraw; // Atomic
-
- if(currentDraw == nextDraw)
- {
- return; // No more primitives to process
- }
-
- draw = drawList[currentDraw & DRAW_COUNT_BITS];
- }
-
- if(!primitiveProgress[unit].references) // Task not already being executed and not still in use by a pixel unit
- {
- primitive = draw->primitive;
- count = draw->count;
- int batch = draw->batchSize;
-
- primitiveProgress[unit].drawCall = currentDraw;
- primitiveProgress[unit].firstPrimitive = primitive;
- primitiveProgress[unit].primitiveCount = count - primitive >= batch ? batch : count - primitive;
-
- draw->primitive += batch;
-
- Task &task = taskQueue[qHead];
- task.type = Task::PRIMITIVES;
- task.primitiveUnit = unit;
-
- primitiveProgress[unit].references = -1;
-
- // Commit to the task queue
- qHead = (qHead + 1) & TASK_COUNT_BITS;
- qSize++;
- }
- }
- }
-
- void Renderer::scheduleTask(int threadIndex)
- {
- schedulerMutex.lock();
-
- int curThreadsAwake = threadsAwake;
-
- if((int)qSize < threadCount - curThreadsAwake + 1)
- {
- findAvailableTasks();
- }
-
- if(qSize != 0)
- {
- task[threadIndex] = taskQueue[(qHead - qSize) & TASK_COUNT_BITS];
- qSize--;
-
- if(curThreadsAwake != threadCount)
- {
- int wakeup = qSize - curThreadsAwake + 1;
-
- for(int i = 0; i < threadCount && wakeup > 0; i++)
- {
- if(task[i].type == Task::SUSPEND)
- {
- suspend[i]->wait();
- task[i].type = Task::RESUME;
- resume[i]->signal();
-
- ++threadsAwake; // Atomic
- wakeup--;
- }
- }
- }
- }
- else
- {
- task[threadIndex].type = Task::SUSPEND;
-
- --threadsAwake; // Atomic
- }
-
- schedulerMutex.unlock();
- }
-
- void Renderer::executeTask(int threadIndex)
- {
- #if PERF_HUD
- int64_t startTick = Timer::ticks();
- #endif
-
- switch(task[threadIndex].type)
- {
- case Task::PRIMITIVES:
- {
- int unit = task[threadIndex].primitiveUnit;
-
- int input = primitiveProgress[unit].firstPrimitive;
- int count = primitiveProgress[unit].primitiveCount;
- DrawCall *draw = drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- int (Renderer::*setupPrimitives)(int batch, int count) = draw->setupPrimitives;
-
- processPrimitiveVertices(unit, input, count, draw->count, threadIndex);
-
- #if PERF_HUD
- int64_t time = Timer::ticks();
- vertexTime[threadIndex] += time - startTick;
- startTick = time;
- #endif
-
- int visible = 0;
-
- if(!draw->setupState.rasterizerDiscard)
- {
- visible = (this->*setupPrimitives)(unit, count);
- }
-
- primitiveProgress[unit].visible = visible;
- primitiveProgress[unit].references = clusterCount;
-
- #if PERF_HUD
- setupTime[threadIndex] += Timer::ticks() - startTick;
- #endif
- }
- break;
- case Task::PIXELS:
- {
- int unit = task[threadIndex].primitiveUnit;
- int visible = primitiveProgress[unit].visible;
-
- if(visible > 0)
- {
- int cluster = task[threadIndex].pixelCluster;
- Primitive *primitive = primitiveBatch[unit];
- DrawCall *draw = drawList[pixelProgress[cluster].drawCall & DRAW_COUNT_BITS];
- DrawData *data = draw->data;
- PixelProcessor::RoutinePointer pixelRoutine = draw->pixelPointer;
-
- pixelRoutine(primitive, visible, cluster, data);
- }
-
- finishRendering(task[threadIndex]);
-
- #if PERF_HUD
- pixelTime[threadIndex] += Timer::ticks() - startTick;
- #endif
- }
- break;
- case Task::RESUME:
- break;
- case Task::SUSPEND:
- break;
- default:
- ASSERT(false);
- }
- }
-
- void Renderer::synchronize()
- {
- sync->lock(sw::PUBLIC);
- sync->unlock();
- }
-
- void Renderer::finishRendering(Task &pixelTask)
- {
- int unit = pixelTask.primitiveUnit;
- int cluster = pixelTask.pixelCluster;
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- DrawData &data = *draw.data;
- int primitive = primitiveProgress[unit].firstPrimitive;
- int count = primitiveProgress[unit].primitiveCount;
- int processedPrimitives = primitive + count;
-
- pixelProgress[cluster].processedPrimitives = processedPrimitives;
-
- if(pixelProgress[cluster].processedPrimitives >= draw.count)
- {
- ++pixelProgress[cluster].drawCall; // Atomic
- pixelProgress[cluster].processedPrimitives = 0;
- }
-
- int ref = primitiveProgress[unit].references--; // Atomic
-
- if(ref == 0)
- {
- ref = draw.references--; // Atomic
-
- if(ref == 0)
- {
- #if PERF_PROFILE
- for(int cluster = 0; cluster < clusterCount; cluster++)
- {
- for(int i = 0; i < PERF_TIMERS; i++)
- {
- profiler.cycles[i] += data.cycles[i][cluster];
- }
- }
- #endif
-
- if(draw.queries)
- {
- for(auto &query : *(draw.queries))
- {
- switch(query->type)
- {
- case Query::FRAGMENTS_PASSED:
- for(int cluster = 0; cluster < clusterCount; cluster++)
- {
- query->data += data.occlusion[cluster];
- }
- break;
- case Query::TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN:
- query->data += processedPrimitives;
- break;
- default:
- break;
- }
-
- query->release();
- }
-
- delete draw.queries;
- draw.queries = 0;
- }
-
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- if(draw.renderTarget[i])
- {
- draw.renderTarget[i]->unlockInternal();
- }
- }
-
- if(draw.depthBuffer)
- {
- draw.depthBuffer->unlockInternal();
- }
-
- if(draw.stencilBuffer)
- {
- draw.stencilBuffer->unlockStencil();
- }
-
- for(int i = 0; i < TOTAL_IMAGE_UNITS; i++)
- {
- if(draw.texture[i])
- {
- draw.texture[i]->unlock();
- }
- }
-
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- if(draw.vertexStream[i])
- {
- draw.vertexStream[i]->unlock();
- }
- }
-
- if(draw.indexBuffer)
- {
- draw.indexBuffer->unlock();
- }
-
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; i++)
- {
- if(draw.pUniformBuffers[i])
- {
- draw.pUniformBuffers[i]->unlock();
- }
- if(draw.vUniformBuffers[i])
- {
- draw.vUniformBuffers[i]->unlock();
- }
- }
-
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; i++)
- {
- if(draw.transformFeedbackBuffers[i])
- {
- draw.transformFeedbackBuffers[i]->unlock();
- }
- }
-
- draw.vertexRoutine.reset();
- draw.setupRoutine.reset();
- draw.pixelRoutine.reset();
-
- sync->unlock();
-
- draw.references = -1;
- resumeApp->signal();
- }
- }
-
- pixelProgress[cluster].executing = false;
- }
-
- void Renderer::processPrimitiveVertices(int unit, unsigned int start, unsigned int triangleCount, unsigned int loop, int thread)
- {
- Triangle *triangle = triangleBatch[unit];
- int primitiveDrawCall = primitiveProgress[unit].drawCall;
- DrawCall *draw = drawList[primitiveDrawCall & DRAW_COUNT_BITS];
- DrawData *data = draw->data;
- VertexTask *task = vertexTask[thread];
-
- const void *indices = data->indices;
- VertexProcessor::RoutinePointer vertexRoutine = draw->vertexPointer;
-
- if(task->vertexCache.drawCall != primitiveDrawCall)
- {
- task->vertexCache.clear();
- task->vertexCache.drawCall = primitiveDrawCall;
- }
-
- unsigned int batch[128][3]; // FIXME: Adjust to dynamic batch size
-
- switch(draw->drawType)
- {
- case DRAW_POINTLIST:
- {
- unsigned int index = start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index;
- batch[i][1] = index;
- batch[i][2] = index;
-
- index += 1;
- }
- }
- break;
- case DRAW_LINELIST:
- {
- unsigned int index = 2 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index + 0;
- batch[i][1] = index + 1;
- batch[i][2] = index + 1;
-
- index += 2;
- }
- }
- break;
- case DRAW_LINESTRIP:
- {
- unsigned int index = start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index + 0;
- batch[i][1] = index + 1;
- batch[i][2] = index + 1;
-
- index += 1;
- }
- }
- break;
- case DRAW_LINELOOP:
- {
- unsigned int index = start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = (index + 0) % loop;
- batch[i][1] = (index + 1) % loop;
- batch[i][2] = (index + 1) % loop;
-
- index += 1;
- }
- }
- break;
- case DRAW_TRIANGLELIST:
- {
- unsigned int index = 3 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index + 0;
- batch[i][1] = index + 1;
- batch[i][2] = index + 2;
-
- index += 3;
- }
- }
- break;
- case DRAW_TRIANGLESTRIP:
- {
- unsigned int index = start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- if(leadingVertexFirst)
- {
- batch[i][0] = index + 0;
- batch[i][1] = index + (index & 1) + 1;
- batch[i][2] = index + (~index & 1) + 1;
- }
- else
- {
- batch[i][0] = index + (index & 1);
- batch[i][1] = index + (~index & 1);
- batch[i][2] = index + 2;
- }
-
- index += 1;
- }
- }
- break;
- case DRAW_TRIANGLEFAN:
- {
- unsigned int index = start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- if(leadingVertexFirst)
- {
- batch[i][0] = index + 1;
- batch[i][1] = index + 2;
- batch[i][2] = 0;
- }
- else
- {
- batch[i][0] = 0;
- batch[i][1] = index + 1;
- batch[i][2] = index + 2;
- }
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDPOINTLIST8:
- {
- const unsigned char *index = (const unsigned char*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = *index;
- batch[i][1] = *index;
- batch[i][2] = *index;
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDPOINTLIST16:
- {
- const unsigned short *index = (const unsigned short*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = *index;
- batch[i][1] = *index;
- batch[i][2] = *index;
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDPOINTLIST32:
- {
- const unsigned int *index = (const unsigned int*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = *index;
- batch[i][1] = *index;
- batch[i][2] = *index;
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDLINELIST8:
- {
- const unsigned char *index = (const unsigned char*)indices + 2 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 2;
- }
- }
- break;
- case DRAW_INDEXEDLINELIST16:
- {
- const unsigned short *index = (const unsigned short*)indices + 2 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 2;
- }
- }
- break;
- case DRAW_INDEXEDLINELIST32:
- {
- const unsigned int *index = (const unsigned int*)indices + 2 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 2;
- }
- }
- break;
- case DRAW_INDEXEDLINESTRIP8:
- {
- const unsigned char *index = (const unsigned char*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDLINESTRIP16:
- {
- const unsigned short *index = (const unsigned short*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDLINESTRIP32:
- {
- const unsigned int *index = (const unsigned int*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDLINELOOP8:
- {
- const unsigned char *index = (const unsigned char*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[(start + i + 0) % loop];
- batch[i][1] = index[(start + i + 1) % loop];
- batch[i][2] = index[(start + i + 1) % loop];
- }
- }
- break;
- case DRAW_INDEXEDLINELOOP16:
- {
- const unsigned short *index = (const unsigned short*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[(start + i + 0) % loop];
- batch[i][1] = index[(start + i + 1) % loop];
- batch[i][2] = index[(start + i + 1) % loop];
- }
- }
- break;
- case DRAW_INDEXEDLINELOOP32:
- {
- const unsigned int *index = (const unsigned int*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[(start + i + 0) % loop];
- batch[i][1] = index[(start + i + 1) % loop];
- batch[i][2] = index[(start + i + 1) % loop];
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLELIST8:
- {
- const unsigned char *index = (const unsigned char*)indices + 3 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[2];
-
- index += 3;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLELIST16:
- {
- const unsigned short *index = (const unsigned short*)indices + 3 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[2];
-
- index += 3;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLELIST32:
- {
- const unsigned int *index = (const unsigned int*)indices + 3 * start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[1];
- batch[i][2] = index[2];
-
- index += 3;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLESTRIP8:
- {
- const unsigned char *index = (const unsigned char*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[((start + i) & 1) + 1];
- batch[i][2] = index[(~(start + i) & 1) + 1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLESTRIP16:
- {
- const unsigned short *index = (const unsigned short*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[((start + i) & 1) + 1];
- batch[i][2] = index[(~(start + i) & 1) + 1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLESTRIP32:
- {
- const unsigned int *index = (const unsigned int*)indices + start;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[0];
- batch[i][1] = index[((start + i) & 1) + 1];
- batch[i][2] = index[(~(start + i) & 1) + 1];
-
- index += 1;
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLEFAN8:
- {
- const unsigned char *index = (const unsigned char*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[start + i + 1];
- batch[i][1] = index[start + i + 2];
- batch[i][2] = index[0];
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLEFAN16:
- {
- const unsigned short *index = (const unsigned short*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[start + i + 1];
- batch[i][1] = index[start + i + 2];
- batch[i][2] = index[0];
- }
- }
- break;
- case DRAW_INDEXEDTRIANGLEFAN32:
- {
- const unsigned int *index = (const unsigned int*)indices;
-
- for(unsigned int i = 0; i < triangleCount; i++)
- {
- batch[i][0] = index[start + i + 1];
- batch[i][1] = index[start + i + 2];
- batch[i][2] = index[0];
- }
- }
- break;
- case DRAW_QUADLIST:
- {
- unsigned int index = 4 * start / 2;
-
- for(unsigned int i = 0; i < triangleCount; i += 2)
- {
- batch[i+0][0] = index + 0;
- batch[i+0][1] = index + 1;
- batch[i+0][2] = index + 2;
-
- batch[i+1][0] = index + 0;
- batch[i+1][1] = index + 2;
- batch[i+1][2] = index + 3;
-
- index += 4;
- }
- }
- break;
- default:
- ASSERT(false);
- return;
- }
-
- task->primitiveStart = start;
- task->vertexCount = triangleCount * 3;
- vertexRoutine(&triangle->v0, (unsigned int*)&batch, task, data);
- }
-
- int Renderer::setupSolidTriangles(int unit, int count)
- {
- Triangle *triangle = triangleBatch[unit];
- Primitive *primitive = primitiveBatch[unit];
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- SetupProcessor::State &state = draw.setupState;
- const SetupProcessor::RoutinePointer &setupRoutine = draw.setupPointer;
-
- int ms = state.multiSample;
- int pos = state.positionRegister;
- const DrawData *data = draw.data;
- int visible = 0;
-
- for(int i = 0; i < count; i++, triangle++)
- {
- Vertex &v0 = triangle->v0;
- Vertex &v1 = triangle->v1;
- Vertex &v2 = triangle->v2;
-
- if((v0.clipFlags & v1.clipFlags & v2.clipFlags) == Clipper::CLIP_FINITE)
- {
- Polygon polygon(&v0.v[pos], &v1.v[pos], &v2.v[pos]);
-
- int clipFlagsOr = v0.clipFlags | v1.clipFlags | v2.clipFlags | draw.clipFlags;
-
- if(clipFlagsOr != Clipper::CLIP_FINITE)
- {
- if(!clipper->clip(polygon, clipFlagsOr, draw))
- {
- continue;
- }
- }
-
- if(setupRoutine(primitive, triangle, &polygon, data))
- {
- primitive += ms;
- visible++;
- }
- }
- }
-
- return visible;
- }
-
- int Renderer::setupWireframeTriangle(int unit, int count)
- {
- Triangle *triangle = triangleBatch[unit];
- Primitive *primitive = primitiveBatch[unit];
- int visible = 0;
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- SetupProcessor::State &state = draw.setupState;
-
- const Vertex &v0 = triangle[0].v0;
- const Vertex &v1 = triangle[0].v1;
- const Vertex &v2 = triangle[0].v2;
-
- float d = (v0.y * v1.x - v0.x * v1.y) * v2.w + (v0.x * v2.y - v0.y * v2.x) * v1.w + (v2.x * v1.y - v1.x * v2.y) * v0.w;
-
- if(state.cullMode == CULL_CLOCKWISE)
- {
- if(d >= 0) return 0;
- }
- else if(state.cullMode == CULL_COUNTERCLOCKWISE)
- {
- if(d <= 0) return 0;
- }
-
- // Copy attributes
- triangle[1].v0 = v1;
- triangle[1].v1 = v2;
- triangle[2].v0 = v2;
- triangle[2].v1 = v0;
-
- if(state.color[0][0].flat) // FIXME
- {
- for(int i = 0; i < 2; i++)
- {
- triangle[1].v0.C[i] = triangle[0].v0.C[i];
- triangle[1].v1.C[i] = triangle[0].v0.C[i];
- triangle[2].v0.C[i] = triangle[0].v0.C[i];
- triangle[2].v1.C[i] = triangle[0].v0.C[i];
- }
- }
-
- for(int i = 0; i < 3; i++)
- {
- if(setupLine(*primitive, *triangle, draw))
- {
- primitive->area = 0.5f * d;
-
- primitive++;
- visible++;
- }
-
- triangle++;
- }
-
- return visible;
- }
-
- int Renderer::setupVertexTriangle(int unit, int count)
- {
- Triangle *triangle = triangleBatch[unit];
- Primitive *primitive = primitiveBatch[unit];
- int visible = 0;
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- SetupProcessor::State &state = draw.setupState;
-
- const Vertex &v0 = triangle[0].v0;
- const Vertex &v1 = triangle[0].v1;
- const Vertex &v2 = triangle[0].v2;
-
- float d = (v0.y * v1.x - v0.x * v1.y) * v2.w + (v0.x * v2.y - v0.y * v2.x) * v1.w + (v2.x * v1.y - v1.x * v2.y) * v0.w;
-
- if(state.cullMode == CULL_CLOCKWISE)
- {
- if(d >= 0) return 0;
- }
- else if(state.cullMode == CULL_COUNTERCLOCKWISE)
- {
- if(d <= 0) return 0;
- }
-
- // Copy attributes
- triangle[1].v0 = v1;
- triangle[2].v0 = v2;
-
- for(int i = 0; i < 3; i++)
- {
- if(setupPoint(*primitive, *triangle, draw))
- {
- primitive->area = 0.5f * d;
-
- primitive++;
- visible++;
- }
-
- triangle++;
- }
-
- return visible;
- }
-
- int Renderer::setupLines(int unit, int count)
- {
- Triangle *triangle = triangleBatch[unit];
- Primitive *primitive = primitiveBatch[unit];
- int visible = 0;
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- SetupProcessor::State &state = draw.setupState;
-
- int ms = state.multiSample;
-
- for(int i = 0; i < count; i++)
- {
- if(setupLine(*primitive, *triangle, draw))
- {
- primitive += ms;
- visible++;
- }
-
- triangle++;
- }
-
- return visible;
- }
-
- int Renderer::setupPoints(int unit, int count)
- {
- Triangle *triangle = triangleBatch[unit];
- Primitive *primitive = primitiveBatch[unit];
- int visible = 0;
-
- DrawCall &draw = *drawList[primitiveProgress[unit].drawCall & DRAW_COUNT_BITS];
- SetupProcessor::State &state = draw.setupState;
-
- int ms = state.multiSample;
-
- for(int i = 0; i < count; i++)
- {
- if(setupPoint(*primitive, *triangle, draw))
- {
- primitive += ms;
- visible++;
- }
-
- triangle++;
- }
-
- return visible;
- }
-
- bool Renderer::setupLine(Primitive &primitive, Triangle &triangle, const DrawCall &draw)
- {
- const SetupProcessor::RoutinePointer &setupRoutine = draw.setupPointer;
- const SetupProcessor::State &state = draw.setupState;
- const DrawData &data = *draw.data;
-
- float lineWidth = data.lineWidth;
-
- Vertex &v0 = triangle.v0;
- Vertex &v1 = triangle.v1;
-
- int pos = state.positionRegister;
-
- const float4 &P0 = v0.v[pos];
- const float4 &P1 = v1.v[pos];
-
- if(P0.w <= 0 && P1.w <= 0)
- {
- return false;
- }
-
- const float W = data.Wx16[0] * (1.0f / 16.0f);
- const float H = data.Hx16[0] * (1.0f / 16.0f);
-
- float dx = W * (P1.x / P1.w - P0.x / P0.w);
- float dy = H * (P1.y / P1.w - P0.y / P0.w);
-
- if(dx == 0 && dy == 0)
- {
- return false;
- }
-
- if(state.multiSample > 1)
- {
- // Rectangle centered on the line segment
-
- float4 P[4];
- int C[4];
-
- P[0] = P0;
- P[1] = P1;
- P[2] = P1;
- P[3] = P0;
-
- float scale = lineWidth * 0.5f / sqrt(dx*dx + dy*dy);
-
- dx *= scale;
- dy *= scale;
-
- float dx0h = dx * P0.w / H;
- float dy0w = dy * P0.w / W;
-
- float dx1h = dx * P1.w / H;
- float dy1w = dy * P1.w / W;
-
- P[0].x += -dy0w;
- P[0].y += +dx0h;
- C[0] = clipper->computeClipFlags(P[0]);
-
- P[1].x += -dy1w;
- P[1].y += +dx1h;
- C[1] = clipper->computeClipFlags(P[1]);
-
- P[2].x += +dy1w;
- P[2].y += -dx1h;
- C[2] = clipper->computeClipFlags(P[2]);
-
- P[3].x += +dy0w;
- P[3].y += -dx0h;
- C[3] = clipper->computeClipFlags(P[3]);
-
- if((C[0] & C[1] & C[2] & C[3]) == Clipper::CLIP_FINITE)
- {
- Polygon polygon(P, 4);
-
- int clipFlagsOr = C[0] | C[1] | C[2] | C[3] | draw.clipFlags;
-
- if(clipFlagsOr != Clipper::CLIP_FINITE)
- {
- if(!clipper->clip(polygon, clipFlagsOr, draw))
- {
- return false;
- }
- }
-
- return setupRoutine(&primitive, &triangle, &polygon, &data);
- }
- }
- else if(true)
- {
- // Connecting diamonds polygon
- // This shape satisfies the diamond test convention, except for the exit rule part.
- // Line segments with overlapping endpoints have duplicate fragments.
- // The ideal algorithm requires half-open line rasterization (b/80135519).
-
- float4 P[8];
- int C[8];
-
- P[0] = P0;
- P[1] = P0;
- P[2] = P0;
- P[3] = P0;
- P[4] = P1;
- P[5] = P1;
- P[6] = P1;
- P[7] = P1;
-
- float dx0 = lineWidth * 0.5f * P0.w / W;
- float dy0 = lineWidth * 0.5f * P0.w / H;
-
- float dx1 = lineWidth * 0.5f * P1.w / W;
- float dy1 = lineWidth * 0.5f * P1.w / H;
-
- P[0].x += -dx0;
- C[0] = clipper->computeClipFlags(P[0]);
-
- P[1].y += +dy0;
- C[1] = clipper->computeClipFlags(P[1]);
-
- P[2].x += +dx0;
- C[2] = clipper->computeClipFlags(P[2]);
-
- P[3].y += -dy0;
- C[3] = clipper->computeClipFlags(P[3]);
-
- P[4].x += -dx1;
- C[4] = clipper->computeClipFlags(P[4]);
-
- P[5].y += +dy1;
- C[5] = clipper->computeClipFlags(P[5]);
-
- P[6].x += +dx1;
- C[6] = clipper->computeClipFlags(P[6]);
-
- P[7].y += -dy1;
- C[7] = clipper->computeClipFlags(P[7]);
-
- if((C[0] & C[1] & C[2] & C[3] & C[4] & C[5] & C[6] & C[7]) == Clipper::CLIP_FINITE)
- {
- float4 L[6];
-
- if(dx > -dy)
- {
- if(dx > dy) // Right
- {
- L[0] = P[0];
- L[1] = P[1];
- L[2] = P[5];
- L[3] = P[6];
- L[4] = P[7];
- L[5] = P[3];
- }
- else // Down
- {
- L[0] = P[0];
- L[1] = P[4];
- L[2] = P[5];
- L[3] = P[6];
- L[4] = P[2];
- L[5] = P[3];
- }
- }
- else
- {
- if(dx > dy) // Up
- {
- L[0] = P[0];
- L[1] = P[1];
- L[2] = P[2];
- L[3] = P[6];
- L[4] = P[7];
- L[5] = P[4];
- }
- else // Left
- {
- L[0] = P[1];
- L[1] = P[2];
- L[2] = P[3];
- L[3] = P[7];
- L[4] = P[4];
- L[5] = P[5];
- }
- }
-
- Polygon polygon(L, 6);
-
- int clipFlagsOr = C[0] | C[1] | C[2] | C[3] | C[4] | C[5] | C[6] | C[7] | draw.clipFlags;
-
- if(clipFlagsOr != Clipper::CLIP_FINITE)
- {
- if(!clipper->clip(polygon, clipFlagsOr, draw))
- {
- return false;
- }
- }
-
- return setupRoutine(&primitive, &triangle, &polygon, &data);
- }
- }
- else
- {
- // Parallelogram approximating Bresenham line
- // This algorithm does not satisfy the ideal diamond-exit rule, but does avoid the
- // duplicate fragment rasterization problem and satisfies all of Vulkan's minimum
- // requirements for Bresenham line segment rasterization.
-
- float4 P[8];
- P[0] = P0;
- P[1] = P0;
- P[2] = P0;
- P[3] = P0;
- P[4] = P1;
- P[5] = P1;
- P[6] = P1;
- P[7] = P1;
-
- float dx0 = lineWidth * 0.5f * P0.w / W;
- float dy0 = lineWidth * 0.5f * P0.w / H;
-
- float dx1 = lineWidth * 0.5f * P1.w / W;
- float dy1 = lineWidth * 0.5f * P1.w / H;
-
- P[0].x += -dx0;
- P[1].y += +dy0;
- P[2].x += +dx0;
- P[3].y += -dy0;
- P[4].x += -dx1;
- P[5].y += +dy1;
- P[6].x += +dx1;
- P[7].y += -dy1;
-
- float4 L[4];
-
- if(dx > -dy)
- {
- if(dx > dy) // Right
- {
- L[0] = P[1];
- L[1] = P[5];
- L[2] = P[7];
- L[3] = P[3];
- }
- else // Down
- {
- L[0] = P[0];
- L[1] = P[4];
- L[2] = P[6];
- L[3] = P[2];
- }
- }
- else
- {
- if(dx > dy) // Up
- {
- L[0] = P[0];
- L[1] = P[2];
- L[2] = P[6];
- L[3] = P[4];
- }
- else // Left
- {
- L[0] = P[1];
- L[1] = P[3];
- L[2] = P[7];
- L[3] = P[5];
- }
- }
-
- int C0 = clipper->computeClipFlags(L[0]);
- int C1 = clipper->computeClipFlags(L[1]);
- int C2 = clipper->computeClipFlags(L[2]);
- int C3 = clipper->computeClipFlags(L[3]);
-
- if((C0 & C1 & C2 & C3) == Clipper::CLIP_FINITE)
- {
- Polygon polygon(L, 4);
-
- int clipFlagsOr = C0 | C1 | C2 | C3;
-
- if(clipFlagsOr != Clipper::CLIP_FINITE)
- {
- if(!clipper->clip(polygon, clipFlagsOr, draw))
- {
- return false;
- }
- }
-
- return setupRoutine(&primitive, &triangle, &polygon, &data);
- }
- }
-
- return false;
- }
-
- bool Renderer::setupPoint(Primitive &primitive, Triangle &triangle, const DrawCall &draw)
- {
- const SetupProcessor::RoutinePointer &setupRoutine = draw.setupPointer;
- const SetupProcessor::State &state = draw.setupState;
- const DrawData &data = *draw.data;
-
- Vertex &v = triangle.v0;
-
- float pSize;
-
- int pts = state.pointSizeRegister;
-
- if(state.pointSizeRegister != Unused)
- {
- pSize = v.v[pts].y;
- }
- else
- {
- pSize = data.point.pointSize[0];
- }
-
- pSize = clamp(pSize, data.point.pointSizeMin, data.point.pointSizeMax);
-
- float4 P[4];
- int C[4];
-
- int pos = state.positionRegister;
-
- P[0] = v.v[pos];
- P[1] = v.v[pos];
- P[2] = v.v[pos];
- P[3] = v.v[pos];
-
- const float X = pSize * P[0].w * data.halfPixelX[0];
- const float Y = pSize * P[0].w * data.halfPixelY[0];
-
- P[0].x -= X;
- P[0].y += Y;
- C[0] = clipper->computeClipFlags(P[0]);
-
- P[1].x += X;
- P[1].y += Y;
- C[1] = clipper->computeClipFlags(P[1]);
-
- P[2].x += X;
- P[2].y -= Y;
- C[2] = clipper->computeClipFlags(P[2]);
-
- P[3].x -= X;
- P[3].y -= Y;
- C[3] = clipper->computeClipFlags(P[3]);
-
- Polygon polygon(P, 4);
-
- if((C[0] & C[1] & C[2] & C[3]) == Clipper::CLIP_FINITE)
- {
- int clipFlagsOr = C[0] | C[1] | C[2] | C[3] | draw.clipFlags;
-
- if(clipFlagsOr != Clipper::CLIP_FINITE)
- {
- if(!clipper->clip(polygon, clipFlagsOr, draw))
- {
- return false;
- }
- }
-
- triangle.v1 = triangle.v0;
- triangle.v2 = triangle.v0;
-
- triangle.v1.X += iround(16 * 0.5f * pSize);
- triangle.v2.Y -= iround(16 * 0.5f * pSize) * (data.Hx16[0] > 0.0f ? 1 : -1); // Both Direct3D and OpenGL expect (0, 0) in the top-left corner
- return setupRoutine(&primitive, &triangle, &polygon, &data);
- }
-
- return false;
- }
-
- void Renderer::initializeThreads()
- {
- unitCount = ceilPow2(threadCount);
- clusterCount = ceilPow2(threadCount);
-
- for(int i = 0; i < unitCount; i++)
- {
- triangleBatch[i] = (Triangle*)allocate(batchSize * sizeof(Triangle));
- primitiveBatch[i] = (Primitive*)allocate(batchSize * sizeof(Primitive));
- }
-
- for(int i = 0; i < threadCount; i++)
- {
- vertexTask[i] = (VertexTask*)allocate(sizeof(VertexTask));
- vertexTask[i]->vertexCache.drawCall = -1;
-
- task[i].type = Task::SUSPEND;
-
- resume[i] = new Event();
- suspend[i] = new Event();
-
- Parameters parameters;
- parameters.threadIndex = i;
- parameters.renderer = this;
-
- exitThreads = false;
- worker[i] = new Thread(threadFunction, &parameters);
-
- suspend[i]->wait();
- suspend[i]->signal();
- }
- }
-
- void Renderer::terminateThreads()
- {
- while(threadsAwake != 0)
- {
- Thread::sleep(1);
- }
-
- for(int thread = 0; thread < threadCount; thread++)
- {
- if(worker[thread])
- {
- exitThreads = true;
- resume[thread]->signal();
- worker[thread]->join();
-
- delete worker[thread];
- worker[thread] = 0;
- delete resume[thread];
- resume[thread] = 0;
- delete suspend[thread];
- suspend[thread] = 0;
- }
-
- deallocate(vertexTask[thread]);
- vertexTask[thread] = 0;
- }
-
- for(int i = 0; i < 16; i++)
- {
- deallocate(triangleBatch[i]);
- triangleBatch[i] = 0;
-
- deallocate(primitiveBatch[i]);
- primitiveBatch[i] = 0;
- }
- }
-
- void Renderer::loadConstants(const VertexShader *vertexShader)
- {
- if(!vertexShader) return;
-
- size_t count = vertexShader->getLength();
-
- for(size_t i = 0; i < count; i++)
- {
- const Shader::Instruction *instruction = vertexShader->getInstruction(i);
-
- if(instruction->opcode == Shader::OPCODE_DEF)
- {
- int index = instruction->dst.index;
- float value[4];
-
- value[0] = instruction->src[0].value[0];
- value[1] = instruction->src[0].value[1];
- value[2] = instruction->src[0].value[2];
- value[3] = instruction->src[0].value[3];
-
- setVertexShaderConstantF(index, value);
- }
- else if(instruction->opcode == Shader::OPCODE_DEFI)
- {
- int index = instruction->dst.index;
- int integer[4];
-
- integer[0] = instruction->src[0].integer[0];
- integer[1] = instruction->src[0].integer[1];
- integer[2] = instruction->src[0].integer[2];
- integer[3] = instruction->src[0].integer[3];
-
- setVertexShaderConstantI(index, integer);
- }
- else if(instruction->opcode == Shader::OPCODE_DEFB)
- {
- int index = instruction->dst.index;
- int boolean = instruction->src[0].boolean[0];
-
- setVertexShaderConstantB(index, &boolean);
- }
- }
- }
-
- void Renderer::loadConstants(const PixelShader *pixelShader)
- {
- if(!pixelShader) return;
-
- size_t count = pixelShader->getLength();
-
- for(size_t i = 0; i < count; i++)
- {
- const Shader::Instruction *instruction = pixelShader->getInstruction(i);
-
- if(instruction->opcode == Shader::OPCODE_DEF)
- {
- int index = instruction->dst.index;
- float value[4];
-
- value[0] = instruction->src[0].value[0];
- value[1] = instruction->src[0].value[1];
- value[2] = instruction->src[0].value[2];
- value[3] = instruction->src[0].value[3];
-
- setPixelShaderConstantF(index, value);
- }
- else if(instruction->opcode == Shader::OPCODE_DEFI)
- {
- int index = instruction->dst.index;
- int integer[4];
-
- integer[0] = instruction->src[0].integer[0];
- integer[1] = instruction->src[0].integer[1];
- integer[2] = instruction->src[0].integer[2];
- integer[3] = instruction->src[0].integer[3];
-
- setPixelShaderConstantI(index, integer);
- }
- else if(instruction->opcode == Shader::OPCODE_DEFB)
- {
- int index = instruction->dst.index;
- int boolean = instruction->src[0].boolean[0];
-
- setPixelShaderConstantB(index, &boolean);
- }
- }
- }
-
- void Renderer::setIndexBuffer(Resource *indexBuffer)
- {
- context->indexBuffer = indexBuffer;
- }
-
- void Renderer::setMultiSampleMask(unsigned int mask)
- {
- context->sampleMask = mask;
- }
-
- void Renderer::setTransparencyAntialiasing(TransparencyAntialiasing transparencyAntialiasing)
- {
- sw::transparencyAntialiasing = transparencyAntialiasing;
- }
-
- bool Renderer::isReadWriteTexture(int sampler)
- {
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- if(context->renderTarget[index] && context->texture[sampler] == context->renderTarget[index]->getResource())
- {
- return true;
- }
- }
-
- if(context->depthBuffer && context->texture[sampler] == context->depthBuffer->getResource())
- {
- return true;
- }
-
- return false;
- }
-
- void Renderer::updateClipper()
- {
- if(updateClipPlanes)
- {
- if(VertexProcessor::isFixedFunction()) // User plane in world space
- {
- const Matrix &scissorWorld = getViewTransform();
-
- if(clipFlags & Clipper::CLIP_PLANE0) clipPlane[0] = scissorWorld * userPlane[0];
- if(clipFlags & Clipper::CLIP_PLANE1) clipPlane[1] = scissorWorld * userPlane[1];
- if(clipFlags & Clipper::CLIP_PLANE2) clipPlane[2] = scissorWorld * userPlane[2];
- if(clipFlags & Clipper::CLIP_PLANE3) clipPlane[3] = scissorWorld * userPlane[3];
- if(clipFlags & Clipper::CLIP_PLANE4) clipPlane[4] = scissorWorld * userPlane[4];
- if(clipFlags & Clipper::CLIP_PLANE5) clipPlane[5] = scissorWorld * userPlane[5];
- }
- else // User plane in clip space
- {
- if(clipFlags & Clipper::CLIP_PLANE0) clipPlane[0] = userPlane[0];
- if(clipFlags & Clipper::CLIP_PLANE1) clipPlane[1] = userPlane[1];
- if(clipFlags & Clipper::CLIP_PLANE2) clipPlane[2] = userPlane[2];
- if(clipFlags & Clipper::CLIP_PLANE3) clipPlane[3] = userPlane[3];
- if(clipFlags & Clipper::CLIP_PLANE4) clipPlane[4] = userPlane[4];
- if(clipFlags & Clipper::CLIP_PLANE5) clipPlane[5] = userPlane[5];
- }
-
- updateClipPlanes = false;
- }
- }
-
- void Renderer::setTextureResource(unsigned int sampler, Resource *resource)
- {
- ASSERT(sampler < TOTAL_IMAGE_UNITS);
-
- context->texture[sampler] = resource;
- }
-
- void Renderer::setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type)
- {
- ASSERT(sampler < TOTAL_IMAGE_UNITS && face < 6 && level < MIPMAP_LEVELS);
-
- context->sampler[sampler].setTextureLevel(face, level, surface, type);
- }
-
- void Renderer::setTextureFilter(SamplerType type, int sampler, FilterType textureFilter)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setTextureFilter(sampler, textureFilter);
- }
- else
- {
- VertexProcessor::setTextureFilter(sampler, textureFilter);
- }
- }
-
- void Renderer::setMipmapFilter(SamplerType type, int sampler, MipmapType mipmapFilter)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMipmapFilter(sampler, mipmapFilter);
- }
- else
- {
- VertexProcessor::setMipmapFilter(sampler, mipmapFilter);
- }
- }
-
- void Renderer::setGatherEnable(SamplerType type, int sampler, bool enable)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setGatherEnable(sampler, enable);
- }
- else
- {
- VertexProcessor::setGatherEnable(sampler, enable);
- }
- }
-
- void Renderer::setAddressingModeU(SamplerType type, int sampler, AddressingMode addressMode)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setAddressingModeU(sampler, addressMode);
- }
- else
- {
- VertexProcessor::setAddressingModeU(sampler, addressMode);
- }
- }
-
- void Renderer::setAddressingModeV(SamplerType type, int sampler, AddressingMode addressMode)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setAddressingModeV(sampler, addressMode);
- }
- else
- {
- VertexProcessor::setAddressingModeV(sampler, addressMode);
- }
- }
-
- void Renderer::setAddressingModeW(SamplerType type, int sampler, AddressingMode addressMode)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setAddressingModeW(sampler, addressMode);
- }
- else
- {
- VertexProcessor::setAddressingModeW(sampler, addressMode);
- }
- }
-
- void Renderer::setReadSRGB(SamplerType type, int sampler, bool sRGB)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setReadSRGB(sampler, sRGB);
- }
- else
- {
- VertexProcessor::setReadSRGB(sampler, sRGB);
- }
- }
-
- void Renderer::setMipmapLOD(SamplerType type, int sampler, float bias)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMipmapLOD(sampler, bias);
- }
- else
- {
- VertexProcessor::setMipmapLOD(sampler, bias);
- }
- }
-
- void Renderer::setBorderColor(SamplerType type, int sampler, const Color<float> &borderColor)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setBorderColor(sampler, borderColor);
- }
- else
- {
- VertexProcessor::setBorderColor(sampler, borderColor);
- }
- }
-
- void Renderer::setMaxAnisotropy(SamplerType type, int sampler, float maxAnisotropy)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMaxAnisotropy(sampler, maxAnisotropy);
- }
- else
- {
- VertexProcessor::setMaxAnisotropy(sampler, maxAnisotropy);
- }
- }
-
- void Renderer::setHighPrecisionFiltering(SamplerType type, int sampler, bool highPrecisionFiltering)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setHighPrecisionFiltering(sampler, highPrecisionFiltering);
- }
- else
- {
- VertexProcessor::setHighPrecisionFiltering(sampler, highPrecisionFiltering);
- }
- }
-
- void Renderer::setSwizzleR(SamplerType type, int sampler, SwizzleType swizzleR)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setSwizzleR(sampler, swizzleR);
- }
- else
- {
- VertexProcessor::setSwizzleR(sampler, swizzleR);
- }
- }
-
- void Renderer::setSwizzleG(SamplerType type, int sampler, SwizzleType swizzleG)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setSwizzleG(sampler, swizzleG);
- }
- else
- {
- VertexProcessor::setSwizzleG(sampler, swizzleG);
- }
- }
-
- void Renderer::setSwizzleB(SamplerType type, int sampler, SwizzleType swizzleB)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setSwizzleB(sampler, swizzleB);
- }
- else
- {
- VertexProcessor::setSwizzleB(sampler, swizzleB);
- }
- }
-
- void Renderer::setSwizzleA(SamplerType type, int sampler, SwizzleType swizzleA)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setSwizzleA(sampler, swizzleA);
- }
- else
- {
- VertexProcessor::setSwizzleA(sampler, swizzleA);
- }
- }
-
- void Renderer::setCompareFunc(SamplerType type, int sampler, CompareFunc compFunc)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setCompareFunc(sampler, compFunc);
- }
- else
- {
- VertexProcessor::setCompareFunc(sampler, compFunc);
- }
- }
-
- void Renderer::setBaseLevel(SamplerType type, int sampler, int baseLevel)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setBaseLevel(sampler, baseLevel);
- }
- else
- {
- VertexProcessor::setBaseLevel(sampler, baseLevel);
- }
- }
-
- void Renderer::setMaxLevel(SamplerType type, int sampler, int maxLevel)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMaxLevel(sampler, maxLevel);
- }
- else
- {
- VertexProcessor::setMaxLevel(sampler, maxLevel);
- }
- }
-
- void Renderer::setMinLod(SamplerType type, int sampler, float minLod)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMinLod(sampler, minLod);
- }
- else
- {
- VertexProcessor::setMinLod(sampler, minLod);
- }
- }
-
- void Renderer::setMaxLod(SamplerType type, int sampler, float maxLod)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setMaxLod(sampler, maxLod);
- }
- else
- {
- VertexProcessor::setMaxLod(sampler, maxLod);
- }
- }
-
- void Renderer::setSyncRequired(SamplerType type, int sampler, bool syncRequired)
- {
- if(type == SAMPLER_PIXEL)
- {
- PixelProcessor::setSyncRequired(sampler, syncRequired);
- }
- else
- {
- VertexProcessor::setSyncRequired(sampler, syncRequired);
- }
- }
-
- void Renderer::setPointSpriteEnable(bool pointSpriteEnable)
- {
- context->setPointSpriteEnable(pointSpriteEnable);
- }
-
- void Renderer::setPointScaleEnable(bool pointScaleEnable)
- {
- context->setPointScaleEnable(pointScaleEnable);
- }
-
- void Renderer::setLineWidth(float width)
- {
- context->lineWidth = width;
- }
-
- void Renderer::setDepthBias(float bias)
- {
- context->depthBias = bias;
- }
-
- void Renderer::setSlopeDepthBias(float slopeBias)
- {
- context->slopeDepthBias = slopeBias;
- }
-
- void Renderer::setRasterizerDiscard(bool rasterizerDiscard)
- {
- context->rasterizerDiscard = rasterizerDiscard;
- }
-
- void Renderer::setPixelShader(const PixelShader *shader)
- {
- context->pixelShader = shader;
-
- loadConstants(shader);
- }
-
- void Renderer::setVertexShader(const VertexShader *shader)
- {
- context->vertexShader = shader;
-
- loadConstants(shader);
- }
-
- void Renderer::setPixelShaderConstantF(unsigned int index, const float value[4], unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->psDirtyConstF < index + count)
- {
- drawCall[i]->psDirtyConstF = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- PixelProcessor::setFloatConstant(index + i, value);
- value += 4;
- }
- }
-
- void Renderer::setPixelShaderConstantI(unsigned int index, const int value[4], unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->psDirtyConstI < index + count)
- {
- drawCall[i]->psDirtyConstI = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- PixelProcessor::setIntegerConstant(index + i, value);
- value += 4;
- }
- }
-
- void Renderer::setPixelShaderConstantB(unsigned int index, const int *boolean, unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->psDirtyConstB < index + count)
- {
- drawCall[i]->psDirtyConstB = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- PixelProcessor::setBooleanConstant(index + i, *boolean);
- boolean++;
- }
- }
-
- void Renderer::setVertexShaderConstantF(unsigned int index, const float value[4], unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->vsDirtyConstF < index + count)
- {
- drawCall[i]->vsDirtyConstF = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- VertexProcessor::setFloatConstant(index + i, value);
- value += 4;
- }
- }
-
- void Renderer::setVertexShaderConstantI(unsigned int index, const int value[4], unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->vsDirtyConstI < index + count)
- {
- drawCall[i]->vsDirtyConstI = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- VertexProcessor::setIntegerConstant(index + i, value);
- value += 4;
- }
- }
-
- void Renderer::setVertexShaderConstantB(unsigned int index, const int *boolean, unsigned int count)
- {
- for(unsigned int i = 0; i < DRAW_COUNT; i++)
- {
- if(drawCall[i]->vsDirtyConstB < index + count)
- {
- drawCall[i]->vsDirtyConstB = index + count;
- }
- }
-
- for(unsigned int i = 0; i < count; i++)
- {
- VertexProcessor::setBooleanConstant(index + i, *boolean);
- boolean++;
- }
- }
-
- void Renderer::setModelMatrix(const Matrix &M, int i)
- {
- VertexProcessor::setModelMatrix(M, i);
- }
-
- void Renderer::setViewMatrix(const Matrix &V)
- {
- VertexProcessor::setViewMatrix(V);
- updateClipPlanes = true;
- }
-
- void Renderer::setBaseMatrix(const Matrix &B)
- {
- VertexProcessor::setBaseMatrix(B);
- updateClipPlanes = true;
- }
-
- void Renderer::setProjectionMatrix(const Matrix &P)
- {
- VertexProcessor::setProjectionMatrix(P);
- updateClipPlanes = true;
- }
-
- void Renderer::addQuery(Query *query)
- {
- queries.push_back(query);
- }
-
- void Renderer::removeQuery(Query *query)
- {
- queries.remove(query);
- }
-
- #if PERF_HUD
- int Renderer::getThreadCount()
- {
- return threadCount;
- }
-
- int64_t Renderer::getVertexTime(int thread)
- {
- return vertexTime[thread];
- }
-
- int64_t Renderer::getSetupTime(int thread)
- {
- return setupTime[thread];
- }
-
- int64_t Renderer::getPixelTime(int thread)
- {
- return pixelTime[thread];
- }
-
- void Renderer::resetTimers()
- {
- for(int thread = 0; thread < threadCount; thread++)
- {
- vertexTime[thread] = 0;
- setupTime[thread] = 0;
- pixelTime[thread] = 0;
- }
- }
- #endif
-
- void Renderer::setViewport(const Viewport &viewport)
- {
- this->viewport = viewport;
- }
-
- void Renderer::setScissor(const Rect &scissor)
- {
- this->scissor = scissor;
- }
-
- void Renderer::setClipFlags(int flags)
- {
- clipFlags = flags << 8; // Bottom 8 bits used by legacy frustum
- }
-
- void Renderer::setClipPlane(unsigned int index, const float plane[4])
- {
- if(index < MAX_CLIP_PLANES)
- {
- userPlane[index] = plane;
- }
- else ASSERT(false);
-
- updateClipPlanes = true;
- }
-
- void Renderer::updateConfiguration(bool initialUpdate)
- {
- bool newConfiguration = swiftConfig->hasNewConfiguration();
-
- if(newConfiguration || initialUpdate)
- {
- terminateThreads();
-
- SwiftConfig::Configuration configuration = {};
- swiftConfig->getConfiguration(configuration);
-
- precacheVertex = !newConfiguration && configuration.precache;
- precacheSetup = !newConfiguration && configuration.precache;
- precachePixel = !newConfiguration && configuration.precache;
-
- VertexProcessor::setRoutineCacheSize(configuration.vertexRoutineCacheSize);
- PixelProcessor::setRoutineCacheSize(configuration.pixelRoutineCacheSize);
- SetupProcessor::setRoutineCacheSize(configuration.setupRoutineCacheSize);
-
- switch(configuration.textureSampleQuality)
- {
- case 0: Sampler::setFilterQuality(FILTER_POINT); break;
- case 1: Sampler::setFilterQuality(FILTER_LINEAR); break;
- case 2: Sampler::setFilterQuality(FILTER_ANISOTROPIC); break;
- default: Sampler::setFilterQuality(FILTER_ANISOTROPIC); break;
- }
-
- switch(configuration.mipmapQuality)
- {
- case 0: Sampler::setMipmapQuality(MIPMAP_POINT); break;
- case 1: Sampler::setMipmapQuality(MIPMAP_LINEAR); break;
- default: Sampler::setMipmapQuality(MIPMAP_LINEAR); break;
- }
-
- setPerspectiveCorrection(configuration.perspectiveCorrection);
-
- switch(configuration.transcendentalPrecision)
- {
- case 0:
- logPrecision = APPROXIMATE;
- expPrecision = APPROXIMATE;
- rcpPrecision = APPROXIMATE;
- rsqPrecision = APPROXIMATE;
- break;
- case 1:
- logPrecision = PARTIAL;
- expPrecision = PARTIAL;
- rcpPrecision = PARTIAL;
- rsqPrecision = PARTIAL;
- break;
- case 2:
- logPrecision = ACCURATE;
- expPrecision = ACCURATE;
- rcpPrecision = ACCURATE;
- rsqPrecision = ACCURATE;
- break;
- case 3:
- logPrecision = WHQL;
- expPrecision = WHQL;
- rcpPrecision = WHQL;
- rsqPrecision = WHQL;
- break;
- case 4:
- logPrecision = IEEE;
- expPrecision = IEEE;
- rcpPrecision = IEEE;
- rsqPrecision = IEEE;
- break;
- default:
- logPrecision = ACCURATE;
- expPrecision = ACCURATE;
- rcpPrecision = ACCURATE;
- rsqPrecision = ACCURATE;
- break;
- }
-
- switch(configuration.transparencyAntialiasing)
- {
- case 0: transparencyAntialiasing = TRANSPARENCY_NONE; break;
- case 1: transparencyAntialiasing = TRANSPARENCY_ALPHA_TO_COVERAGE; break;
- default: transparencyAntialiasing = TRANSPARENCY_NONE; break;
- }
-
- switch(configuration.threadCount)
- {
- case -1: threadCount = CPUID::coreCount(); break;
- case 0: threadCount = CPUID::processAffinity(); break;
- default: threadCount = configuration.threadCount; break;
- }
-
- CPUID::setEnableSSE4_1(configuration.enableSSE4_1);
- CPUID::setEnableSSSE3(configuration.enableSSSE3);
- CPUID::setEnableSSE3(configuration.enableSSE3);
- CPUID::setEnableSSE2(configuration.enableSSE2);
- CPUID::setEnableSSE(configuration.enableSSE);
-
- rr::Config::Edit cfg;
- cfg.clearOptimizationPasses();
- for(auto pass : configuration.optimization)
- {
- if (pass != rr::Optimization::Pass::Disabled) { cfg.add(pass); }
- }
- rr::Nucleus::adjustDefaultConfig(cfg);
-
- forceWindowed = configuration.forceWindowed;
- complementaryDepthBuffer = configuration.complementaryDepthBuffer;
- postBlendSRGB = configuration.postBlendSRGB;
- exactColorRounding = configuration.exactColorRounding;
- forceClearRegisters = configuration.forceClearRegisters;
-
- #ifndef NDEBUG
- minPrimitives = configuration.minPrimitives;
- maxPrimitives = configuration.maxPrimitives;
- #endif
- }
-
- if(!initialUpdate && !worker[0])
- {
- initializeThreads();
- }
- }
-}
diff --git a/src/Renderer/Renderer.hpp b/src/Renderer/Renderer.hpp
deleted file mode 100644
index 4ed11f612..000000000
--- a/src/Renderer/Renderer.hpp
+++ /dev/null
@@ -1,516 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Renderer_hpp
-#define sw_Renderer_hpp
-
-#include "VertexProcessor.hpp"
-#include "PixelProcessor.hpp"
-#include "SetupProcessor.hpp"
-#include "Plane.hpp"
-#include "Blitter.hpp"
-#include "Common/MutexLock.hpp"
-#include "Common/Thread.hpp"
-#include "Main/Config.hpp"
-
-#include <list>
-
-namespace sw
-{
- class Clipper;
- struct DrawCall;
- class PixelShader;
- class VertexShader;
- class SwiftConfig;
- struct Task;
- class Resource;
- struct Constants;
-
- enum TranscendentalPrecision
- {
- APPROXIMATE,
- PARTIAL, // 2^-10
- ACCURATE,
- WHQL, // 2^-21
- IEEE // 2^-23
- };
-
- extern TranscendentalPrecision logPrecision;
- extern TranscendentalPrecision expPrecision;
- extern TranscendentalPrecision rcpPrecision;
- extern TranscendentalPrecision rsqPrecision;
- extern bool perspectiveCorrection;
-
- struct Conventions
- {
- bool halfIntegerCoordinates;
- bool symmetricNormalizedDepth;
- bool booleanFaceRegister;
- bool fullPixelPositionRegister;
- bool leadingVertexFirst;
- bool secondaryColor;
- bool colorsDefaultToZero;
- };
-
- static const Conventions OpenGL =
- {
- true, // halfIntegerCoordinates
- true, // symmetricNormalizedDepth
- true, // booleanFaceRegister
- true, // fullPixelPositionRegister
- false, // leadingVertexFirst
- false, // secondaryColor
- true, // colorsDefaultToZero
- };
-
- static const Conventions Direct3D =
- {
- false, // halfIntegerCoordinates
- false, // symmetricNormalizedDepth
- false, // booleanFaceRegister
- false, // fullPixelPositionRegister
- true, // leadingVertexFirst
- true, // secondardyColor
- false, // colorsDefaultToZero
- };
-
- struct Query
- {
- enum Type { FRAGMENTS_PASSED, TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN };
-
- Query(Type type);
-
- void addRef();
- void release();
-
- inline void begin()
- {
- building = true;
- data = 0;
- }
-
- inline void end()
- {
- building = false;
- }
-
- inline bool isReady() const
- {
- return (reference == 1);
- }
-
- bool building;
- AtomicInt data;
-
- const Type type;
- private:
- ~Query() {} // Only delete a query within the release() function
-
- AtomicInt reference;
- };
-
- struct DrawData
- {
- const Constants *constants;
-
- const void *input[MAX_VERTEX_INPUTS];
- unsigned int stride[MAX_VERTEX_INPUTS];
- Texture mipmap[TOTAL_IMAGE_UNITS];
- const void *indices;
-
- struct VS
- {
- float4 c[VERTEX_UNIFORM_VECTORS + 1]; // One extra for indices out of range, c[VERTEX_UNIFORM_VECTORS] = {0, 0, 0, 0}
- byte* u[MAX_UNIFORM_BUFFER_BINDINGS];
- byte* t[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS];
- unsigned int reg[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]; // Offset used when reading from registers, in components
- unsigned int row[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]; // Number of rows to read
- unsigned int col[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]; // Number of columns to read
- unsigned int str[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]; // Number of components between each varying in output buffer
- int4 i[16];
- bool b[16];
- };
-
- struct PS
- {
- word4 cW[8][4];
- float4 c[FRAGMENT_UNIFORM_VECTORS];
- byte* u[MAX_UNIFORM_BUFFER_BINDINGS];
- int4 i[16];
- bool b[16];
- };
-
- union
- {
- VS vs;
- VertexProcessor::FixedFunction ff;
- };
-
- PS ps;
-
- int instanceID;
-
- VertexProcessor::PointSprite point;
- float lineWidth;
-
- PixelProcessor::Stencil stencil[2]; // clockwise, counterclockwise
- PixelProcessor::Fog fog;
- PixelProcessor::Factor factor;
- unsigned int occlusion[16]; // Number of pixels passing depth test
-
- #if PERF_PROFILE
- int64_t cycles[PERF_TIMERS][16];
- #endif
-
- TextureStage::Uniforms textureStage[8];
-
- float4 Wx16;
- float4 Hx16;
- float4 X0x16;
- float4 Y0x16;
- float4 XXXX;
- float4 YYYY;
- float4 halfPixelX;
- float4 halfPixelY;
- float viewportHeight;
- float slopeDepthBias;
- float depthRange;
- float depthNear;
- Plane clipPlane[6];
-
- unsigned int *colorBuffer[RENDERTARGETS];
- int colorPitchB[RENDERTARGETS];
- int colorSliceB[RENDERTARGETS];
- float *depthBuffer;
- int depthPitchB;
- int depthSliceB;
- unsigned char *stencilBuffer;
- int stencilPitchB;
- int stencilSliceB;
-
- int scissorX0;
- int scissorX1;
- int scissorY0;
- int scissorY1;
-
- float4 a2c0;
- float4 a2c1;
- float4 a2c2;
- float4 a2c3;
- };
-
- struct Viewport
- {
- float x0;
- float y0;
- float width;
- float height;
- float minZ;
- float maxZ;
- };
-
- class Renderer : public VertexProcessor, public PixelProcessor, public SetupProcessor
- {
- struct Task
- {
- enum Type
- {
- PRIMITIVES,
- PIXELS,
-
- RESUME,
- SUSPEND
- };
-
- AtomicInt type;
- AtomicInt primitiveUnit;
- AtomicInt pixelCluster;
- };
-
- struct PrimitiveProgress
- {
- void init()
- {
- drawCall = 0;
- firstPrimitive = 0;
- primitiveCount = 0;
- visible = 0;
- references = 0;
- }
-
- AtomicInt drawCall;
- AtomicInt firstPrimitive;
- AtomicInt primitiveCount;
- AtomicInt visible;
- AtomicInt references;
- };
-
- struct PixelProgress
- {
- void init()
- {
- drawCall = 0;
- processedPrimitives = 0;
- executing = false;
- }
-
- AtomicInt drawCall;
- AtomicInt processedPrimitives;
- AtomicInt executing;
- };
-
- public:
- Renderer(Context *context, Conventions conventions, bool exactColorRounding);
-
- virtual ~Renderer();
-
- void *operator new(size_t size);
- void operator delete(void * mem);
-
- void draw(DrawType drawType, unsigned int indexOffset, unsigned int count, bool update = true);
-
- void clear(void *value, Format format, Surface *dest, const Rect &rect, unsigned int rgbaMask);
- void blit(Surface *source, const SliceRectF &sRect, Surface *dest, const SliceRect &dRect, bool filter, bool isStencil = false, bool sRGBconversion = true);
- void blit3D(Surface *source, Surface *dest);
-
- void setIndexBuffer(Resource *indexBuffer);
-
- void setMultiSampleMask(unsigned int mask);
- void setTransparencyAntialiasing(TransparencyAntialiasing transparencyAntialiasing);
-
- void setTextureResource(unsigned int sampler, Resource *resource);
- void setTextureLevel(unsigned int sampler, unsigned int face, unsigned int level, Surface *surface, TextureType type);
-
- void setTextureFilter(SamplerType type, int sampler, FilterType textureFilter);
- void setMipmapFilter(SamplerType type, int sampler, MipmapType mipmapFilter);
- void setGatherEnable(SamplerType type, int sampler, bool enable);
- void setAddressingModeU(SamplerType type, int sampler, AddressingMode addressingMode);
- void setAddressingModeV(SamplerType type, int sampler, AddressingMode addressingMode);
- void setAddressingModeW(SamplerType type, int sampler, AddressingMode addressingMode);
- void setReadSRGB(SamplerType type, int sampler, bool sRGB);
- void setMipmapLOD(SamplerType type, int sampler, float bias);
- void setBorderColor(SamplerType type, int sampler, const Color<float> &borderColor);
- void setMaxAnisotropy(SamplerType type, int sampler, float maxAnisotropy);
- void setHighPrecisionFiltering(SamplerType type, int sampler, bool highPrecisionFiltering);
- void setSwizzleR(SamplerType type, int sampler, SwizzleType swizzleR);
- void setSwizzleG(SamplerType type, int sampler, SwizzleType swizzleG);
- void setSwizzleB(SamplerType type, int sampler, SwizzleType swizzleB);
- void setSwizzleA(SamplerType type, int sampler, SwizzleType swizzleA);
- void setCompareFunc(SamplerType type, int sampler, CompareFunc compare);
- void setBaseLevel(SamplerType type, int sampler, int baseLevel);
- void setMaxLevel(SamplerType type, int sampler, int maxLevel);
- void setMinLod(SamplerType type, int sampler, float minLod);
- void setMaxLod(SamplerType type, int sampler, float maxLod);
- void setSyncRequired(SamplerType type, int sampler, bool syncRequired);
-
- void setPointSpriteEnable(bool pointSpriteEnable);
- void setPointScaleEnable(bool pointScaleEnable);
- void setLineWidth(float width);
-
- void setDepthBias(float bias);
- void setSlopeDepthBias(float slopeBias);
-
- void setRasterizerDiscard(bool rasterizerDiscard);
-
- // Programmable pipelines
- void setPixelShader(const PixelShader *shader);
- void setVertexShader(const VertexShader *shader);
-
- void setPixelShaderConstantF(unsigned int index, const float value[4], unsigned int count = 1);
- void setPixelShaderConstantI(unsigned int index, const int value[4], unsigned int count = 1);
- void setPixelShaderConstantB(unsigned int index, const int *boolean, unsigned int count = 1);
-
- void setVertexShaderConstantF(unsigned int index, const float value[4], unsigned int count = 1);
- void setVertexShaderConstantI(unsigned int index, const int value[4], unsigned int count = 1);
- void setVertexShaderConstantB(unsigned int index, const int *boolean, unsigned int count = 1);
-
- // Viewport & Clipper
- void setViewport(const Viewport &viewport);
- void setScissor(const Rect &scissor);
- void setClipFlags(int flags);
- void setClipPlane(unsigned int index, const float plane[4]);
-
- // Partial transform
- void setModelMatrix(const Matrix &M, int i = 0);
- void setViewMatrix(const Matrix &V);
- void setBaseMatrix(const Matrix &B);
- void setProjectionMatrix(const Matrix &P);
-
- void addQuery(Query *query);
- void removeQuery(Query *query);
-
- void synchronize();
-
- #if PERF_HUD
- // Performance timers
- int getThreadCount();
- int64_t getVertexTime(int thread);
- int64_t getSetupTime(int thread);
- int64_t getPixelTime(int thread);
- void resetTimers();
- #endif
-
- static int getClusterCount() { return clusterCount; }
-
- private:
- static void threadFunction(void *parameters);
- void threadLoop(int threadIndex);
- void taskLoop(int threadIndex);
- void findAvailableTasks();
- void scheduleTask(int threadIndex);
- void executeTask(int threadIndex);
- void finishRendering(Task &pixelTask);
-
- void processPrimitiveVertices(int unit, unsigned int start, unsigned int count, unsigned int loop, int thread);
-
- int setupSolidTriangles(int batch, int count);
- int setupWireframeTriangle(int batch, int count);
- int setupVertexTriangle(int batch, int count);
- int setupLines(int batch, int count);
- int setupPoints(int batch, int count);
-
- bool setupLine(Primitive &primitive, Triangle &triangle, const DrawCall &draw);
- bool setupPoint(Primitive &primitive, Triangle &triangle, const DrawCall &draw);
-
- bool isReadWriteTexture(int sampler);
- void updateClipper();
- void updateConfiguration(bool initialUpdate = false);
- void initializeThreads();
- void terminateThreads();
-
- void loadConstants(const VertexShader *vertexShader);
- void loadConstants(const PixelShader *pixelShader);
-
- Context *context;
- Clipper *clipper;
- Blitter *blitter;
- Viewport viewport;
- Rect scissor;
- int clipFlags;
-
- Triangle *triangleBatch[16];
- Primitive *primitiveBatch[16];
-
- // User-defined clipping planes
- Plane userPlane[MAX_CLIP_PLANES];
- Plane clipPlane[MAX_CLIP_PLANES]; // Tranformed to clip space
- bool updateClipPlanes;
-
- AtomicInt exitThreads;
- AtomicInt threadsAwake;
- Thread *worker[16];
- Event *resume[16]; // Events for resuming threads
- Event *suspend[16]; // Events for suspending threads
- Event *resumeApp; // Event for resuming the application thread
-
- PrimitiveProgress primitiveProgress[16];
- PixelProgress pixelProgress[16];
- Task task[16]; // Current tasks for threads
-
- enum {
- DRAW_COUNT = 16, // Number of draw calls buffered (must be power of 2)
- DRAW_COUNT_BITS = DRAW_COUNT - 1,
- };
- DrawCall *drawCall[DRAW_COUNT];
- DrawCall *drawList[DRAW_COUNT];
-
- AtomicInt currentDraw;
- AtomicInt nextDraw;
-
- enum {
- TASK_COUNT = 32, // Size of the task queue (must be power of 2)
- TASK_COUNT_BITS = TASK_COUNT - 1,
- };
- Task taskQueue[TASK_COUNT];
- AtomicInt qHead;
- AtomicInt qSize;
-
- static AtomicInt unitCount;
- static AtomicInt clusterCount;
-
- MutexLock schedulerMutex;
-
- #if PERF_HUD
- int64_t vertexTime[16];
- int64_t setupTime[16];
- int64_t pixelTime[16];
- #endif
-
- VertexTask *vertexTask[16];
-
- SwiftConfig *swiftConfig;
-
- std::list<Query*> queries;
- Resource *sync;
-
- VertexProcessor::State vertexState;
- SetupProcessor::State setupState;
- PixelProcessor::State pixelState;
-
- std::shared_ptr<Routine> vertexRoutine;
- std::shared_ptr<Routine> setupRoutine;
- std::shared_ptr<Routine> pixelRoutine;
- };
-
- struct DrawCall
- {
- DrawCall();
-
- ~DrawCall();
-
- AtomicInt drawType;
- AtomicInt batchSize;
-
- std::shared_ptr<Routine> vertexRoutine;
- std::shared_ptr<Routine> setupRoutine;
- std::shared_ptr<Routine> pixelRoutine;
-
- VertexProcessor::RoutinePointer vertexPointer;
- SetupProcessor::RoutinePointer setupPointer;
- PixelProcessor::RoutinePointer pixelPointer;
-
- int (Renderer::*setupPrimitives)(int batch, int count);
- SetupProcessor::State setupState;
-
- Resource *vertexStream[MAX_VERTEX_INPUTS];
- Resource *indexBuffer;
- Surface *renderTarget[RENDERTARGETS];
- Surface *depthBuffer;
- Surface *stencilBuffer;
- Resource *texture[TOTAL_IMAGE_UNITS];
- Resource* pUniformBuffers[MAX_UNIFORM_BUFFER_BINDINGS];
- Resource* vUniformBuffers[MAX_UNIFORM_BUFFER_BINDINGS];
- Resource* transformFeedbackBuffers[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS];
-
- unsigned int vsDirtyConstF;
- unsigned int vsDirtyConstI;
- unsigned int vsDirtyConstB;
-
- unsigned int psDirtyConstF;
- unsigned int psDirtyConstI;
- unsigned int psDirtyConstB;
-
- std::list<Query*> *queries;
-
- AtomicInt clipFlags;
-
- AtomicInt primitive; // Current primitive to enter pipeline
- AtomicInt count; // Number of primitives to render
- AtomicInt references; // Remaining references to this draw call, 0 when done drawing, -1 when resources unlocked and slot is free
-
- DrawData *data;
- };
-}
-
-#endif // sw_Renderer_hpp
diff --git a/src/Renderer/RoutineCache.hpp b/src/Renderer/RoutineCache.hpp
deleted file mode 100644
index 61f635aa8..000000000
--- a/src/Renderer/RoutineCache.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_RoutineCache_hpp
-#define sw_RoutineCache_hpp
-
-#include "LRUCache.hpp"
-
-#include "Reactor/Reactor.hpp"
-
-namespace sw
-{
- using namespace rr;
-
- template<class State>
- using RoutineCache = LRUCache<State, std::shared_ptr<Routine>>;
-}
-
-#endif // sw_RoutineCache_hpp
diff --git a/src/Renderer/Sampler.cpp b/src/Renderer/Sampler.cpp
deleted file mode 100644
index efac4c650..000000000
--- a/src/Renderer/Sampler.cpp
+++ /dev/null
@@ -1,514 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Sampler.hpp"
-
-#include "Context.hpp"
-#include "Surface.hpp"
-#include "Shader/PixelRoutine.hpp"
-#include "Common/Debug.hpp"
-
-#include <memory.h>
-#include <string.h>
-
-namespace sw
-{
- FilterType Sampler::maximumTextureFilterQuality = FILTER_LINEAR;
- MipmapType Sampler::maximumMipmapFilterQuality = MIPMAP_POINT;
-
- Sampler::State::State()
- {
- memset(this, 0, sizeof(State));
- }
-
- Sampler::Sampler()
- {
- // FIXME: Mipmap::init
- static const unsigned int zero = 0x00FF00FF;
-
- for(int level = 0; level < MIPMAP_LEVELS; level++)
- {
- Mipmap &mipmap = texture.mipmap[level];
-
- memset(&mipmap, 0, sizeof(Mipmap));
-
- for(int face = 0; face < 6; face++)
- {
- mipmap.buffer[face] = &zero;
- }
- }
-
- externalTextureFormat = FORMAT_NULL;
- internalTextureFormat = FORMAT_NULL;
- textureType = TEXTURE_NULL;
-
- textureFilter = FILTER_LINEAR;
- addressingModeU = ADDRESSING_WRAP;
- addressingModeV = ADDRESSING_WRAP;
- addressingModeW = ADDRESSING_WRAP;
- mipmapFilterState = MIPMAP_NONE;
- sRGB = false;
- gather = false;
- highPrecisionFiltering = false;
- border = 0;
-
- swizzleR = SWIZZLE_RED;
- swizzleG = SWIZZLE_GREEN;
- swizzleB = SWIZZLE_BLUE;
- swizzleA = SWIZZLE_ALPHA;
-
- compare = COMPARE_BYPASS;
-
- texture.LOD = 0.0f;
- exp2LOD = 1.0f;
-
- texture.baseLevel = 0;
- texture.maxLevel = 1000;
- texture.maxLod = MAX_TEXTURE_LOD;
- texture.minLod = 0;
- }
-
- Sampler::~Sampler()
- {
- }
-
- Sampler::State Sampler::samplerState() const
- {
- State state;
-
- if(textureType != TEXTURE_NULL)
- {
- state.textureType = textureType;
- state.textureFormat = internalTextureFormat;
- state.textureFilter = getTextureFilter();
- state.addressingModeU = getAddressingModeU();
- state.addressingModeV = getAddressingModeV();
- state.addressingModeW = getAddressingModeW();
- state.mipmapFilter = mipmapFilter();
- state.sRGB = (sRGB && Surface::isSRGBreadable(externalTextureFormat)) || Surface::isSRGBformat(internalTextureFormat);
- state.swizzleR = swizzleR;
- state.swizzleG = swizzleG;
- state.swizzleB = swizzleB;
- state.swizzleA = swizzleA;
- state.highPrecisionFiltering = highPrecisionFiltering;
- state.compare = getCompareFunc();
-
- #if PERF_PROFILE
- state.compressedFormat = Surface::isCompressed(externalTextureFormat);
- #endif
- }
-
- return state;
- }
-
- void Sampler::setTextureLevel(int face, int level, Surface *surface, TextureType type)
- {
- if(surface)
- {
- Mipmap &mipmap = texture.mipmap[level];
-
- border = surface->getBorder();
- mipmap.buffer[face] = surface->lockInternal(-border, -border, 0, LOCK_UNLOCKED, PRIVATE);
-
- if(face == 0)
- {
- externalTextureFormat = surface->getExternalFormat();
- internalTextureFormat = surface->getInternalFormat();
-
- int width = surface->getWidth();
- int height = surface->getHeight();
- int depth = surface->getDepth();
- int pitchP = surface->getInternalPitchP();
- int sliceP = surface->getInternalSliceP();
-
- if(level == 0)
- {
- texture.widthHeightLOD[0] = width * exp2LOD;
- texture.widthHeightLOD[1] = width * exp2LOD;
- texture.widthHeightLOD[2] = height * exp2LOD;
- texture.widthHeightLOD[3] = height * exp2LOD;
-
- texture.widthLOD[0] = width * exp2LOD;
- texture.widthLOD[1] = width * exp2LOD;
- texture.widthLOD[2] = width * exp2LOD;
- texture.widthLOD[3] = width * exp2LOD;
-
- texture.heightLOD[0] = height * exp2LOD;
- texture.heightLOD[1] = height * exp2LOD;
- texture.heightLOD[2] = height * exp2LOD;
- texture.heightLOD[3] = height * exp2LOD;
-
- texture.depthLOD[0] = depth * exp2LOD;
- texture.depthLOD[1] = depth * exp2LOD;
- texture.depthLOD[2] = depth * exp2LOD;
- texture.depthLOD[3] = depth * exp2LOD;
- }
-
- if(Surface::isFloatFormat(internalTextureFormat))
- {
- mipmap.fWidth[0] = (float)width / 65536.0f;
- mipmap.fWidth[1] = (float)width / 65536.0f;
- mipmap.fWidth[2] = (float)width / 65536.0f;
- mipmap.fWidth[3] = (float)width / 65536.0f;
-
- mipmap.fHeight[0] = (float)height / 65536.0f;
- mipmap.fHeight[1] = (float)height / 65536.0f;
- mipmap.fHeight[2] = (float)height / 65536.0f;
- mipmap.fHeight[3] = (float)height / 65536.0f;
-
- mipmap.fDepth[0] = (float)depth / 65536.0f;
- mipmap.fDepth[1] = (float)depth / 65536.0f;
- mipmap.fDepth[2] = (float)depth / 65536.0f;
- mipmap.fDepth[3] = (float)depth / 65536.0f;
- }
-
- short halfTexelU = 0x8000 / width;
- short halfTexelV = 0x8000 / height;
- short halfTexelW = 0x8000 / depth;
-
- mipmap.uHalf[0] = halfTexelU;
- mipmap.uHalf[1] = halfTexelU;
- mipmap.uHalf[2] = halfTexelU;
- mipmap.uHalf[3] = halfTexelU;
-
- mipmap.vHalf[0] = halfTexelV;
- mipmap.vHalf[1] = halfTexelV;
- mipmap.vHalf[2] = halfTexelV;
- mipmap.vHalf[3] = halfTexelV;
-
- mipmap.wHalf[0] = halfTexelW;
- mipmap.wHalf[1] = halfTexelW;
- mipmap.wHalf[2] = halfTexelW;
- mipmap.wHalf[3] = halfTexelW;
-
- mipmap.width[0] = width;
- mipmap.width[1] = width;
- mipmap.width[2] = width;
- mipmap.width[3] = width;
-
- mipmap.height[0] = height;
- mipmap.height[1] = height;
- mipmap.height[2] = height;
- mipmap.height[3] = height;
-
- mipmap.depth[0] = depth;
- mipmap.depth[1] = depth;
- mipmap.depth[2] = depth;
- mipmap.depth[3] = depth;
-
- mipmap.onePitchP[0] = 1;
- mipmap.onePitchP[1] = pitchP;
- mipmap.onePitchP[2] = 1;
- mipmap.onePitchP[3] = pitchP;
-
- mipmap.pitchP[0] = pitchP;
- mipmap.pitchP[1] = pitchP;
- mipmap.pitchP[2] = pitchP;
- mipmap.pitchP[3] = pitchP;
-
- mipmap.sliceP[0] = sliceP;
- mipmap.sliceP[1] = sliceP;
- mipmap.sliceP[2] = sliceP;
- mipmap.sliceP[3] = sliceP;
-
- if(internalTextureFormat == FORMAT_YV12_BT601 ||
- internalTextureFormat == FORMAT_YV12_BT709 ||
- internalTextureFormat == FORMAT_YV12_JFIF)
- {
- unsigned int YStride = pitchP;
- unsigned int YSize = YStride * height;
- unsigned int CStride = align<16>(YStride / 2);
- unsigned int CSize = CStride * height / 2;
-
- mipmap.buffer[1] = (byte*)mipmap.buffer[0] + YSize;
- mipmap.buffer[2] = (byte*)mipmap.buffer[1] + CSize;
-
- texture.mipmap[1].width[0] = width / 2;
- texture.mipmap[1].width[1] = width / 2;
- texture.mipmap[1].width[2] = width / 2;
- texture.mipmap[1].width[3] = width / 2;
- texture.mipmap[1].height[0] = height / 2;
- texture.mipmap[1].height[1] = height / 2;
- texture.mipmap[1].height[2] = height / 2;
- texture.mipmap[1].height[3] = height / 2;
- texture.mipmap[1].onePitchP[0] = 1;
- texture.mipmap[1].onePitchP[1] = CStride;
- texture.mipmap[1].onePitchP[2] = 1;
- texture.mipmap[1].onePitchP[3] = CStride;
- }
- }
- }
-
- textureType = type;
- }
-
- void Sampler::setTextureFilter(FilterType textureFilter)
- {
- this->textureFilter = (FilterType)min(textureFilter, maximumTextureFilterQuality);
- }
-
- void Sampler::setMipmapFilter(MipmapType mipmapFilter)
- {
- mipmapFilterState = (MipmapType)min(mipmapFilter, maximumMipmapFilterQuality);
- }
-
- void Sampler::setGatherEnable(bool enable)
- {
- gather = enable;
- }
-
- void Sampler::setAddressingModeU(AddressingMode addressingMode)
- {
- addressingModeU = addressingMode;
- }
-
- void Sampler::setAddressingModeV(AddressingMode addressingMode)
- {
- addressingModeV = addressingMode;
- }
-
- void Sampler::setAddressingModeW(AddressingMode addressingMode)
- {
- addressingModeW = addressingMode;
- }
-
- void Sampler::setReadSRGB(bool sRGB)
- {
- this->sRGB = sRGB;
- }
-
- void Sampler::setBorderColor(const Color<float> &borderColor)
- {
- // FIXME: Compact into generic function // FIXME: Clamp
- short r = iround(0xFFFF * borderColor.r);
- short g = iround(0xFFFF * borderColor.g);
- short b = iround(0xFFFF * borderColor.b);
- short a = iround(0xFFFF * borderColor.a);
-
- texture.borderColor4[0][0] = texture.borderColor4[0][1] = texture.borderColor4[0][2] = texture.borderColor4[0][3] = r;
- texture.borderColor4[1][0] = texture.borderColor4[1][1] = texture.borderColor4[1][2] = texture.borderColor4[1][3] = g;
- texture.borderColor4[2][0] = texture.borderColor4[2][1] = texture.borderColor4[2][2] = texture.borderColor4[2][3] = b;
- texture.borderColor4[3][0] = texture.borderColor4[3][1] = texture.borderColor4[3][2] = texture.borderColor4[3][3] = a;
-
- texture.borderColorF[0][0] = texture.borderColorF[0][1] = texture.borderColorF[0][2] = texture.borderColorF[0][3] = borderColor.r;
- texture.borderColorF[1][0] = texture.borderColorF[1][1] = texture.borderColorF[1][2] = texture.borderColorF[1][3] = borderColor.g;
- texture.borderColorF[2][0] = texture.borderColorF[2][1] = texture.borderColorF[2][2] = texture.borderColorF[2][3] = borderColor.b;
- texture.borderColorF[3][0] = texture.borderColorF[3][1] = texture.borderColorF[3][2] = texture.borderColorF[3][3] = borderColor.a;
- }
-
- void Sampler::setMaxAnisotropy(float maxAnisotropy)
- {
- texture.maxAnisotropy = maxAnisotropy;
- }
-
- void Sampler::setHighPrecisionFiltering(bool highPrecisionFiltering)
- {
- this->highPrecisionFiltering = highPrecisionFiltering;
- }
-
- void Sampler::setSwizzleR(SwizzleType swizzleR)
- {
- this->swizzleR = swizzleR;
- }
-
- void Sampler::setSwizzleG(SwizzleType swizzleG)
- {
- this->swizzleG = swizzleG;
- }
-
- void Sampler::setSwizzleB(SwizzleType swizzleB)
- {
- this->swizzleB = swizzleB;
- }
-
- void Sampler::setSwizzleA(SwizzleType swizzleA)
- {
- this->swizzleA = swizzleA;
- }
-
- void Sampler::setCompareFunc(CompareFunc compare)
- {
- this->compare = compare;
- }
-
- void Sampler::setBaseLevel(int baseLevel)
- {
- texture.baseLevel = baseLevel;
- }
-
- void Sampler::setMaxLevel(int maxLevel)
- {
- texture.maxLevel = maxLevel;
- }
-
- void Sampler::setMinLod(float minLod)
- {
- texture.minLod = clamp(minLod, 0.0f, (float)(MAX_TEXTURE_LOD));
- }
-
- void Sampler::setMaxLod(float maxLod)
- {
- texture.maxLod = clamp(maxLod, 0.0f, (float)(MAX_TEXTURE_LOD));
- }
-
- void Sampler::setFilterQuality(FilterType maximumFilterQuality)
- {
- Sampler::maximumTextureFilterQuality = maximumFilterQuality;
- }
-
- void Sampler::setMipmapQuality(MipmapType maximumFilterQuality)
- {
- Sampler::maximumMipmapFilterQuality = maximumFilterQuality;
- }
-
- void Sampler::setMipmapLOD(float LOD)
- {
- texture.LOD = LOD;
- exp2LOD = exp2(LOD);
- }
-
- bool Sampler::hasTexture() const
- {
- return textureType != TEXTURE_NULL;
- }
-
- bool Sampler::hasUnsignedTexture() const
- {
- return Surface::isUnsignedComponent(internalTextureFormat, 0) &&
- Surface::isUnsignedComponent(internalTextureFormat, 1) &&
- Surface::isUnsignedComponent(internalTextureFormat, 2) &&
- Surface::isUnsignedComponent(internalTextureFormat, 3);
- }
-
- bool Sampler::hasCubeTexture() const
- {
- return textureType == TEXTURE_CUBE;
- }
-
- bool Sampler::hasVolumeTexture() const
- {
- return textureType == TEXTURE_3D || textureType == TEXTURE_2D_ARRAY;
- }
-
- void Sampler::setSyncRequired(bool isSyncRequired)
- {
- syncRequired = isSyncRequired;
- }
-
- bool Sampler::requiresSync() const
- {
- return syncRequired;
- }
-
- const Texture &Sampler::getTextureData()
- {
- return texture;
- }
-
- MipmapType Sampler::mipmapFilter() const
- {
- if(mipmapFilterState != MIPMAP_NONE)
- {
- for(int i = 1; i < MIPMAP_LEVELS; i++)
- {
- if(texture.mipmap[0].buffer[0] != texture.mipmap[i].buffer[0])
- {
- return mipmapFilterState;
- }
- }
- }
-
- // Only one mipmap level
- return MIPMAP_NONE;
- }
-
- TextureType Sampler::getTextureType() const
- {
- return textureType;
- }
-
- FilterType Sampler::getTextureFilter() const
- {
- // Don't filter 1x1 textures.
- if(texture.mipmap[0].width[0] == 1 && texture.mipmap[0].height[0] == 1 && texture.mipmap[0].depth[0] == 1)
- {
- if(mipmapFilter() == MIPMAP_NONE)
- {
- return FILTER_POINT;
- }
- }
-
- FilterType filter = textureFilter;
-
- if(gather && Surface::componentCount(internalTextureFormat) == 1)
- {
- filter = FILTER_GATHER;
- }
-
- if(textureType != TEXTURE_2D || texture.maxAnisotropy == 1.0f)
- {
- return (FilterType)min(filter, FILTER_LINEAR);
- }
-
- return filter;
- }
-
- AddressingMode Sampler::getAddressingModeU() const
- {
- if(textureType == TEXTURE_CUBE)
- {
- return border ? ADDRESSING_SEAMLESS : ADDRESSING_CLAMP;
- }
-
- return addressingModeU;
- }
-
- AddressingMode Sampler::getAddressingModeV() const
- {
- if(textureType == TEXTURE_CUBE)
- {
- return border ? ADDRESSING_SEAMLESS : ADDRESSING_CLAMP;
- }
-
- return addressingModeV;
- }
-
- AddressingMode Sampler::getAddressingModeW() const
- {
- if(textureType == TEXTURE_2D_ARRAY ||
- textureType == TEXTURE_2D ||
- textureType == TEXTURE_CUBE ||
- textureType == TEXTURE_RECTANGLE)
- {
- return ADDRESSING_LAYER;
- }
-
- return addressingModeW;
- }
-
- CompareFunc Sampler::getCompareFunc() const
- {
- if(getTextureFilter() == FILTER_GATHER)
- {
- return COMPARE_BYPASS;
- }
-
- if(internalTextureFormat == FORMAT_D32FS8_SHADOW)
- {
- return COMPARE_LESSEQUAL;
- }
-
- return compare;
- }
-}
diff --git a/src/Renderer/Sampler.hpp b/src/Renderer/Sampler.hpp
deleted file mode 100644
index af225c505..000000000
--- a/src/Renderer/Sampler.hpp
+++ /dev/null
@@ -1,248 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Sampler_hpp
-#define sw_Sampler_hpp
-
-#include "Main/Config.hpp"
-#include "Renderer/Surface.hpp"
-#include "Common/Types.hpp"
-
-namespace sw
-{
- struct Mipmap
- {
- const void *buffer[6];
-
- float4 fWidth;
- float4 fHeight;
- float4 fDepth;
-
- short uHalf[4];
- short vHalf[4];
- short wHalf[4];
- short width[4];
- short height[4];
- short depth[4];
- short onePitchP[4];
- int4 pitchP;
- int4 sliceP;
- };
-
- struct Texture
- {
- Mipmap mipmap[MIPMAP_LEVELS];
-
- float LOD;
- float4 widthHeightLOD;
- float4 widthLOD;
- float4 heightLOD;
- float4 depthLOD;
-
- word4 borderColor4[4];
- float4 borderColorF[4];
- float maxAnisotropy;
- int baseLevel;
- int maxLevel;
- float minLod;
- float maxLod;
- };
-
- enum SamplerType
- {
- SAMPLER_PIXEL,
- SAMPLER_VERTEX
- };
-
- enum TextureType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- TEXTURE_NULL,
- TEXTURE_2D,
- TEXTURE_RECTANGLE,
- TEXTURE_CUBE,
- TEXTURE_3D,
- TEXTURE_2D_ARRAY,
-
- TEXTURE_LAST = TEXTURE_2D_ARRAY
- };
-
- enum FilterType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- FILTER_POINT,
- FILTER_GATHER,
- FILTER_MIN_POINT_MAG_LINEAR,
- FILTER_MIN_LINEAR_MAG_POINT,
- FILTER_LINEAR,
- FILTER_ANISOTROPIC,
-
- FILTER_LAST = FILTER_ANISOTROPIC
- };
-
- enum MipmapType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- MIPMAP_NONE,
- MIPMAP_POINT,
- MIPMAP_LINEAR,
-
- MIPMAP_LAST = MIPMAP_LINEAR
- };
-
- enum AddressingMode ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- ADDRESSING_WRAP,
- ADDRESSING_CLAMP,
- ADDRESSING_MIRROR,
- ADDRESSING_MIRRORONCE,
- ADDRESSING_BORDER, // Single color
- ADDRESSING_SEAMLESS, // Border of pixels
- ADDRESSING_LAYER,
- ADDRESSING_TEXELFETCH,
-
- ADDRESSING_LAST = ADDRESSING_TEXELFETCH
- };
-
- enum CompareFunc ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- COMPARE_BYPASS,
- COMPARE_LESSEQUAL,
- COMPARE_GREATEREQUAL,
- COMPARE_LESS,
- COMPARE_GREATER,
- COMPARE_EQUAL,
- COMPARE_NOTEQUAL,
- COMPARE_ALWAYS,
- COMPARE_NEVER,
-
- COMPARE_LAST = COMPARE_NEVER
- };
-
- enum SwizzleType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- SWIZZLE_RED,
- SWIZZLE_GREEN,
- SWIZZLE_BLUE,
- SWIZZLE_ALPHA,
- SWIZZLE_ZERO,
- SWIZZLE_ONE,
-
- SWIZZLE_LAST = SWIZZLE_ONE
- };
-
- class Sampler
- {
- public:
- struct State
- {
- State();
-
- TextureType textureType : BITS(TEXTURE_LAST);
- Format textureFormat : BITS(FORMAT_LAST);
- FilterType textureFilter : BITS(FILTER_LAST);
- AddressingMode addressingModeU : BITS(ADDRESSING_LAST);
- AddressingMode addressingModeV : BITS(ADDRESSING_LAST);
- AddressingMode addressingModeW : BITS(ADDRESSING_LAST);
- MipmapType mipmapFilter : BITS(FILTER_LAST);
- bool sRGB : 1;
- SwizzleType swizzleR : BITS(SWIZZLE_LAST);
- SwizzleType swizzleG : BITS(SWIZZLE_LAST);
- SwizzleType swizzleB : BITS(SWIZZLE_LAST);
- SwizzleType swizzleA : BITS(SWIZZLE_LAST);
- bool highPrecisionFiltering : 1;
- CompareFunc compare : BITS(COMPARE_LAST);
-
- #if PERF_PROFILE
- bool compressedFormat : 1;
- #endif
- };
-
- Sampler();
-
- ~Sampler();
-
- State samplerState() const;
-
- void setTextureLevel(int face, int level, Surface *surface, TextureType type);
-
- void setTextureFilter(FilterType textureFilter);
- void setMipmapFilter(MipmapType mipmapFilter);
- void setGatherEnable(bool enable);
- void setAddressingModeU(AddressingMode addressingMode);
- void setAddressingModeV(AddressingMode addressingMode);
- void setAddressingModeW(AddressingMode addressingMode);
- void setReadSRGB(bool sRGB);
- void setBorderColor(const Color<float> &borderColor);
- void setMaxAnisotropy(float maxAnisotropy);
- void setHighPrecisionFiltering(bool highPrecisionFiltering);
- void setSwizzleR(SwizzleType swizzleR);
- void setSwizzleG(SwizzleType swizzleG);
- void setSwizzleB(SwizzleType swizzleB);
- void setSwizzleA(SwizzleType swizzleA);
- void setCompareFunc(CompareFunc compare);
- void setBaseLevel(int baseLevel);
- void setMaxLevel(int maxLevel);
- void setMinLod(float minLod);
- void setMaxLod(float maxLod);
- void setSyncRequired(bool isSincRequired);
-
- static void setFilterQuality(FilterType maximumFilterQuality);
- static void setMipmapQuality(MipmapType maximumFilterQuality);
- void setMipmapLOD(float lod);
-
- bool hasTexture() const;
- bool hasUnsignedTexture() const;
- bool hasCubeTexture() const;
- bool hasVolumeTexture() const;
- bool requiresSync() const;
-
- const Texture &getTextureData();
-
- private:
- MipmapType mipmapFilter() const;
- TextureType getTextureType() const;
- FilterType getTextureFilter() const;
- AddressingMode getAddressingModeU() const;
- AddressingMode getAddressingModeV() const;
- AddressingMode getAddressingModeW() const;
- CompareFunc getCompareFunc() const;
-
- Format externalTextureFormat;
- Format internalTextureFormat;
- TextureType textureType;
-
- FilterType textureFilter;
- AddressingMode addressingModeU;
- AddressingMode addressingModeV;
- AddressingMode addressingModeW;
- MipmapType mipmapFilterState;
- bool sRGB;
- bool gather;
- bool highPrecisionFiltering;
- bool syncRequired;
- int border;
-
- SwizzleType swizzleR;
- SwizzleType swizzleG;
- SwizzleType swizzleB;
- SwizzleType swizzleA;
- CompareFunc compare;
-
- Texture texture;
- float exp2LOD;
-
- static FilterType maximumTextureFilterQuality;
- static MipmapType maximumMipmapFilterQuality;
- };
-}
-
-#endif // sw_Sampler_hpp
diff --git a/src/Renderer/SetupProcessor.cpp b/src/Renderer/SetupProcessor.cpp
deleted file mode 100644
index f23068fe9..000000000
--- a/src/Renderer/SetupProcessor.cpp
+++ /dev/null
@@ -1,246 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "SetupProcessor.hpp"
-
-#include "Primitive.hpp"
-#include "Polygon.hpp"
-#include "Context.hpp"
-#include "Renderer.hpp"
-#include "Shader/SetupRoutine.hpp"
-#include "Shader/Constants.hpp"
-#include "Common/Debug.hpp"
-
-#include <cstring>
-
-namespace sw
-{
- extern bool complementaryDepthBuffer;
- extern bool fullPixelPositionRegister;
-
- bool precacheSetup = false;
-
- uint32_t SetupProcessor::States::computeHash()
- {
- uint32_t *state = reinterpret_cast<uint32_t*>(this);
- uint32_t hash = 0;
-
- for(unsigned int i = 0; i < sizeof(States) / sizeof(uint32_t); i++)
- {
- hash ^= state[i];
- }
-
- return hash;
- }
-
- bool SetupProcessor::State::operator==(const State &state) const
- {
- if(hash != state.hash)
- {
- return false;
- }
-
- static_assert(is_memcmparable<State>::value, "Cannot memcmp States");
- return memcmp(static_cast<const States*>(this), static_cast<const States*>(&state), sizeof(States)) == 0;
- }
-
- SetupProcessor::SetupProcessor(Context *context) : context(context)
- {
- routineCache = nullptr;
- setRoutineCacheSize(1024);
- }
-
- SetupProcessor::~SetupProcessor()
- {
- delete routineCache;
- routineCache = nullptr;
- }
-
- SetupProcessor::State SetupProcessor::update() const
- {
- State state;
-
- bool vPosZW = (context->pixelShader && context->pixelShader->isVPosDeclared() && fullPixelPositionRegister);
-
- state.isDrawPoint = context->isDrawPoint(true);
- state.isDrawLine = context->isDrawLine(true);
- state.isDrawTriangle = context->isDrawTriangle(false);
- state.isDrawSolidTriangle = context->isDrawTriangle(true);
- state.interpolateZ = context->depthBufferActive() || context->pixelFogActive() != FOG_NONE || vPosZW;
- state.interpolateW = context->perspectiveActive() || vPosZW;
- state.perspective = context->perspectiveActive();
- state.pointSprite = context->pointSpriteActive();
- state.cullMode = context->cullMode;
- state.twoSidedStencil = context->stencilActive() && context->twoSidedStencil;
- state.slopeDepthBias = context->slopeDepthBias != 0.0f;
- state.vFace = context->pixelShader && context->pixelShader->isVFaceDeclared();
-
- state.positionRegister = Pos;
- state.pointSizeRegister = Unused;
-
- state.multiSample = context->getMultiSampleCount();
- state.rasterizerDiscard = context->rasterizerDiscard;
-
- if(context->vertexShader)
- {
- state.positionRegister = context->vertexShader->getPositionRegister();
- state.pointSizeRegister = context->vertexShader->getPointSizeRegister();
- }
- else if(context->pointSizeActive())
- {
- state.pointSizeRegister = Pts;
- }
-
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- state.gradient[interpolant][component].attribute = Unused;
- state.gradient[interpolant][component].flat = false;
- state.gradient[interpolant][component].wrap = false;
- }
- }
-
- state.fog.attribute = Unused;
- state.fog.flat = false;
- state.fog.wrap = false;
-
- const bool point = context->isDrawPoint(true);
- const bool sprite = context->pointSpriteActive();
- const bool flatShading = (context->shadingMode == SHADING_FLAT) || point;
-
- if(context->vertexShader && context->pixelShader)
- {
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- int project = context->isProjectionComponent(interpolant - 2, component) ? 1 : 0;
- const Shader::Semantic& semantic = context->pixelShader->getInput(interpolant, component - project);
-
- if(semantic.active())
- {
- int input = interpolant;
- for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
- {
- if(semantic == context->vertexShader->getOutput(i, component - project))
- {
- input = i;
- break;
- }
- }
-
- bool flat = point;
-
- switch(semantic.usage)
- {
- case Shader::USAGE_TEXCOORD: flat = point && !sprite; break;
- case Shader::USAGE_COLOR: flat = semantic.flat || flatShading; break;
- }
-
- state.gradient[interpolant][component].attribute = input;
- state.gradient[interpolant][component].flat = flat;
- }
- }
- }
- }
- else if(context->preTransformed && context->pixelShader)
- {
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- const Shader::Semantic& semantic = context->pixelShader->getInput(interpolant, component);
-
- switch(semantic.usage)
- {
- case 0xFF:
- break;
- case Shader::USAGE_TEXCOORD:
- state.gradient[interpolant][component].attribute = T0 + semantic.index;
- state.gradient[interpolant][component].flat = semantic.flat || (point && !sprite);
- break;
- case Shader::USAGE_COLOR:
- state.gradient[interpolant][component].attribute = C0 + semantic.index;
- state.gradient[interpolant][component].flat = semantic.flat || flatShading;
- break;
- default:
- ASSERT(false);
- }
- }
- }
- }
- else if(context->pixelShaderModel() < 0x0300)
- {
- for(int coordinate = 0; coordinate < 8; coordinate++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(context->textureActive(coordinate, component))
- {
- state.texture[coordinate][component].attribute = T0 + coordinate;
- state.texture[coordinate][component].flat = point && !sprite;
- state.texture[coordinate][component].wrap = (context->textureWrap[coordinate] & (1 << component)) != 0;
- }
- }
- }
-
- for(int color = 0; color < 2; color++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(context->colorActive(color, component))
- {
- state.color[color][component].attribute = C0 + color;
- state.color[color][component].flat = flatShading;
- }
- }
- }
- }
- else ASSERT(false);
-
- if(context->fogActive())
- {
- state.fog.attribute = Fog;
- state.fog.flat = point;
- }
-
- state.hash = state.computeHash();
-
- return state;
- }
-
- std::shared_ptr<Routine> SetupProcessor::routine(const State &state)
- {
- auto routine = routineCache->query(state);
-
- if(!routine)
- {
- SetupRoutine *generator = new SetupRoutine(state);
- generator->generate();
- routine = generator->getRoutine();
- delete generator;
-
- routineCache->add(state, routine);
- }
-
- return routine;
- }
-
- void SetupProcessor::setRoutineCacheSize(int cacheSize)
- {
- delete routineCache;
- routineCache = new RoutineCache<State>(clamp(cacheSize, 1, 65536));
- }
-}
diff --git a/src/Renderer/SetupProcessor.hpp b/src/Renderer/SetupProcessor.hpp
deleted file mode 100644
index 4807e27eb..000000000
--- a/src/Renderer/SetupProcessor.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_SetupProcessor_hpp
-#define sw_SetupProcessor_hpp
-
-#include "Context.hpp"
-#include "RoutineCache.hpp"
-#include "Shader/VertexShader.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Common/Types.hpp"
-
-namespace sw
-{
- struct Primitive;
- struct Triangle;
- struct Polygon;
- struct Vertex;
- struct DrawCall;
- struct DrawData;
-
- class SetupProcessor
- {
- public:
- struct States : Memset<States>
- {
- States() : Memset(this, 0) {}
-
- uint32_t computeHash();
-
- bool isDrawPoint : 1;
- bool isDrawLine : 1;
- bool isDrawTriangle : 1;
- bool isDrawSolidTriangle : 1;
- bool interpolateZ : 1;
- bool interpolateW : 1;
- bool perspective : 1;
- bool pointSprite : 1;
- unsigned int positionRegister : BITS(VERTEX_OUTPUT_LAST);
- unsigned int pointSizeRegister : BITS(VERTEX_OUTPUT_LAST);
- CullMode cullMode : BITS(CULL_LAST);
- bool twoSidedStencil : 1;
- bool slopeDepthBias : 1;
- bool vFace : 1;
- unsigned int multiSample : 3; // 1, 2 or 4
- bool rasterizerDiscard : 1;
-
- struct Gradient
- {
- unsigned char attribute : BITS(VERTEX_OUTPUT_LAST);
- bool flat : 1;
- bool wrap : 1;
- };
-
- union
- {
- struct
- {
- Gradient color[2][4];
- Gradient texture[8][4];
- Gradient fog;
- };
-
- Gradient gradient[MAX_FRAGMENT_INPUTS][4];
- };
- };
-
- struct State : States
- {
- bool operator==(const State &states) const;
-
- uint32_t hash;
- };
-
- typedef bool (*RoutinePointer)(Primitive *primitive, const Triangle *triangle, const Polygon *polygon, const DrawData *draw);
-
- SetupProcessor(Context *context);
-
- ~SetupProcessor();
-
- protected:
- State update() const;
- std::shared_ptr<Routine> routine(const State &state);
-
- void setRoutineCacheSize(int cacheSize);
-
- private:
- Context *const context;
-
- RoutineCache<State> *routineCache;
- };
-}
-
-#endif // sw_SetupProcessor_hpp
diff --git a/src/Renderer/Stream.hpp b/src/Renderer/Stream.hpp
deleted file mode 100644
index 969d8b2b1..000000000
--- a/src/Renderer/Stream.hpp
+++ /dev/null
@@ -1,105 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Stream_hpp
-#define sw_Stream_hpp
-
-#include "Common/Types.hpp"
-
-namespace sw
-{
- class Resource;
-
- enum StreamType ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- STREAMTYPE_COLOR, // 4 normalized unsigned bytes, ZYXW order
- STREAMTYPE_UDEC3, // 3 unsigned 10-bit fields
- STREAMTYPE_DEC3N, // 3 normalized signed 10-bit fields
- STREAMTYPE_INDICES, // 4 unsigned bytes, stored unconverted into X component
- STREAMTYPE_FLOAT, // Normalization ignored
- STREAMTYPE_BYTE,
- STREAMTYPE_SBYTE,
- STREAMTYPE_SHORT,
- STREAMTYPE_USHORT,
- STREAMTYPE_INT,
- STREAMTYPE_UINT,
- STREAMTYPE_FIXED, // Normalization ignored (16.16 format)
- STREAMTYPE_HALF, // Normalization ignored
- STREAMTYPE_2_10_10_10_INT,
- STREAMTYPE_2_10_10_10_UINT,
-
- STREAMTYPE_LAST = STREAMTYPE_2_10_10_10_UINT
- };
-
- struct StreamResource
- {
- Resource *resource;
- const void *buffer;
- unsigned int stride;
- };
-
- struct Stream : public StreamResource
- {
- Stream(Resource *resource = 0, const void *buffer = 0, unsigned int stride = 0)
- {
- this->resource = resource;
- this->buffer = buffer;
- this->stride = stride;
- }
-
- Stream &define(StreamType type, unsigned int count, bool normalized = false)
- {
- this->type = type;
- this->count = count;
- this->normalized = normalized;
-
- return *this;
- }
-
- Stream &define(const void *buffer, StreamType type, unsigned int count, bool normalized = false)
- {
- this->buffer = buffer;
- this->type = type;
- this->count = count;
- this->normalized = normalized;
-
- return *this;
- }
-
- Stream &defaults()
- {
- static const float4 null = {0, 0, 0, 1};
-
- resource = 0;
- buffer = &null;
- stride = 0;
- type = STREAMTYPE_FLOAT;
- count = 0;
- normalized = false;
-
- return *this;
- }
-
- operator bool() const // Returns true if stream contains data
- {
- return count != 0;
- }
-
- StreamType type;
- unsigned char count;
- bool normalized;
- };
-}
-
-#endif // sw_Stream_hpp
diff --git a/src/Renderer/Surface.cpp b/src/Renderer/Surface.cpp
deleted file mode 100644
index 8ce207a73..000000000
--- a/src/Renderer/Surface.cpp
+++ /dev/null
@@ -1,5996 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Surface.hpp"
-
-#include "Color.hpp"
-#include "Context.hpp"
-#include "ETC_Decoder.hpp"
-#include "Renderer.hpp"
-#include "Common/Half.hpp"
-#include "Common/Memory.hpp"
-#include "Common/CPUID.hpp"
-#include "Common/Resource.hpp"
-#include "Common/Debug.hpp"
-#include "Reactor/Reactor.hpp"
-
-#if defined(__i386__) || defined(__x86_64__)
- #include <xmmintrin.h>
- #include <emmintrin.h>
-#endif
-
-#undef min
-#undef max
-
-namespace sw
-{
- extern bool quadLayoutEnabled;
- extern bool complementaryDepthBuffer;
- extern TranscendentalPrecision logPrecision;
-
- unsigned int *Surface::palette = 0;
- unsigned int Surface::paletteID = 0;
-
- void Surface::Buffer::write(int x, int y, int z, const Color<float> &color)
- {
- ASSERT((x >= -border) && (x < (width + border)));
- ASSERT((y >= -border) && (y < (height + border)));
- ASSERT((z >= 0) && (z < depth));
-
- byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
-
- for(int i = 0; i < samples; i++)
- {
- write(element, color);
- element += sliceB;
- }
- }
-
- void Surface::Buffer::write(int x, int y, const Color<float> &color)
- {
- ASSERT((x >= -border) && (x < (width + border)));
- ASSERT((y >= -border) && (y < (height + border)));
-
- byte *element = (byte*)buffer + (x + border) * bytes + (y + border) * pitchB;
-
- for(int i = 0; i < samples; i++)
- {
- write(element, color);
- element += sliceB;
- }
- }
-
- inline void Surface::Buffer::write(void *element, const Color<float> &color)
- {
- float r = color.r;
- float g = color.g;
- float b = color.b;
- float a = color.a;
-
- if(isSRGBformat(format))
- {
- r = linearToSRGB(r);
- g = linearToSRGB(g);
- b = linearToSRGB(b);
- }
-
- switch(format)
- {
- case FORMAT_A8:
- *(unsigned char*)element = unorm<8>(a);
- break;
- case FORMAT_R8_SNORM:
- *(char*)element = snorm<8>(r);
- break;
- case FORMAT_R8:
- *(unsigned char*)element = unorm<8>(r);
- break;
- case FORMAT_R8I:
- *(char*)element = scast<8>(r);
- break;
- case FORMAT_R8UI:
- *(unsigned char*)element = ucast<8>(r);
- break;
- case FORMAT_R16I:
- *(short*)element = scast<16>(r);
- break;
- case FORMAT_R16UI:
- *(unsigned short*)element = ucast<16>(r);
- break;
- case FORMAT_R32I:
- *(int*)element = static_cast<int>(r);
- break;
- case FORMAT_R32UI:
- *(unsigned int*)element = static_cast<unsigned int>(r);
- break;
- case FORMAT_R3G3B2:
- *(unsigned char*)element = (unorm<3>(r) << 5) | (unorm<3>(g) << 2) | (unorm<2>(b) << 0);
- break;
- case FORMAT_A8R3G3B2:
- *(unsigned short*)element = (unorm<8>(a) << 8) | (unorm<3>(r) << 5) | (unorm<3>(g) << 2) | (unorm<2>(b) << 0);
- break;
- case FORMAT_X4R4G4B4:
- *(unsigned short*)element = 0xF000 | (unorm<4>(r) << 8) | (unorm<4>(g) << 4) | (unorm<4>(b) << 0);
- break;
- case FORMAT_A4R4G4B4:
- *(unsigned short*)element = (unorm<4>(a) << 12) | (unorm<4>(r) << 8) | (unorm<4>(g) << 4) | (unorm<4>(b) << 0);
- break;
- case FORMAT_R4G4B4A4:
- *(unsigned short*)element = (unorm<4>(r) << 12) | (unorm<4>(g) << 8) | (unorm<4>(b) << 4) | (unorm<4>(a) << 0);
- break;
- case FORMAT_R5G6B5:
- *(unsigned short*)element = (unorm<5>(r) << 11) | (unorm<6>(g) << 5) | (unorm<5>(b) << 0);
- break;
- case FORMAT_A1R5G5B5:
- *(unsigned short*)element = (unorm<1>(a) << 15) | (unorm<5>(r) << 10) | (unorm<5>(g) << 5) | (unorm<5>(b) << 0);
- break;
- case FORMAT_R5G5B5A1:
- *(unsigned short*)element = (unorm<5>(r) << 11) | (unorm<5>(g) << 6) | (unorm<5>(b) << 1) | (unorm<5>(a) << 0);
- break;
- case FORMAT_X1R5G5B5:
- *(unsigned short*)element = 0x8000 | (unorm<5>(r) << 10) | (unorm<5>(g) << 5) | (unorm<5>(b) << 0);
- break;
- case FORMAT_A8R8G8B8:
- *(unsigned int*)element = (unorm<8>(a) << 24) | (unorm<8>(r) << 16) | (unorm<8>(g) << 8) | (unorm<8>(b) << 0);
- break;
- case FORMAT_X8R8G8B8:
- *(unsigned int*)element = 0xFF000000 | (unorm<8>(r) << 16) | (unorm<8>(g) << 8) | (unorm<8>(b) << 0);
- break;
- case FORMAT_A8B8G8R8_SNORM:
- *(unsigned int*)element = (static_cast<unsigned int>(snorm<8>(a)) << 24) |
- (static_cast<unsigned int>(snorm<8>(b)) << 16) |
- (static_cast<unsigned int>(snorm<8>(g)) << 8) |
- (static_cast<unsigned int>(snorm<8>(r)) << 0);
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_A8:
- *(unsigned int*)element = (unorm<8>(a) << 24) | (unorm<8>(b) << 16) | (unorm<8>(g) << 8) | (unorm<8>(r) << 0);
- break;
- case FORMAT_A8B8G8R8I:
- *(unsigned int*)element = (static_cast<unsigned int>(scast<8>(a)) << 24) |
- (static_cast<unsigned int>(scast<8>(b)) << 16) |
- (static_cast<unsigned int>(scast<8>(g)) << 8) |
- (static_cast<unsigned int>(scast<8>(r)) << 0);
- break;
- case FORMAT_A8B8G8R8UI:
- *(unsigned int*)element = (ucast<8>(a) << 24) | (ucast<8>(b) << 16) | (ucast<8>(g) << 8) | (ucast<8>(r) << 0);
- break;
- case FORMAT_X8B8G8R8_SNORM:
- *(unsigned int*)element = 0x7F000000 |
- (static_cast<unsigned int>(snorm<8>(b)) << 16) |
- (static_cast<unsigned int>(snorm<8>(g)) << 8) |
- (static_cast<unsigned int>(snorm<8>(r)) << 0);
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- *(unsigned int*)element = 0xFF000000 | (unorm<8>(b) << 16) | (unorm<8>(g) << 8) | (unorm<8>(r) << 0);
- break;
- case FORMAT_X8B8G8R8I:
- *(unsigned int*)element = 0x7F000000 |
- (static_cast<unsigned int>(scast<8>(b)) << 16) |
- (static_cast<unsigned int>(scast<8>(g)) << 8) |
- (static_cast<unsigned int>(scast<8>(r)) << 0);
- case FORMAT_X8B8G8R8UI:
- *(unsigned int*)element = 0xFF000000 | (ucast<8>(b) << 16) | (ucast<8>(g) << 8) | (ucast<8>(r) << 0);
- break;
- case FORMAT_A2R10G10B10:
- *(unsigned int*)element = (unorm<2>(a) << 30) | (unorm<10>(r) << 20) | (unorm<10>(g) << 10) | (unorm<10>(b) << 0);
- break;
- case FORMAT_A2B10G10R10:
- case FORMAT_A2B10G10R10UI:
- *(unsigned int*)element = (unorm<2>(a) << 30) | (unorm<10>(b) << 20) | (unorm<10>(g) << 10) | (unorm<10>(r) << 0);
- break;
- case FORMAT_G8R8_SNORM:
- *(unsigned short*)element = (static_cast<unsigned short>(snorm<8>(g)) << 8) |
- (static_cast<unsigned short>(snorm<8>(r)) << 0);
- break;
- case FORMAT_G8R8:
- *(unsigned short*)element = (unorm<8>(g) << 8) | (unorm<8>(r) << 0);
- break;
- case FORMAT_G8R8I:
- *(unsigned short*)element = (static_cast<unsigned short>(scast<8>(g)) << 8) |
- (static_cast<unsigned short>(scast<8>(r)) << 0);
- break;
- case FORMAT_G8R8UI:
- *(unsigned short*)element = (ucast<8>(g) << 8) | (ucast<8>(r) << 0);
- break;
- case FORMAT_G16R16:
- *(unsigned int*)element = (unorm<16>(g) << 16) | (unorm<16>(r) << 0);
- break;
- case FORMAT_G16R16I:
- *(unsigned int*)element = (static_cast<unsigned int>(scast<16>(g)) << 16) |
- (static_cast<unsigned int>(scast<16>(r)) << 0);
- break;
- case FORMAT_G16R16UI:
- *(unsigned int*)element = (ucast<16>(g) << 16) | (ucast<16>(r) << 0);
- break;
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- ((unsigned int*)element)[0] = static_cast<unsigned int>(r);
- ((unsigned int*)element)[1] = static_cast<unsigned int>(g);
- break;
- case FORMAT_A16B16G16R16:
- ((unsigned short*)element)[0] = unorm<16>(r);
- ((unsigned short*)element)[1] = unorm<16>(g);
- ((unsigned short*)element)[2] = unorm<16>(b);
- ((unsigned short*)element)[3] = unorm<16>(a);
- break;
- case FORMAT_A16B16G16R16I:
- ((unsigned short*)element)[0] = static_cast<unsigned short>(scast<16>(r));
- ((unsigned short*)element)[1] = static_cast<unsigned short>(scast<16>(g));
- ((unsigned short*)element)[2] = static_cast<unsigned short>(scast<16>(b));
- ((unsigned short*)element)[3] = static_cast<unsigned short>(scast<16>(a));
- break;
- case FORMAT_A16B16G16R16UI:
- ((unsigned short*)element)[0] = static_cast<unsigned short>(ucast<16>(r));
- ((unsigned short*)element)[1] = static_cast<unsigned short>(ucast<16>(g));
- ((unsigned short*)element)[2] = static_cast<unsigned short>(ucast<16>(b));
- ((unsigned short*)element)[3] = static_cast<unsigned short>(ucast<16>(a));
- break;
- case FORMAT_X16B16G16R16I:
- ((unsigned short*)element)[0] = static_cast<unsigned short>(scast<16>(r));
- ((unsigned short*)element)[1] = static_cast<unsigned short>(scast<16>(g));
- ((unsigned short*)element)[2] = static_cast<unsigned short>(scast<16>(b));
- break;
- case FORMAT_X16B16G16R16UI:
- ((unsigned short*)element)[0] = static_cast<unsigned short>(ucast<16>(r));
- ((unsigned short*)element)[1] = static_cast<unsigned short>(ucast<16>(g));
- ((unsigned short*)element)[2] = static_cast<unsigned short>(ucast<16>(b));
- break;
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- ((unsigned int*)element)[0] = static_cast<unsigned int>(r);
- ((unsigned int*)element)[1] = static_cast<unsigned int>(g);
- ((unsigned int*)element)[2] = static_cast<unsigned int>(b);
- ((unsigned int*)element)[3] = static_cast<unsigned int>(a);
- break;
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- ((unsigned int*)element)[0] = static_cast<unsigned int>(r);
- ((unsigned int*)element)[1] = static_cast<unsigned int>(g);
- ((unsigned int*)element)[2] = static_cast<unsigned int>(b);
- break;
- case FORMAT_V8U8:
- *(unsigned short*)element = (snorm<8>(g) << 8) | (snorm<8>(r) << 0);
- break;
- case FORMAT_L6V5U5:
- *(unsigned short*)element = (unorm<6>(b) << 10) | (snorm<5>(g) << 5) | (snorm<5>(r) << 0);
- break;
- case FORMAT_Q8W8V8U8:
- *(unsigned int*)element = (snorm<8>(a) << 24) | (snorm<8>(b) << 16) | (snorm<8>(g) << 8) | (snorm<8>(r) << 0);
- break;
- case FORMAT_X8L8V8U8:
- *(unsigned int*)element = 0xFF000000 | (unorm<8>(b) << 16) | (snorm<8>(g) << 8) | (snorm<8>(r) << 0);
- break;
- case FORMAT_V16U16:
- *(unsigned int*)element = (snorm<16>(g) << 16) | (snorm<16>(r) << 0);
- break;
- case FORMAT_A2W10V10U10:
- *(unsigned int*)element = (unorm<2>(a) << 30) | (snorm<10>(b) << 20) | (snorm<10>(g) << 10) | (snorm<10>(r) << 0);
- break;
- case FORMAT_A16W16V16U16:
- ((unsigned short*)element)[0] = snorm<16>(r);
- ((unsigned short*)element)[1] = snorm<16>(g);
- ((unsigned short*)element)[2] = snorm<16>(b);
- ((unsigned short*)element)[3] = unorm<16>(a);
- break;
- case FORMAT_Q16W16V16U16:
- ((unsigned short*)element)[0] = snorm<16>(r);
- ((unsigned short*)element)[1] = snorm<16>(g);
- ((unsigned short*)element)[2] = snorm<16>(b);
- ((unsigned short*)element)[3] = snorm<16>(a);
- break;
- case FORMAT_R8G8B8:
- ((unsigned char*)element)[0] = unorm<8>(b);
- ((unsigned char*)element)[1] = unorm<8>(g);
- ((unsigned char*)element)[2] = unorm<8>(r);
- break;
- case FORMAT_B8G8R8:
- ((unsigned char*)element)[0] = unorm<8>(r);
- ((unsigned char*)element)[1] = unorm<8>(g);
- ((unsigned char*)element)[2] = unorm<8>(b);
- break;
- case FORMAT_R16F:
- *(half*)element = (half)r;
- break;
- case FORMAT_A16F:
- *(half*)element = (half)a;
- break;
- case FORMAT_G16R16F:
- ((half*)element)[0] = (half)r;
- ((half*)element)[1] = (half)g;
- break;
- case FORMAT_X16B16G16R16F_UNSIGNED:
- r = max(r, 0.0f); g = max(g, 0.0f); b = max(b, 0.0f);
- // Fall through to FORMAT_X16B16G16R16F.
- case FORMAT_X16B16G16R16F:
- ((half*)element)[3] = 1.0f;
- // Fall through to FORMAT_B16G16R16F.
- case FORMAT_B16G16R16F:
- ((half*)element)[0] = (half)r;
- ((half*)element)[1] = (half)g;
- ((half*)element)[2] = (half)b;
- break;
- case FORMAT_A16B16G16R16F:
- ((half*)element)[0] = (half)r;
- ((half*)element)[1] = (half)g;
- ((half*)element)[2] = (half)b;
- ((half*)element)[3] = (half)a;
- break;
- case FORMAT_A32F:
- *(float*)element = a;
- break;
- case FORMAT_R32F:
- *(float*)element = r;
- break;
- case FORMAT_G32R32F:
- ((float*)element)[0] = r;
- ((float*)element)[1] = g;
- break;
- case FORMAT_X32B32G32R32F_UNSIGNED:
- r = max(r, 0.0f); g = max(g, 0.0f); b = max(b, 0.0f);
- // Fall through to FORMAT_X32B32G32R32F.
- case FORMAT_X32B32G32R32F:
- ((float*)element)[3] = 1.0f;
- // Fall through to FORMAT_B32G32R32F.
- case FORMAT_B32G32R32F:
- ((float*)element)[0] = r;
- ((float*)element)[1] = g;
- ((float*)element)[2] = b;
- break;
- case FORMAT_A32B32G32R32F:
- ((float*)element)[0] = r;
- ((float*)element)[1] = g;
- ((float*)element)[2] = b;
- ((float*)element)[3] = a;
- break;
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- *((float*)element) = r;
- break;
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- *((float*)element) = 1 - r;
- break;
- case FORMAT_S8:
- *((unsigned char*)element) = unorm<8>(r);
- break;
- case FORMAT_L8:
- *(unsigned char*)element = unorm<8>(r);
- break;
- case FORMAT_A4L4:
- *(unsigned char*)element = (unorm<4>(a) << 4) | (unorm<4>(r) << 0);
- break;
- case FORMAT_L16:
- *(unsigned short*)element = unorm<16>(r);
- break;
- case FORMAT_A8L8:
- *(unsigned short*)element = (unorm<8>(a) << 8) | (unorm<8>(r) << 0);
- break;
- case FORMAT_L16F:
- *(half*)element = (half)r;
- break;
- case FORMAT_A16L16F:
- ((half*)element)[0] = (half)r;
- ((half*)element)[1] = (half)a;
- break;
- case FORMAT_L32F:
- *(float*)element = r;
- break;
- case FORMAT_A32L32F:
- ((float*)element)[0] = r;
- ((float*)element)[1] = a;
- break;
- default:
- ASSERT(false);
- }
- }
-
- Color<float> Surface::Buffer::read(int x, int y, int z) const
- {
- ASSERT((x >= -border) && (x < (width + border)));
- ASSERT((y >= -border) && (y < (height + border)));
- ASSERT((z >= 0) && (z < depth));
-
- void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB + z * samples * sliceB;
-
- return read(element);
- }
-
- Color<float> Surface::Buffer::read(int x, int y) const
- {
- ASSERT((x >= -border) && (x < (width + border)));
- ASSERT((y >= -border) && (y < (height + border)));
-
- void *element = (unsigned char*)buffer + (x + border) * bytes + (y + border) * pitchB;
-
- return read(element);
- }
-
- inline Color<float> Surface::Buffer::read(void *element) const
- {
- float r = 0.0f;
- float g = 0.0f;
- float b = 0.0f;
- float a = 1.0f;
-
- switch(format)
- {
- case FORMAT_P8:
- {
- ASSERT(palette);
-
- unsigned int abgr = palette[*(unsigned char*)element];
-
- r = (abgr & 0x000000FF) * (1.0f / 0x000000FF);
- g = (abgr & 0x0000FF00) * (1.0f / 0x0000FF00);
- b = (abgr & 0x00FF0000) * (1.0f / 0x00FF0000);
- a = (abgr & 0xFF000000) * (1.0f / 0xFF000000);
- }
- break;
- case FORMAT_A8P8:
- {
- ASSERT(palette);
-
- unsigned int bgr = palette[((unsigned char*)element)[0]];
-
- r = (bgr & 0x000000FF) * (1.0f / 0x000000FF);
- g = (bgr & 0x0000FF00) * (1.0f / 0x0000FF00);
- b = (bgr & 0x00FF0000) * (1.0f / 0x00FF0000);
- a = ((unsigned char*)element)[1] * (1.0f / 0xFF);
- }
- break;
- case FORMAT_A8:
- r = 0;
- g = 0;
- b = 0;
- a = *(unsigned char*)element * (1.0f / 0xFF);
- break;
- case FORMAT_R8_SNORM:
- r = max((*(signed char*)element) * (1.0f / 0x7F), -1.0f);
- break;
- case FORMAT_R8:
- r = *(unsigned char*)element * (1.0f / 0xFF);
- break;
- case FORMAT_R8I:
- r = *(signed char*)element;
- break;
- case FORMAT_R8UI:
- r = *(unsigned char*)element;
- break;
- case FORMAT_R3G3B2:
- {
- unsigned char rgb = *(unsigned char*)element;
-
- r = (rgb & 0xE0) * (1.0f / 0xE0);
- g = (rgb & 0x1C) * (1.0f / 0x1C);
- b = (rgb & 0x03) * (1.0f / 0x03);
- }
- break;
- case FORMAT_A8R3G3B2:
- {
- unsigned short argb = *(unsigned short*)element;
-
- a = (argb & 0xFF00) * (1.0f / 0xFF00);
- r = (argb & 0x00E0) * (1.0f / 0x00E0);
- g = (argb & 0x001C) * (1.0f / 0x001C);
- b = (argb & 0x0003) * (1.0f / 0x0003);
- }
- break;
- case FORMAT_X4R4G4B4:
- {
- unsigned short rgb = *(unsigned short*)element;
-
- r = (rgb & 0x0F00) * (1.0f / 0x0F00);
- g = (rgb & 0x00F0) * (1.0f / 0x00F0);
- b = (rgb & 0x000F) * (1.0f / 0x000F);
- }
- break;
- case FORMAT_A4R4G4B4:
- {
- unsigned short argb = *(unsigned short*)element;
-
- a = (argb & 0xF000) * (1.0f / 0xF000);
- r = (argb & 0x0F00) * (1.0f / 0x0F00);
- g = (argb & 0x00F0) * (1.0f / 0x00F0);
- b = (argb & 0x000F) * (1.0f / 0x000F);
- }
- break;
- case FORMAT_R4G4B4A4:
- {
- unsigned short rgba = *(unsigned short*)element;
-
- r = (rgba & 0xF000) * (1.0f / 0xF000);
- g = (rgba & 0x0F00) * (1.0f / 0x0F00);
- b = (rgba & 0x00F0) * (1.0f / 0x00F0);
- a = (rgba & 0x000F) * (1.0f / 0x000F);
- }
- break;
- case FORMAT_R5G6B5:
- {
- unsigned short rgb = *(unsigned short*)element;
-
- r = (rgb & 0xF800) * (1.0f / 0xF800);
- g = (rgb & 0x07E0) * (1.0f / 0x07E0);
- b = (rgb & 0x001F) * (1.0f / 0x001F);
- }
- break;
- case FORMAT_A1R5G5B5:
- {
- unsigned short argb = *(unsigned short*)element;
-
- a = (argb & 0x8000) * (1.0f / 0x8000);
- r = (argb & 0x7C00) * (1.0f / 0x7C00);
- g = (argb & 0x03E0) * (1.0f / 0x03E0);
- b = (argb & 0x001F) * (1.0f / 0x001F);
- }
- break;
- case FORMAT_R5G5B5A1:
- {
- unsigned short rgba = *(unsigned short*)element;
-
- r = (rgba & 0xF800) * (1.0f / 0xF800);
- g = (rgba & 0x07C0) * (1.0f / 0x07C0);
- b = (rgba & 0x003E) * (1.0f / 0x003E);
- a = (rgba & 0x0001) * (1.0f / 0x0001);
- }
- break;
- case FORMAT_X1R5G5B5:
- {
- unsigned short xrgb = *(unsigned short*)element;
-
- r = (xrgb & 0x7C00) * (1.0f / 0x7C00);
- g = (xrgb & 0x03E0) * (1.0f / 0x03E0);
- b = (xrgb & 0x001F) * (1.0f / 0x001F);
- }
- break;
- case FORMAT_A8R8G8B8:
- {
- unsigned int argb = *(unsigned int*)element;
-
- a = (argb & 0xFF000000) * (1.0f / 0xFF000000);
- r = (argb & 0x00FF0000) * (1.0f / 0x00FF0000);
- g = (argb & 0x0000FF00) * (1.0f / 0x0000FF00);
- b = (argb & 0x000000FF) * (1.0f / 0x000000FF);
- }
- break;
- case FORMAT_X8R8G8B8:
- {
- unsigned int xrgb = *(unsigned int*)element;
-
- r = (xrgb & 0x00FF0000) * (1.0f / 0x00FF0000);
- g = (xrgb & 0x0000FF00) * (1.0f / 0x0000FF00);
- b = (xrgb & 0x000000FF) * (1.0f / 0x000000FF);
- }
- break;
- case FORMAT_A8B8G8R8_SNORM:
- {
- signed char* abgr = (signed char*)element;
-
- r = max(abgr[0] * (1.0f / 0x7F), -1.0f);
- g = max(abgr[1] * (1.0f / 0x7F), -1.0f);
- b = max(abgr[2] * (1.0f / 0x7F), -1.0f);
- a = max(abgr[3] * (1.0f / 0x7F), -1.0f);
- }
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_A8:
- {
- unsigned int abgr = *(unsigned int*)element;
-
- a = (abgr & 0xFF000000) * (1.0f / 0xFF000000);
- b = (abgr & 0x00FF0000) * (1.0f / 0x00FF0000);
- g = (abgr & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (abgr & 0x000000FF) * (1.0f / 0x000000FF);
- }
- break;
- case FORMAT_A8B8G8R8I:
- {
- signed char* abgr = (signed char*)element;
-
- r = abgr[0];
- g = abgr[1];
- b = abgr[2];
- a = abgr[3];
- }
- break;
- case FORMAT_A8B8G8R8UI:
- {
- unsigned char* abgr = (unsigned char*)element;
-
- r = abgr[0];
- g = abgr[1];
- b = abgr[2];
- a = abgr[3];
- }
- break;
- case FORMAT_X8B8G8R8_SNORM:
- {
- signed char* bgr = (signed char*)element;
-
- r = max(bgr[0] * (1.0f / 0x7F), -1.0f);
- g = max(bgr[1] * (1.0f / 0x7F), -1.0f);
- b = max(bgr[2] * (1.0f / 0x7F), -1.0f);
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- {
- unsigned int xbgr = *(unsigned int*)element;
-
- b = (xbgr & 0x00FF0000) * (1.0f / 0x00FF0000);
- g = (xbgr & 0x0000FF00) * (1.0f / 0x0000FF00);
- r = (xbgr & 0x000000FF) * (1.0f / 0x000000FF);
- }
- break;
- case FORMAT_X8B8G8R8I:
- {
- signed char* bgr = (signed char*)element;
-
- r = bgr[0];
- g = bgr[1];
- b = bgr[2];
- }
- break;
- case FORMAT_X8B8G8R8UI:
- {
- unsigned char* bgr = (unsigned char*)element;
-
- r = bgr[0];
- g = bgr[1];
- b = bgr[2];
- }
- break;
- case FORMAT_G8R8_SNORM:
- {
- signed char* gr = (signed char*)element;
-
- r = (gr[0] & 0xFF00) * (1.0f / 0xFF00);
- g = (gr[1] & 0x00FF) * (1.0f / 0x00FF);
- }
- break;
- case FORMAT_G8R8:
- {
- unsigned short gr = *(unsigned short*)element;
-
- g = (gr & 0xFF00) * (1.0f / 0xFF00);
- r = (gr & 0x00FF) * (1.0f / 0x00FF);
- }
- break;
- case FORMAT_G8R8I:
- {
- signed char* gr = (signed char*)element;
-
- r = gr[0];
- g = gr[1];
- }
- break;
- case FORMAT_G8R8UI:
- {
- unsigned char* gr = (unsigned char*)element;
-
- r = gr[0];
- g = gr[1];
- }
- break;
- case FORMAT_R16I:
- r = *((short*)element);
- break;
- case FORMAT_R16UI:
- r = *((unsigned short*)element);
- break;
- case FORMAT_G16R16I:
- {
- short* gr = (short*)element;
-
- r = gr[0];
- g = gr[1];
- }
- break;
- case FORMAT_G16R16:
- {
- unsigned int gr = *(unsigned int*)element;
-
- g = (gr & 0xFFFF0000) * (1.0f / 0xFFFF0000);
- r = (gr & 0x0000FFFF) * (1.0f / 0x0000FFFF);
- }
- break;
- case FORMAT_G16R16UI:
- {
- unsigned short* gr = (unsigned short*)element;
-
- r = gr[0];
- g = gr[1];
- }
- break;
- case FORMAT_A2R10G10B10:
- {
- unsigned int argb = *(unsigned int*)element;
-
- a = (argb & 0xC0000000) * (1.0f / 0xC0000000);
- r = (argb & 0x3FF00000) * (1.0f / 0x3FF00000);
- g = (argb & 0x000FFC00) * (1.0f / 0x000FFC00);
- b = (argb & 0x000003FF) * (1.0f / 0x000003FF);
- }
- break;
- case FORMAT_A2B10G10R10:
- {
- unsigned int abgr = *(unsigned int*)element;
-
- a = (abgr & 0xC0000000) * (1.0f / 0xC0000000);
- b = (abgr & 0x3FF00000) * (1.0f / 0x3FF00000);
- g = (abgr & 0x000FFC00) * (1.0f / 0x000FFC00);
- r = (abgr & 0x000003FF) * (1.0f / 0x000003FF);
- }
- break;
- case FORMAT_A2B10G10R10UI:
- {
- unsigned int abgr = *(unsigned int*)element;
-
- a = static_cast<float>((abgr & 0xC0000000) >> 30);
- b = static_cast<float>((abgr & 0x3FF00000) >> 20);
- g = static_cast<float>((abgr & 0x000FFC00) >> 10);
- r = static_cast<float>(abgr & 0x000003FF);
- }
- break;
- case FORMAT_A16B16G16R16I:
- {
- short* abgr = (short*)element;
-
- r = abgr[0];
- g = abgr[1];
- b = abgr[2];
- a = abgr[3];
- }
- break;
- case FORMAT_A16B16G16R16:
- r = ((unsigned short*)element)[0] * (1.0f / 0xFFFF);
- g = ((unsigned short*)element)[1] * (1.0f / 0xFFFF);
- b = ((unsigned short*)element)[2] * (1.0f / 0xFFFF);
- a = ((unsigned short*)element)[3] * (1.0f / 0xFFFF);
- break;
- case FORMAT_A16B16G16R16UI:
- {
- unsigned short* abgr = (unsigned short*)element;
-
- r = abgr[0];
- g = abgr[1];
- b = abgr[2];
- a = abgr[3];
- }
- break;
- case FORMAT_X16B16G16R16I:
- {
- short* bgr = (short*)element;
-
- r = bgr[0];
- g = bgr[1];
- b = bgr[2];
- }
- break;
- case FORMAT_X16B16G16R16UI:
- {
- unsigned short* bgr = (unsigned short*)element;
-
- r = bgr[0];
- g = bgr[1];
- b = bgr[2];
- }
- break;
- case FORMAT_A32B32G32R32I:
- {
- int* abgr = (int*)element;
-
- r = static_cast<float>(abgr[0]);
- g = static_cast<float>(abgr[1]);
- b = static_cast<float>(abgr[2]);
- a = static_cast<float>(abgr[3]);
- }
- break;
- case FORMAT_A32B32G32R32UI:
- {
- unsigned int* abgr = (unsigned int*)element;
-
- r = static_cast<float>(abgr[0]);
- g = static_cast<float>(abgr[1]);
- b = static_cast<float>(abgr[2]);
- a = static_cast<float>(abgr[3]);
- }
- break;
- case FORMAT_X32B32G32R32I:
- {
- int* bgr = (int*)element;
-
- r = static_cast<float>(bgr[0]);
- g = static_cast<float>(bgr[1]);
- b = static_cast<float>(bgr[2]);
- }
- break;
- case FORMAT_X32B32G32R32UI:
- {
- unsigned int* bgr = (unsigned int*)element;
-
- r = static_cast<float>(bgr[0]);
- g = static_cast<float>(bgr[1]);
- b = static_cast<float>(bgr[2]);
- }
- break;
- case FORMAT_G32R32I:
- {
- int* gr = (int*)element;
-
- r = static_cast<float>(gr[0]);
- g = static_cast<float>(gr[1]);
- }
- break;
- case FORMAT_G32R32UI:
- {
- unsigned int* gr = (unsigned int*)element;
-
- r = static_cast<float>(gr[0]);
- g = static_cast<float>(gr[1]);
- }
- break;
- case FORMAT_R32I:
- r = static_cast<float>(*((int*)element));
- break;
- case FORMAT_R32UI:
- r = static_cast<float>(*((unsigned int*)element));
- break;
- case FORMAT_V8U8:
- {
- unsigned short vu = *(unsigned short*)element;
-
- r = ((int)(vu & 0x00FF) << 24) * (1.0f / 0x7F000000);
- g = ((int)(vu & 0xFF00) << 16) * (1.0f / 0x7F000000);
- }
- break;
- case FORMAT_L6V5U5:
- {
- unsigned short lvu = *(unsigned short*)element;
-
- r = ((int)(lvu & 0x001F) << 27) * (1.0f / 0x78000000);
- g = ((int)(lvu & 0x03E0) << 22) * (1.0f / 0x78000000);
- b = (lvu & 0xFC00) * (1.0f / 0xFC00);
- }
- break;
- case FORMAT_Q8W8V8U8:
- {
- unsigned int qwvu = *(unsigned int*)element;
-
- r = ((int)(qwvu & 0x000000FF) << 24) * (1.0f / 0x7F000000);
- g = ((int)(qwvu & 0x0000FF00) << 16) * (1.0f / 0x7F000000);
- b = ((int)(qwvu & 0x00FF0000) << 8) * (1.0f / 0x7F000000);
- a = ((int)(qwvu & 0xFF000000) << 0) * (1.0f / 0x7F000000);
- }
- break;
- case FORMAT_X8L8V8U8:
- {
- unsigned int xlvu = *(unsigned int*)element;
-
- r = ((int)(xlvu & 0x000000FF) << 24) * (1.0f / 0x7F000000);
- g = ((int)(xlvu & 0x0000FF00) << 16) * (1.0f / 0x7F000000);
- b = (xlvu & 0x00FF0000) * (1.0f / 0x00FF0000);
- }
- break;
- case FORMAT_R8G8B8:
- r = ((unsigned char*)element)[2] * (1.0f / 0xFF);
- g = ((unsigned char*)element)[1] * (1.0f / 0xFF);
- b = ((unsigned char*)element)[0] * (1.0f / 0xFF);
- break;
- case FORMAT_B8G8R8:
- r = ((unsigned char*)element)[0] * (1.0f / 0xFF);
- g = ((unsigned char*)element)[1] * (1.0f / 0xFF);
- b = ((unsigned char*)element)[2] * (1.0f / 0xFF);
- break;
- case FORMAT_V16U16:
- {
- unsigned int vu = *(unsigned int*)element;
-
- r = ((int)(vu & 0x0000FFFF) << 16) * (1.0f / 0x7FFF0000);
- g = ((int)(vu & 0xFFFF0000) << 0) * (1.0f / 0x7FFF0000);
- }
- break;
- case FORMAT_A2W10V10U10:
- {
- unsigned int awvu = *(unsigned int*)element;
-
- r = ((int)(awvu & 0x000003FF) << 22) * (1.0f / 0x7FC00000);
- g = ((int)(awvu & 0x000FFC00) << 12) * (1.0f / 0x7FC00000);
- b = ((int)(awvu & 0x3FF00000) << 2) * (1.0f / 0x7FC00000);
- a = (awvu & 0xC0000000) * (1.0f / 0xC0000000);
- }
- break;
- case FORMAT_A16W16V16U16:
- r = ((signed short*)element)[0] * (1.0f / 0x7FFF);
- g = ((signed short*)element)[1] * (1.0f / 0x7FFF);
- b = ((signed short*)element)[2] * (1.0f / 0x7FFF);
- a = ((unsigned short*)element)[3] * (1.0f / 0xFFFF);
- break;
- case FORMAT_Q16W16V16U16:
- r = ((signed short*)element)[0] * (1.0f / 0x7FFF);
- g = ((signed short*)element)[1] * (1.0f / 0x7FFF);
- b = ((signed short*)element)[2] * (1.0f / 0x7FFF);
- a = ((signed short*)element)[3] * (1.0f / 0x7FFF);
- break;
- case FORMAT_L8:
- r =
- g =
- b = *(unsigned char*)element * (1.0f / 0xFF);
- break;
- case FORMAT_A4L4:
- {
- unsigned char al = *(unsigned char*)element;
-
- r =
- g =
- b = (al & 0x0F) * (1.0f / 0x0F);
- a = (al & 0xF0) * (1.0f / 0xF0);
- }
- break;
- case FORMAT_L16:
- r =
- g =
- b = *(unsigned short*)element * (1.0f / 0xFFFF);
- break;
- case FORMAT_A8L8:
- r =
- g =
- b = ((unsigned char*)element)[0] * (1.0f / 0xFF);
- a = ((unsigned char*)element)[1] * (1.0f / 0xFF);
- break;
- case FORMAT_L16F:
- r =
- g =
- b = *(half*)element;
- break;
- case FORMAT_A16L16F:
- r =
- g =
- b = ((half*)element)[0];
- a = ((half*)element)[1];
- break;
- case FORMAT_L32F:
- r =
- g =
- b = *(float*)element;
- break;
- case FORMAT_A32L32F:
- r =
- g =
- b = ((float*)element)[0];
- a = ((float*)element)[1];
- break;
- case FORMAT_A16F:
- a = *(half*)element;
- break;
- case FORMAT_R16F:
- r = *(half*)element;
- break;
- case FORMAT_G16R16F:
- r = ((half*)element)[0];
- g = ((half*)element)[1];
- break;
- case FORMAT_X16B16G16R16F:
- case FORMAT_X16B16G16R16F_UNSIGNED:
- case FORMAT_B16G16R16F:
- r = ((half*)element)[0];
- g = ((half*)element)[1];
- b = ((half*)element)[2];
- break;
- case FORMAT_A16B16G16R16F:
- r = ((half*)element)[0];
- g = ((half*)element)[1];
- b = ((half*)element)[2];
- a = ((half*)element)[3];
- break;
- case FORMAT_A32F:
- a = *(float*)element;
- break;
- case FORMAT_R32F:
- r = *(float*)element;
- break;
- case FORMAT_G32R32F:
- r = ((float*)element)[0];
- g = ((float*)element)[1];
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_B32G32R32F:
- r = ((float*)element)[0];
- g = ((float*)element)[1];
- b = ((float*)element)[2];
- break;
- case FORMAT_A32B32G32R32F:
- r = ((float*)element)[0];
- g = ((float*)element)[1];
- b = ((float*)element)[2];
- a = ((float*)element)[3];
- break;
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- r = *(float*)element;
- g = r;
- b = r;
- a = r;
- break;
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- r = 1.0f - *(float*)element;
- g = r;
- b = r;
- a = r;
- break;
- case FORMAT_S8:
- r = *(unsigned char*)element * (1.0f / 0xFF);
- break;
- default:
- ASSERT(false);
- }
-
- if(isSRGBformat(format))
- {
- r = sRGBtoLinear(r);
- g = sRGBtoLinear(g);
- b = sRGBtoLinear(b);
- }
-
- return Color<float>(r, g, b, a);
- }
-
- Color<float> Surface::Buffer::sample(float x, float y, float z) const
- {
- x -= 0.5f;
- y -= 0.5f;
- z -= 0.5f;
-
- int x0 = clamp((int)x, 0, width - 1);
- int x1 = (x0 + 1 >= width) ? x0 : x0 + 1;
-
- int y0 = clamp((int)y, 0, height - 1);
- int y1 = (y0 + 1 >= height) ? y0 : y0 + 1;
-
- int z0 = clamp((int)z, 0, depth - 1);
- int z1 = (z0 + 1 >= depth) ? z0 : z0 + 1;
-
- Color<float> c000 = read(x0, y0, z0);
- Color<float> c100 = read(x1, y0, z0);
- Color<float> c010 = read(x0, y1, z0);
- Color<float> c110 = read(x1, y1, z0);
- Color<float> c001 = read(x0, y0, z1);
- Color<float> c101 = read(x1, y0, z1);
- Color<float> c011 = read(x0, y1, z1);
- Color<float> c111 = read(x1, y1, z1);
-
- float fx = x - x0;
- float fy = y - y0;
- float fz = z - z0;
-
- c000 *= (1 - fx) * (1 - fy) * (1 - fz);
- c100 *= fx * (1 - fy) * (1 - fz);
- c010 *= (1 - fx) * fy * (1 - fz);
- c110 *= fx * fy * (1 - fz);
- c001 *= (1 - fx) * (1 - fy) * fz;
- c101 *= fx * (1 - fy) * fz;
- c011 *= (1 - fx) * fy * fz;
- c111 *= fx * fy * fz;
-
- return c000 + c100 + c010 + c110 + c001 + c101 + c011 + c111;
- }
-
- Color<float> Surface::Buffer::sample(float x, float y, int layer) const
- {
- x -= 0.5f;
- y -= 0.5f;
-
- int x0 = clamp((int)x, 0, width - 1);
- int x1 = (x0 + 1 >= width) ? x0 : x0 + 1;
-
- int y0 = clamp((int)y, 0, height - 1);
- int y1 = (y0 + 1 >= height) ? y0 : y0 + 1;
-
- Color<float> c00 = read(x0, y0, layer);
- Color<float> c10 = read(x1, y0, layer);
- Color<float> c01 = read(x0, y1, layer);
- Color<float> c11 = read(x1, y1, layer);
-
- float fx = x - x0;
- float fy = y - y0;
-
- c00 *= (1 - fx) * (1 - fy);
- c10 *= fx * (1 - fy);
- c01 *= (1 - fx) * fy;
- c11 *= fx * fy;
-
- return c00 + c10 + c01 + c11;
- }
-
- void *Surface::Buffer::lockRect(int x, int y, int z, Lock lock)
- {
- this->lock = lock;
-
- switch(lock)
- {
- case LOCK_UNLOCKED:
- case LOCK_READONLY:
- case LOCK_UPDATE:
- break;
- case LOCK_WRITEONLY:
- case LOCK_READWRITE:
- case LOCK_DISCARD:
- dirty = true;
- break;
- default:
- ASSERT(false);
- }
-
- if(buffer)
- {
- x += border;
- y += border;
-
- switch(format)
- {
- case FORMAT_DXT1:
- case FORMAT_ATI1:
- case FORMAT_ETC1:
- case FORMAT_R11_EAC:
- case FORMAT_SIGNED_R11_EAC:
- case FORMAT_RGB8_ETC2:
- case FORMAT_SRGB8_ETC2:
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- return (unsigned char*)buffer + 8 * (x / 4) + (y / 4) * pitchB + z * sliceB;
- case FORMAT_RG11_EAC:
- case FORMAT_SIGNED_RG11_EAC:
- case FORMAT_RGBA8_ETC2_EAC:
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC:
- return (unsigned char*)buffer + 16 * (x / 4) + (y / 4) * pitchB + z * sliceB;
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- case FORMAT_ATI2:
- return (unsigned char*)buffer + 16 * (x / 4) + (y / 4) * pitchB + z * sliceB;
- default:
- return (unsigned char*)buffer + x * bytes + y * pitchB + z * samples * sliceB;
- }
- }
-
- return nullptr;
- }
-
- void Surface::Buffer::unlockRect()
- {
- lock = LOCK_UNLOCKED;
- }
-
- class SurfaceImplementation : public Surface
- {
- public:
- SurfaceImplementation(int width, int height, int depth, Format format, void *pixels, int pitch, int slice)
- : Surface(width, height, depth, format, pixels, pitch, slice) {}
- SurfaceImplementation(Resource *texture, int width, int height, int depth, int border, int samples, Format format, bool lockable, bool renderTarget, int pitchP = 0)
- : Surface(texture, width, height, depth, border, samples, format, lockable, renderTarget, pitchP) {}
- ~SurfaceImplementation() override {}
-
- void *lockInternal(int x, int y, int z, Lock lock, Accessor client) override
- {
- return Surface::lockInternal(x, y, z, lock, client);
- }
-
- void unlockInternal() override
- {
- Surface::unlockInternal();
- }
- };
-
- Surface *Surface::create(int width, int height, int depth, Format format, void *pixels, int pitch, int slice)
- {
- return new SurfaceImplementation(width, height, depth, format, pixels, pitch, slice);
- }
-
- Surface *Surface::create(Resource *texture, int width, int height, int depth, int border, int samples, Format format, bool lockable, bool renderTarget, int pitchPprovided)
- {
- return new SurfaceImplementation(texture, width, height, depth, border, samples, format, lockable, renderTarget, pitchPprovided);
- }
-
- Surface::Surface(int width, int height, int depth, Format format, void *pixels, int pitch, int slice) : lockable(true), renderTarget(false)
- {
- resource = new Resource(0);
- hasParent = false;
- ownExternal = false;
- depth = max(1, depth);
-
- external.buffer = pixels;
- external.width = width;
- external.height = height;
- external.depth = depth;
- external.samples = 1;
- external.format = format;
- external.bytes = bytes(external.format);
- external.pitchB = pitch;
- external.pitchP = external.bytes ? pitch / external.bytes : 0;
- external.sliceB = slice;
- external.sliceP = external.bytes ? slice / external.bytes : 0;
- external.border = 0;
- external.lock = LOCK_UNLOCKED;
- external.dirty = true;
-
- internal.buffer = nullptr;
- internal.width = width;
- internal.height = height;
- internal.depth = depth;
- internal.samples = 1;
- internal.format = selectInternalFormat(format);
- internal.bytes = bytes(internal.format);
- internal.pitchB = pitchB(internal.width, 0, internal.format, false);
- internal.pitchP = pitchP(internal.width, 0, internal.format, false);
- internal.sliceB = sliceB(internal.width, internal.height, 0, internal.format, false);
- internal.sliceP = sliceP(internal.width, internal.height, 0, internal.format, false);
- internal.border = 0;
- internal.lock = LOCK_UNLOCKED;
- internal.dirty = false;
-
- stencil.buffer = nullptr;
- stencil.width = width;
- stencil.height = height;
- stencil.depth = depth;
- stencil.samples = 1;
- stencil.format = isStencil(format) ? FORMAT_S8 : FORMAT_NULL;
- stencil.bytes = bytes(stencil.format);
- stencil.pitchB = pitchB(stencil.width, 0, stencil.format, false);
- stencil.pitchP = pitchP(stencil.width, 0, stencil.format, false);
- stencil.sliceB = sliceB(stencil.width, stencil.height, 0, stencil.format, false);
- stencil.sliceP = sliceP(stencil.width, stencil.height, 0, stencil.format, false);
- stencil.border = 0;
- stencil.lock = LOCK_UNLOCKED;
- stencil.dirty = false;
-
- dirtyContents = true;
- paletteUsed = 0;
- }
-
- Surface::Surface(Resource *texture, int width, int height, int depth, int border, int samples, Format format, bool lockable, bool renderTarget, int pitchPprovided) : lockable(lockable), renderTarget(renderTarget)
- {
- resource = texture ? texture : new Resource(0);
- hasParent = texture != nullptr;
- ownExternal = true;
- depth = max(1, depth);
- samples = max(1, samples);
-
- external.buffer = nullptr;
- external.width = width;
- external.height = height;
- external.depth = depth;
- external.samples = (short)samples;
- external.format = format;
- external.bytes = bytes(external.format);
- external.pitchB = !pitchPprovided ? pitchB(external.width, 0, external.format, renderTarget && !texture) : pitchPprovided * external.bytes;
- external.pitchP = !pitchPprovided ? pitchP(external.width, 0, external.format, renderTarget && !texture) : pitchPprovided;
- external.sliceB = sliceB(external.width, external.height, 0, external.format, renderTarget && !texture);
- external.sliceP = sliceP(external.width, external.height, 0, external.format, renderTarget && !texture);
- external.border = 0;
- external.lock = LOCK_UNLOCKED;
- external.dirty = false;
-
- internal.buffer = nullptr;
- internal.width = width;
- internal.height = height;
- internal.depth = depth;
- internal.samples = (short)samples;
- internal.format = selectInternalFormat(format);
- internal.bytes = bytes(internal.format);
- internal.pitchB = !pitchPprovided ? pitchB(internal.width, border, internal.format, renderTarget) : pitchPprovided * internal.bytes;
- internal.pitchP = !pitchPprovided ? pitchP(internal.width, border, internal.format, renderTarget) : pitchPprovided;
- internal.sliceB = sliceB(internal.width, internal.height, border, internal.format, renderTarget);
- internal.sliceP = sliceP(internal.width, internal.height, border, internal.format, renderTarget);
- internal.border = (short)border;
- internal.lock = LOCK_UNLOCKED;
- internal.dirty = false;
-
- stencil.buffer = nullptr;
- stencil.width = width;
- stencil.height = height;
- stencil.depth = depth;
- stencil.samples = (short)samples;
- stencil.format = isStencil(format) ? FORMAT_S8 : FORMAT_NULL;
- stencil.bytes = bytes(stencil.format);
- stencil.pitchB = pitchB(stencil.width, 0, stencil.format, renderTarget);
- stencil.pitchP = pitchP(stencil.width, 0, stencil.format, renderTarget);
- stencil.sliceB = sliceB(stencil.width, stencil.height, 0, stencil.format, renderTarget);
- stencil.sliceP = sliceP(stencil.width, stencil.height, 0, stencil.format, renderTarget);
- stencil.border = 0;
- stencil.lock = LOCK_UNLOCKED;
- stencil.dirty = false;
-
- dirtyContents = true;
- paletteUsed = 0;
- }
-
- Surface::~Surface()
- {
- // sync() must be called before this destructor to ensure all locks have been released.
- // We can't call it here because the parent resource may already have been destroyed.
- ASSERT(isUnlocked());
-
- if(!hasParent)
- {
- resource->destruct();
- }
-
- if(ownExternal)
- {
- deallocate(external.buffer);
- }
-
- if(internal.buffer != external.buffer)
- {
- deallocate(internal.buffer);
- }
-
- deallocate(stencil.buffer);
-
- external.buffer = nullptr;
- internal.buffer = nullptr;
- stencil.buffer = nullptr;
- }
-
- void *Surface::lockExternal(int x, int y, int z, Lock lock, Accessor client)
- {
- resource->lock(client);
-
- if(!external.buffer)
- {
- if(internal.buffer && identicalBuffers())
- {
- external.buffer = internal.buffer;
- }
- else
- {
- external.buffer = allocateBuffer(external.width, external.height, external.depth, external.border, external.samples, external.format);
- }
- }
-
- if(internal.dirty)
- {
- if(lock != LOCK_DISCARD)
- {
- update(external, internal);
- }
-
- internal.dirty = false;
- }
-
- switch(lock)
- {
- case LOCK_READONLY:
- break;
- case LOCK_WRITEONLY:
- case LOCK_READWRITE:
- case LOCK_DISCARD:
- dirtyContents = true;
- break;
- default:
- ASSERT(false);
- }
-
- return external.lockRect(x, y, z, lock);
- }
-
- void Surface::unlockExternal()
- {
- external.unlockRect();
-
- resource->unlock();
- }
-
- void *Surface::lockInternal(int x, int y, int z, Lock lock, Accessor client)
- {
- if(lock != LOCK_UNLOCKED)
- {
- resource->lock(client);
- }
-
- if(!internal.buffer)
- {
- if(external.buffer && identicalBuffers())
- {
- internal.buffer = external.buffer;
- }
- else
- {
- internal.buffer = allocateBuffer(internal.width, internal.height, internal.depth, internal.border, internal.samples, internal.format);
- }
- }
-
- // FIXME: WHQL requires conversion to lower external precision and back
- if(logPrecision >= WHQL)
- {
- if(internal.dirty && renderTarget && internal.format != external.format)
- {
- if(lock != LOCK_DISCARD)
- {
- switch(external.format)
- {
- case FORMAT_R3G3B2:
- case FORMAT_A8R3G3B2:
- case FORMAT_A1R5G5B5:
- case FORMAT_A2R10G10B10:
- case FORMAT_A2B10G10R10:
- lockExternal(0, 0, 0, LOCK_READWRITE, client);
- unlockExternal();
- break;
- default:
- // Difference passes WHQL
- break;
- }
- }
- }
- }
-
- if(external.dirty || (isPalette(external.format) && paletteUsed != Surface::paletteID))
- {
- if(lock != LOCK_DISCARD)
- {
- update(internal, external);
- }
-
- external.dirty = false;
- paletteUsed = Surface::paletteID;
- }
-
- switch(lock)
- {
- case LOCK_UNLOCKED:
- case LOCK_READONLY:
- break;
- case LOCK_WRITEONLY:
- case LOCK_READWRITE:
- case LOCK_DISCARD:
- dirtyContents = true;
- break;
- default:
- ASSERT(false);
- }
-
- if(lock == LOCK_READONLY && client == PUBLIC)
- {
- resolve();
- }
-
- return internal.lockRect(x, y, z, lock);
- }
-
- void Surface::unlockInternal()
- {
- internal.unlockRect();
-
- resource->unlock();
- }
-
- void *Surface::lockStencil(int x, int y, int front, Accessor client)
- {
- resource->lock(client);
-
- if(stencil.format == FORMAT_NULL)
- {
- return nullptr;
- }
-
- if(!stencil.buffer)
- {
- stencil.buffer = allocateBuffer(stencil.width, stencil.height, stencil.depth, stencil.border, stencil.samples, stencil.format);
- }
-
- return stencil.lockRect(x, y, front, LOCK_READWRITE); // FIXME
- }
-
- void Surface::unlockStencil()
- {
- stencil.unlockRect();
-
- resource->unlock();
- }
-
- int Surface::bytes(Format format)
- {
- switch(format)
- {
- case FORMAT_NULL: return 0;
- case FORMAT_P8: return 1;
- case FORMAT_A8P8: return 2;
- case FORMAT_A8: return 1;
- case FORMAT_R8I: return 1;
- case FORMAT_R8: return 1;
- case FORMAT_R3G3B2: return 1;
- case FORMAT_R16I: return 2;
- case FORMAT_R16UI: return 2;
- case FORMAT_A8R3G3B2: return 2;
- case FORMAT_R5G6B5: return 2;
- case FORMAT_A1R5G5B5: return 2;
- case FORMAT_X1R5G5B5: return 2;
- case FORMAT_R5G5B5A1: return 2;
- case FORMAT_X4R4G4B4: return 2;
- case FORMAT_A4R4G4B4: return 2;
- case FORMAT_R4G4B4A4: return 2;
- case FORMAT_R8G8B8: return 3;
- case FORMAT_B8G8R8: return 3;
- case FORMAT_R32I: return 4;
- case FORMAT_R32UI: return 4;
- case FORMAT_X8R8G8B8: return 4;
- // case FORMAT_X8G8R8B8Q: return 4;
- case FORMAT_A8R8G8B8: return 4;
- // case FORMAT_A8G8R8B8Q: return 4;
- case FORMAT_X8B8G8R8I: return 4;
- case FORMAT_X8B8G8R8: return 4;
- case FORMAT_SRGB8_X8: return 4;
- case FORMAT_SRGB8_A8: return 4;
- case FORMAT_A8B8G8R8I: return 4;
- case FORMAT_R8UI: return 1;
- case FORMAT_G8R8UI: return 2;
- case FORMAT_X8B8G8R8UI: return 4;
- case FORMAT_A8B8G8R8UI: return 4;
- case FORMAT_A8B8G8R8: return 4;
- case FORMAT_R8_SNORM: return 1;
- case FORMAT_G8R8_SNORM: return 2;
- case FORMAT_X8B8G8R8_SNORM: return 4;
- case FORMAT_A8B8G8R8_SNORM: return 4;
- case FORMAT_A2R10G10B10: return 4;
- case FORMAT_A2B10G10R10: return 4;
- case FORMAT_A2B10G10R10UI: return 4;
- case FORMAT_G8R8I: return 2;
- case FORMAT_G8R8: return 2;
- case FORMAT_G16R16I: return 4;
- case FORMAT_G16R16UI: return 4;
- case FORMAT_G16R16: return 4;
- case FORMAT_G32R32I: return 8;
- case FORMAT_G32R32UI: return 8;
- case FORMAT_X16B16G16R16I: return 8;
- case FORMAT_X16B16G16R16UI: return 8;
- case FORMAT_A16B16G16R16I: return 8;
- case FORMAT_A16B16G16R16UI: return 8;
- case FORMAT_A16B16G16R16: return 8;
- case FORMAT_X32B32G32R32I: return 16;
- case FORMAT_X32B32G32R32UI: return 16;
- case FORMAT_A32B32G32R32I: return 16;
- case FORMAT_A32B32G32R32UI: return 16;
- // Compressed formats
- case FORMAT_DXT1: return 2; // Column of four pixels
- case FORMAT_DXT3: return 4; // Column of four pixels
- case FORMAT_DXT5: return 4; // Column of four pixels
- case FORMAT_ATI1: return 2; // Column of four pixels
- case FORMAT_ATI2: return 4; // Column of four pixels
- case FORMAT_ETC1: return 2; // Column of four pixels
- case FORMAT_R11_EAC: return 2;
- case FORMAT_SIGNED_R11_EAC: return 2;
- case FORMAT_RG11_EAC: return 4;
- case FORMAT_SIGNED_RG11_EAC: return 4;
- case FORMAT_RGB8_ETC2: return 2;
- case FORMAT_SRGB8_ETC2: return 2;
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: return 2;
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: return 2;
- case FORMAT_RGBA8_ETC2_EAC: return 4;
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC: return 4;
- // Bumpmap formats
- case FORMAT_V8U8: return 2;
- case FORMAT_L6V5U5: return 2;
- case FORMAT_Q8W8V8U8: return 4;
- case FORMAT_X8L8V8U8: return 4;
- case FORMAT_A2W10V10U10: return 4;
- case FORMAT_V16U16: return 4;
- case FORMAT_A16W16V16U16: return 8;
- case FORMAT_Q16W16V16U16: return 8;
- // Luminance formats
- case FORMAT_L8: return 1;
- case FORMAT_A4L4: return 1;
- case FORMAT_L16: return 2;
- case FORMAT_A8L8: return 2;
- case FORMAT_L16F: return 2;
- case FORMAT_A16L16F: return 4;
- case FORMAT_L32F: return 4;
- case FORMAT_A32L32F: return 8;
- // Floating-point formats
- case FORMAT_A16F: return 2;
- case FORMAT_R16F: return 2;
- case FORMAT_G16R16F: return 4;
- case FORMAT_B16G16R16F: return 6;
- case FORMAT_X16B16G16R16F: return 8;
- case FORMAT_A16B16G16R16F: return 8;
- case FORMAT_X16B16G16R16F_UNSIGNED: return 8;
- case FORMAT_A32F: return 4;
- case FORMAT_R32F: return 4;
- case FORMAT_G32R32F: return 8;
- case FORMAT_B32G32R32F: return 12;
- case FORMAT_X32B32G32R32F: return 16;
- case FORMAT_A32B32G32R32F: return 16;
- case FORMAT_X32B32G32R32F_UNSIGNED: return 16;
- // Depth/stencil formats
- case FORMAT_D16: return 2;
- case FORMAT_D32: return 4;
- case FORMAT_D24X8: return 4;
- case FORMAT_D24S8: return 4;
- case FORMAT_D24FS8: return 4;
- case FORMAT_D32F: return 4;
- case FORMAT_D32FS8: return 4;
- case FORMAT_D32F_COMPLEMENTARY: return 4;
- case FORMAT_D32FS8_COMPLEMENTARY: return 4;
- case FORMAT_D32F_LOCKABLE: return 4;
- case FORMAT_D32FS8_TEXTURE: return 4;
- case FORMAT_D32F_SHADOW: return 4;
- case FORMAT_D32FS8_SHADOW: return 4;
- case FORMAT_DF24S8: return 4;
- case FORMAT_DF16S8: return 2;
- case FORMAT_INTZ: return 4;
- case FORMAT_S8: return 1;
- case FORMAT_YV12_BT601: return 1; // Y plane only
- case FORMAT_YV12_BT709: return 1; // Y plane only
- case FORMAT_YV12_JFIF: return 1; // Y plane only
- default:
- ASSERT(false);
- }
-
- return 0;
- }
-
- int Surface::pitchB(int width, int border, Format format, bool target)
- {
- width += 2 * border;
-
- // Render targets require 2x2 quads
- if(target || isDepth(format) || isStencil(format))
- {
- width = align<2>(width);
- }
-
- switch(format)
- {
- case FORMAT_DXT1:
- case FORMAT_ETC1:
- case FORMAT_R11_EAC:
- case FORMAT_SIGNED_R11_EAC:
- case FORMAT_RGB8_ETC2:
- case FORMAT_SRGB8_ETC2:
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- return 8 * ((width + 3) / 4); // 64 bit per 4x4 block, computed per 4 rows
- case FORMAT_RG11_EAC:
- case FORMAT_SIGNED_RG11_EAC:
- case FORMAT_RGBA8_ETC2_EAC:
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC:
- return 16 * ((width + 3) / 4); // 128 bit per 4x4 block, computed per 4 rows
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- return 16 * ((width + 3) / 4); // 128 bit per 4x4 block, computed per 4 rows
- case FORMAT_ATI1:
- return 2 * ((width + 3) / 4); // 64 bit per 4x4 block, computed per row
- case FORMAT_ATI2:
- return 4 * ((width + 3) / 4); // 128 bit per 4x4 block, computed per row
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return align<16>(width);
- default:
- return bytes(format) * width;
- }
- }
-
- int Surface::pitchP(int width, int border, Format format, bool target)
- {
- int B = bytes(format);
-
- return B > 0 ? pitchB(width, border, format, target) / B : 0;
- }
-
- int Surface::sliceB(int width, int height, int border, Format format, bool target)
- {
- height += 2 * border;
-
- // Render targets require 2x2 quads
- if(target || isDepth(format) || isStencil(format))
- {
- height = align<2>(height);
- }
-
- switch(format)
- {
- case FORMAT_DXT1:
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- case FORMAT_ETC1:
- case FORMAT_R11_EAC:
- case FORMAT_SIGNED_R11_EAC:
- case FORMAT_RG11_EAC:
- case FORMAT_SIGNED_RG11_EAC:
- case FORMAT_RGB8_ETC2:
- case FORMAT_SRGB8_ETC2:
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_RGBA8_ETC2_EAC:
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC:
- return pitchB(width, border, format, target) * ((height + 3) / 4); // Pitch computed per 4 rows
- case FORMAT_ATI1:
- case FORMAT_ATI2:
- return pitchB(width, border, format, target) * align<4>(height); // Pitch computed per row
- default:
- return pitchB(width, border, format, target) * height; // Pitch computed per row
- }
- }
-
- int Surface::sliceP(int width, int height, int border, Format format, bool target)
- {
- int B = bytes(format);
-
- return B > 0 ? sliceB(width, height, border, format, target) / B : 0;
- }
-
- void Surface::update(Buffer &destination, Buffer &source)
- {
- // ASSERT(source.lock != LOCK_UNLOCKED);
- // ASSERT(destination.lock != LOCK_UNLOCKED);
-
- if(destination.buffer != source.buffer)
- {
- ASSERT(source.dirty && !destination.dirty);
-
- switch(source.format)
- {
- case FORMAT_R8G8B8: decodeR8G8B8(destination, source); break; // FIXME: Check destination format
- case FORMAT_X1R5G5B5: decodeX1R5G5B5(destination, source); break; // FIXME: Check destination format
- case FORMAT_A1R5G5B5: decodeA1R5G5B5(destination, source); break; // FIXME: Check destination format
- case FORMAT_X4R4G4B4: decodeX4R4G4B4(destination, source); break; // FIXME: Check destination format
- case FORMAT_A4R4G4B4: decodeA4R4G4B4(destination, source); break; // FIXME: Check destination format
- case FORMAT_P8: decodeP8(destination, source); break; // FIXME: Check destination format
- case FORMAT_DXT1: decodeDXT1(destination, source); break; // FIXME: Check destination format
- case FORMAT_DXT3: decodeDXT3(destination, source); break; // FIXME: Check destination format
- case FORMAT_DXT5: decodeDXT5(destination, source); break; // FIXME: Check destination format
- case FORMAT_ATI1: decodeATI1(destination, source); break; // FIXME: Check destination format
- case FORMAT_ATI2: decodeATI2(destination, source); break; // FIXME: Check destination format
- case FORMAT_R11_EAC: decodeEAC(destination, source, 1, false); break; // FIXME: Check destination format
- case FORMAT_SIGNED_R11_EAC: decodeEAC(destination, source, 1, true); break; // FIXME: Check destination format
- case FORMAT_RG11_EAC: decodeEAC(destination, source, 2, false); break; // FIXME: Check destination format
- case FORMAT_SIGNED_RG11_EAC: decodeEAC(destination, source, 2, true); break; // FIXME: Check destination format
- case FORMAT_ETC1:
- case FORMAT_RGB8_ETC2: decodeETC2(destination, source, 0, false); break; // FIXME: Check destination format
- case FORMAT_SRGB8_ETC2: decodeETC2(destination, source, 0, true); break; // FIXME: Check destination format
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: decodeETC2(destination, source, 1, false); break; // FIXME: Check destination format
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: decodeETC2(destination, source, 1, true); break; // FIXME: Check destination format
- case FORMAT_RGBA8_ETC2_EAC: decodeETC2(destination, source, 8, false); break; // FIXME: Check destination format
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC: decodeETC2(destination, source, 8, true); break; // FIXME: Check destination format
- default: genericUpdate(destination, source); break;
- }
- }
- }
-
- void Surface::genericUpdate(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
- int rowBytes = width * source.bytes;
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- if(source.format == destination.format)
- {
- memcpy(destinationRow, sourceRow, rowBytes);
- }
- else
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- Color<float> color = source.read(sourceElement);
- destination.write(destinationElement, color);
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeR8G8B8(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int b = sourceElement[0];
- unsigned int g = sourceElement[1];
- unsigned int r = sourceElement[2];
-
- *(unsigned int*)destinationElement = 0xFF000000 | (r << 16) | (g << 8) | (b << 0);
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeX1R5G5B5(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int xrgb = *(unsigned short*)sourceElement;
-
- unsigned int r = (((xrgb & 0x7C00) * 134771 + 0x800000) >> 8) & 0x00FF0000;
- unsigned int g = (((xrgb & 0x03E0) * 16846 + 0x8000) >> 8) & 0x0000FF00;
- unsigned int b = (((xrgb & 0x001F) * 2106 + 0x80) >> 8);
-
- *(unsigned int*)destinationElement = 0xFF000000 | r | g | b;
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeA1R5G5B5(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int argb = *(unsigned short*)sourceElement;
-
- unsigned int a = (argb & 0x8000) * 130560;
- unsigned int r = (((argb & 0x7C00) * 134771 + 0x800000) >> 8) & 0x00FF0000;
- unsigned int g = (((argb & 0x03E0) * 16846 + 0x8000) >> 8) & 0x0000FF00;
- unsigned int b = (((argb & 0x001F) * 2106 + 0x80) >> 8);
-
- *(unsigned int*)destinationElement = a | r | g | b;
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeX4R4G4B4(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int xrgb = *(unsigned short*)sourceElement;
-
- unsigned int r = ((xrgb & 0x0F00) * 0x00001100) & 0x00FF0000;
- unsigned int g = ((xrgb & 0x00F0) * 0x00000110) & 0x0000FF00;
- unsigned int b = (xrgb & 0x000F) * 0x00000011;
-
- *(unsigned int*)destinationElement = 0xFF000000 | r | g | b;
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeA4R4G4B4(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int argb = *(unsigned short*)sourceElement;
-
- unsigned int a = ((argb & 0xF000) * 0x00011000) & 0xFF000000;
- unsigned int r = ((argb & 0x0F00) * 0x00001100) & 0x00FF0000;
- unsigned int g = ((argb & 0x00F0) * 0x00000110) & 0x0000FF00;
- unsigned int b = (argb & 0x000F) * 0x00000011;
-
- *(unsigned int*)destinationElement = a | r | g | b;
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeP8(Buffer &destination, Buffer &source)
- {
- unsigned char *sourceSlice = (unsigned char*)source.lockRect(0, 0, 0, sw::LOCK_READONLY);
- unsigned char *destinationSlice = (unsigned char*)destination.lockRect(0, 0, 0, sw::LOCK_UPDATE);
-
- int depth = min(destination.depth, source.depth);
- int height = min(destination.height, source.height);
- int width = min(destination.width, source.width);
-
- for(int z = 0; z < depth; z++)
- {
- unsigned char *sourceRow = sourceSlice;
- unsigned char *destinationRow = destinationSlice;
-
- for(int y = 0; y < height; y++)
- {
- unsigned char *sourceElement = sourceRow;
- unsigned char *destinationElement = destinationRow;
-
- for(int x = 0; x < width; x++)
- {
- unsigned int abgr = palette[*(unsigned char*)sourceElement];
-
- unsigned int r = (abgr & 0x000000FF) << 16;
- unsigned int g = (abgr & 0x0000FF00) << 0;
- unsigned int b = (abgr & 0x00FF0000) >> 16;
- unsigned int a = (abgr & 0xFF000000) >> 0;
-
- *(unsigned int*)destinationElement = a | r | g | b;
-
- sourceElement += source.bytes;
- destinationElement += destination.bytes;
- }
-
- sourceRow += source.pitchB;
- destinationRow += destination.pitchB;
- }
-
- sourceSlice += source.sliceB;
- destinationSlice += destination.sliceB;
- }
-
- source.unlockRect();
- destination.unlockRect();
- }
-
- void Surface::decodeDXT1(Buffer &internal, Buffer &external)
- {
- unsigned int *destSlice = (unsigned int*)internal.lockRect(0, 0, 0, LOCK_UPDATE);
- const DXT1 *source = (const DXT1*)external.lockRect(0, 0, 0, LOCK_READONLY);
-
- for(int z = 0; z < external.depth; z++)
- {
- unsigned int *dest = destSlice;
-
- for(int y = 0; y < external.height; y += 4)
- {
- for(int x = 0; x < external.width; x += 4)
- {
- Color<byte> c[4];
-
- c[0] = source->c0;
- c[1] = source->c1;
-
- if(source->c0 > source->c1) // No transparency
- {
- // c2 = 2 / 3 * c0 + 1 / 3 * c1
- c[2].r = (byte)((2 * (word)c[0].r + (word)c[1].r + 1) / 3);
- c[2].g = (byte)((2 * (word)c[0].g + (word)c[1].g + 1) / 3);
- c[2].b = (byte)((2 * (word)c[0].b + (word)c[1].b + 1) / 3);
- c[2].a = 0xFF;
-
- // c3 = 1 / 3 * c0 + 2 / 3 * c1
- c[3].r = (byte)(((word)c[0].r + 2 * (word)c[1].r + 1) / 3);
- c[3].g = (byte)(((word)c[0].g + 2 * (word)c[1].g + 1) / 3);
- c[3].b = (byte)(((word)c[0].b + 2 * (word)c[1].b + 1) / 3);
- c[3].a = 0xFF;
- }
- else // c3 transparent
- {
- // c2 = 1 / 2 * c0 + 1 / 2 * c1
- c[2].r = (byte)(((word)c[0].r + (word)c[1].r) / 2);
- c[2].g = (byte)(((word)c[0].g + (word)c[1].g) / 2);
- c[2].b = (byte)(((word)c[0].b + (word)c[1].b) / 2);
- c[2].a = 0xFF;
-
- c[3].r = 0;
- c[3].g = 0;
- c[3].b = 0;
- c[3].a = 0;
- }
-
- for(int j = 0; j < 4 && (y + j) < internal.height; j++)
- {
- for(int i = 0; i < 4 && (x + i) < internal.width; i++)
- {
- dest[(x + i) + (y + j) * internal.pitchP] = c[(unsigned int)(source->lut >> 2 * (i + j * 4)) % 4];
- }
- }
-
- source++;
- }
- }
-
- (byte*&)destSlice += internal.sliceB;
- }
-
- external.unlockRect();
- internal.unlockRect();
- }
-
- void Surface::decodeDXT3(Buffer &internal, Buffer &external)
- {
- unsigned int *destSlice = (unsigned int*)internal.lockRect(0, 0, 0, LOCK_UPDATE);
- const DXT3 *source = (const DXT3*)external.lockRect(0, 0, 0, LOCK_READONLY);
-
- for(int z = 0; z < external.depth; z++)
- {
- unsigned int *dest = destSlice;
-
- for(int y = 0; y < external.height; y += 4)
- {
- for(int x = 0; x < external.width; x += 4)
- {
- Color<byte> c[4];
-
- c[0] = source->c0;
- c[1] = source->c1;
-
- // c2 = 2 / 3 * c0 + 1 / 3 * c1
- c[2].r = (byte)((2 * (word)c[0].r + (word)c[1].r + 1) / 3);
- c[2].g = (byte)((2 * (word)c[0].g + (word)c[1].g + 1) / 3);
- c[2].b = (byte)((2 * (word)c[0].b + (word)c[1].b + 1) / 3);
-
- // c3 = 1 / 3 * c0 + 2 / 3 * c1
- c[3].r = (byte)(((word)c[0].r + 2 * (word)c[1].r + 1) / 3);
- c[3].g = (byte)(((word)c[0].g + 2 * (word)c[1].g + 1) / 3);
- c[3].b = (byte)(((word)c[0].b + 2 * (word)c[1].b + 1) / 3);
-
- for(int j = 0; j < 4 && (y + j) < internal.height; j++)
- {
- for(int i = 0; i < 4 && (x + i) < internal.width; i++)
- {
- unsigned int a = (unsigned int)(source->a >> 4 * (i + j * 4)) & 0x0F;
- unsigned int color = (c[(unsigned int)(source->lut >> 2 * (i + j * 4)) % 4] & 0x00FFFFFF) | ((a << 28) + (a << 24));
-
- dest[(x + i) + (y + j) * internal.pitchP] = color;
- }
- }
-
- source++;
- }
- }
-
- (byte*&)destSlice += internal.sliceB;
- }
-
- external.unlockRect();
- internal.unlockRect();
- }
-
- void Surface::decodeDXT5(Buffer &internal, Buffer &external)
- {
- unsigned int *destSlice = (unsigned int*)internal.lockRect(0, 0, 0, LOCK_UPDATE);
- const DXT5 *source = (const DXT5*)external.lockRect(0, 0, 0, LOCK_READONLY);
-
- for(int z = 0; z < external.depth; z++)
- {
- unsigned int *dest = destSlice;
-
- for(int y = 0; y < external.height; y += 4)
- {
- for(int x = 0; x < external.width; x += 4)
- {
- Color<byte> c[4];
-
- c[0] = source->c0;
- c[1] = source->c1;
-
- // c2 = 2 / 3 * c0 + 1 / 3 * c1
- c[2].r = (byte)((2 * (word)c[0].r + (word)c[1].r + 1) / 3);
- c[2].g = (byte)((2 * (word)c[0].g + (word)c[1].g + 1) / 3);
- c[2].b = (byte)((2 * (word)c[0].b + (word)c[1].b + 1) / 3);
-
- // c3 = 1 / 3 * c0 + 2 / 3 * c1
- c[3].r = (byte)(((word)c[0].r + 2 * (word)c[1].r + 1) / 3);
- c[3].g = (byte)(((word)c[0].g + 2 * (word)c[1].g + 1) / 3);
- c[3].b = (byte)(((word)c[0].b + 2 * (word)c[1].b + 1) / 3);
-
- byte a[8];
-
- a[0] = source->a0;
- a[1] = source->a1;
-
- if(a[0] > a[1])
- {
- a[2] = (byte)((6 * (word)a[0] + 1 * (word)a[1] + 3) / 7);
- a[3] = (byte)((5 * (word)a[0] + 2 * (word)a[1] + 3) / 7);
- a[4] = (byte)((4 * (word)a[0] + 3 * (word)a[1] + 3) / 7);
- a[5] = (byte)((3 * (word)a[0] + 4 * (word)a[1] + 3) / 7);
- a[6] = (byte)((2 * (word)a[0] + 5 * (word)a[1] + 3) / 7);
- a[7] = (byte)((1 * (word)a[0] + 6 * (word)a[1] + 3) / 7);
- }
- else
- {
- a[2] = (byte)((4 * (word)a[0] + 1 * (word)a[1] + 2) / 5);
- a[3] = (byte)((3 * (word)a[0] + 2 * (word)a[1] + 2) / 5);
- a[4] = (byte)((2 * (word)a[0] + 3 * (word)a[1] + 2) / 5);
- a[5] = (byte)((1 * (word)a[0] + 4 * (word)a[1] + 2) / 5);
- a[6] = 0;
- a[7] = 0xFF;
- }
-
- for(int j = 0; j < 4 && (y + j) < internal.height; j++)
- {
- for(int i = 0; i < 4 && (x + i) < internal.width; i++)
- {
- unsigned int alpha = (unsigned int)a[(unsigned int)(source->alut >> (16 + 3 * (i + j * 4))) % 8] << 24;
- unsigned int color = (c[(source->clut >> 2 * (i + j * 4)) % 4] & 0x00FFFFFF) | alpha;
-
- dest[(x + i) + (y + j) * internal.pitchP] = color;
- }
- }
-
- source++;
- }
- }
-
- (byte*&)destSlice += internal.sliceB;
- }
-
- external.unlockRect();
- internal.unlockRect();
- }
-
- void Surface::decodeATI1(Buffer &internal, Buffer &external)
- {
- byte *destSlice = (byte*)internal.lockRect(0, 0, 0, LOCK_UPDATE);
- const ATI1 *source = (const ATI1*)external.lockRect(0, 0, 0, LOCK_READONLY);
-
- for(int z = 0; z < external.depth; z++)
- {
- byte *dest = destSlice;
-
- for(int y = 0; y < external.height; y += 4)
- {
- for(int x = 0; x < external.width; x += 4)
- {
- byte r[8];
-
- r[0] = source->r0;
- r[1] = source->r1;
-
- if(r[0] > r[1])
- {
- r[2] = (byte)((6 * (word)r[0] + 1 * (word)r[1] + 3) / 7);
- r[3] = (byte)((5 * (word)r[0] + 2 * (word)r[1] + 3) / 7);
- r[4] = (byte)((4 * (word)r[0] + 3 * (word)r[1] + 3) / 7);
- r[5] = (byte)((3 * (word)r[0] + 4 * (word)r[1] + 3) / 7);
- r[6] = (byte)((2 * (word)r[0] + 5 * (word)r[1] + 3) / 7);
- r[7] = (byte)((1 * (word)r[0] + 6 * (word)r[1] + 3) / 7);
- }
- else
- {
- r[2] = (byte)((4 * (word)r[0] + 1 * (word)r[1] + 2) / 5);
- r[3] = (byte)((3 * (word)r[0] + 2 * (word)r[1] + 2) / 5);
- r[4] = (byte)((2 * (word)r[0] + 3 * (word)r[1] + 2) / 5);
- r[5] = (byte)((1 * (word)r[0] + 4 * (word)r[1] + 2) / 5);
- r[6] = 0;
- r[7] = 0xFF;
- }
-
- for(int j = 0; j < 4 && (y + j) < internal.height; j++)
- {
- for(int i = 0; i < 4 && (x + i) < internal.width; i++)
- {
- dest[(x + i) + (y + j) * internal.pitchP] = r[(unsigned int)(source->rlut >> (16 + 3 * (i + j * 4))) % 8];
- }
- }
-
- source++;
- }
- }
-
- destSlice += internal.sliceB;
- }
-
- external.unlockRect();
- internal.unlockRect();
- }
-
- void Surface::decodeATI2(Buffer &internal, Buffer &external)
- {
- word *destSlice = (word*)internal.lockRect(0, 0, 0, LOCK_UPDATE);
- const ATI2 *source = (const ATI2*)external.lockRect(0, 0, 0, LOCK_READONLY);
-
- for(int z = 0; z < external.depth; z++)
- {
- word *dest = destSlice;
-
- for(int y = 0; y < external.height; y += 4)
- {
- for(int x = 0; x < external.width; x += 4)
- {
- byte X[8];
-
- X[0] = source->x0;
- X[1] = source->x1;
-
- if(X[0] > X[1])
- {
- X[2] = (byte)((6 * (word)X[0] + 1 * (word)X[1] + 3) / 7);
- X[3] = (byte)((5 * (word)X[0] + 2 * (word)X[1] + 3) / 7);
- X[4] = (byte)((4 * (word)X[0] + 3 * (word)X[1] + 3) / 7);
- X[5] = (byte)((3 * (word)X[0] + 4 * (word)X[1] + 3) / 7);
- X[6] = (byte)((2 * (word)X[0] + 5 * (word)X[1] + 3) / 7);
- X[7] = (byte)((1 * (word)X[0] + 6 * (word)X[1] + 3) / 7);
- }
- else
- {
- X[2] = (byte)((4 * (word)X[0] + 1 * (word)X[1] + 2) / 5);
- X[3] = (byte)((3 * (word)X[0] + 2 * (word)X[1] + 2) / 5);
- X[4] = (byte)((2 * (word)X[0] + 3 * (word)X[1] + 2) / 5);
- X[5] = (byte)((1 * (word)X[0] + 4 * (word)X[1] + 2) / 5);
- X[6] = 0;
- X[7] = 0xFF;
- }
-
- byte Y[8];
-
- Y[0] = source->y0;
- Y[1] = source->y1;
-
- if(Y[0] > Y[1])
- {
- Y[2] = (byte)((6 * (word)Y[0] + 1 * (word)Y[1] + 3) / 7);
- Y[3] = (byte)((5 * (word)Y[0] + 2 * (word)Y[1] + 3) / 7);
- Y[4] = (byte)((4 * (word)Y[0] + 3 * (word)Y[1] + 3) / 7);
- Y[5] = (byte)((3 * (word)Y[0] + 4 * (word)Y[1] + 3) / 7);
- Y[6] = (byte)((2 * (word)Y[0] + 5 * (word)Y[1] + 3) / 7);
- Y[7] = (byte)((1 * (word)Y[0] + 6 * (word)Y[1] + 3) / 7);
- }
- else
- {
- Y[2] = (byte)((4 * (word)Y[0] + 1 * (word)Y[1] + 2) / 5);
- Y[3] = (byte)((3 * (word)Y[0] + 2 * (word)Y[1] + 2) / 5);
- Y[4] = (byte)((2 * (word)Y[0] + 3 * (word)Y[1] + 2) / 5);
- Y[5] = (byte)((1 * (word)Y[0] + 4 * (word)Y[1] + 2) / 5);
- Y[6] = 0;
- Y[7] = 0xFF;
- }
-
- for(int j = 0; j < 4 && (y + j) < internal.height; j++)
- {
- for(int i = 0; i < 4 && (x + i) < internal.width; i++)
- {
- word r = X[(unsigned int)(source->xlut >> (16 + 3 * (i + j * 4))) % 8];
- word g = Y[(unsigned int)(source->ylut >> (16 + 3 * (i + j * 4))) % 8];
-
- dest[(x + i) + (y + j) * internal.pitchP] = (g << 8) + r;
- }
- }
-
- source++;
- }
- }
-
- (byte*&)destSlice += internal.sliceB;
- }
-
- external.unlockRect();
- internal.unlockRect();
- }
-
- void Surface::decodeETC2(Buffer &internal, Buffer &external, int nbAlphaBits, bool isSRGB)
- {
- ETC_Decoder::Decode((const byte*)external.lockRect(0, 0, 0, LOCK_READONLY), (byte*)internal.lockRect(0, 0, 0, LOCK_UPDATE), external.width, external.height, internal.width, internal.height, internal.pitchB, internal.bytes,
- (nbAlphaBits == 8) ? ETC_Decoder::ETC_RGBA : ((nbAlphaBits == 1) ? ETC_Decoder::ETC_RGB_PUNCHTHROUGH_ALPHA : ETC_Decoder::ETC_RGB));
- external.unlockRect();
- internal.unlockRect();
-
- if(isSRGB)
- {
- static byte sRGBtoLinearTable[256];
- static bool sRGBtoLinearTableDirty = true;
- if(sRGBtoLinearTableDirty)
- {
- for(int i = 0; i < 256; i++)
- {
- sRGBtoLinearTable[i] = static_cast<byte>(sRGBtoLinear(static_cast<float>(i) / 255.0f) * 255.0f + 0.5f);
- }
- sRGBtoLinearTableDirty = false;
- }
-
- // Perform sRGB conversion in place after decoding
- byte *src = (byte*)internal.lockRect(0, 0, 0, LOCK_READWRITE);
- for(int y = 0; y < internal.height; y++)
- {
- byte *srcRow = src + y * internal.pitchB;
- for(int x = 0; x < internal.width; x++)
- {
- byte *srcPix = srcRow + x * internal.bytes;
- for(int i = 0; i < 3; i++)
- {
- srcPix[i] = sRGBtoLinearTable[srcPix[i]];
- }
- }
- }
- internal.unlockRect();
- }
- }
-
- void Surface::decodeEAC(Buffer &internal, Buffer &external, int nbChannels, bool isSigned)
- {
- ASSERT(nbChannels == 1 || nbChannels == 2);
-
- byte *src = (byte*)internal.lockRect(0, 0, 0, LOCK_READWRITE);
- ETC_Decoder::Decode((const byte*)external.lockRect(0, 0, 0, LOCK_READONLY), src, external.width, external.height, internal.width, internal.height, internal.pitchB, internal.bytes,
- (nbChannels == 1) ? (isSigned ? ETC_Decoder::ETC_R_SIGNED : ETC_Decoder::ETC_R_UNSIGNED) : (isSigned ? ETC_Decoder::ETC_RG_SIGNED : ETC_Decoder::ETC_RG_UNSIGNED));
- external.unlockRect();
-
- // FIXME: We convert EAC data to float, until signed short internal formats are supported
- // This code can be removed if ETC2 images are decoded to internal 16 bit signed R/RG formats
- const float normalization = isSigned ? (1.0f / (8.0f * 127.875f)) : (1.0f / (8.0f * 255.875f));
- for(int y = 0; y < internal.height; y++)
- {
- byte* srcRow = src + y * internal.pitchB;
- for(int x = internal.width - 1; x >= 0; x--)
- {
- int* srcPix = reinterpret_cast<int*>(srcRow + x * internal.bytes);
- float* dstPix = reinterpret_cast<float*>(srcPix);
- for(int c = nbChannels - 1; c >= 0; c--)
- {
- dstPix[c] = clamp(static_cast<float>(srcPix[c]) * normalization, -1.0f, 1.0f);
- }
- }
- }
-
- internal.unlockRect();
- }
-
- size_t Surface::size(int width, int height, int depth, int border, int samples, Format format)
- {
- samples = max(1, samples);
-
- switch(format)
- {
- default:
- {
- uint64_t size = (uint64_t)sliceB(width, height, border, format, true) * depth * samples;
-
- // We can only sample buffers smaller than 2 GiB, due to signed 32-bit offset calculations.
- // Force an out-of-memory if larger, or let the caller report an error.
- if(size >= 0x80000000u)
- {
- return std::numeric_limits<size_t>::max();
- }
-
- // Unpacking byte4 to short4 in the sampler currently involves reading 8 bytes,
- // and stencil operations also read 8 bytes per four 8-bit stencil values,
- // so we have to allocate 4 extra bytes to avoid buffer overruns.
- // TODO(b/145229887): Eliminate if possible, or don't hard-code.
- return static_cast<size_t>(size) + 4;
- }
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- {
- width += 2 * border;
- height += 2 * border;
-
- size_t YStride = align<16>(width);
- size_t YSize = YStride * height;
- size_t CStride = align<16>(YStride / 2);
- size_t CSize = CStride * height / 2;
-
- return YSize + 2 * CSize;
- }
- }
- }
-
- bool Surface::isStencil(Format format)
- {
- switch(format)
- {
- case FORMAT_D32:
- case FORMAT_D16:
- case FORMAT_D24X8:
- case FORMAT_D32F:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32F_SHADOW:
- return false;
- case FORMAT_D24S8:
- case FORMAT_D24FS8:
- case FORMAT_S8:
- case FORMAT_DF24S8:
- case FORMAT_DF16S8:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_D32FS8:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_INTZ:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isDepth(Format format)
- {
- switch(format)
- {
- case FORMAT_D32:
- case FORMAT_D16:
- case FORMAT_D24X8:
- case FORMAT_D24S8:
- case FORMAT_D24FS8:
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_DF24S8:
- case FORMAT_DF16S8:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_INTZ:
- return true;
- case FORMAT_S8:
- return false;
- default:
- return false;
- }
- }
-
- bool Surface::hasQuadLayout(Format format)
- {
- switch(format)
- {
- case FORMAT_D32:
- case FORMAT_D16:
- case FORMAT_D24X8:
- case FORMAT_D24S8:
- case FORMAT_D24FS8:
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_DF24S8:
- case FORMAT_DF16S8:
- case FORMAT_INTZ:
- case FORMAT_S8:
- case FORMAT_A8G8R8B8Q:
- case FORMAT_X8G8R8B8Q:
- return true;
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- default:
- break;
- }
-
- return false;
- }
-
- bool Surface::isPalette(Format format)
- {
- switch(format)
- {
- case FORMAT_P8:
- case FORMAT_A8P8:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isFloatFormat(Format format)
- {
- switch(format)
- {
- case FORMAT_R5G6B5:
- case FORMAT_R8G8B8:
- case FORMAT_B8G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_A8B8G8R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_A8B8G8R8:
- case FORMAT_G8R8I:
- case FORMAT_G8R8:
- case FORMAT_A2B10G10R10:
- case FORMAT_A2B10G10R10UI:
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_G16R16:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_A16B16G16R16:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_A8:
- case FORMAT_R8I:
- case FORMAT_R8:
- case FORMAT_S8:
- case FORMAT_L8:
- case FORMAT_L16:
- case FORMAT_A8L8:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- return false;
- case FORMAT_R16F:
- case FORMAT_G16R16F:
- case FORMAT_B16G16R16F:
- case FORMAT_X16B16G16R16F:
- case FORMAT_A16B16G16R16F:
- case FORMAT_X16B16G16R16F_UNSIGNED:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_B32G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_L16F:
- case FORMAT_A16L16F:
- case FORMAT_L32F:
- case FORMAT_A32L32F:
- return true;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool Surface::isUnsignedComponent(Format format, int component)
- {
- switch(format)
- {
- case FORMAT_NULL:
- case FORMAT_R5G6B5:
- case FORMAT_R8G8B8:
- case FORMAT_B8G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_G8R8:
- case FORMAT_A2B10G10R10:
- case FORMAT_A2B10G10R10UI:
- case FORMAT_R16UI:
- case FORMAT_G16R16:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_R32UI:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_R8UI:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_D32F:
- case FORMAT_D32FS8:
- case FORMAT_D32F_COMPLEMENTARY:
- case FORMAT_D32FS8_COMPLEMENTARY:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_L16:
- case FORMAT_A8L8:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return true;
- case FORMAT_A8B8G8R8I:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_Q8W8V8U8:
- case FORMAT_Q16W16V16U16:
- case FORMAT_A32B32G32R32F:
- return false;
- case FORMAT_R32F:
- case FORMAT_R8I:
- case FORMAT_R16I:
- case FORMAT_R32I:
- case FORMAT_R8_SNORM:
- return component >= 1;
- case FORMAT_V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_V16U16:
- case FORMAT_G32R32F:
- case FORMAT_G8R8I:
- case FORMAT_G16R16I:
- case FORMAT_G32R32I:
- case FORMAT_G8R8_SNORM:
- return component >= 2;
- case FORMAT_A16W16V16U16:
- case FORMAT_B32G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X8B8G8R8_SNORM:
- return component >= 3;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool Surface::isSRGBreadable(Format format)
- {
- // Keep in sync with Capabilities::isSRGBreadable
- switch(format)
- {
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_R8G8B8:
- case FORMAT_A8R8G8B8:
- case FORMAT_X8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_R5G6B5:
- case FORMAT_X1R5G5B5:
- case FORMAT_A1R5G5B5:
- case FORMAT_A4R4G4B4:
- case FORMAT_DXT1:
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- case FORMAT_ATI1:
- case FORMAT_ATI2:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isSRGBwritable(Format format)
- {
- // Keep in sync with Capabilities::isSRGBwritable
- switch(format)
- {
- case FORMAT_NULL:
- case FORMAT_A8R8G8B8:
- case FORMAT_X8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_R5G6B5:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isSRGBformat(Format format)
- {
- switch(format)
- {
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isCompressed(Format format)
- {
- switch(format)
- {
- case FORMAT_DXT1:
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- case FORMAT_ATI1:
- case FORMAT_ATI2:
- case FORMAT_ETC1:
- case FORMAT_R11_EAC:
- case FORMAT_SIGNED_R11_EAC:
- case FORMAT_RG11_EAC:
- case FORMAT_SIGNED_RG11_EAC:
- case FORMAT_RGB8_ETC2:
- case FORMAT_SRGB8_ETC2:
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_RGBA8_ETC2_EAC:
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isSignedNonNormalizedInteger(Format format)
- {
- switch(format)
- {
- case FORMAT_A8B8G8R8I:
- case FORMAT_X8B8G8R8I:
- case FORMAT_G8R8I:
- case FORMAT_R8I:
- case FORMAT_A16B16G16R16I:
- case FORMAT_X16B16G16R16I:
- case FORMAT_G16R16I:
- case FORMAT_R16I:
- case FORMAT_A32B32G32R32I:
- case FORMAT_X32B32G32R32I:
- case FORMAT_G32R32I:
- case FORMAT_R32I:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isUnsignedNonNormalizedInteger(Format format)
- {
- switch(format)
- {
- case FORMAT_A8B8G8R8UI:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_G8R8UI:
- case FORMAT_R8UI:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_G16R16UI:
- case FORMAT_R16UI:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_G32R32UI:
- case FORMAT_R32UI:
- return true;
- default:
- return false;
- }
- }
-
- bool Surface::isNonNormalizedInteger(Format format)
- {
- return isSignedNonNormalizedInteger(format) ||
- isUnsignedNonNormalizedInteger(format);
- }
-
- bool Surface::isNormalizedInteger(Format format)
- {
- return !isFloatFormat(format) &&
- !isNonNormalizedInteger(format) &&
- !isCompressed(format) &&
- !isDepth(format) &&
- !isStencil(format);
- }
-
- int Surface::componentCount(Format format)
- {
- switch(format)
- {
- case FORMAT_R5G6B5: return 3;
- case FORMAT_X8R8G8B8: return 3;
- case FORMAT_X8B8G8R8I: return 3;
- case FORMAT_X8B8G8R8: return 3;
- case FORMAT_A8R8G8B8: return 4;
- case FORMAT_SRGB8_X8: return 3;
- case FORMAT_SRGB8_A8: return 4;
- case FORMAT_A8B8G8R8I: return 4;
- case FORMAT_A8B8G8R8: return 4;
- case FORMAT_G8R8I: return 2;
- case FORMAT_G8R8: return 2;
- case FORMAT_R8_SNORM: return 1;
- case FORMAT_G8R8_SNORM: return 2;
- case FORMAT_X8B8G8R8_SNORM:return 3;
- case FORMAT_A8B8G8R8_SNORM:return 4;
- case FORMAT_R8UI: return 1;
- case FORMAT_G8R8UI: return 2;
- case FORMAT_X8B8G8R8UI: return 3;
- case FORMAT_A8B8G8R8UI: return 4;
- case FORMAT_A2B10G10R10: return 4;
- case FORMAT_A2B10G10R10UI: return 4;
- case FORMAT_G16R16I: return 2;
- case FORMAT_G16R16UI: return 2;
- case FORMAT_G16R16: return 2;
- case FORMAT_G32R32I: return 2;
- case FORMAT_G32R32UI: return 2;
- case FORMAT_X16B16G16R16I: return 3;
- case FORMAT_X16B16G16R16UI: return 3;
- case FORMAT_A16B16G16R16I: return 4;
- case FORMAT_A16B16G16R16UI: return 4;
- case FORMAT_A16B16G16R16: return 4;
- case FORMAT_X32B32G32R32I: return 3;
- case FORMAT_X32B32G32R32UI: return 3;
- case FORMAT_A32B32G32R32I: return 4;
- case FORMAT_A32B32G32R32UI: return 4;
- case FORMAT_V8U8: return 2;
- case FORMAT_Q8W8V8U8: return 4;
- case FORMAT_X8L8V8U8: return 3;
- case FORMAT_V16U16: return 2;
- case FORMAT_A16W16V16U16: return 4;
- case FORMAT_Q16W16V16U16: return 4;
- case FORMAT_R32F: return 1;
- case FORMAT_G32R32F: return 2;
- case FORMAT_X32B32G32R32F: return 3;
- case FORMAT_A32B32G32R32F: return 4;
- case FORMAT_X32B32G32R32F_UNSIGNED: return 3;
- case FORMAT_D32F: return 1;
- case FORMAT_D32FS8: return 1;
- case FORMAT_D32F_LOCKABLE: return 1;
- case FORMAT_D32FS8_TEXTURE: return 1;
- case FORMAT_D32F_SHADOW: return 1;
- case FORMAT_D32FS8_SHADOW: return 1;
- case FORMAT_A8: return 1;
- case FORMAT_R8I: return 1;
- case FORMAT_R8: return 1;
- case FORMAT_R16I: return 1;
- case FORMAT_R16UI: return 1;
- case FORMAT_R32I: return 1;
- case FORMAT_R32UI: return 1;
- case FORMAT_L8: return 1;
- case FORMAT_L16: return 1;
- case FORMAT_A8L8: return 2;
- case FORMAT_YV12_BT601: return 3;
- case FORMAT_YV12_BT709: return 3;
- case FORMAT_YV12_JFIF: return 3;
- default:
- ASSERT(false);
- }
-
- return 1;
- }
-
- void *Surface::allocateBuffer(int width, int height, int depth, int border, int samples, Format format)
- {
- return allocate(size(width, height, depth, border, samples, format));
- }
-
- void Surface::memfill4(void *buffer, int pattern, int bytes)
- {
- while((size_t)buffer & 0x1 && bytes >= 1)
- {
- *(char*)buffer = (char)pattern;
- (char*&)buffer += 1;
- bytes -= 1;
- }
-
- while((size_t)buffer & 0x3 && bytes >= 2)
- {
- *(short*)buffer = (short)pattern;
- (short*&)buffer += 1;
- bytes -= 2;
- }
-
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE())
- {
- while((size_t)buffer & 0xF && bytes >= 4)
- {
- *(int*)buffer = pattern;
- (int*&)buffer += 1;
- bytes -= 4;
- }
-
- __m128 quad = _mm_set_ps1((float&)pattern);
-
- float *pointer = (float*)buffer;
- int qxwords = bytes / 64;
- bytes -= qxwords * 64;
-
- while(qxwords--)
- {
- _mm_stream_ps(pointer + 0, quad);
- _mm_stream_ps(pointer + 4, quad);
- _mm_stream_ps(pointer + 8, quad);
- _mm_stream_ps(pointer + 12, quad);
-
- pointer += 16;
- }
-
- buffer = pointer;
- }
- #endif
-
- while(bytes >= 4)
- {
- *(int*)buffer = (int)pattern;
- (int*&)buffer += 1;
- bytes -= 4;
- }
-
- while(bytes >= 2)
- {
- *(short*)buffer = (short)pattern;
- (short*&)buffer += 1;
- bytes -= 2;
- }
-
- while(bytes >= 1)
- {
- *(char*)buffer = (char)pattern;
- (char*&)buffer += 1;
- bytes -= 1;
- }
- }
-
- void Surface::sync()
- {
- resource->lock(EXCLUSIVE);
- resource->unlock();
- }
-
- bool Surface::isEntire(const Rect& rect) const
- {
- return (rect.x0 == 0 && rect.y0 == 0 && rect.x1 == internal.width && rect.y1 == internal.height && internal.depth == 1);
- }
-
- Rect Surface::getRect() const
- {
- return Rect(0, 0, internal.width, internal.height);
- }
-
- void Surface::clearDepth(float depth, int x0, int y0, int width, int height)
- {
- if(width == 0 || height == 0)
- {
- return;
- }
-
- if(internal.format == FORMAT_NULL)
- {
- return;
- }
-
- // Not overlapping
- if(x0 > internal.width) return;
- if(y0 > internal.height) return;
- if(x0 + width < 0) return;
- if(y0 + height < 0) return;
-
- // Clip against dimensions
- if(x0 < 0) {width += x0; x0 = 0;}
- if(x0 + width > internal.width) width = internal.width - x0;
- if(y0 < 0) {height += y0; y0 = 0;}
- if(y0 + height > internal.height) height = internal.height - y0;
-
- const bool entire = x0 == 0 && y0 == 0 && width == internal.width && height == internal.height;
- const Lock lock = entire ? LOCK_DISCARD : LOCK_WRITEONLY;
-
- int x1 = x0 + width;
- int y1 = y0 + height;
-
- if(!hasQuadLayout(internal.format))
- {
- float *target = (float*)lockInternal(x0, y0, 0, lock, PUBLIC);
-
- for(int z = 0; z < internal.samples; z++)
- {
- float *row = target;
- for(int y = y0; y < y1; y++)
- {
- memfill4(row, (int&)depth, width * sizeof(float));
- row += internal.pitchP;
- }
- target += internal.sliceP;
- }
-
- unlockInternal();
- }
- else // Quad layout
- {
- if(complementaryDepthBuffer)
- {
- depth = 1 - depth;
- }
-
- float *buffer = (float*)lockInternal(0, 0, 0, lock, PUBLIC);
-
- int oddX0 = (x0 & ~1) * 2 + (x0 & 1);
- int oddX1 = (x1 & ~1) * 2;
- int evenX0 = ((x0 + 1) & ~1) * 2;
- int evenBytes = (oddX1 - evenX0) * sizeof(float);
-
- for(int z = 0; z < internal.samples; z++)
- {
- for(int y = y0; y < y1; y++)
- {
- float *target = buffer + (y & ~1) * internal.pitchP + (y & 1) * 2;
-
- if((y & 1) == 0 && y + 1 < y1) // Fill quad line at once
- {
- if((x0 & 1) != 0)
- {
- target[oddX0 + 0] = depth;
- target[oddX0 + 2] = depth;
- }
-
- // for(int x2 = evenX0; x2 < x1 * 2; x2 += 4)
- // {
- // target[x2 + 0] = depth;
- // target[x2 + 1] = depth;
- // target[x2 + 2] = depth;
- // target[x2 + 3] = depth;
- // }
-
- // __asm
- // {
- // movss xmm0, depth
- // shufps xmm0, xmm0, 0x00
- //
- // mov eax, x0
- // add eax, 1
- // and eax, 0xFFFFFFFE
- // cmp eax, x1
- // jge qEnd
- //
- // mov edi, target
- //
- // qLoop:
- // movntps [edi+8*eax], xmm0
- //
- // add eax, 2
- // cmp eax, x1
- // jl qLoop
- // qEnd:
- // }
-
- memfill4(&target[evenX0], (int&)depth, evenBytes);
-
- if((x1 & 1) != 0)
- {
- target[oddX1 + 0] = depth;
- target[oddX1 + 2] = depth;
- }
-
- y++;
- }
- else
- {
- for(int x = x0, i = oddX0; x < x1; x++, i = (x & ~1) * 2 + (x & 1))
- {
- target[i] = depth;
- }
- }
- }
-
- buffer += internal.sliceP;
- }
-
- unlockInternal();
- }
- }
-
- void Surface::clearStencil(unsigned char s, unsigned char mask, int x0, int y0, int width, int height)
- {
- if(mask == 0 || width == 0 || height == 0)
- {
- return;
- }
-
- if(stencil.format == FORMAT_NULL)
- {
- return;
- }
-
- // Not overlapping
- if(x0 > internal.width) return;
- if(y0 > internal.height) return;
- if(x0 + width < 0) return;
- if(y0 + height < 0) return;
-
- // Clip against dimensions
- if(x0 < 0) {width += x0; x0 = 0;}
- if(x0 + width > internal.width) width = internal.width - x0;
- if(y0 < 0) {height += y0; y0 = 0;}
- if(y0 + height > internal.height) height = internal.height - y0;
-
- int x1 = x0 + width;
- int y1 = y0 + height;
-
- int oddX0 = (x0 & ~1) * 2 + (x0 & 1);
- int oddX1 = (x1 & ~1) * 2;
- int evenX0 = ((x0 + 1) & ~1) * 2;
- int evenBytes = oddX1 - evenX0;
-
- unsigned char maskedS = s & mask;
- unsigned char invMask = ~mask;
- unsigned int fill = maskedS;
- fill = fill | (fill << 8) | (fill << 16) | (fill << 24);
-
- char *buffer = (char*)lockStencil(0, 0, 0, PUBLIC);
-
- // Stencil buffers are assumed to use quad layout
- for(int z = 0; z < stencil.samples; z++)
- {
- for(int y = y0; y < y1; y++)
- {
- char *target = buffer + (y & ~1) * stencil.pitchP + (y & 1) * 2;
-
- if((y & 1) == 0 && y + 1 < y1 && mask == 0xFF) // Fill quad line at once
- {
- if((x0 & 1) != 0)
- {
- target[oddX0 + 0] = fill;
- target[oddX0 + 2] = fill;
- }
-
- memfill4(&target[evenX0], fill, evenBytes);
-
- if((x1 & 1) != 0)
- {
- target[oddX1 + 0] = fill;
- target[oddX1 + 2] = fill;
- }
-
- y++;
- }
- else
- {
- for(int x = x0; x < x1; x++)
- {
- int i = (x & ~1) * 2 + (x & 1);
- target[i] = maskedS | (target[i] & invMask);
- }
- }
- }
-
- buffer += stencil.sliceP;
- }
-
- unlockStencil();
- }
-
- void Surface::fill(const Color<float> &color, int x0, int y0, int width, int height)
- {
- unsigned char *row;
- Buffer *buffer;
-
- if(internal.dirty)
- {
- row = (unsigned char*)lockInternal(x0, y0, 0, LOCK_WRITEONLY, PUBLIC);
- buffer = &internal;
- }
- else
- {
- row = (unsigned char*)lockExternal(x0, y0, 0, LOCK_WRITEONLY, PUBLIC);
- buffer = &external;
- }
-
- if(buffer->bytes <= 4)
- {
- int c;
- buffer->write(&c, color);
-
- if(buffer->bytes <= 1) c = (c << 8) | c;
- if(buffer->bytes <= 2) c = (c << 16) | c;
-
- for(int y = 0; y < height; y++)
- {
- memfill4(row, c, width * buffer->bytes);
-
- row += buffer->pitchB;
- }
- }
- else // Generic
- {
- for(int y = 0; y < height; y++)
- {
- unsigned char *element = row;
-
- for(int x = 0; x < width; x++)
- {
- buffer->write(element, color);
-
- element += buffer->bytes;
- }
-
- row += buffer->pitchB;
- }
- }
-
- if(buffer == &internal)
- {
- unlockInternal();
- }
- else
- {
- unlockExternal();
- }
- }
-
- void Surface::copyInternal(const Surface *source, int x, int y, float srcX, float srcY, bool filter)
- {
- ASSERT(internal.lock != LOCK_UNLOCKED && source && source->internal.lock != LOCK_UNLOCKED);
-
- sw::Color<float> color;
-
- if(!filter)
- {
- color = source->internal.read((int)srcX, (int)srcY, 0);
- }
- else // Bilinear filtering
- {
- color = source->internal.sample(srcX, srcY, 0);
- }
-
- internal.write(x, y, color);
- }
-
- void Surface::copyInternal(const Surface *source, int x, int y, int z, float srcX, float srcY, float srcZ, bool filter)
- {
- ASSERT(internal.lock != LOCK_UNLOCKED && source && source->internal.lock != LOCK_UNLOCKED);
-
- sw::Color<float> color;
-
- if(!filter)
- {
- color = source->internal.read((int)srcX, (int)srcY, int(srcZ));
- }
- else // Bilinear filtering
- {
- color = source->internal.sample(srcX, srcY, srcZ);
- }
-
- internal.write(x, y, z, color);
- }
-
- void Surface::copyCubeEdge(Edge dstEdge, Surface *src, Edge srcEdge)
- {
- Surface *dst = this;
-
- // Figure out if the edges to be copied in reverse order respectively from one another
- // The copy should be reversed whenever the same edges are contiguous or if we're
- // copying top <-> right or bottom <-> left. This is explained by the layout, which is:
- //
- // | +y |
- // | -x | +z | +x | -z |
- // | -y |
-
- bool reverse = (srcEdge == dstEdge) ||
- ((srcEdge == TOP) && (dstEdge == RIGHT)) ||
- ((srcEdge == RIGHT) && (dstEdge == TOP)) ||
- ((srcEdge == BOTTOM) && (dstEdge == LEFT)) ||
- ((srcEdge == LEFT) && (dstEdge == BOTTOM));
-
- int srcBytes = src->bytes(src->Surface::getInternalFormat());
- int srcPitch = src->getInternalPitchB();
- int dstBytes = dst->bytes(dst->Surface::getInternalFormat());
- int dstPitch = dst->getInternalPitchB();
-
- int srcW = src->getWidth();
- int srcH = src->getHeight();
- int dstW = dst->getWidth();
- int dstH = dst->getHeight();
-
- ASSERT(srcW == srcH && dstW == dstH && srcW == dstW && srcBytes == dstBytes);
-
- // Src is expressed in the regular [0, width-1], [0, height-1] space
- int srcDelta = ((srcEdge == TOP) || (srcEdge == BOTTOM)) ? srcBytes : srcPitch;
- int srcStart = ((srcEdge == BOTTOM) ? srcPitch * (srcH - 1) : ((srcEdge == RIGHT) ? srcBytes * (srcW - 1) : 0));
-
- // Dst contains borders, so it is expressed in the [-1, width+1], [-1, height+1] space
- int dstDelta = (((dstEdge == TOP) || (dstEdge == BOTTOM)) ? dstBytes : dstPitch) * (reverse ? -1 : 1);
- int dstStart = ((dstEdge == BOTTOM) ? dstPitch * (dstH + 1) : ((dstEdge == RIGHT) ? dstBytes * (dstW + 1) : 0)) + (reverse ? dstW * -dstDelta : dstDelta);
-
- char *srcBuf = (char*)src->lockInternal(0, 0, 0, sw::LOCK_READONLY, sw::PRIVATE) + srcStart;
- char *dstBuf = (char*)dst->lockInternal(-1, -1, 0, sw::LOCK_READWRITE, sw::PRIVATE) + dstStart;
-
- for(int i = 0; i < srcW; ++i, dstBuf += dstDelta, srcBuf += srcDelta)
- {
- memcpy(dstBuf, srcBuf, srcBytes);
- }
-
- if(dstEdge == LEFT || dstEdge == RIGHT)
- {
- // TOP and BOTTOM are already set, let's average out the corners
- int x0 = (dstEdge == RIGHT) ? dstW : -1;
- int y0 = -1;
- int x1 = (dstEdge == RIGHT) ? dstW - 1 : 0;
- int y1 = 0;
- dst->computeCubeCorner(x0, y0, x1, y1);
- y0 = dstH;
- y1 = dstH - 1;
- dst->computeCubeCorner(x0, y0, x1, y1);
- }
-
- src->unlockInternal();
- dst->unlockInternal();
- }
-
- void Surface::computeCubeCorner(int x0, int y0, int x1, int y1)
- {
- ASSERT(internal.lock != LOCK_UNLOCKED);
-
- sw::Color<float> color = internal.read(x0, y1);
- color += internal.read(x1, y0);
- color += internal.read(x1, y1);
- color *= (1.0f / 3.0f);
-
- internal.write(x0, y0, color);
- }
-
- bool Surface::hasStencil() const
- {
- return isStencil(external.format);
- }
-
- bool Surface::hasDepth() const
- {
- return isDepth(external.format);
- }
-
- bool Surface::hasPalette() const
- {
- return isPalette(external.format);
- }
-
- bool Surface::isRenderTarget() const
- {
- return renderTarget;
- }
-
- bool Surface::hasDirtyContents() const
- {
- return dirtyContents;
- }
-
- void Surface::markContentsClean()
- {
- dirtyContents = false;
- }
-
- Resource *Surface::getResource()
- {
- return resource;
- }
-
- bool Surface::identicalBuffers() const
- {
- return external.format == internal.format &&
- external.width == internal.width &&
- external.height == internal.height &&
- external.depth == internal.depth &&
- external.pitchB == internal.pitchB &&
- external.sliceB == internal.sliceB &&
- external.border == internal.border &&
- external.samples == internal.samples;
- }
-
- Format Surface::selectInternalFormat(Format format) const
- {
- switch(format)
- {
- case FORMAT_NULL:
- return FORMAT_NULL;
- case FORMAT_P8:
- case FORMAT_A8P8:
- case FORMAT_A4R4G4B4:
- case FORMAT_A1R5G5B5:
- case FORMAT_A8R3G3B2:
- return FORMAT_A8R8G8B8;
- case FORMAT_A8:
- return FORMAT_A8;
- case FORMAT_R8I:
- return FORMAT_R8I;
- case FORMAT_R8UI:
- return FORMAT_R8UI;
- case FORMAT_R8_SNORM:
- return FORMAT_R8_SNORM;
- case FORMAT_R8:
- return FORMAT_R8;
- case FORMAT_R16I:
- return FORMAT_R16I;
- case FORMAT_R16UI:
- return FORMAT_R16UI;
- case FORMAT_R32I:
- return FORMAT_R32I;
- case FORMAT_R32UI:
- return FORMAT_R32UI;
- case FORMAT_X16B16G16R16I:
- return FORMAT_X16B16G16R16I;
- case FORMAT_A16B16G16R16I:
- return FORMAT_A16B16G16R16I;
- case FORMAT_X16B16G16R16UI:
- return FORMAT_X16B16G16R16UI;
- case FORMAT_A16B16G16R16UI:
- return FORMAT_A16B16G16R16UI;
- case FORMAT_A2R10G10B10:
- case FORMAT_A2B10G10R10:
- case FORMAT_A16B16G16R16:
- return FORMAT_A16B16G16R16;
- case FORMAT_A2B10G10R10UI:
- return FORMAT_A16B16G16R16UI;
- case FORMAT_X32B32G32R32I:
- return FORMAT_X32B32G32R32I;
- case FORMAT_A32B32G32R32I:
- return FORMAT_A32B32G32R32I;
- case FORMAT_X32B32G32R32UI:
- return FORMAT_X32B32G32R32UI;
- case FORMAT_A32B32G32R32UI:
- return FORMAT_A32B32G32R32UI;
- case FORMAT_G8R8I:
- return FORMAT_G8R8I;
- case FORMAT_G8R8UI:
- return FORMAT_G8R8UI;
- case FORMAT_G8R8_SNORM:
- return FORMAT_G8R8_SNORM;
- case FORMAT_G8R8:
- return FORMAT_G8R8;
- case FORMAT_G16R16I:
- return FORMAT_G16R16I;
- case FORMAT_G16R16UI:
- return FORMAT_G16R16UI;
- case FORMAT_G16R16:
- return FORMAT_G16R16;
- case FORMAT_G32R32I:
- return FORMAT_G32R32I;
- case FORMAT_G32R32UI:
- return FORMAT_G32R32UI;
- case FORMAT_A8R8G8B8:
- if(lockable || !quadLayoutEnabled)
- {
- return FORMAT_A8R8G8B8;
- }
- else
- {
- return FORMAT_A8G8R8B8Q;
- }
- case FORMAT_A8B8G8R8I:
- return FORMAT_A8B8G8R8I;
- case FORMAT_A8B8G8R8UI:
- return FORMAT_A8B8G8R8UI;
- case FORMAT_A8B8G8R8_SNORM:
- return FORMAT_A8B8G8R8_SNORM;
- case FORMAT_R5G5B5A1:
- case FORMAT_R4G4B4A4:
- case FORMAT_A8B8G8R8:
- return FORMAT_A8B8G8R8;
- case FORMAT_R5G6B5:
- return FORMAT_R5G6B5;
- case FORMAT_R3G3B2:
- case FORMAT_R8G8B8:
- case FORMAT_X4R4G4B4:
- case FORMAT_X1R5G5B5:
- case FORMAT_X8R8G8B8:
- if(lockable || !quadLayoutEnabled)
- {
- return FORMAT_X8R8G8B8;
- }
- else
- {
- return FORMAT_X8G8R8B8Q;
- }
- case FORMAT_X8B8G8R8I:
- return FORMAT_X8B8G8R8I;
- case FORMAT_X8B8G8R8UI:
- return FORMAT_X8B8G8R8UI;
- case FORMAT_X8B8G8R8_SNORM:
- return FORMAT_X8B8G8R8_SNORM;
- case FORMAT_B8G8R8:
- case FORMAT_X8B8G8R8:
- return FORMAT_X8B8G8R8;
- case FORMAT_SRGB8_X8:
- return FORMAT_SRGB8_X8;
- case FORMAT_SRGB8_A8:
- return FORMAT_SRGB8_A8;
- // Compressed formats
- case FORMAT_DXT1:
- case FORMAT_DXT3:
- case FORMAT_DXT5:
- case FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
- case FORMAT_RGBA8_ETC2_EAC:
- case FORMAT_SRGB8_ALPHA8_ETC2_EAC:
- return FORMAT_A8R8G8B8;
- case FORMAT_ATI1:
- return FORMAT_R8;
- case FORMAT_R11_EAC:
- case FORMAT_SIGNED_R11_EAC:
- return FORMAT_R32F; // FIXME: Signed 8bit format would be sufficient
- case FORMAT_ATI2:
- return FORMAT_G8R8;
- case FORMAT_RG11_EAC:
- case FORMAT_SIGNED_RG11_EAC:
- return FORMAT_G32R32F; // FIXME: Signed 8bit format would be sufficient
- case FORMAT_ETC1:
- case FORMAT_RGB8_ETC2:
- case FORMAT_SRGB8_ETC2:
- return FORMAT_X8R8G8B8;
- // Bumpmap formats
- case FORMAT_V8U8: return FORMAT_V8U8;
- case FORMAT_L6V5U5: return FORMAT_X8L8V8U8;
- case FORMAT_Q8W8V8U8: return FORMAT_Q8W8V8U8;
- case FORMAT_X8L8V8U8: return FORMAT_X8L8V8U8;
- case FORMAT_V16U16: return FORMAT_V16U16;
- case FORMAT_A2W10V10U10: return FORMAT_A16W16V16U16;
- case FORMAT_Q16W16V16U16: return FORMAT_Q16W16V16U16;
- // Floating-point formats
- case FORMAT_A16F: return FORMAT_A32B32G32R32F;
- case FORMAT_R16F: return FORMAT_R32F;
- case FORMAT_G16R16F: return FORMAT_G32R32F;
- case FORMAT_B16G16R16F: return FORMAT_X32B32G32R32F;
- case FORMAT_X16B16G16R16F: return FORMAT_X32B32G32R32F;
- case FORMAT_A16B16G16R16F: return FORMAT_A32B32G32R32F;
- case FORMAT_X16B16G16R16F_UNSIGNED: return FORMAT_X32B32G32R32F_UNSIGNED;
- case FORMAT_A32F: return FORMAT_A32B32G32R32F;
- case FORMAT_R32F: return FORMAT_R32F;
- case FORMAT_G32R32F: return FORMAT_G32R32F;
- case FORMAT_B32G32R32F: return FORMAT_X32B32G32R32F;
- case FORMAT_X32B32G32R32F: return FORMAT_X32B32G32R32F;
- case FORMAT_A32B32G32R32F: return FORMAT_A32B32G32R32F;
- case FORMAT_X32B32G32R32F_UNSIGNED: return FORMAT_X32B32G32R32F_UNSIGNED;
- // Luminance formats
- case FORMAT_L8: return FORMAT_L8;
- case FORMAT_A4L4: return FORMAT_A8L8;
- case FORMAT_L16: return FORMAT_L16;
- case FORMAT_A8L8: return FORMAT_A8L8;
- case FORMAT_L16F: return FORMAT_X32B32G32R32F;
- case FORMAT_A16L16F: return FORMAT_A32B32G32R32F;
- case FORMAT_L32F: return FORMAT_X32B32G32R32F;
- case FORMAT_A32L32F: return FORMAT_A32B32G32R32F;
- // Depth/stencil formats
- case FORMAT_D16:
- case FORMAT_D32:
- case FORMAT_D24X8:
- if(hasParent) // Texture
- {
- return FORMAT_D32F_SHADOW;
- }
- else if(complementaryDepthBuffer)
- {
- return FORMAT_D32F_COMPLEMENTARY;
- }
- else
- {
- return FORMAT_D32F;
- }
- case FORMAT_D24S8:
- case FORMAT_D24FS8:
- if(hasParent) // Texture
- {
- return FORMAT_D32FS8_SHADOW;
- }
- else if(complementaryDepthBuffer)
- {
- return FORMAT_D32FS8_COMPLEMENTARY;
- }
- else
- {
- return FORMAT_D32FS8;
- }
- case FORMAT_D32F: return FORMAT_D32F;
- case FORMAT_D32FS8: return FORMAT_D32FS8;
- case FORMAT_D32F_LOCKABLE: return FORMAT_D32F_LOCKABLE;
- case FORMAT_D32FS8_TEXTURE: return FORMAT_D32FS8_TEXTURE;
- case FORMAT_INTZ: return FORMAT_D32FS8_TEXTURE;
- case FORMAT_DF24S8: return FORMAT_D32FS8_SHADOW;
- case FORMAT_DF16S8: return FORMAT_D32FS8_SHADOW;
- case FORMAT_S8: return FORMAT_S8;
- // YUV formats
- case FORMAT_YV12_BT601: return FORMAT_YV12_BT601;
- case FORMAT_YV12_BT709: return FORMAT_YV12_BT709;
- case FORMAT_YV12_JFIF: return FORMAT_YV12_JFIF;
- default:
- ASSERT(false);
- }
-
- return FORMAT_NULL;
- }
-
- void Surface::setTexturePalette(unsigned int *palette)
- {
- Surface::palette = palette;
- Surface::paletteID++;
- }
-
- void Surface::resolve()
- {
- if(internal.samples <= 1 || !internal.dirty || !renderTarget || internal.format == FORMAT_NULL)
- {
- return;
- }
-
- ASSERT(internal.depth == 1); // Unimplemented
-
- void *source = internal.lockRect(0, 0, 0, LOCK_READWRITE);
-
- int width = internal.width;
- int height = internal.height;
- int pitch = internal.pitchB;
- int slice = internal.sliceB;
-
- unsigned char *source0 = (unsigned char*)source;
- unsigned char *source1 = source0 + slice;
- unsigned char *source2 = source1 + slice;
- unsigned char *source3 = source2 + slice;
- unsigned char *source4 = source3 + slice;
- unsigned char *source5 = source4 + slice;
- unsigned char *source6 = source5 + slice;
- unsigned char *source7 = source6 + slice;
- unsigned char *source8 = source7 + slice;
- unsigned char *source9 = source8 + slice;
- unsigned char *sourceA = source9 + slice;
- unsigned char *sourceB = sourceA + slice;
- unsigned char *sourceC = sourceB + slice;
- unsigned char *sourceD = sourceC + slice;
- unsigned char *sourceE = sourceD + slice;
- unsigned char *sourceF = sourceE + slice;
-
- if(internal.format == FORMAT_X8R8G8B8 || internal.format == FORMAT_A8R8G8B8 ||
- internal.format == FORMAT_X8B8G8R8 || internal.format == FORMAT_A8B8G8R8 ||
- internal.format == FORMAT_SRGB8_X8 || internal.format == FORMAT_SRGB8_A8)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE2() && (width % 4) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
-
- c0 = _mm_avg_epu8(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
-
- c0 = _mm_avg_epu8(c0, c1);
- c2 = _mm_avg_epu8(c2, c3);
- c0 = _mm_avg_epu8(c0, c2);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 4 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 4 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 4 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 4 * x));
-
- c0 = _mm_avg_epu8(c0, c1);
- c2 = _mm_avg_epu8(c2, c3);
- c4 = _mm_avg_epu8(c4, c5);
- c6 = _mm_avg_epu8(c6, c7);
- c0 = _mm_avg_epu8(c0, c2);
- c4 = _mm_avg_epu8(c4, c6);
- c0 = _mm_avg_epu8(c0, c4);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 4 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 4 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 4 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 4 * x));
- __m128i c8 = _mm_load_si128((__m128i*)(source8 + 4 * x));
- __m128i c9 = _mm_load_si128((__m128i*)(source9 + 4 * x));
- __m128i cA = _mm_load_si128((__m128i*)(sourceA + 4 * x));
- __m128i cB = _mm_load_si128((__m128i*)(sourceB + 4 * x));
- __m128i cC = _mm_load_si128((__m128i*)(sourceC + 4 * x));
- __m128i cD = _mm_load_si128((__m128i*)(sourceD + 4 * x));
- __m128i cE = _mm_load_si128((__m128i*)(sourceE + 4 * x));
- __m128i cF = _mm_load_si128((__m128i*)(sourceF + 4 * x));
-
- c0 = _mm_avg_epu8(c0, c1);
- c2 = _mm_avg_epu8(c2, c3);
- c4 = _mm_avg_epu8(c4, c5);
- c6 = _mm_avg_epu8(c6, c7);
- c8 = _mm_avg_epu8(c8, c9);
- cA = _mm_avg_epu8(cA, cB);
- cC = _mm_avg_epu8(cC, cD);
- cE = _mm_avg_epu8(cE, cF);
- c0 = _mm_avg_epu8(c0, c2);
- c4 = _mm_avg_epu8(c4, c6);
- c8 = _mm_avg_epu8(c8, cA);
- cC = _mm_avg_epu8(cC, cE);
- c0 = _mm_avg_epu8(c0, c4);
- c8 = _mm_avg_epu8(c8, cC);
- c0 = _mm_avg_epu8(c0, c8);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- #define AVERAGE(x, y) (((x) & (y)) + ((((x) ^ (y)) >> 1) & 0x7F7F7F7F) + (((x) ^ (y)) & 0x01010101))
-
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c0 = AVERAGE(c0, c2);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c0 = AVERAGE(c0, c4);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
- unsigned int c8 = *(unsigned int*)(source8 + 4 * x);
- unsigned int c9 = *(unsigned int*)(source9 + 4 * x);
- unsigned int cA = *(unsigned int*)(sourceA + 4 * x);
- unsigned int cB = *(unsigned int*)(sourceB + 4 * x);
- unsigned int cC = *(unsigned int*)(sourceC + 4 * x);
- unsigned int cD = *(unsigned int*)(sourceD + 4 * x);
- unsigned int cE = *(unsigned int*)(sourceE + 4 * x);
- unsigned int cF = *(unsigned int*)(sourceF + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c8 = AVERAGE(c8, c9);
- cA = AVERAGE(cA, cB);
- cC = AVERAGE(cC, cD);
- cE = AVERAGE(cE, cF);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c8 = AVERAGE(c8, cA);
- cC = AVERAGE(cC, cE);
- c0 = AVERAGE(c0, c4);
- c8 = AVERAGE(c8, cC);
- c0 = AVERAGE(c0, c8);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
-
- #undef AVERAGE
- }
- }
- else if(internal.format == FORMAT_G16R16)
- {
-
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE2() && (width % 4) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c0 = _mm_avg_epu16(c0, c2);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 4 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 4 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 4 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 4 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c4 = _mm_avg_epu16(c4, c5);
- c6 = _mm_avg_epu16(c6, c7);
- c0 = _mm_avg_epu16(c0, c2);
- c4 = _mm_avg_epu16(c4, c6);
- c0 = _mm_avg_epu16(c0, c4);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 4 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 4 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 4 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 4 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 4 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 4 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 4 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 4 * x));
- __m128i c8 = _mm_load_si128((__m128i*)(source8 + 4 * x));
- __m128i c9 = _mm_load_si128((__m128i*)(source9 + 4 * x));
- __m128i cA = _mm_load_si128((__m128i*)(sourceA + 4 * x));
- __m128i cB = _mm_load_si128((__m128i*)(sourceB + 4 * x));
- __m128i cC = _mm_load_si128((__m128i*)(sourceC + 4 * x));
- __m128i cD = _mm_load_si128((__m128i*)(sourceD + 4 * x));
- __m128i cE = _mm_load_si128((__m128i*)(sourceE + 4 * x));
- __m128i cF = _mm_load_si128((__m128i*)(sourceF + 4 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c4 = _mm_avg_epu16(c4, c5);
- c6 = _mm_avg_epu16(c6, c7);
- c8 = _mm_avg_epu16(c8, c9);
- cA = _mm_avg_epu16(cA, cB);
- cC = _mm_avg_epu16(cC, cD);
- cE = _mm_avg_epu16(cE, cF);
- c0 = _mm_avg_epu16(c0, c2);
- c4 = _mm_avg_epu16(c4, c6);
- c8 = _mm_avg_epu16(c8, cA);
- cC = _mm_avg_epu16(cC, cE);
- c0 = _mm_avg_epu16(c0, c4);
- c8 = _mm_avg_epu16(c8, cC);
- c0 = _mm_avg_epu16(c0, c8);
-
- _mm_store_si128((__m128i*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- #define AVERAGE(x, y) (((x) & (y)) + ((((x) ^ (y)) >> 1) & 0x7FFF7FFF) + (((x) ^ (y)) & 0x00010001))
-
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c0 = AVERAGE(c0, c2);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c0 = AVERAGE(c0, c4);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
- unsigned int c8 = *(unsigned int*)(source8 + 4 * x);
- unsigned int c9 = *(unsigned int*)(source9 + 4 * x);
- unsigned int cA = *(unsigned int*)(sourceA + 4 * x);
- unsigned int cB = *(unsigned int*)(sourceB + 4 * x);
- unsigned int cC = *(unsigned int*)(sourceC + 4 * x);
- unsigned int cD = *(unsigned int*)(sourceD + 4 * x);
- unsigned int cE = *(unsigned int*)(sourceE + 4 * x);
- unsigned int cF = *(unsigned int*)(sourceF + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c8 = AVERAGE(c8, c9);
- cA = AVERAGE(cA, cB);
- cC = AVERAGE(cC, cD);
- cE = AVERAGE(cE, cF);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c8 = AVERAGE(c8, cA);
- cC = AVERAGE(cC, cE);
- c0 = AVERAGE(c0, c4);
- c8 = AVERAGE(c8, cC);
- c0 = AVERAGE(c0, c8);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
-
- #undef AVERAGE
- }
- }
- else if(internal.format == FORMAT_A16B16G16R16)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE2() && (width % 2) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 8 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 8 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 8 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 8 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 8 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 8 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c0 = _mm_avg_epu16(c0, c2);
-
- _mm_store_si128((__m128i*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 8 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 8 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 8 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 8 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 8 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 8 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 8 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 8 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c4 = _mm_avg_epu16(c4, c5);
- c6 = _mm_avg_epu16(c6, c7);
- c0 = _mm_avg_epu16(c0, c2);
- c4 = _mm_avg_epu16(c4, c6);
- c0 = _mm_avg_epu16(c0, c4);
-
- _mm_store_si128((__m128i*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 8 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 8 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 8 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 8 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 8 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 8 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 8 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 8 * x));
- __m128i c8 = _mm_load_si128((__m128i*)(source8 + 8 * x));
- __m128i c9 = _mm_load_si128((__m128i*)(source9 + 8 * x));
- __m128i cA = _mm_load_si128((__m128i*)(sourceA + 8 * x));
- __m128i cB = _mm_load_si128((__m128i*)(sourceB + 8 * x));
- __m128i cC = _mm_load_si128((__m128i*)(sourceC + 8 * x));
- __m128i cD = _mm_load_si128((__m128i*)(sourceD + 8 * x));
- __m128i cE = _mm_load_si128((__m128i*)(sourceE + 8 * x));
- __m128i cF = _mm_load_si128((__m128i*)(sourceF + 8 * x));
-
- c0 = _mm_avg_epu16(c0, c1);
- c2 = _mm_avg_epu16(c2, c3);
- c4 = _mm_avg_epu16(c4, c5);
- c6 = _mm_avg_epu16(c6, c7);
- c8 = _mm_avg_epu16(c8, c9);
- cA = _mm_avg_epu16(cA, cB);
- cC = _mm_avg_epu16(cC, cD);
- cE = _mm_avg_epu16(cE, cF);
- c0 = _mm_avg_epu16(c0, c2);
- c4 = _mm_avg_epu16(c4, c6);
- c8 = _mm_avg_epu16(c8, cA);
- cC = _mm_avg_epu16(cC, cE);
- c0 = _mm_avg_epu16(c0, c4);
- c8 = _mm_avg_epu16(c8, cC);
- c0 = _mm_avg_epu16(c0, c8);
-
- _mm_store_si128((__m128i*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- #define AVERAGE(x, y) (((x) & (y)) + ((((x) ^ (y)) >> 1) & 0x7FFF7FFF) + (((x) ^ (y)) & 0x00010001))
-
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c0 = AVERAGE(c0, c2);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c0 = AVERAGE(c0, c4);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- unsigned int c0 = *(unsigned int*)(source0 + 4 * x);
- unsigned int c1 = *(unsigned int*)(source1 + 4 * x);
- unsigned int c2 = *(unsigned int*)(source2 + 4 * x);
- unsigned int c3 = *(unsigned int*)(source3 + 4 * x);
- unsigned int c4 = *(unsigned int*)(source4 + 4 * x);
- unsigned int c5 = *(unsigned int*)(source5 + 4 * x);
- unsigned int c6 = *(unsigned int*)(source6 + 4 * x);
- unsigned int c7 = *(unsigned int*)(source7 + 4 * x);
- unsigned int c8 = *(unsigned int*)(source8 + 4 * x);
- unsigned int c9 = *(unsigned int*)(source9 + 4 * x);
- unsigned int cA = *(unsigned int*)(sourceA + 4 * x);
- unsigned int cB = *(unsigned int*)(sourceB + 4 * x);
- unsigned int cC = *(unsigned int*)(sourceC + 4 * x);
- unsigned int cD = *(unsigned int*)(sourceD + 4 * x);
- unsigned int cE = *(unsigned int*)(sourceE + 4 * x);
- unsigned int cF = *(unsigned int*)(sourceF + 4 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c8 = AVERAGE(c8, c9);
- cA = AVERAGE(cA, cB);
- cC = AVERAGE(cC, cD);
- cE = AVERAGE(cE, cF);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c8 = AVERAGE(c8, cA);
- cC = AVERAGE(cC, cE);
- c0 = AVERAGE(c0, c4);
- c8 = AVERAGE(c8, cC);
- c0 = AVERAGE(c0, c8);
-
- *(unsigned int*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
-
- #undef AVERAGE
- }
- }
- else if(internal.format == FORMAT_R32F)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE() && (width % 4) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 4 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 4 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 2.0f));
-
- _mm_store_ps((float*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 4 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 4 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 4 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 4 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c0 = _mm_add_ps(c0, c2);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 4.0f));
-
- _mm_store_ps((float*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 4 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 4 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 4 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 4 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 4 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 4 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 4 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 4 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c0 = _mm_add_ps(c0, c4);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 8.0f));
-
- _mm_store_ps((float*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 4)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 4 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 4 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 4 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 4 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 4 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 4 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 4 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 4 * x));
- __m128 c8 = _mm_load_ps((float*)(source8 + 4 * x));
- __m128 c9 = _mm_load_ps((float*)(source9 + 4 * x));
- __m128 cA = _mm_load_ps((float*)(sourceA + 4 * x));
- __m128 cB = _mm_load_ps((float*)(sourceB + 4 * x));
- __m128 cC = _mm_load_ps((float*)(sourceC + 4 * x));
- __m128 cD = _mm_load_ps((float*)(sourceD + 4 * x));
- __m128 cE = _mm_load_ps((float*)(sourceE + 4 * x));
- __m128 cF = _mm_load_ps((float*)(sourceF + 4 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c8 = _mm_add_ps(c8, c9);
- cA = _mm_add_ps(cA, cB);
- cC = _mm_add_ps(cC, cD);
- cE = _mm_add_ps(cE, cF);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c8 = _mm_add_ps(c8, cA);
- cC = _mm_add_ps(cC, cE);
- c0 = _mm_add_ps(c0, c4);
- c8 = _mm_add_ps(c8, cC);
- c0 = _mm_add_ps(c0, c8);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 16.0f));
-
- _mm_store_ps((float*)(source0 + 4 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
-
- c0 = c0 + c1;
- c0 *= 1.0f / 2.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c0 = c0 + c2;
- c0 *= 1.0f / 4.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c0 = c0 + c4;
- c0 *= 1.0f / 8.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
- float c8 = *(float*)(source8 + 4 * x);
- float c9 = *(float*)(source9 + 4 * x);
- float cA = *(float*)(sourceA + 4 * x);
- float cB = *(float*)(sourceB + 4 * x);
- float cC = *(float*)(sourceC + 4 * x);
- float cD = *(float*)(sourceD + 4 * x);
- float cE = *(float*)(sourceE + 4 * x);
- float cF = *(float*)(sourceF + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c8 = c8 + c9;
- cA = cA + cB;
- cC = cC + cD;
- cE = cE + cF;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c8 = c8 + cA;
- cC = cC + cE;
- c0 = c0 + c4;
- c8 = c8 + cC;
- c0 = c0 + c8;
- c0 *= 1.0f / 16.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- }
- else if(internal.format == FORMAT_G32R32F)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE() && (width % 2) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 8 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 8 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 2.0f));
-
- _mm_store_ps((float*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 8 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 8 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 8 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 8 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c0 = _mm_add_ps(c0, c2);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 4.0f));
-
- _mm_store_ps((float*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 8 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 8 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 8 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 8 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 8 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 8 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 8 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 8 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c0 = _mm_add_ps(c0, c4);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 8.0f));
-
- _mm_store_ps((float*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 2)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 8 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 8 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 8 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 8 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 8 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 8 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 8 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 8 * x));
- __m128 c8 = _mm_load_ps((float*)(source8 + 8 * x));
- __m128 c9 = _mm_load_ps((float*)(source9 + 8 * x));
- __m128 cA = _mm_load_ps((float*)(sourceA + 8 * x));
- __m128 cB = _mm_load_ps((float*)(sourceB + 8 * x));
- __m128 cC = _mm_load_ps((float*)(sourceC + 8 * x));
- __m128 cD = _mm_load_ps((float*)(sourceD + 8 * x));
- __m128 cE = _mm_load_ps((float*)(sourceE + 8 * x));
- __m128 cF = _mm_load_ps((float*)(sourceF + 8 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c8 = _mm_add_ps(c8, c9);
- cA = _mm_add_ps(cA, cB);
- cC = _mm_add_ps(cC, cD);
- cE = _mm_add_ps(cE, cF);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c8 = _mm_add_ps(c8, cA);
- cC = _mm_add_ps(cC, cE);
- c0 = _mm_add_ps(c0, c4);
- c8 = _mm_add_ps(c8, cC);
- c0 = _mm_add_ps(c0, c8);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 16.0f));
-
- _mm_store_ps((float*)(source0 + 8 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
-
- c0 = c0 + c1;
- c0 *= 1.0f / 2.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c0 = c0 + c2;
- c0 *= 1.0f / 4.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c0 = c0 + c4;
- c0 *= 1.0f / 8.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 2 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
- float c8 = *(float*)(source8 + 4 * x);
- float c9 = *(float*)(source9 + 4 * x);
- float cA = *(float*)(sourceA + 4 * x);
- float cB = *(float*)(sourceB + 4 * x);
- float cC = *(float*)(sourceC + 4 * x);
- float cD = *(float*)(sourceD + 4 * x);
- float cE = *(float*)(sourceE + 4 * x);
- float cF = *(float*)(sourceF + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c8 = c8 + c9;
- cA = cA + cB;
- cC = cC + cD;
- cE = cE + cF;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c8 = c8 + cA;
- cC = cC + cE;
- c0 = c0 + c4;
- c8 = c8 + cC;
- c0 = c0 + c8;
- c0 *= 1.0f / 16.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- }
- else if(internal.format == FORMAT_A32B32G32R32F ||
- internal.format == FORMAT_X32B32G32R32F ||
- internal.format == FORMAT_X32B32G32R32F_UNSIGNED)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE())
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 16 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 16 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 2.0f));
-
- _mm_store_ps((float*)(source0 + 16 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 16 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 16 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 16 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 16 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c0 = _mm_add_ps(c0, c2);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 4.0f));
-
- _mm_store_ps((float*)(source0 + 16 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 16 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 16 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 16 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 16 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 16 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 16 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 16 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 16 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c0 = _mm_add_ps(c0, c4);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 8.0f));
-
- _mm_store_ps((float*)(source0 + 16 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- __m128 c0 = _mm_load_ps((float*)(source0 + 16 * x));
- __m128 c1 = _mm_load_ps((float*)(source1 + 16 * x));
- __m128 c2 = _mm_load_ps((float*)(source2 + 16 * x));
- __m128 c3 = _mm_load_ps((float*)(source3 + 16 * x));
- __m128 c4 = _mm_load_ps((float*)(source4 + 16 * x));
- __m128 c5 = _mm_load_ps((float*)(source5 + 16 * x));
- __m128 c6 = _mm_load_ps((float*)(source6 + 16 * x));
- __m128 c7 = _mm_load_ps((float*)(source7 + 16 * x));
- __m128 c8 = _mm_load_ps((float*)(source8 + 16 * x));
- __m128 c9 = _mm_load_ps((float*)(source9 + 16 * x));
- __m128 cA = _mm_load_ps((float*)(sourceA + 16 * x));
- __m128 cB = _mm_load_ps((float*)(sourceB + 16 * x));
- __m128 cC = _mm_load_ps((float*)(sourceC + 16 * x));
- __m128 cD = _mm_load_ps((float*)(sourceD + 16 * x));
- __m128 cE = _mm_load_ps((float*)(sourceE + 16 * x));
- __m128 cF = _mm_load_ps((float*)(sourceF + 16 * x));
-
- c0 = _mm_add_ps(c0, c1);
- c2 = _mm_add_ps(c2, c3);
- c4 = _mm_add_ps(c4, c5);
- c6 = _mm_add_ps(c6, c7);
- c8 = _mm_add_ps(c8, c9);
- cA = _mm_add_ps(cA, cB);
- cC = _mm_add_ps(cC, cD);
- cE = _mm_add_ps(cE, cF);
- c0 = _mm_add_ps(c0, c2);
- c4 = _mm_add_ps(c4, c6);
- c8 = _mm_add_ps(c8, cA);
- cC = _mm_add_ps(cC, cE);
- c0 = _mm_add_ps(c0, c4);
- c8 = _mm_add_ps(c8, cC);
- c0 = _mm_add_ps(c0, c8);
- c0 = _mm_mul_ps(c0, _mm_set1_ps(1.0f / 16.0f));
-
- _mm_store_ps((float*)(source0 + 16 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 4 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
-
- c0 = c0 + c1;
- c0 *= 1.0f / 2.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 4 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c0 = c0 + c2;
- c0 *= 1.0f / 4.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 4 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c0 = c0 + c4;
- c0 *= 1.0f / 8.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < 4 * width; x++)
- {
- float c0 = *(float*)(source0 + 4 * x);
- float c1 = *(float*)(source1 + 4 * x);
- float c2 = *(float*)(source2 + 4 * x);
- float c3 = *(float*)(source3 + 4 * x);
- float c4 = *(float*)(source4 + 4 * x);
- float c5 = *(float*)(source5 + 4 * x);
- float c6 = *(float*)(source6 + 4 * x);
- float c7 = *(float*)(source7 + 4 * x);
- float c8 = *(float*)(source8 + 4 * x);
- float c9 = *(float*)(source9 + 4 * x);
- float cA = *(float*)(sourceA + 4 * x);
- float cB = *(float*)(sourceB + 4 * x);
- float cC = *(float*)(sourceC + 4 * x);
- float cD = *(float*)(sourceD + 4 * x);
- float cE = *(float*)(sourceE + 4 * x);
- float cF = *(float*)(sourceF + 4 * x);
-
- c0 = c0 + c1;
- c2 = c2 + c3;
- c4 = c4 + c5;
- c6 = c6 + c7;
- c8 = c8 + c9;
- cA = cA + cB;
- cC = cC + cD;
- cE = cE + cF;
- c0 = c0 + c2;
- c4 = c4 + c6;
- c8 = c8 + cA;
- cC = cC + cE;
- c0 = c0 + c4;
- c8 = c8 + cC;
- c0 = c0 + c8;
- c0 *= 1.0f / 16.0f;
-
- *(float*)(source0 + 4 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- }
- else if(internal.format == FORMAT_R5G6B5)
- {
- #if defined(__i386__) || defined(__x86_64__)
- if(CPUID::supportsSSE2() && (width % 8) == 0)
- {
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 8)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 2 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 2 * x));
-
- static const ushort8 r_b = {0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F};
- static const ushort8 _g_ = {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0};
- __m128i c0_r_b = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- __m128i c0__g_ = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(_g_));
- __m128i c1_r_b = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(r_b));
- __m128i c1__g_ = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
-
- c0 = _mm_avg_epu8(c0_r_b, c1_r_b);
- c0 = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- c1 = _mm_avg_epu16(c0__g_, c1__g_);
- c1 = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- c0 = _mm_or_si128(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 2 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 8)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 2 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 2 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 2 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 2 * x));
-
- static const ushort8 r_b = {0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F};
- static const ushort8 _g_ = {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0};
- __m128i c0_r_b = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- __m128i c0__g_ = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(_g_));
- __m128i c1_r_b = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(r_b));
- __m128i c1__g_ = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- __m128i c2_r_b = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(r_b));
- __m128i c2__g_ = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(_g_));
- __m128i c3_r_b = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(r_b));
- __m128i c3__g_ = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(_g_));
-
- c0 = _mm_avg_epu8(c0_r_b, c1_r_b);
- c2 = _mm_avg_epu8(c2_r_b, c3_r_b);
- c0 = _mm_avg_epu8(c0, c2);
- c0 = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- c1 = _mm_avg_epu16(c0__g_, c1__g_);
- c3 = _mm_avg_epu16(c2__g_, c3__g_);
- c1 = _mm_avg_epu16(c1, c3);
- c1 = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- c0 = _mm_or_si128(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 2 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 8)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 2 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 2 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 2 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 2 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 2 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 2 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 2 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 2 * x));
-
- static const ushort8 r_b = {0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F};
- static const ushort8 _g_ = {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0};
- __m128i c0_r_b = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- __m128i c0__g_ = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(_g_));
- __m128i c1_r_b = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(r_b));
- __m128i c1__g_ = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- __m128i c2_r_b = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(r_b));
- __m128i c2__g_ = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(_g_));
- __m128i c3_r_b = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(r_b));
- __m128i c3__g_ = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(_g_));
- __m128i c4_r_b = _mm_and_si128(c4, reinterpret_cast<const __m128i&>(r_b));
- __m128i c4__g_ = _mm_and_si128(c4, reinterpret_cast<const __m128i&>(_g_));
- __m128i c5_r_b = _mm_and_si128(c5, reinterpret_cast<const __m128i&>(r_b));
- __m128i c5__g_ = _mm_and_si128(c5, reinterpret_cast<const __m128i&>(_g_));
- __m128i c6_r_b = _mm_and_si128(c6, reinterpret_cast<const __m128i&>(r_b));
- __m128i c6__g_ = _mm_and_si128(c6, reinterpret_cast<const __m128i&>(_g_));
- __m128i c7_r_b = _mm_and_si128(c7, reinterpret_cast<const __m128i&>(r_b));
- __m128i c7__g_ = _mm_and_si128(c7, reinterpret_cast<const __m128i&>(_g_));
-
- c0 = _mm_avg_epu8(c0_r_b, c1_r_b);
- c2 = _mm_avg_epu8(c2_r_b, c3_r_b);
- c4 = _mm_avg_epu8(c4_r_b, c5_r_b);
- c6 = _mm_avg_epu8(c6_r_b, c7_r_b);
- c0 = _mm_avg_epu8(c0, c2);
- c4 = _mm_avg_epu8(c4, c6);
- c0 = _mm_avg_epu8(c0, c4);
- c0 = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- c1 = _mm_avg_epu16(c0__g_, c1__g_);
- c3 = _mm_avg_epu16(c2__g_, c3__g_);
- c5 = _mm_avg_epu16(c4__g_, c5__g_);
- c7 = _mm_avg_epu16(c6__g_, c7__g_);
- c1 = _mm_avg_epu16(c1, c3);
- c5 = _mm_avg_epu16(c5, c7);
- c1 = _mm_avg_epu16(c1, c5);
- c1 = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- c0 = _mm_or_si128(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 2 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x += 8)
- {
- __m128i c0 = _mm_load_si128((__m128i*)(source0 + 2 * x));
- __m128i c1 = _mm_load_si128((__m128i*)(source1 + 2 * x));
- __m128i c2 = _mm_load_si128((__m128i*)(source2 + 2 * x));
- __m128i c3 = _mm_load_si128((__m128i*)(source3 + 2 * x));
- __m128i c4 = _mm_load_si128((__m128i*)(source4 + 2 * x));
- __m128i c5 = _mm_load_si128((__m128i*)(source5 + 2 * x));
- __m128i c6 = _mm_load_si128((__m128i*)(source6 + 2 * x));
- __m128i c7 = _mm_load_si128((__m128i*)(source7 + 2 * x));
- __m128i c8 = _mm_load_si128((__m128i*)(source8 + 2 * x));
- __m128i c9 = _mm_load_si128((__m128i*)(source9 + 2 * x));
- __m128i cA = _mm_load_si128((__m128i*)(sourceA + 2 * x));
- __m128i cB = _mm_load_si128((__m128i*)(sourceB + 2 * x));
- __m128i cC = _mm_load_si128((__m128i*)(sourceC + 2 * x));
- __m128i cD = _mm_load_si128((__m128i*)(sourceD + 2 * x));
- __m128i cE = _mm_load_si128((__m128i*)(sourceE + 2 * x));
- __m128i cF = _mm_load_si128((__m128i*)(sourceF + 2 * x));
-
- static const ushort8 r_b = {0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F, 0xF81F};
- static const ushort8 _g_ = {0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0, 0x07E0};
- __m128i c0_r_b = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- __m128i c0__g_ = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(_g_));
- __m128i c1_r_b = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(r_b));
- __m128i c1__g_ = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- __m128i c2_r_b = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(r_b));
- __m128i c2__g_ = _mm_and_si128(c2, reinterpret_cast<const __m128i&>(_g_));
- __m128i c3_r_b = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(r_b));
- __m128i c3__g_ = _mm_and_si128(c3, reinterpret_cast<const __m128i&>(_g_));
- __m128i c4_r_b = _mm_and_si128(c4, reinterpret_cast<const __m128i&>(r_b));
- __m128i c4__g_ = _mm_and_si128(c4, reinterpret_cast<const __m128i&>(_g_));
- __m128i c5_r_b = _mm_and_si128(c5, reinterpret_cast<const __m128i&>(r_b));
- __m128i c5__g_ = _mm_and_si128(c5, reinterpret_cast<const __m128i&>(_g_));
- __m128i c6_r_b = _mm_and_si128(c6, reinterpret_cast<const __m128i&>(r_b));
- __m128i c6__g_ = _mm_and_si128(c6, reinterpret_cast<const __m128i&>(_g_));
- __m128i c7_r_b = _mm_and_si128(c7, reinterpret_cast<const __m128i&>(r_b));
- __m128i c7__g_ = _mm_and_si128(c7, reinterpret_cast<const __m128i&>(_g_));
- __m128i c8_r_b = _mm_and_si128(c8, reinterpret_cast<const __m128i&>(r_b));
- __m128i c8__g_ = _mm_and_si128(c8, reinterpret_cast<const __m128i&>(_g_));
- __m128i c9_r_b = _mm_and_si128(c9, reinterpret_cast<const __m128i&>(r_b));
- __m128i c9__g_ = _mm_and_si128(c9, reinterpret_cast<const __m128i&>(_g_));
- __m128i cA_r_b = _mm_and_si128(cA, reinterpret_cast<const __m128i&>(r_b));
- __m128i cA__g_ = _mm_and_si128(cA, reinterpret_cast<const __m128i&>(_g_));
- __m128i cB_r_b = _mm_and_si128(cB, reinterpret_cast<const __m128i&>(r_b));
- __m128i cB__g_ = _mm_and_si128(cB, reinterpret_cast<const __m128i&>(_g_));
- __m128i cC_r_b = _mm_and_si128(cC, reinterpret_cast<const __m128i&>(r_b));
- __m128i cC__g_ = _mm_and_si128(cC, reinterpret_cast<const __m128i&>(_g_));
- __m128i cD_r_b = _mm_and_si128(cD, reinterpret_cast<const __m128i&>(r_b));
- __m128i cD__g_ = _mm_and_si128(cD, reinterpret_cast<const __m128i&>(_g_));
- __m128i cE_r_b = _mm_and_si128(cE, reinterpret_cast<const __m128i&>(r_b));
- __m128i cE__g_ = _mm_and_si128(cE, reinterpret_cast<const __m128i&>(_g_));
- __m128i cF_r_b = _mm_and_si128(cF, reinterpret_cast<const __m128i&>(r_b));
- __m128i cF__g_ = _mm_and_si128(cF, reinterpret_cast<const __m128i&>(_g_));
-
- c0 = _mm_avg_epu8(c0_r_b, c1_r_b);
- c2 = _mm_avg_epu8(c2_r_b, c3_r_b);
- c4 = _mm_avg_epu8(c4_r_b, c5_r_b);
- c6 = _mm_avg_epu8(c6_r_b, c7_r_b);
- c8 = _mm_avg_epu8(c8_r_b, c9_r_b);
- cA = _mm_avg_epu8(cA_r_b, cB_r_b);
- cC = _mm_avg_epu8(cC_r_b, cD_r_b);
- cE = _mm_avg_epu8(cE_r_b, cF_r_b);
- c0 = _mm_avg_epu8(c0, c2);
- c4 = _mm_avg_epu8(c4, c6);
- c8 = _mm_avg_epu8(c8, cA);
- cC = _mm_avg_epu8(cC, cE);
- c0 = _mm_avg_epu8(c0, c4);
- c8 = _mm_avg_epu8(c8, cC);
- c0 = _mm_avg_epu8(c0, c8);
- c0 = _mm_and_si128(c0, reinterpret_cast<const __m128i&>(r_b));
- c1 = _mm_avg_epu16(c0__g_, c1__g_);
- c3 = _mm_avg_epu16(c2__g_, c3__g_);
- c5 = _mm_avg_epu16(c4__g_, c5__g_);
- c7 = _mm_avg_epu16(c6__g_, c7__g_);
- c9 = _mm_avg_epu16(c8__g_, c9__g_);
- cB = _mm_avg_epu16(cA__g_, cB__g_);
- cD = _mm_avg_epu16(cC__g_, cD__g_);
- cF = _mm_avg_epu16(cE__g_, cF__g_);
- c1 = _mm_avg_epu8(c1, c3);
- c5 = _mm_avg_epu8(c5, c7);
- c9 = _mm_avg_epu8(c9, cB);
- cD = _mm_avg_epu8(cD, cF);
- c1 = _mm_avg_epu8(c1, c5);
- c9 = _mm_avg_epu8(c9, cD);
- c1 = _mm_avg_epu8(c1, c9);
- c1 = _mm_and_si128(c1, reinterpret_cast<const __m128i&>(_g_));
- c0 = _mm_or_si128(c0, c1);
-
- _mm_store_si128((__m128i*)(source0 + 2 * x), c0);
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
- }
- else
- #endif
- {
- #define AVERAGE(x, y) (((x) & (y)) + ((((x) ^ (y)) >> 1) & 0x7BEF) + (((x) ^ (y)) & 0x0821))
-
- if(internal.samples == 2)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned short c0 = *(unsigned short*)(source0 + 2 * x);
- unsigned short c1 = *(unsigned short*)(source1 + 2 * x);
-
- c0 = AVERAGE(c0, c1);
-
- *(unsigned short*)(source0 + 2 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- }
- }
- else if(internal.samples == 4)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned short c0 = *(unsigned short*)(source0 + 2 * x);
- unsigned short c1 = *(unsigned short*)(source1 + 2 * x);
- unsigned short c2 = *(unsigned short*)(source2 + 2 * x);
- unsigned short c3 = *(unsigned short*)(source3 + 2 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c0 = AVERAGE(c0, c2);
-
- *(unsigned short*)(source0 + 2 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- }
- }
- else if(internal.samples == 8)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned short c0 = *(unsigned short*)(source0 + 2 * x);
- unsigned short c1 = *(unsigned short*)(source1 + 2 * x);
- unsigned short c2 = *(unsigned short*)(source2 + 2 * x);
- unsigned short c3 = *(unsigned short*)(source3 + 2 * x);
- unsigned short c4 = *(unsigned short*)(source4 + 2 * x);
- unsigned short c5 = *(unsigned short*)(source5 + 2 * x);
- unsigned short c6 = *(unsigned short*)(source6 + 2 * x);
- unsigned short c7 = *(unsigned short*)(source7 + 2 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c0 = AVERAGE(c0, c4);
-
- *(unsigned short*)(source0 + 2 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- }
- }
- else if(internal.samples == 16)
- {
- for(int y = 0; y < height; y++)
- {
- for(int x = 0; x < width; x++)
- {
- unsigned short c0 = *(unsigned short*)(source0 + 2 * x);
- unsigned short c1 = *(unsigned short*)(source1 + 2 * x);
- unsigned short c2 = *(unsigned short*)(source2 + 2 * x);
- unsigned short c3 = *(unsigned short*)(source3 + 2 * x);
- unsigned short c4 = *(unsigned short*)(source4 + 2 * x);
- unsigned short c5 = *(unsigned short*)(source5 + 2 * x);
- unsigned short c6 = *(unsigned short*)(source6 + 2 * x);
- unsigned short c7 = *(unsigned short*)(source7 + 2 * x);
- unsigned short c8 = *(unsigned short*)(source8 + 2 * x);
- unsigned short c9 = *(unsigned short*)(source9 + 2 * x);
- unsigned short cA = *(unsigned short*)(sourceA + 2 * x);
- unsigned short cB = *(unsigned short*)(sourceB + 2 * x);
- unsigned short cC = *(unsigned short*)(sourceC + 2 * x);
- unsigned short cD = *(unsigned short*)(sourceD + 2 * x);
- unsigned short cE = *(unsigned short*)(sourceE + 2 * x);
- unsigned short cF = *(unsigned short*)(sourceF + 2 * x);
-
- c0 = AVERAGE(c0, c1);
- c2 = AVERAGE(c2, c3);
- c4 = AVERAGE(c4, c5);
- c6 = AVERAGE(c6, c7);
- c8 = AVERAGE(c8, c9);
- cA = AVERAGE(cA, cB);
- cC = AVERAGE(cC, cD);
- cE = AVERAGE(cE, cF);
- c0 = AVERAGE(c0, c2);
- c4 = AVERAGE(c4, c6);
- c8 = AVERAGE(c8, cA);
- cC = AVERAGE(cC, cE);
- c0 = AVERAGE(c0, c4);
- c8 = AVERAGE(c8, cC);
- c0 = AVERAGE(c0, c8);
-
- *(unsigned short*)(source0 + 2 * x) = c0;
- }
-
- source0 += pitch;
- source1 += pitch;
- source2 += pitch;
- source3 += pitch;
- source4 += pitch;
- source5 += pitch;
- source6 += pitch;
- source7 += pitch;
- source8 += pitch;
- source9 += pitch;
- sourceA += pitch;
- sourceB += pitch;
- sourceC += pitch;
- sourceD += pitch;
- sourceE += pitch;
- sourceF += pitch;
- }
- }
- else ASSERT(false);
-
- #undef AVERAGE
- }
- }
- else
- {
- // UNIMPLEMENTED();
- }
- }
-}
diff --git a/src/Renderer/Surface.hpp b/src/Renderer/Surface.hpp
deleted file mode 100644
index d6d001c45..000000000
--- a/src/Renderer/Surface.hpp
+++ /dev/null
@@ -1,636 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Surface_hpp
-#define sw_Surface_hpp
-
-#include "Color.hpp"
-#include "Main/Config.hpp"
-#include "Common/Resource.hpp"
-
-namespace sw
-{
- class Resource;
-
- template <typename T> struct RectT
- {
- RectT() {}
- RectT(T x0i, T y0i, T x1i, T y1i) : x0(x0i), y0(y0i), x1(x1i), y1(y1i) {}
-
- void clip(T minX, T minY, T maxX, T maxY)
- {
- x0 = clamp(x0, minX, maxX);
- y0 = clamp(y0, minY, maxY);
- x1 = clamp(x1, minX, maxX);
- y1 = clamp(y1, minY, maxY);
- }
-
- T width() const { return x1 - x0; }
- T height() const { return y1 - y0; }
-
- T x0; // Inclusive
- T y0; // Inclusive
- T x1; // Exclusive
- T y1; // Exclusive
- };
-
- typedef RectT<int> Rect;
- typedef RectT<float> RectF;
-
- template<typename T> struct SliceRectT : public RectT<T>
- {
- SliceRectT() : slice(0) {}
- SliceRectT(const RectT<T>& rect) : RectT<T>(rect), slice(0) {}
- SliceRectT(const RectT<T>& rect, int s) : RectT<T>(rect), slice(s) {}
- SliceRectT(T x0, T y0, T x1, T y1, int s) : RectT<T>(x0, y0, x1, y1), slice(s) {}
- int slice;
- };
-
- typedef SliceRectT<int> SliceRect;
- typedef SliceRectT<float> SliceRectF;
-
- enum Format ENUM_UNDERLYING_TYPE_UNSIGNED_INT
- {
- FORMAT_NULL,
-
- FORMAT_A8,
- FORMAT_R8I,
- FORMAT_R8UI,
- FORMAT_R8_SNORM,
- FORMAT_R8,
- FORMAT_R16I,
- FORMAT_R16UI,
- FORMAT_R32I,
- FORMAT_R32UI,
- FORMAT_R3G3B2,
- FORMAT_A8R3G3B2,
- FORMAT_X4R4G4B4,
- FORMAT_A4R4G4B4,
- FORMAT_R4G4B4A4,
- FORMAT_R5G6B5,
- FORMAT_R8G8B8,
- FORMAT_B8G8R8,
- FORMAT_X8R8G8B8,
- FORMAT_A8R8G8B8,
- FORMAT_X8B8G8R8I,
- FORMAT_X8B8G8R8UI,
- FORMAT_X8B8G8R8_SNORM,
- FORMAT_X8B8G8R8,
- FORMAT_A8B8G8R8I,
- FORMAT_A8B8G8R8UI,
- FORMAT_A8B8G8R8_SNORM,
- FORMAT_A8B8G8R8,
- FORMAT_SRGB8_X8,
- FORMAT_SRGB8_A8,
- FORMAT_X1R5G5B5,
- FORMAT_A1R5G5B5,
- FORMAT_R5G5B5A1,
- FORMAT_G8R8I,
- FORMAT_G8R8UI,
- FORMAT_G8R8_SNORM,
- FORMAT_G8R8,
- FORMAT_G16R16,
- FORMAT_G16R16I,
- FORMAT_G16R16UI,
- FORMAT_G32R32I,
- FORMAT_G32R32UI,
- FORMAT_A2R10G10B10,
- FORMAT_A2B10G10R10,
- FORMAT_A2B10G10R10UI,
- FORMAT_A16B16G16R16,
- FORMAT_X16B16G16R16I,
- FORMAT_X16B16G16R16UI,
- FORMAT_A16B16G16R16I,
- FORMAT_A16B16G16R16UI,
- FORMAT_X32B32G32R32I,
- FORMAT_X32B32G32R32UI,
- FORMAT_A32B32G32R32I,
- FORMAT_A32B32G32R32UI,
- // Paletted formats
- FORMAT_P8,
- FORMAT_A8P8,
- // Compressed formats
- FORMAT_DXT1,
- FORMAT_DXT3,
- FORMAT_DXT5,
- FORMAT_ATI1,
- FORMAT_ATI2,
- FORMAT_ETC1,
- FORMAT_R11_EAC,
- FORMAT_SIGNED_R11_EAC,
- FORMAT_RG11_EAC,
- FORMAT_SIGNED_RG11_EAC,
- FORMAT_RGB8_ETC2,
- FORMAT_SRGB8_ETC2,
- FORMAT_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- FORMAT_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
- FORMAT_RGBA8_ETC2_EAC,
- FORMAT_SRGB8_ALPHA8_ETC2_EAC,
- // Floating-point formats
- FORMAT_A16F,
- FORMAT_R16F,
- FORMAT_G16R16F,
- FORMAT_B16G16R16F,
- FORMAT_X16B16G16R16F,
- FORMAT_A16B16G16R16F,
- FORMAT_X16B16G16R16F_UNSIGNED,
- FORMAT_A32F,
- FORMAT_R32F,
- FORMAT_G32R32F,
- FORMAT_B32G32R32F,
- FORMAT_X32B32G32R32F,
- FORMAT_A32B32G32R32F,
- FORMAT_X32B32G32R32F_UNSIGNED,
- // Bump map formats
- FORMAT_V8U8,
- FORMAT_L6V5U5,
- FORMAT_Q8W8V8U8,
- FORMAT_X8L8V8U8,
- FORMAT_A2W10V10U10,
- FORMAT_V16U16,
- FORMAT_A16W16V16U16,
- FORMAT_Q16W16V16U16,
- // Luminance formats
- FORMAT_L8,
- FORMAT_A4L4,
- FORMAT_L16,
- FORMAT_A8L8,
- FORMAT_L16F,
- FORMAT_A16L16F,
- FORMAT_L32F,
- FORMAT_A32L32F,
- // Depth/stencil formats
- FORMAT_D16,
- FORMAT_D32,
- FORMAT_D24X8,
- FORMAT_D24S8,
- FORMAT_D24FS8,
- FORMAT_D32F, // Quad layout
- FORMAT_D32FS8, // Quad layout
- FORMAT_D32F_COMPLEMENTARY, // Quad layout, 1 - z
- FORMAT_D32FS8_COMPLEMENTARY, // Quad layout, 1 - z
- FORMAT_D32F_LOCKABLE, // Linear layout
- FORMAT_D32FS8_TEXTURE, // Linear layout, no PCF
- FORMAT_D32F_SHADOW, // Linear layout, PCF
- FORMAT_D32FS8_SHADOW, // Linear layout, PCF
- FORMAT_DF24S8,
- FORMAT_DF16S8,
- FORMAT_INTZ,
- FORMAT_S8,
- // Quad layout framebuffer
- FORMAT_X8G8R8B8Q,
- FORMAT_A8G8R8B8Q,
- // YUV formats
- FORMAT_YV12_BT601,
- FORMAT_YV12_BT709,
- FORMAT_YV12_JFIF, // Full-swing BT.601
-
- FORMAT_LAST = FORMAT_YV12_JFIF
- };
-
- enum Lock
- {
- LOCK_UNLOCKED,
- LOCK_READONLY,
- LOCK_WRITEONLY,
- LOCK_READWRITE,
- LOCK_DISCARD,
- LOCK_UPDATE // Write access which doesn't dirty the buffer, because it's being updated with the sibling's data.
- };
-
- class [[clang::lto_visibility_public]] Surface
- {
- private:
- struct Buffer
- {
- friend Surface;
-
- private:
- void write(int x, int y, int z, const Color<float> &color);
- void write(int x, int y, const Color<float> &color);
- void write(void *element, const Color<float> &color);
- Color<float> read(int x, int y, int z) const;
- Color<float> read(int x, int y) const;
- Color<float> read(void *element) const;
- Color<float> sample(float x, float y, float z) const;
- Color<float> sample(float x, float y, int layer) const;
-
- void *lockRect(int x, int y, int z, Lock lock);
- void unlockRect();
-
- void *buffer;
- int width;
- int height;
- int depth;
- short border;
- short samples;
-
- int bytes;
- int pitchB;
- int pitchP;
- int sliceB;
- int sliceP;
-
- Format format;
- AtomicInt lock;
-
- bool dirty; // Sibling internal/external buffer doesn't match.
- };
-
- protected:
- Surface(int width, int height, int depth, Format format, void *pixels, int pitch, int slice);
- Surface(Resource *texture, int width, int height, int depth, int border, int samples, Format format, bool lockable, bool renderTarget, int pitchP = 0);
-
- public:
- static Surface *create(int width, int height, int depth, Format format, void *pixels, int pitch, int slice);
- static Surface *create(Resource *texture, int width, int height, int depth, int border, int samples, Format format, bool lockable, bool renderTarget, int pitchP = 0);
-
- virtual ~Surface() = 0;
-
- inline void *lock(int x, int y, int z, Lock lock, Accessor client, bool internal = false);
- inline void unlock(bool internal = false);
- inline int getWidth() const;
- inline int getHeight() const;
- inline int getDepth() const;
- inline int getBorder() const;
- inline Format getFormat(bool internal = false) const;
- inline int getPitchB(bool internal = false) const;
- inline int getPitchP(bool internal = false) const;
- inline int getSliceB(bool internal = false) const;
- inline int getSliceP(bool internal = false) const;
-
- void *lockExternal(int x, int y, int z, Lock lock, Accessor client);
- void unlockExternal();
- inline Format getExternalFormat() const;
- inline int getExternalPitchB() const;
- inline int getExternalPitchP() const;
- inline int getExternalSliceB() const;
- inline int getExternalSliceP() const;
-
- virtual void *lockInternal(int x, int y, int z, Lock lock, Accessor client) = 0;
- virtual void unlockInternal() = 0;
- inline Format getInternalFormat() const;
- inline int getInternalPitchB() const;
- inline int getInternalPitchP() const;
- inline int getInternalSliceB() const;
- inline int getInternalSliceP() const;
-
- void *lockStencil(int x, int y, int front, Accessor client);
- void unlockStencil();
- inline Format getStencilFormat() const;
- inline int getStencilPitchB() const;
- inline int getStencilSliceB() const;
-
- void sync(); // Wait for lock(s) to be released.
- virtual bool requiresSync() const { return false; }
- inline bool isUnlocked() const; // Only reliable after sync().
-
- inline int getSamples() const;
- inline int getMultiSampleCount() const;
- inline int getSuperSampleCount() const;
-
- bool isEntire(const Rect& rect) const;
- Rect getRect() const;
- void clearDepth(float depth, int x0, int y0, int width, int height);
- void clearStencil(unsigned char stencil, unsigned char mask, int x0, int y0, int width, int height);
- void fill(const Color<float> &color, int x0, int y0, int width, int height);
-
- Color<float> readExternal(int x, int y, int z) const;
- Color<float> readExternal(int x, int y) const;
- Color<float> sampleExternal(float x, float y, float z) const;
- Color<float> sampleExternal(float x, float y) const;
- void writeExternal(int x, int y, int z, const Color<float> &color);
- void writeExternal(int x, int y, const Color<float> &color);
-
- void copyInternal(const Surface* src, int x, int y, float srcX, float srcY, bool filter);
- void copyInternal(const Surface* src, int x, int y, int z, float srcX, float srcY, float srcZ, bool filter);
-
- enum Edge { TOP, BOTTOM, RIGHT, LEFT };
- void copyCubeEdge(Edge dstEdge, Surface *src, Edge srcEdge);
- void computeCubeCorner(int x0, int y0, int x1, int y1);
-
- bool hasStencil() const;
- bool hasDepth() const;
- bool hasPalette() const;
- bool isRenderTarget() const;
-
- bool hasDirtyContents() const;
- void markContentsClean();
- inline bool isExternalDirty() const;
- Resource *getResource();
-
- static int bytes(Format format);
- static int pitchB(int width, int border, Format format, bool target);
- static int pitchP(int width, int border, Format format, bool target);
- static int sliceB(int width, int height, int border, Format format, bool target);
- static int sliceP(int width, int height, int border, Format format, bool target);
- static size_t size(int width, int height, int depth, int border, int samples, Format format);
-
- static bool isStencil(Format format);
- static bool isDepth(Format format);
- static bool hasQuadLayout(Format format);
- static bool isPalette(Format format);
-
- static bool isFloatFormat(Format format);
- static bool isUnsignedComponent(Format format, int component);
- static bool isSRGBreadable(Format format);
- static bool isSRGBwritable(Format format);
- static bool isSRGBformat(Format format);
- static bool isCompressed(Format format);
- static bool isSignedNonNormalizedInteger(Format format);
- static bool isUnsignedNonNormalizedInteger(Format format);
- static bool isNonNormalizedInteger(Format format);
- static bool isNormalizedInteger(Format format);
- static int componentCount(Format format);
-
- static void setTexturePalette(unsigned int *palette);
-
- private:
- sw::Resource *resource;
-
- typedef unsigned char byte;
- typedef unsigned short word;
- typedef unsigned int dword;
- typedef uint64_t qword;
-
- struct DXT1
- {
- word c0;
- word c1;
- dword lut;
- };
-
- struct DXT3
- {
- qword a;
-
- word c0;
- word c1;
- dword lut;
- };
-
- struct DXT5
- {
- union
- {
- struct
- {
- byte a0;
- byte a1;
- };
-
- qword alut; // Skip first 16 bit
- };
-
- word c0;
- word c1;
- dword clut;
- };
-
- struct ATI2
- {
- union
- {
- struct
- {
- byte y0;
- byte y1;
- };
-
- qword ylut; // Skip first 16 bit
- };
-
- union
- {
- struct
- {
- byte x0;
- byte x1;
- };
-
- qword xlut; // Skip first 16 bit
- };
- };
-
- struct ATI1
- {
- union
- {
- struct
- {
- byte r0;
- byte r1;
- };
-
- qword rlut; // Skip first 16 bit
- };
- };
-
- static void decodeR8G8B8(Buffer &destination, Buffer &source);
- static void decodeX1R5G5B5(Buffer &destination, Buffer &source);
- static void decodeA1R5G5B5(Buffer &destination, Buffer &source);
- static void decodeX4R4G4B4(Buffer &destination, Buffer &source);
- static void decodeA4R4G4B4(Buffer &destination, Buffer &source);
- static void decodeP8(Buffer &destination, Buffer &source);
-
- static void decodeDXT1(Buffer &internal, Buffer &external);
- static void decodeDXT3(Buffer &internal, Buffer &external);
- static void decodeDXT5(Buffer &internal, Buffer &external);
- static void decodeATI1(Buffer &internal, Buffer &external);
- static void decodeATI2(Buffer &internal, Buffer &external);
- static void decodeEAC(Buffer &internal, Buffer &external, int nbChannels, bool isSigned);
- static void decodeETC2(Buffer &internal, Buffer &external, int nbAlphaBits, bool isSRGB);
-
- static void update(Buffer &destination, Buffer &source);
- static void genericUpdate(Buffer &destination, Buffer &source);
- static void *allocateBuffer(int width, int height, int depth, int border, int samples, Format format);
- static void memfill4(void *buffer, int pattern, int bytes);
-
- bool identicalBuffers() const;
- Format selectInternalFormat(Format format) const;
-
- void resolve();
-
- Buffer external;
- Buffer internal;
- Buffer stencil;
-
- const bool lockable;
- const bool renderTarget;
-
- bool dirtyContents; // Sibling surfaces need updating (mipmaps / cube borders).
- unsigned int paletteUsed;
-
- static unsigned int *palette; // FIXME: Not multi-device safe
- static unsigned int paletteID;
-
- bool hasParent;
- bool ownExternal;
- };
-}
-
-#undef min
-#undef max
-
-namespace sw
-{
- void *Surface::lock(int x, int y, int z, Lock lock, Accessor client, bool internal)
- {
- return internal ? lockInternal(x, y, z, lock, client) : lockExternal(x, y, z, lock, client);
- }
-
- void Surface::unlock(bool internal)
- {
- return internal ? unlockInternal() : unlockExternal();
- }
-
- int Surface::getWidth() const
- {
- return external.width;
- }
-
- int Surface::getHeight() const
- {
- return external.height;
- }
-
- int Surface::getDepth() const
- {
- return external.depth;
- }
-
- int Surface::getBorder() const
- {
- return internal.border;
- }
-
- Format Surface::getFormat(bool internal) const
- {
- return internal ? getInternalFormat() : getExternalFormat();
- }
-
- int Surface::getPitchB(bool internal) const
- {
- return internal ? getInternalPitchB() : getExternalPitchB();
- }
-
- int Surface::getPitchP(bool internal) const
- {
- return internal ? getInternalPitchP() : getExternalPitchP();
- }
-
- int Surface::getSliceB(bool internal) const
- {
- return internal ? getInternalSliceB() : getExternalSliceB();
- }
-
- int Surface::getSliceP(bool internal) const
- {
- return internal ? getInternalSliceP() : getExternalSliceP();
- }
-
- Format Surface::getExternalFormat() const
- {
- return external.format;
- }
-
- int Surface::getExternalPitchB() const
- {
- return external.pitchB;
- }
-
- int Surface::getExternalPitchP() const
- {
- return external.pitchP;
- }
-
- int Surface::getExternalSliceB() const
- {
- return external.sliceB;
- }
-
- int Surface::getExternalSliceP() const
- {
- return external.sliceP;
- }
-
- Format Surface::getInternalFormat() const
- {
- return internal.format;
- }
-
- int Surface::getInternalPitchB() const
- {
- return internal.pitchB;
- }
-
- int Surface::getInternalPitchP() const
- {
- return internal.pitchP;
- }
-
- int Surface::getInternalSliceB() const
- {
- return internal.sliceB;
- }
-
- int Surface::getInternalSliceP() const
- {
- return internal.sliceP;
- }
-
- Format Surface::getStencilFormat() const
- {
- return stencil.format;
- }
-
- int Surface::getStencilPitchB() const
- {
- return stencil.pitchB;
- }
-
- int Surface::getStencilSliceB() const
- {
- return stencil.sliceB;
- }
-
- int Surface::getSamples() const
- {
- return internal.samples;
- }
-
- int Surface::getMultiSampleCount() const
- {
- return sw::min((int)internal.samples, 4);
- }
-
- int Surface::getSuperSampleCount() const
- {
- return internal.samples > 4 ? internal.samples / 4 : 1;
- }
-
- bool Surface::isUnlocked() const
- {
- return external.lock == LOCK_UNLOCKED &&
- internal.lock == LOCK_UNLOCKED &&
- stencil.lock == LOCK_UNLOCKED;
- }
-
- bool Surface::isExternalDirty() const
- {
- return external.buffer && external.buffer != internal.buffer && external.dirty;
- }
-}
-
-#endif // sw_Surface_hpp
diff --git a/src/Renderer/TextureStage.cpp b/src/Renderer/TextureStage.cpp
deleted file mode 100644
index 032747819..000000000
--- a/src/Renderer/TextureStage.cpp
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "TextureStage.hpp"
-
-#include "Sampler.hpp"
-#include "Common/Debug.hpp"
-
-#include <string.h>
-
-namespace sw
-{
- TextureStage::State::State()
- {
- memset(this, 0, sizeof(State));
- }
-
- TextureStage::TextureStage() : sampler(0), previousStage(0)
- {
- }
-
- TextureStage::~TextureStage()
- {
- }
-
- void TextureStage::init(int stage, const Sampler *sampler, const TextureStage *previousStage)
- {
- this->stage = stage;
-
- stageOperation = (stage == 0 ? STAGE_MODULATE : STAGE_DISABLE);
- firstArgument = SOURCE_TEXTURE;
- secondArgument = SOURCE_CURRENT;
- thirdArgument = SOURCE_CURRENT;
- stageOperationAlpha = (stage == 0 ? STAGE_SELECTARG1 : STAGE_DISABLE);
- firstArgumentAlpha = SOURCE_DIFFUSE;
- secondArgumentAlpha = SOURCE_CURRENT;
- thirdArgumentAlpha = SOURCE_CURRENT;
- firstModifier = MODIFIER_COLOR;
- secondModifier = MODIFIER_COLOR;
- thirdModifier = MODIFIER_COLOR;
- firstModifierAlpha = MODIFIER_COLOR;
- secondModifierAlpha = MODIFIER_COLOR;
- thirdModifierAlpha = MODIFIER_COLOR;
- destinationArgument = DESTINATION_CURRENT;
-
- texCoordIndex = stage;
- this->sampler = sampler;
- this->previousStage = previousStage;
- }
-
- TextureStage::State TextureStage::textureStageState() const
- {
- State state;
-
- if(!isStageDisabled())
- {
- state.stageOperation = stageOperation;
- state.firstArgument = firstArgument;
- state.secondArgument = secondArgument;
- state.thirdArgument = thirdArgument;
- state.stageOperationAlpha = stageOperationAlpha;
- state.firstArgumentAlpha = firstArgumentAlpha;
- state.secondArgumentAlpha = secondArgumentAlpha;
- state.thirdArgumentAlpha = thirdArgumentAlpha;
- state.firstModifier = firstModifier;
- state.secondModifier = secondModifier;
- state.thirdModifier = thirdModifier;
- state.firstModifierAlpha = firstModifierAlpha;
- state.secondModifierAlpha = secondModifierAlpha;
- state.thirdModifierAlpha = thirdModifierAlpha;
- state.destinationArgument = destinationArgument;
- state.texCoordIndex = texCoordIndex;
-
- state.cantUnderflow = sampler->hasUnsignedTexture() || !usesTexture();
- state.usesTexture = usesTexture();
- }
-
- return state;
- }
-
- void TextureStage::setConstantColor(const Color<float> &constantColor)
- {
- // FIXME: Compact into generic function // FIXME: Clamp
- short r = iround(4095 * constantColor.r);
- short g = iround(4095 * constantColor.g);
- short b = iround(4095 * constantColor.b);
- short a = iround(4095 * constantColor.a);
-
- uniforms.constantColor4[0][0] = uniforms.constantColor4[0][1] = uniforms.constantColor4[0][2] = uniforms.constantColor4[0][3] = r;
- uniforms.constantColor4[1][0] = uniforms.constantColor4[1][1] = uniforms.constantColor4[1][2] = uniforms.constantColor4[1][3] = g;
- uniforms.constantColor4[2][0] = uniforms.constantColor4[2][1] = uniforms.constantColor4[2][2] = uniforms.constantColor4[2][3] = b;
- uniforms.constantColor4[3][0] = uniforms.constantColor4[3][1] = uniforms.constantColor4[3][2] = uniforms.constantColor4[3][3] = a;
- }
-
- void TextureStage::setBumpmapMatrix(int element, float value)
- {
- uniforms.bumpmapMatrix4F[element / 2][element % 2][0] = value;
- uniforms.bumpmapMatrix4F[element / 2][element % 2][1] = value;
- uniforms.bumpmapMatrix4F[element / 2][element % 2][2] = value;
- uniforms.bumpmapMatrix4F[element / 2][element % 2][3] = value;
-
- uniforms.bumpmapMatrix4W[element / 2][element % 2][0] = iround(4095 * value);
- uniforms.bumpmapMatrix4W[element / 2][element % 2][1] = iround(4095 * value);
- uniforms.bumpmapMatrix4W[element / 2][element % 2][2] = iround(4095 * value);
- uniforms.bumpmapMatrix4W[element / 2][element % 2][3] = iround(4095 * value);
- }
-
- void TextureStage::setLuminanceScale(float value)
- {
- short scale = iround(4095 * value);
-
- uniforms.luminanceScale4[0] = uniforms.luminanceScale4[1] = uniforms.luminanceScale4[2] = uniforms.luminanceScale4[3] = scale;
- }
-
- void TextureStage::setLuminanceOffset(float value)
- {
- short offset = iround(4095 * value);
-
- uniforms.luminanceOffset4[0] = uniforms.luminanceOffset4[1] = uniforms.luminanceOffset4[2] = uniforms.luminanceOffset4[3] = offset;
- }
-
- void TextureStage::setTexCoordIndex(unsigned int texCoordIndex)
- {
- ASSERT(texCoordIndex < 8);
-
- this->texCoordIndex = texCoordIndex;
- }
-
- void TextureStage::setStageOperation(StageOperation stageOperation)
- {
- this->stageOperation = stageOperation;
- }
-
- void TextureStage::setFirstArgument(SourceArgument firstArgument)
- {
- this->firstArgument = firstArgument;
- }
-
- void TextureStage::setSecondArgument(SourceArgument secondArgument)
- {
- this->secondArgument = secondArgument;
- }
-
- void TextureStage::setThirdArgument(SourceArgument thirdArgument)
- {
- this->thirdArgument = thirdArgument;
- }
-
- void TextureStage::setStageOperationAlpha(StageOperation stageOperationAlpha)
- {
- this->stageOperationAlpha = stageOperationAlpha;
- }
-
- void TextureStage::setFirstArgumentAlpha(SourceArgument firstArgumentAlpha)
- {
- this->firstArgumentAlpha = firstArgumentAlpha;
- }
-
- void TextureStage::setSecondArgumentAlpha(SourceArgument secondArgumentAlpha)
- {
- this->secondArgumentAlpha = secondArgumentAlpha;
- }
-
- void TextureStage::setThirdArgumentAlpha(SourceArgument thirdArgumentAlpha)
- {
- this->thirdArgumentAlpha= thirdArgumentAlpha;
- }
-
- void TextureStage::setFirstModifier(ArgumentModifier firstModifier)
- {
- this->firstModifier = firstModifier;
- }
-
- void TextureStage::setSecondModifier(ArgumentModifier secondModifier)
- {
- this->secondModifier = secondModifier;
- }
-
- void TextureStage::setThirdModifier(ArgumentModifier thirdModifier)
- {
- this->thirdModifier = thirdModifier;
- }
-
- void TextureStage::setFirstModifierAlpha(ArgumentModifier firstModifierAlpha)
- {
- this->firstModifierAlpha = firstModifierAlpha;
- }
-
- void TextureStage::setSecondModifierAlpha(ArgumentModifier secondModifierAlpha)
- {
- this->secondModifierAlpha = secondModifierAlpha;
- }
-
- void TextureStage::setThirdModifierAlpha(ArgumentModifier thirdModifierAlpha)
- {
- this->thirdModifierAlpha = thirdModifierAlpha;
- }
-
- void TextureStage::setDestinationArgument(DestinationArgument destinationArgument)
- {
- this->destinationArgument = destinationArgument;
- }
-
- bool TextureStage::usesColor(SourceArgument source) const
- {
- // One argument
- if(stageOperation == STAGE_SELECTARG1 || stageOperation == STAGE_PREMODULATE)
- {
- return firstArgument == source;
- }
- else if(stageOperation == STAGE_SELECTARG2)
- {
- return secondArgument == source;
- }
- else if(stageOperation == STAGE_SELECTARG3)
- {
- return thirdArgument == source;
- }
- else
- {
- // Two arguments or more
- if(firstArgument == source || secondArgument == source)
- {
- return true;
- }
-
- // Three arguments
- if(stageOperation == STAGE_MULTIPLYADD || stageOperation == STAGE_LERP)
- {
- return thirdArgument == source;
- }
- }
-
- return false;
- }
-
- bool TextureStage::usesAlpha(SourceArgument source) const
- {
- if(stageOperationAlpha == STAGE_DISABLE)
- {
- return false;
- }
-
- if(source == SOURCE_TEXTURE)
- {
- if(stageOperation == STAGE_BLENDTEXTUREALPHA || stageOperation == STAGE_BLENDTEXTUREALPHAPM)
- {
- return true;
- }
- }
- else if(source == SOURCE_CURRENT)
- {
- if(stageOperation == STAGE_BLENDCURRENTALPHA)
- {
- return true;
- }
- }
- else if(source == SOURCE_DIFFUSE)
- {
- if(stageOperation == STAGE_BLENDDIFFUSEALPHA)
- {
- return true;
- }
- }
- else if(source == SOURCE_TFACTOR)
- {
- if(stageOperation == STAGE_BLENDFACTORALPHA)
- {
- return true;
- }
- }
-
- // One argument
- if(stageOperation == STAGE_SELECTARG1 || stageOperation == STAGE_PREMODULATE)
- {
- if(firstArgument == source && (firstModifier == MODIFIER_ALPHA || firstModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
- }
- else if(stageOperation == STAGE_SELECTARG2)
- {
- if(secondArgument == source && (secondModifier == MODIFIER_ALPHA || secondModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
- }
- else if(stageOperation == STAGE_SELECTARG3)
- {
- if(thirdArgument == source && (thirdModifier == MODIFIER_ALPHA || thirdModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
- }
- else
- {
- // Two arguments or more
- if(firstArgument == source || secondArgument == source)
- {
- if(firstArgument == source && (firstModifier == MODIFIER_ALPHA || firstModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
-
- if(secondArgument == source && (secondModifier == MODIFIER_ALPHA || secondModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
- }
-
- // Three arguments
- if(stageOperation == STAGE_MULTIPLYADD || stageOperation == STAGE_LERP)
- {
- if(thirdArgument == source && (thirdModifier == MODIFIER_ALPHA || thirdModifier == MODIFIER_INVALPHA))
- {
- return true;
- }
- }
- }
-
- // One argument
- if(stageOperationAlpha == STAGE_SELECTARG1 || stageOperationAlpha == STAGE_PREMODULATE)
- {
- return firstArgumentAlpha == source;
- }
- else if(stageOperationAlpha == STAGE_SELECTARG2)
- {
- return secondArgumentAlpha == source;
- }
- else if(stageOperationAlpha == STAGE_SELECTARG3)
- {
- return thirdArgumentAlpha == source;
- }
- else
- {
- // Two arguments or more
- if(firstArgumentAlpha == source || secondArgumentAlpha == source)
- {
- return true;
- }
-
- // Three arguments
- if(stageOperationAlpha == STAGE_MULTIPLYADD || stageOperationAlpha == STAGE_LERP)
- {
- return thirdArgumentAlpha == source;
- }
- }
-
- return false;
- }
-
- bool TextureStage::uses(SourceArgument source) const
- {
- return usesColor(source) || usesAlpha(source);
- }
-
- bool TextureStage::usesCurrent() const
- {
- return uses(SOURCE_CURRENT) || (stageOperation == STAGE_BLENDCURRENTALPHA || stageOperationAlpha == STAGE_BLENDCURRENTALPHA);
- }
-
- bool TextureStage::usesDiffuse() const
- {
- return uses(SOURCE_DIFFUSE) || (stageOperation == STAGE_BLENDDIFFUSEALPHA || stageOperationAlpha == STAGE_BLENDDIFFUSEALPHA);
- }
-
- bool TextureStage::usesSpecular() const
- {
- return uses(SOURCE_SPECULAR);
- }
-
- bool TextureStage::usesTexture() const
- {
- return uses(SOURCE_TEXTURE) ||
- stageOperation == STAGE_BLENDTEXTUREALPHA ||
- stageOperationAlpha == STAGE_BLENDTEXTUREALPHA ||
- stageOperation == STAGE_BLENDTEXTUREALPHAPM ||
- stageOperationAlpha == STAGE_BLENDTEXTUREALPHAPM ||
- (previousStage && previousStage->stageOperation == STAGE_PREMODULATE) ||
- (previousStage && previousStage->stageOperationAlpha == STAGE_PREMODULATE);
- }
-
- bool TextureStage::isStageDisabled() const
- {
- bool disabled = (stageOperation == STAGE_DISABLE) || (!sampler->hasTexture() && usesTexture());
-
- if(!previousStage || disabled)
- {
- return disabled;
- }
- else
- {
- return previousStage->isStageDisabled();
- }
- }
-
- bool TextureStage::writesCurrent() const
- {
- return !isStageDisabled() && destinationArgument == DESTINATION_CURRENT && stageOperation != STAGE_BUMPENVMAP && stageOperation != STAGE_BUMPENVMAPLUMINANCE;
- }
-}
diff --git a/src/Renderer/TextureStage.hpp b/src/Renderer/TextureStage.hpp
deleted file mode 100644
index 2c9ecbdea..000000000
--- a/src/Renderer/TextureStage.hpp
+++ /dev/null
@@ -1,198 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_TextureStage_hpp
-#define sw_TextureStage_hpp
-
-#include "Common/Types.hpp"
-#include "Common/Math.hpp"
-#include "Renderer/Color.hpp"
-
-namespace sw
-{
- class Sampler;
- class PixelRoutine;
- class Context;
-
- class TextureStage
- {
- friend class Context; // FIXME
-
- public:
- enum StageOperation
- {
- STAGE_DISABLE,
- STAGE_SELECTARG1,
- STAGE_SELECTARG2,
- STAGE_SELECTARG3,
- STAGE_MODULATE,
- STAGE_MODULATE2X,
- STAGE_MODULATE4X,
- STAGE_ADD,
- STAGE_ADDSIGNED,
- STAGE_ADDSIGNED2X,
- STAGE_SUBTRACT,
- STAGE_ADDSMOOTH,
- STAGE_MULTIPLYADD,
- STAGE_LERP,
- STAGE_DOT3,
- STAGE_BLENDCURRENTALPHA,
- STAGE_BLENDDIFFUSEALPHA,
- STAGE_BLENDFACTORALPHA,
- STAGE_BLENDTEXTUREALPHA,
- STAGE_BLENDTEXTUREALPHAPM,
- STAGE_PREMODULATE,
- STAGE_MODULATEALPHA_ADDCOLOR,
- STAGE_MODULATECOLOR_ADDALPHA,
- STAGE_MODULATEINVALPHA_ADDCOLOR,
- STAGE_MODULATEINVCOLOR_ADDALPHA,
- STAGE_BUMPENVMAP,
- STAGE_BUMPENVMAPLUMINANCE,
-
- STAGE_LAST = STAGE_BUMPENVMAPLUMINANCE
- };
-
- enum SourceArgument
- {
- SOURCE_TEXTURE,
- SOURCE_CONSTANT,
- SOURCE_CURRENT,
- SOURCE_DIFFUSE,
- SOURCE_SPECULAR,
- SOURCE_TEMP,
- SOURCE_TFACTOR,
-
- SOURCE_LAST = SOURCE_TFACTOR
- };
-
- enum DestinationArgument
- {
- DESTINATION_CURRENT,
- DESTINATION_TEMP,
-
- DESTINATION_LAST = DESTINATION_TEMP
- };
-
- enum ArgumentModifier
- {
- MODIFIER_COLOR,
- MODIFIER_INVCOLOR,
- MODIFIER_ALPHA,
- MODIFIER_INVALPHA,
-
- MODIFIER_LAST = MODIFIER_INVALPHA
- };
-
- struct State
- {
- State();
-
- unsigned int stageOperation : BITS(STAGE_LAST);
- unsigned int firstArgument : BITS(SOURCE_LAST);
- unsigned int secondArgument : BITS(SOURCE_LAST);
- unsigned int thirdArgument : BITS(SOURCE_LAST);
- unsigned int stageOperationAlpha : BITS(STAGE_LAST);
- unsigned int firstArgumentAlpha : BITS(SOURCE_LAST);
- unsigned int secondArgumentAlpha : BITS(SOURCE_LAST);
- unsigned int thirdArgumentAlpha : BITS(SOURCE_LAST);
- unsigned int firstModifier : BITS(MODIFIER_LAST);
- unsigned int secondModifier : BITS(MODIFIER_LAST);
- unsigned int thirdModifier : BITS(MODIFIER_LAST);
- unsigned int firstModifierAlpha : BITS(MODIFIER_LAST);
- unsigned int secondModifierAlpha : BITS(MODIFIER_LAST);
- unsigned int thirdModifierAlpha : BITS(MODIFIER_LAST);
- unsigned int destinationArgument : BITS(DESTINATION_LAST);
- unsigned int texCoordIndex : BITS(7);
-
- unsigned int cantUnderflow : 1;
- unsigned int usesTexture : 1;
- };
-
- struct Uniforms
- {
- word4 constantColor4[4];
- float4 bumpmapMatrix4F[2][2];
- word4 bumpmapMatrix4W[2][2];
- word4 luminanceScale4;
- word4 luminanceOffset4;
- };
-
- TextureStage();
-
- ~TextureStage();
-
- void init(int stage, const Sampler *sampler, const TextureStage *previousStage);
-
- State textureStageState() const;
-
- void setConstantColor(const Color<float> &constantColor);
- void setBumpmapMatrix(int element, float value);
- void setLuminanceScale(float value);
- void setLuminanceOffset(float value);
-
- void setTexCoordIndex(unsigned int texCoordIndex);
- void setStageOperation(StageOperation stageOperation);
- void setFirstArgument(SourceArgument firstArgument);
- void setSecondArgument(SourceArgument secondArgument);
- void setThirdArgument(SourceArgument thirdArgument);
- void setStageOperationAlpha(StageOperation stageOperationAlpha);
- void setFirstArgumentAlpha(SourceArgument firstArgumentAlpha);
- void setSecondArgumentAlpha(SourceArgument secondArgumentAlpha);
- void setThirdArgumentAlpha(SourceArgument thirdArgumentAlpha);
- void setFirstModifier(ArgumentModifier firstModifier);
- void setSecondModifier(ArgumentModifier secondModifier);
- void setThirdModifier(ArgumentModifier thirdModifier);
- void setFirstModifierAlpha(ArgumentModifier firstModifierAlpha);
- void setSecondModifierAlpha(ArgumentModifier secondModifierAlpha);
- void setThirdModifierAlpha(ArgumentModifier thirdModifierAlpha);
- void setDestinationArgument(DestinationArgument destinationArgument);
-
- Uniforms uniforms; // FIXME: Private
-
- private:
- bool usesColor(SourceArgument source) const;
- bool usesAlpha(SourceArgument source) const;
- bool uses(SourceArgument source) const;
- bool usesCurrent() const;
- bool usesDiffuse() const;
- bool usesSpecular() const;
- bool usesTexture() const;
- bool isStageDisabled() const;
- bool writesCurrent() const;
-
- int stage;
-
- StageOperation stageOperation;
- SourceArgument firstArgument;
- SourceArgument secondArgument;
- SourceArgument thirdArgument;
- StageOperation stageOperationAlpha;
- SourceArgument firstArgumentAlpha;
- SourceArgument secondArgumentAlpha;
- SourceArgument thirdArgumentAlpha;
- ArgumentModifier firstModifier;
- ArgumentModifier secondModifier;
- ArgumentModifier thirdModifier;
- ArgumentModifier firstModifierAlpha;
- ArgumentModifier secondModifierAlpha;
- ArgumentModifier thirdModifierAlpha;
- DestinationArgument destinationArgument;
-
- int texCoordIndex;
- const Sampler *sampler;
- const TextureStage *previousStage;
- };
-}
-
-#endif // sw_TextureStage_hpp
diff --git a/src/Renderer/Triangle.hpp b/src/Renderer/Triangle.hpp
deleted file mode 100644
index 8a91fabbe..000000000
--- a/src/Renderer/Triangle.hpp
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Triangle_hpp
-#define sw_Triangle_hpp
-
-#include "Vertex.hpp"
-
-namespace sw
-{
- struct Triangle
- {
- Vertex V0;
- Vertex V1;
- Vertex V2;
- };
-}
-
-#endif // sw_Triangle_hpp
diff --git a/src/Renderer/Vector.cpp b/src/Renderer/Vector.cpp
deleted file mode 100644
index 872163922..000000000
--- a/src/Renderer/Vector.cpp
+++ /dev/null
@@ -1,175 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Vector.hpp"
-
-#include "Matrix.hpp"
-#include "Common/Math.hpp"
-
-namespace sw
-{
- Vector Vector::operator+() const
- {
- return *this;
- }
-
- Vector Vector::operator-() const
- {
- return Vector(-x, -y, -z);
- }
-
- Vector &Vector::operator+=(const Vector &v)
- {
- x += v.x;
- y += v.y;
- z += v.z;
-
- return *this;
- }
-
- Vector &Vector::operator-=(const Vector &v)
- {
- x -= v.x;
- y -= v.y;
- z -= v.z;
-
- return *this;
- }
-
- Vector &Vector::operator*=(float s)
- {
- x *= s;
- y *= s;
- z *= s;
-
- return *this;
- }
-
- Vector &Vector::operator/=(float s)
- {
- float r = 1.0f / s;
-
- return *this *= r;
- }
-
- bool operator==(const Vector &U, const Vector &v)
- {
- if(U.x == v.x && U.y == v.y && U.z == v.z)
- return true;
- else
- return false;
- }
-
- bool operator!=(const Vector &U, const Vector &v)
- {
- if(U.x != v.x || U.y != v.y || U.z != v.z)
- return true;
- else
- return false;
- }
-
- bool operator>(const Vector &u, const Vector &v)
- {
- if((u^2) > (v^2))
- return true;
- else
- return false;
- }
-
- bool operator<(const Vector &u, const Vector &v)
- {
- if((u^2) < (v^2))
- return true;
- else
- return false;
- }
-
- Vector operator+(const Vector &u, const Vector &v)
- {
- return Vector(u.x + v.x, u.y + v.y, u.z + v.z);
- }
-
- Vector operator-(const Vector &u, const Vector &v)
- {
- return Vector(u.x - v.x, u.y - v.y, u.z - v.z);
- }
-
- float operator*(const Vector &u, const Vector &v)
- {
- return u.x * v.x + u.y * v.y + u.z * v.z;
- }
-
- Vector operator*(float s, const Vector &v)
- {
- return Vector(s * v.x, s * v.y, s * v.z);
- }
-
- Vector operator*(const Vector &v, float s)
- {
- return Vector(v.x * s, v.y * s, v.z * s);
- }
-
- Vector operator/(const Vector &v, float s)
- {
- float r = 1.0f / s;
-
- return Vector(v.x * r, v.y * r, v.z * r);
- }
-
- float operator^(const Vector &u, const Vector &v)
- {
- return acos(u / Vector::N(u) * v / Vector::N(v));
- }
-
- Vector operator%(const Vector &u, const Vector &v)
- {
- return Vector(u.y * v.z - u.z * v.y, u.z * v.x - u.x * v.z, u.x * v.y - u.y * v.x);
- }
-
- Vector operator*(const Matrix &M, const Vector &v)
- {
- return Vector(M(1, 1) * v.x + M(1, 2) * v.y + M(1, 3) * v.z,
- M(2, 1) * v.x + M(2, 2) * v.y + M(2, 3) * v.z,
- M(3, 1) * v.x + M(3, 2) * v.y + M(3, 3) * v.z);
- }
-
- Vector operator*(const Vector &v, const Matrix &M)
- {
- return Vector(v.x * M(1, 1) + v.y * M(2, 1) + v.z * M(3, 1) + M(4, 1),
- v.x * M(1, 2) + v.y * M(2, 2) + v.z * M(3, 2) + M(4, 2),
- v.x * M(1, 3) + v.y * M(2, 3) + v.z * M(3, 3) + M(4, 3));
- }
-
- Vector &operator*=(Vector &v, const Matrix &M)
- {
- return v = v * M;
- }
-
- float Vector::N(const Vector &v)
- {
- return sqrt(v.x*v.x + v.y*v.y + v.z*v.z);
- }
-
- float Vector::N2(const Vector &v)
- {
- return v.x*v.x + v.y*v.y + v.z*v.z;
- }
-
- Vector lerp(const Vector &u, const Vector &v, float t)
- {
- return Vector(u.x + t * (v.x - u.x),
- u.y + t * (v.y - u.y),
- u.z + t * (v.z - u.z));
- }
-}
diff --git a/src/Renderer/Vector.hpp b/src/Renderer/Vector.hpp
deleted file mode 100644
index e7f261da6..000000000
--- a/src/Renderer/Vector.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Vector_hpp
-#define Vector_hpp
-
-namespace sw
-{
- struct Point;
- struct Matrix;
- struct Plane;
-
- struct Vector
- {
- Vector();
- Vector(const int i);
- Vector(const Vector &v);
- Vector(const Point &p);
- Vector(float v_x, float v_y, float v_z);
-
- Vector &operator=(const Vector &v);
-
- union
- {
- float v[3];
-
- struct
- {
- float x;
- float y;
- float z;
- };
- };
-
- float &operator[](int i);
- float &operator()(int i);
-
- const float &operator[](int i) const;
- const float &operator()(int i) const;
-
- Vector operator+() const;
- Vector operator-() const;
-
- Vector &operator+=(const Vector &v);
- Vector &operator-=(const Vector &v);
- Vector &operator*=(float s);
- Vector &operator/=(float s);
-
- friend bool operator==(const Vector &u, const Vector &v);
- friend bool operator!=(const Vector &u, const Vector &v);
-
- friend Vector operator+(const Vector &u, const Vector &v);
- friend Vector operator-(const Vector &u, const Vector &v);
- friend float operator*(const Vector &u, const Vector &v); // Dot product
- friend Vector operator*(float s, const Vector &v);
- friend Vector operator*(const Vector &v, float s);
- friend Vector operator/(const Vector &v, float s);
- friend float operator^(const Vector &u, const Vector &v); // Angle between vectors
- friend Vector operator%(const Vector &u, const Vector &v); // Cross product
-
- friend Vector operator*(const Matrix &M, const Vector& v);
- friend Vector operator*(const Vector &v, const Matrix &M);
- friend Vector &operator*=(Vector &v, const Matrix &M);
-
- static float N(const Vector &v); // Norm
- static float N2(const Vector &v); // Squared norm
-
- static Vector mirror(const Vector &v, const Plane &p);
- static Vector reflect(const Vector &v, const Plane &p);
- static Vector lerp(const Vector &u, const Vector &v, float t);
- };
-}
-
-#include "Point.hpp"
-
-namespace sw
-{
- inline Vector::Vector()
- {
- }
-
- inline Vector::Vector(const int i)
- {
- const float s = (float)i;
-
- x = s;
- y = s;
- z = s;
- }
-
- inline Vector::Vector(const Vector &v)
- {
- x = v.x;
- y = v.y;
- z = v.z;
- }
-
- inline Vector::Vector(const Point &P)
- {
- x = P.x;
- y = P.y;
- z = P.z;
- }
-
- inline Vector::Vector(float v_x, float v_y, float v_z)
- {
- x = v_x;
- y = v_y;
- z = v_z;
- }
-
- inline Vector &Vector::operator=(const Vector &v)
- {
- x = v.x;
- y = v.y;
- z = v.z;
-
- return *this;
- }
-
- inline float &Vector::operator()(int i)
- {
- return v[i];
- }
-
- inline float &Vector::operator[](int i)
- {
- return v[i];
- }
-
- inline const float &Vector::operator()(int i) const
- {
- return v[i];
- }
-
- inline const float &Vector::operator[](int i) const
- {
- return v[i];
- }
-}
-
-#endif // Vector_hpp
diff --git a/src/Renderer/Vertex.hpp b/src/Renderer/Vertex.hpp
deleted file mode 100644
index 9ae8d1434..000000000
--- a/src/Renderer/Vertex.hpp
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef Vertex_hpp
-#define Vertex_hpp
-
-#include "Color.hpp"
-#include "Common/Types.hpp"
-#include "Main/Config.hpp"
-
-namespace sw
-{
- enum Out
- {
- // Default vertex output semantics
- Pos = 0,
- C0 = 1, // Diffuse
- C1 = 2, // Specular
- T0 = 3,
- T1 = 4,
- T2 = 5,
- T3 = 6,
- T4 = 7,
- T5 = 8,
- T6 = 9,
- T7 = 10,
- Fog = 11, // x component
- Pts = Fog, // y component
-
- // Variable semantics
- V0 = 0,
- Vn_1 = MAX_VERTEX_OUTPUTS - 1,
-
- Unused,
- VERTEX_OUTPUT_LAST = Unused,
- };
-
- struct UVWQ
- {
- float u;
- float v;
- float w;
- float q;
-
- float &operator[](int i)
- {
- return (&u)[i];
- }
- };
-
- ALIGN(16, struct Vertex
- {
- union
- {
- struct // Fixed semantics
- {
- // Position
- float x;
- float y;
- float z;
- float w;
-
- float4 C[2]; // Diffuse and specular color
-
- UVWQ T[8]; // Texture coordinates
-
- float f; // Fog
- float pSize; // Point size
- };
-
- float4 v[MAX_VERTEX_OUTPUTS]; // Generic components using semantic declaration
- };
-
- // Projected coordinates
- int X;
- int Y;
- float Z;
- float W;
-
- int clipFlags;
- int padding[3];
- });
-
- static_assert((sizeof(Vertex) & 0x0000000F) == 0, "Vertex size not a multiple of 16 bytes (alignment requirement)");
-}
-
-#endif // Vertex_hpp
diff --git a/src/Renderer/VertexProcessor.cpp b/src/Renderer/VertexProcessor.cpp
deleted file mode 100644
index 0020d747c..000000000
--- a/src/Renderer/VertexProcessor.cpp
+++ /dev/null
@@ -1,1126 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexProcessor.hpp"
-
-#include "Shader/VertexPipeline.hpp"
-#include "Shader/VertexProgram.hpp"
-#include "Shader/VertexShader.hpp"
-#include "Shader/PixelShader.hpp"
-#include "Shader/Constants.hpp"
-#include "Common/Math.hpp"
-#include "Common/Memory.hpp"
-#include "Common/Debug.hpp"
-
-#include <cstring>
-
-namespace sw
-{
- bool precacheVertex = false;
-
- void VertexCache::clear()
- {
- for(int i = 0; i < 16; i++)
- {
- tag[i] = 0x80000000;
- }
- }
-
- uint32_t VertexProcessor::States::computeHash()
- {
- uint32_t *state = reinterpret_cast<uint32_t*>(this);
- uint32_t hash = 0;
-
- for(unsigned int i = 0; i < sizeof(States) / sizeof(uint32_t); i++)
- {
- hash ^= state[i];
- }
-
- return hash;
- }
-
- bool VertexProcessor::State::operator==(const State &state) const
- {
- if(hash != state.hash)
- {
- return false;
- }
-
- static_assert(is_memcmparable<State>::value, "Cannot memcmp States");
- return memcmp(static_cast<const States*>(this), static_cast<const States*>(&state), sizeof(States)) == 0;
- }
-
- VertexProcessor::TransformFeedbackInfo::TransformFeedbackInfo()
- {
- buffer = nullptr;
- offset = 0;
- reg = 0;
- row = 0;
- col = 0;
- stride = 0;
- }
-
- VertexProcessor::UniformBufferInfo::UniformBufferInfo()
- {
- buffer = nullptr;
- offset = 0;
- }
-
- VertexProcessor::VertexProcessor(Context *context) : context(context)
- {
- for(int i = 0; i < 12; i++)
- {
- M[i] = 1;
- }
-
- V = 1;
- B = 1;
- P = 0;
- PB = 0;
- PBV = 0;
-
- for(int i = 0; i < 12; i++)
- {
- PBVM[i] = 0;
- }
-
- setLightingEnable(true);
- setSpecularEnable(false);
-
- for(int i = 0; i < 8; i++)
- {
- setLightEnable(i, false);
- setLightPosition(i, 0);
- }
-
- updateMatrix = true;
- updateViewMatrix = true;
- updateBaseMatrix = true;
- updateProjectionMatrix = true;
- updateLighting = true;
-
- for(int i = 0; i < 12; i++)
- {
- updateModelMatrix[i] = true;
- }
-
- routineCache = nullptr;
- setRoutineCacheSize(1024);
- }
-
- VertexProcessor::~VertexProcessor()
- {
- delete routineCache;
- routineCache = nullptr;
- }
-
- // This object has to be mem aligned
- void *VertexProcessor::operator new(size_t size)
- {
- ASSERT(size == sizeof(VertexProcessor)); // This operator can't be called from a derived class
- return sw::allocate(sizeof(VertexProcessor), 16);
- }
-
- void VertexProcessor::operator delete(void *mem)
- {
- sw::deallocate(mem);
- }
-
- void VertexProcessor::setInputStream(int index, const Stream &stream)
- {
- context->input[index] = stream;
- }
-
- void VertexProcessor::resetInputStreams(bool preTransformed)
- {
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- context->input[i].defaults();
- }
-
- context->preTransformed = preTransformed;
- }
-
- void VertexProcessor::setFloatConstant(unsigned int index, const float value[4])
- {
- if(index < VERTEX_UNIFORM_VECTORS)
- {
- c[index][0] = value[0];
- c[index][1] = value[1];
- c[index][2] = value[2];
- c[index][3] = value[3];
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setIntegerConstant(unsigned int index, const int integer[4])
- {
- if(index < 16)
- {
- i[index][0] = integer[0];
- i[index][1] = integer[1];
- i[index][2] = integer[2];
- i[index][3] = integer[3];
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setBooleanConstant(unsigned int index, int boolean)
- {
- if(index < 16)
- {
- b[index] = boolean != 0;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setUniformBuffer(int index, sw::Resource* buffer, int offset)
- {
- uniformBufferInfo[index].buffer = buffer;
- uniformBufferInfo[index].offset = offset;
- }
-
- void VertexProcessor::lockUniformBuffers(byte** u, sw::Resource* uniformBuffers[])
- {
- for(int i = 0; i < MAX_UNIFORM_BUFFER_BINDINGS; ++i)
- {
- u[i] = uniformBufferInfo[i].buffer ? static_cast<byte*>(uniformBufferInfo[i].buffer->lock(PUBLIC, PRIVATE)) + uniformBufferInfo[i].offset : nullptr;
- uniformBuffers[i] = uniformBufferInfo[i].buffer;
- }
- }
-
- void VertexProcessor::setTransformFeedbackBuffer(int index, sw::Resource* buffer, int offset, unsigned int reg, unsigned int row, unsigned int col, unsigned int stride)
- {
- transformFeedbackInfo[index].buffer = buffer;
- transformFeedbackInfo[index].offset = offset;
- transformFeedbackInfo[index].reg = reg;
- transformFeedbackInfo[index].row = row;
- transformFeedbackInfo[index].col = col;
- transformFeedbackInfo[index].stride = stride;
- }
-
- void VertexProcessor::lockTransformFeedbackBuffers(byte** t, unsigned int* v, unsigned int* r, unsigned int* c, unsigned int* s, sw::Resource* transformFeedbackBuffers[])
- {
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; ++i)
- {
- t[i] = transformFeedbackInfo[i].buffer ? static_cast<byte*>(transformFeedbackInfo[i].buffer->lock(PUBLIC, PRIVATE)) + transformFeedbackInfo[i].offset : nullptr;
- transformFeedbackBuffers[i] = transformFeedbackInfo[i].buffer;
- v[i] = transformFeedbackInfo[i].reg;
- r[i] = transformFeedbackInfo[i].row;
- c[i] = transformFeedbackInfo[i].col;
- s[i] = transformFeedbackInfo[i].stride;
- }
- }
-
- void VertexProcessor::setModelMatrix(const Matrix &M, int i)
- {
- if(i < 12)
- {
- this->M[i] = M;
-
- updateMatrix = true;
- updateModelMatrix[i] = true;
- updateLighting = true;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setViewMatrix(const Matrix &V)
- {
- this->V = V;
-
- updateMatrix = true;
- updateViewMatrix = true;
- }
-
- void VertexProcessor::setBaseMatrix(const Matrix &B)
- {
- this->B = B;
-
- updateMatrix = true;
- updateBaseMatrix = true;
- }
-
- void VertexProcessor::setProjectionMatrix(const Matrix &P)
- {
- this->P = P;
- context->wBasedFog = (P[3][0] != 0.0f) || (P[3][1] != 0.0f) || (P[3][2] != 0.0f) || (P[3][3] != 1.0f);
-
- updateMatrix = true;
- updateProjectionMatrix = true;
- }
-
- void VertexProcessor::setLightingEnable(bool lightingEnable)
- {
- context->setLightingEnable(lightingEnable);
-
- updateLighting = true;
- }
-
- void VertexProcessor::setLightEnable(unsigned int light, bool lightEnable)
- {
- if(light < 8)
- {
- context->setLightEnable(light, lightEnable);
- }
- else ASSERT(false);
-
- updateLighting = true;
- }
-
- void VertexProcessor::setSpecularEnable(bool specularEnable)
- {
- context->setSpecularEnable(specularEnable);
-
- updateLighting = true;
- }
-
- void VertexProcessor::setLightPosition(unsigned int light, const Point &lightPosition)
- {
- if(light < 8)
- {
- context->setLightPosition(light, lightPosition);
- }
- else ASSERT(false);
-
- updateLighting = true;
- }
-
- void VertexProcessor::setLightDiffuse(unsigned int light, const Color<float> &lightDiffuse)
- {
- if(light < 8)
- {
- ff.lightDiffuse[light][0] = lightDiffuse.r;
- ff.lightDiffuse[light][1] = lightDiffuse.g;
- ff.lightDiffuse[light][2] = lightDiffuse.b;
- ff.lightDiffuse[light][3] = lightDiffuse.a;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setLightSpecular(unsigned int light, const Color<float> &lightSpecular)
- {
- if(light < 8)
- {
- ff.lightSpecular[light][0] = lightSpecular.r;
- ff.lightSpecular[light][1] = lightSpecular.g;
- ff.lightSpecular[light][2] = lightSpecular.b;
- ff.lightSpecular[light][3] = lightSpecular.a;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setLightAmbient(unsigned int light, const Color<float> &lightAmbient)
- {
- if(light < 8)
- {
- ff.lightAmbient[light][0] = lightAmbient.r;
- ff.lightAmbient[light][1] = lightAmbient.g;
- ff.lightAmbient[light][2] = lightAmbient.b;
- ff.lightAmbient[light][3] = lightAmbient.a;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setLightAttenuation(unsigned int light, float constant, float linear, float quadratic)
- {
- if(light < 8)
- {
- ff.attenuationConstant[light] = replicate(constant);
- ff.attenuationLinear[light] = replicate(linear);
- ff.attenuationQuadratic[light] = replicate(quadratic);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setLightRange(unsigned int light, float lightRange)
- {
- if(light < 8)
- {
- ff.lightRange[light] = lightRange;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setFogEnable(bool fogEnable)
- {
- context->fogEnable = fogEnable;
- }
-
- void VertexProcessor::setVertexFogMode(FogMode fogMode)
- {
- context->vertexFogMode = fogMode;
- }
-
- void VertexProcessor::setInstanceID(int instanceID)
- {
- context->instanceID = instanceID;
- }
-
- void VertexProcessor::setColorVertexEnable(bool colorVertexEnable)
- {
- context->setColorVertexEnable(colorVertexEnable);
- }
-
- void VertexProcessor::setDiffuseMaterialSource(MaterialSource diffuseMaterialSource)
- {
- context->setDiffuseMaterialSource(diffuseMaterialSource);
- }
-
- void VertexProcessor::setSpecularMaterialSource(MaterialSource specularMaterialSource)
- {
- context->setSpecularMaterialSource(specularMaterialSource);
- }
-
- void VertexProcessor::setAmbientMaterialSource(MaterialSource ambientMaterialSource)
- {
- context->setAmbientMaterialSource(ambientMaterialSource);
- }
-
- void VertexProcessor::setEmissiveMaterialSource(MaterialSource emissiveMaterialSource)
- {
- context->setEmissiveMaterialSource(emissiveMaterialSource);
- }
-
- void VertexProcessor::setGlobalAmbient(const Color<float> &globalAmbient)
- {
- ff.globalAmbient[0] = globalAmbient.r;
- ff.globalAmbient[1] = globalAmbient.g;
- ff.globalAmbient[2] = globalAmbient.b;
- ff.globalAmbient[3] = globalAmbient.a;
- }
-
- void VertexProcessor::setMaterialEmission(const Color<float> &emission)
- {
- ff.materialEmission[0] = emission.r;
- ff.materialEmission[1] = emission.g;
- ff.materialEmission[2] = emission.b;
- ff.materialEmission[3] = emission.a;
- }
-
- void VertexProcessor::setMaterialAmbient(const Color<float> &materialAmbient)
- {
- ff.materialAmbient[0] = materialAmbient.r;
- ff.materialAmbient[1] = materialAmbient.g;
- ff.materialAmbient[2] = materialAmbient.b;
- ff.materialAmbient[3] = materialAmbient.a;
- }
-
- void VertexProcessor::setMaterialDiffuse(const Color<float> &diffuseColor)
- {
- ff.materialDiffuse[0] = diffuseColor.r;
- ff.materialDiffuse[1] = diffuseColor.g;
- ff.materialDiffuse[2] = diffuseColor.b;
- ff.materialDiffuse[3] = diffuseColor.a;
- }
-
- void VertexProcessor::setMaterialSpecular(const Color<float> &specularColor)
- {
- ff.materialSpecular[0] = specularColor.r;
- ff.materialSpecular[1] = specularColor.g;
- ff.materialSpecular[2] = specularColor.b;
- ff.materialSpecular[3] = specularColor.a;
- }
-
- void VertexProcessor::setMaterialShininess(float specularPower)
- {
- ff.materialShininess = specularPower;
- }
-
- void VertexProcessor::setLightViewPosition(unsigned int light, const Point &P)
- {
- if(light < 8)
- {
- ff.lightPosition[light][0] = P.x;
- ff.lightPosition[light][1] = P.y;
- ff.lightPosition[light][2] = P.z;
- ff.lightPosition[light][3] = 1;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setRangeFogEnable(bool enable)
- {
- context->rangeFogEnable = enable;
- }
-
- void VertexProcessor::setIndexedVertexBlendEnable(bool indexedVertexBlendEnable)
- {
- context->indexedVertexBlendEnable = indexedVertexBlendEnable;
- }
-
- void VertexProcessor::setVertexBlendMatrixCount(unsigned int vertexBlendMatrixCount)
- {
- if(vertexBlendMatrixCount <= 4)
- {
- context->vertexBlendMatrixCount = vertexBlendMatrixCount;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setTextureWrap(unsigned int stage, int mask)
- {
- if(stage < TEXTURE_IMAGE_UNITS)
- {
- context->textureWrap[stage] = mask;
- }
- else ASSERT(false);
-
- context->textureWrapActive = false;
-
- for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++)
- {
- context->textureWrapActive |= (context->textureWrap[i] != 0x00);
- }
- }
-
- void VertexProcessor::setTexGen(unsigned int stage, TexGen texGen)
- {
- if(stage < 8)
- {
- context->texGen[stage] = texGen;
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setLocalViewer(bool localViewer)
- {
- context->localViewer = localViewer;
- }
-
- void VertexProcessor::setNormalizeNormals(bool normalizeNormals)
- {
- context->normalizeNormals = normalizeNormals;
- }
-
- void VertexProcessor::setTextureMatrix(int stage, const Matrix &T)
- {
- for(int i = 0; i < 4; i++)
- {
- for(int j = 0; j < 4; j++)
- {
- ff.textureTransform[stage][i][j] = T[i][j];
- }
- }
- }
-
- void VertexProcessor::setTextureTransform(int stage, int count, bool project)
- {
- context->textureTransformCount[stage] = count;
- context->textureTransformProject[stage] = project;
- }
-
- void VertexProcessor::setTextureFilter(unsigned int sampler, FilterType textureFilter)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setTextureFilter(textureFilter);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMipmapFilter(unsigned int sampler, MipmapType mipmapFilter)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMipmapFilter(mipmapFilter);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setGatherEnable(unsigned int sampler, bool enable)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setGatherEnable(enable);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setAddressingModeU(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setAddressingModeU(addressMode);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setAddressingModeV(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setAddressingModeV(addressMode);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setAddressingModeW(unsigned int sampler, AddressingMode addressMode)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setAddressingModeW(addressMode);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setReadSRGB(unsigned int sampler, bool sRGB)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setReadSRGB(sRGB);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMipmapLOD(unsigned int sampler, float bias)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMipmapLOD(bias);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setBorderColor(unsigned int sampler, const Color<float> &borderColor)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setBorderColor(borderColor);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMaxAnisotropy(unsigned int sampler, float maxAnisotropy)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMaxAnisotropy(maxAnisotropy);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setHighPrecisionFiltering(unsigned int sampler, bool highPrecisionFiltering)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setHighPrecisionFiltering(highPrecisionFiltering);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setSwizzleR(unsigned int sampler, SwizzleType swizzleR)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setSwizzleR(swizzleR);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setSwizzleG(unsigned int sampler, SwizzleType swizzleG)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setSwizzleG(swizzleG);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setSwizzleB(unsigned int sampler, SwizzleType swizzleB)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setSwizzleB(swizzleB);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setSwizzleA(unsigned int sampler, SwizzleType swizzleA)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setSwizzleA(swizzleA);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setCompareFunc(unsigned int sampler, CompareFunc compFunc)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setCompareFunc(compFunc);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setBaseLevel(unsigned int sampler, int baseLevel)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setBaseLevel(baseLevel);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMaxLevel(unsigned int sampler, int maxLevel)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMaxLevel(maxLevel);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMinLod(unsigned int sampler, float minLod)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMinLod(minLod);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setMaxLod(unsigned int sampler, float maxLod)
- {
- if(sampler < VERTEX_TEXTURE_IMAGE_UNITS)
- {
- context->sampler[TEXTURE_IMAGE_UNITS + sampler].setMaxLod(maxLod);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setSyncRequired(unsigned int sampler, bool isSincRequired)
- {
- if(sampler < TEXTURE_IMAGE_UNITS)
- {
- context->sampler[sampler].setSyncRequired(isSincRequired);
- }
- else ASSERT(false);
- }
-
- void VertexProcessor::setPointSize(float pointSize)
- {
- point.pointSize = replicate(pointSize);
- }
-
- void VertexProcessor::setPointSizeMin(float pointSizeMin)
- {
- point.pointSizeMin = pointSizeMin;
- }
-
- void VertexProcessor::setPointSizeMax(float pointSizeMax)
- {
- point.pointSizeMax = pointSizeMax;
- }
-
- void VertexProcessor::setPointScaleA(float pointScaleA)
- {
- point.pointScaleA = pointScaleA;
- }
-
- void VertexProcessor::setPointScaleB(float pointScaleB)
- {
- point.pointScaleB = pointScaleB;
- }
-
- void VertexProcessor::setPointScaleC(float pointScaleC)
- {
- point.pointScaleC = pointScaleC;
- }
-
- void VertexProcessor::setTransformFeedbackQueryEnabled(bool enable)
- {
- context->transformFeedbackQueryEnabled = enable;
- }
-
- void VertexProcessor::enableTransformFeedback(uint64_t enable)
- {
- context->transformFeedbackEnabled = enable;
- }
-
- const Matrix &VertexProcessor::getModelTransform(int i)
- {
- updateTransform();
- return PBVM[i];
- }
-
- const Matrix &VertexProcessor::getViewTransform()
- {
- updateTransform();
- return PBV;
- }
-
- bool VertexProcessor::isFixedFunction()
- {
- return !context->vertexShader;
- }
-
- void VertexProcessor::setTransform(const Matrix &M, int i)
- {
- ff.transformT[i][0][0] = M[0][0];
- ff.transformT[i][0][1] = M[1][0];
- ff.transformT[i][0][2] = M[2][0];
- ff.transformT[i][0][3] = M[3][0];
-
- ff.transformT[i][1][0] = M[0][1];
- ff.transformT[i][1][1] = M[1][1];
- ff.transformT[i][1][2] = M[2][1];
- ff.transformT[i][1][3] = M[3][1];
-
- ff.transformT[i][2][0] = M[0][2];
- ff.transformT[i][2][1] = M[1][2];
- ff.transformT[i][2][2] = M[2][2];
- ff.transformT[i][2][3] = M[3][2];
-
- ff.transformT[i][3][0] = M[0][3];
- ff.transformT[i][3][1] = M[1][3];
- ff.transformT[i][3][2] = M[2][3];
- ff.transformT[i][3][3] = M[3][3];
- }
-
- void VertexProcessor::setCameraTransform(const Matrix &M, int i)
- {
- ff.cameraTransformT[i][0][0] = M[0][0];
- ff.cameraTransformT[i][0][1] = M[1][0];
- ff.cameraTransformT[i][0][2] = M[2][0];
- ff.cameraTransformT[i][0][3] = M[3][0];
-
- ff.cameraTransformT[i][1][0] = M[0][1];
- ff.cameraTransformT[i][1][1] = M[1][1];
- ff.cameraTransformT[i][1][2] = M[2][1];
- ff.cameraTransformT[i][1][3] = M[3][1];
-
- ff.cameraTransformT[i][2][0] = M[0][2];
- ff.cameraTransformT[i][2][1] = M[1][2];
- ff.cameraTransformT[i][2][2] = M[2][2];
- ff.cameraTransformT[i][2][3] = M[3][2];
-
- ff.cameraTransformT[i][3][0] = M[0][3];
- ff.cameraTransformT[i][3][1] = M[1][3];
- ff.cameraTransformT[i][3][2] = M[2][3];
- ff.cameraTransformT[i][3][3] = M[3][3];
- }
-
- void VertexProcessor::setNormalTransform(const Matrix &M, int i)
- {
- ff.normalTransformT[i][0][0] = M[0][0];
- ff.normalTransformT[i][0][1] = M[1][0];
- ff.normalTransformT[i][0][2] = M[2][0];
- ff.normalTransformT[i][0][3] = M[3][0];
-
- ff.normalTransformT[i][1][0] = M[0][1];
- ff.normalTransformT[i][1][1] = M[1][1];
- ff.normalTransformT[i][1][2] = M[2][1];
- ff.normalTransformT[i][1][3] = M[3][1];
-
- ff.normalTransformT[i][2][0] = M[0][2];
- ff.normalTransformT[i][2][1] = M[1][2];
- ff.normalTransformT[i][2][2] = M[2][2];
- ff.normalTransformT[i][2][3] = M[3][2];
-
- ff.normalTransformT[i][3][0] = M[0][3];
- ff.normalTransformT[i][3][1] = M[1][3];
- ff.normalTransformT[i][3][2] = M[2][3];
- ff.normalTransformT[i][3][3] = M[3][3];
- }
-
- void VertexProcessor::updateTransform()
- {
- if(!updateMatrix) return;
-
- int activeMatrices = context->indexedVertexBlendEnable ? 12 : max(context->vertexBlendMatrixCount, 1);
-
- if(updateProjectionMatrix)
- {
- PB = P * B;
- PBV = PB * V;
-
- for(int i = 0; i < activeMatrices; i++)
- {
- PBVM[i] = PBV * M[i];
- updateModelMatrix[i] = false;
- }
-
- updateProjectionMatrix = false;
- updateBaseMatrix = false;
- updateViewMatrix = false;
- }
-
- if(updateBaseMatrix)
- {
- PB = P * B;
- PBV = PB * V;
-
- for(int i = 0; i < activeMatrices; i++)
- {
- PBVM[i] = PBV * M[i];
- updateModelMatrix[i] = false;
- }
-
- updateBaseMatrix = false;
- updateViewMatrix = false;
- }
-
- if(updateViewMatrix)
- {
- PBV = PB * V;
-
- for(int i = 0; i < activeMatrices; i++)
- {
- PBVM[i] = PBV * M[i];
- updateModelMatrix[i] = false;
- }
-
- updateViewMatrix = false;
- }
-
- for(int i = 0; i < activeMatrices; i++)
- {
- if(updateModelMatrix[i])
- {
- PBVM[i] = PBV * M[i];
- updateModelMatrix[i] = false;
- }
- }
-
- for(int i = 0; i < activeMatrices; i++)
- {
- setTransform(PBVM[i], i);
- setCameraTransform(B * V * M[i], i);
- setNormalTransform(~!(B * V * M[i]), i);
- }
-
- updateMatrix = false;
- }
-
- void VertexProcessor::setRoutineCacheSize(int cacheSize)
- {
- delete routineCache;
- routineCache = new RoutineCache<State>(clamp(cacheSize, 1, 65536));
- }
-
- const VertexProcessor::State VertexProcessor::update(DrawType drawType)
- {
- if(isFixedFunction())
- {
- updateTransform();
-
- if(updateLighting)
- {
- for(int i = 0; i < 8; i++)
- {
- if(context->vertexLightActive(i))
- {
- // Light position in camera coordinates
- setLightViewPosition(i, B * V * context->getLightPosition(i));
- }
- }
-
- updateLighting = false;
- }
- }
-
- State state;
-
- if(context->vertexShader)
- {
- state.shaderID = context->vertexShader->getSerialID();
- }
- else
- {
- state.shaderID = 0;
- }
-
- state.fixedFunction = !context->vertexShader && context->pixelShaderModel() < 0x0300;
- state.textureSampling = context->vertexShader ? context->vertexShader->containsTextureSampling() : false;
- state.positionRegister = context->vertexShader ? context->vertexShader->getPositionRegister() : Pos;
- state.pointSizeRegister = context->vertexShader ? context->vertexShader->getPointSizeRegister() : Pts;
-
- state.vertexBlendMatrixCount = context->vertexBlendMatrixCountActive();
- state.indexedVertexBlendEnable = context->indexedVertexBlendActive();
- state.vertexNormalActive = context->vertexNormalActive();
- state.normalizeNormals = context->normalizeNormalsActive();
- state.vertexLightingActive = context->vertexLightingActive();
- state.diffuseActive = context->diffuseActive();
- state.specularActive = context->specularActive();
- state.vertexSpecularActive = context->vertexSpecularActive();
-
- state.vertexLightActive = context->vertexLightActive(0) << 0 |
- context->vertexLightActive(1) << 1 |
- context->vertexLightActive(2) << 2 |
- context->vertexLightActive(3) << 3 |
- context->vertexLightActive(4) << 4 |
- context->vertexLightActive(5) << 5 |
- context->vertexLightActive(6) << 6 |
- context->vertexLightActive(7) << 7;
-
- state.vertexDiffuseMaterialSourceActive = context->vertexDiffuseMaterialSourceActive();
- state.vertexSpecularMaterialSourceActive = context->vertexSpecularMaterialSourceActive();
- state.vertexAmbientMaterialSourceActive = context->vertexAmbientMaterialSourceActive();
- state.vertexEmissiveMaterialSourceActive = context->vertexEmissiveMaterialSourceActive();
- state.fogActive = context->fogActive();
- state.vertexFogMode = context->vertexFogModeActive();
- state.rangeFogActive = context->rangeFogActive();
- state.localViewerActive = context->localViewerActive();
- state.pointSizeActive = context->pointSizeActive();
- state.pointScaleActive = context->pointScaleActive();
-
- state.preTransformed = context->preTransformed;
- state.superSampling = context->getSuperSampleCount() > 1;
-
- state.transformFeedbackQueryEnabled = context->transformFeedbackQueryEnabled;
- state.transformFeedbackEnabled = context->transformFeedbackEnabled;
-
- // Note: Quads aren't handled for verticesPerPrimitive, but verticesPerPrimitive is used for transform feedback,
- // which is an OpenGL ES 3.0 feature, and OpenGL ES 3.0 doesn't support quads as a primitive type.
- DrawType type = static_cast<DrawType>(static_cast<unsigned int>(drawType) & 0xF);
- state.verticesPerPrimitive = 1 + (type >= DRAW_LINELIST) + (type >= DRAW_TRIANGLELIST);
-
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- state.input[i].type = context->input[i].type;
- state.input[i].count = context->input[i].count;
- state.input[i].normalized = context->input[i].normalized;
- state.input[i].attribType = context->vertexShader ? context->vertexShader->getAttribType(i) : VertexShader::ATTRIBTYPE_FLOAT;
- }
-
- if(!context->vertexShader)
- {
- for(int i = 0; i < 8; i++)
- {
- // state.textureState[i].vertexTextureActive = context->vertexTextureActive(i, 0);
- state.textureState[i].texGenActive = context->texGenActive(i);
- state.textureState[i].textureTransformCountActive = context->textureTransformCountActive(i);
- state.textureState[i].texCoordIndexActive = context->texCoordIndexActive(i);
- }
- }
- else
- {
- for(unsigned int i = 0; i < VERTEX_TEXTURE_IMAGE_UNITS; i++)
- {
- if(context->vertexShader->usesSampler(i))
- {
- state.sampler[i] = context->sampler[TEXTURE_IMAGE_UNITS + i].samplerState();
- }
- }
- }
-
- if(context->vertexShader) // FIXME: Also when pre-transformed?
- {
- for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
- {
- state.output[i].xWrite = context->vertexShader->getOutput(i, 0).active();
- state.output[i].yWrite = context->vertexShader->getOutput(i, 1).active();
- state.output[i].zWrite = context->vertexShader->getOutput(i, 2).active();
- state.output[i].wWrite = context->vertexShader->getOutput(i, 3).active();
- }
- }
- else if(!context->preTransformed || context->pixelShaderModel() < 0x0300)
- {
- state.output[Pos].write = 0xF;
-
- if(context->diffuseActive() && (context->lightingEnable || context->input[Color0]))
- {
- state.output[C0].write = 0xF;
- }
-
- if(context->specularActive())
- {
- state.output[C1].write = 0xF;
- }
-
- for(int stage = 0; stage < 8; stage++)
- {
- if(context->texCoordActive(stage, 0)) state.output[T0 + stage].write |= 0x01;
- if(context->texCoordActive(stage, 1)) state.output[T0 + stage].write |= 0x02;
- if(context->texCoordActive(stage, 2)) state.output[T0 + stage].write |= 0x04;
- if(context->texCoordActive(stage, 3)) state.output[T0 + stage].write |= 0x08;
- }
-
- if(context->fogActive())
- {
- state.output[Fog].xWrite = true;
- }
-
- if(context->pointSizeActive())
- {
- state.output[Pts].yWrite = true;
- }
- }
- else
- {
- state.output[Pos].write = 0xF;
-
- for(int i = 0; i < 2; i++)
- {
- if(context->input[Color0 + i])
- {
- state.output[C0 + i].write = 0xF;
- }
- }
-
- for(int i = 0; i < 8; i++)
- {
- if(context->input[TexCoord0 + i])
- {
- state.output[T0 + i].write = 0xF;
- }
- }
-
- if(context->input[PointSize])
- {
- state.output[Pts].yWrite = true;
- }
- }
-
- if(context->vertexShaderModel() < 0x0300)
- {
- state.output[C0].clamp = 0xF;
- state.output[C1].clamp = 0xF;
- state.output[Fog].xClamp = true;
- }
-
- state.hash = state.computeHash();
-
- return state;
- }
-
- std::shared_ptr<Routine> VertexProcessor::routine(const State &state)
- {
- auto routine = routineCache->query(state);
-
- if(!routine) // Create one
- {
- VertexRoutine *generator = nullptr;
-
- if(state.fixedFunction)
- {
- generator = new VertexPipeline(state);
- }
- else
- {
- generator = new VertexProgram(state, context->vertexShader);
- }
-
- generator->generate();
- routine = (*generator)("VertexRoutine_%0.8X", state.shaderID);
- delete generator;
-
- routineCache->add(state, routine);
- }
-
- return routine;
- }
-}
diff --git a/src/Renderer/VertexProcessor.hpp b/src/Renderer/VertexProcessor.hpp
deleted file mode 100644
index 7321e6991..000000000
--- a/src/Renderer/VertexProcessor.hpp
+++ /dev/null
@@ -1,354 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_VertexProcessor_hpp
-#define sw_VertexProcessor_hpp
-
-#include "Matrix.hpp"
-#include "Context.hpp"
-#include "RoutineCache.hpp"
-#include "Shader/VertexShader.hpp"
-
-namespace sw
-{
- struct DrawData;
-
- struct VertexCache // FIXME: Variable size
- {
- void clear();
-
- Vertex vertex[16][4];
- unsigned int tag[16];
-
- int drawCall;
- };
-
- struct VertexTask
- {
- unsigned int vertexCount;
- unsigned int primitiveStart;
- VertexCache vertexCache;
- };
-
- class VertexProcessor
- {
- public:
- struct States : Memset<States>
- {
- States() : Memset(this, 0) {}
-
- uint32_t computeHash();
-
- uint64_t shaderID;
-
- bool fixedFunction : 1; // TODO: Eliminate by querying shader.
- bool textureSampling : 1; // TODO: Eliminate by querying shader.
- unsigned int positionRegister : BITS(MAX_VERTEX_OUTPUTS); // TODO: Eliminate by querying shader.
- unsigned int pointSizeRegister : BITS(MAX_VERTEX_OUTPUTS); // TODO: Eliminate by querying shader.
-
- unsigned int vertexBlendMatrixCount : 3;
- bool indexedVertexBlendEnable : 1;
- bool vertexNormalActive : 1;
- bool normalizeNormals : 1;
- bool vertexLightingActive : 1;
- bool diffuseActive : 1;
- bool specularActive : 1;
- bool vertexSpecularActive : 1;
- unsigned int vertexLightActive : 8;
- MaterialSource vertexDiffuseMaterialSourceActive : BITS(MATERIAL_LAST);
- MaterialSource vertexSpecularMaterialSourceActive : BITS(MATERIAL_LAST);
- MaterialSource vertexAmbientMaterialSourceActive : BITS(MATERIAL_LAST);
- MaterialSource vertexEmissiveMaterialSourceActive : BITS(MATERIAL_LAST);
- bool fogActive : 1;
- FogMode vertexFogMode : BITS(FOG_LAST);
- bool rangeFogActive : 1;
- bool localViewerActive : 1;
- bool pointSizeActive : 1;
- bool pointScaleActive : 1;
- bool transformFeedbackQueryEnabled : 1;
- uint64_t transformFeedbackEnabled : 64;
- unsigned char verticesPerPrimitive : 2; // 1 (points), 2 (lines) or 3 (triangles)
-
- bool preTransformed : 1;
- bool superSampling : 1;
-
- struct TextureState
- {
- TexGen texGenActive : BITS(TEXGEN_LAST);
- unsigned char textureTransformCountActive : 3;
- unsigned char texCoordIndexActive : 3;
- };
-
- TextureState textureState[8];
-
- Sampler::State sampler[VERTEX_TEXTURE_IMAGE_UNITS];
-
- struct Input
- {
- operator bool() const // Returns true if stream contains data
- {
- return count != 0;
- }
-
- StreamType type : BITS(STREAMTYPE_LAST);
- unsigned int count : 3;
- bool normalized : 1;
- unsigned int attribType : BITS(VertexShader::ATTRIBTYPE_LAST);
- };
-
- struct Output
- {
- union
- {
- unsigned char write : 4;
-
- struct
- {
- unsigned char xWrite : 1;
- unsigned char yWrite : 1;
- unsigned char zWrite : 1;
- unsigned char wWrite : 1;
- };
- };
-
- union
- {
- unsigned char clamp : 4;
-
- struct
- {
- unsigned char xClamp : 1;
- unsigned char yClamp : 1;
- unsigned char zClamp : 1;
- unsigned char wClamp : 1;
- };
- };
- };
-
- Input input[MAX_VERTEX_INPUTS];
- Output output[MAX_VERTEX_OUTPUTS];
- };
-
- struct State : States
- {
- bool operator==(const State &state) const;
-
- uint32_t hash;
- };
-
- struct FixedFunction
- {
- float4 transformT[12][4];
- float4 cameraTransformT[12][4];
- float4 normalTransformT[12][4];
- float4 textureTransform[8][4];
-
- float4 lightPosition[8];
- float4 lightAmbient[8];
- float4 lightSpecular[8];
- float4 lightDiffuse[8];
- float4 attenuationConstant[8];
- float4 attenuationLinear[8];
- float4 attenuationQuadratic[8];
- float lightRange[8];
- float4 materialDiffuse;
- float4 materialSpecular;
- float materialShininess;
- float4 globalAmbient;
- float4 materialEmission;
- float4 materialAmbient;
- };
-
- struct PointSprite
- {
- float4 pointSize;
- float pointSizeMin;
- float pointSizeMax;
- float pointScaleA;
- float pointScaleB;
- float pointScaleC;
- };
-
- typedef void (*RoutinePointer)(Vertex *output, unsigned int *batch, VertexTask *vertexTask, DrawData *draw);
-
- VertexProcessor(Context *context);
-
- virtual ~VertexProcessor();
-
- void *operator new(size_t size);
- void operator delete(void *mem);
-
- void setInputStream(int index, const Stream &stream);
- void resetInputStreams(bool preTransformed);
-
- void setFloatConstant(unsigned int index, const float value[4]);
- void setIntegerConstant(unsigned int index, const int integer[4]);
- void setBooleanConstant(unsigned int index, int boolean);
-
- void setUniformBuffer(int index, sw::Resource* uniformBuffer, int offset);
- void lockUniformBuffers(byte** u, sw::Resource* uniformBuffers[]);
-
- void setTransformFeedbackBuffer(int index, sw::Resource* transformFeedbackBuffer, int offset, unsigned int reg, unsigned int row, unsigned int col, unsigned int stride);
- void lockTransformFeedbackBuffers(byte** t, unsigned int* v, unsigned int* r, unsigned int* c, unsigned int* s, sw::Resource* transformFeedbackBuffers[]);
-
- // Transformations
- void setModelMatrix(const Matrix &M, int i = 0);
- void setViewMatrix(const Matrix &V);
- void setBaseMatrix(const Matrix &B);
- void setProjectionMatrix(const Matrix &P);
-
- // Lighting
- void setLightingEnable(bool lightingEnable);
- void setLightEnable(unsigned int light, bool lightEnable);
- void setSpecularEnable(bool specularEnable);
-
- void setGlobalAmbient(const Color<float> &globalAmbient);
- void setLightPosition(unsigned int light, const Point &lightPosition);
- void setLightViewPosition(unsigned int light, const Point &lightPosition);
- void setLightDiffuse(unsigned int light, const Color<float> &lightDiffuse);
- void setLightSpecular(unsigned int light, const Color<float> &lightSpecular);
- void setLightAmbient(unsigned int light, const Color<float> &lightAmbient);
- void setLightAttenuation(unsigned int light, float constant, float linear, float quadratic);
- void setLightRange(unsigned int light, float lightRange);
-
- void setInstanceID(int instanceID);
-
- void setFogEnable(bool fogEnable);
- void setVertexFogMode(FogMode fogMode);
- void setRangeFogEnable(bool enable);
-
- void setColorVertexEnable(bool colorVertexEnable);
- void setDiffuseMaterialSource(MaterialSource diffuseMaterialSource);
- void setSpecularMaterialSource(MaterialSource specularMaterialSource);
- void setAmbientMaterialSource(MaterialSource ambientMaterialSource);
- void setEmissiveMaterialSource(MaterialSource emissiveMaterialSource);
-
- void setMaterialEmission(const Color<float> &emission);
- void setMaterialAmbient(const Color<float> &materialAmbient);
- void setMaterialDiffuse(const Color<float> &diffuseColor);
- void setMaterialSpecular(const Color<float> &specularColor);
- void setMaterialShininess(float specularPower);
-
- void setIndexedVertexBlendEnable(bool indexedVertexBlendEnable);
- void setVertexBlendMatrixCount(unsigned int vertexBlendMatrixCount);
-
- void setTextureWrap(unsigned int stage, int mask);
- void setTexGen(unsigned int stage, TexGen texGen);
- void setLocalViewer(bool localViewer);
- void setNormalizeNormals(bool normalizeNormals);
- void setTextureMatrix(int stage, const Matrix &T);
- void setTextureTransform(int stage, int count, bool project);
-
- void setTextureFilter(unsigned int sampler, FilterType textureFilter);
- void setMipmapFilter(unsigned int sampler, MipmapType mipmapFilter);
- void setGatherEnable(unsigned int sampler, bool enable);
- void setAddressingModeU(unsigned int sampler, AddressingMode addressingMode);
- void setAddressingModeV(unsigned int sampler, AddressingMode addressingMode);
- void setAddressingModeW(unsigned int sampler, AddressingMode addressingMode);
- void setReadSRGB(unsigned int sampler, bool sRGB);
- void setMipmapLOD(unsigned int sampler, float bias);
- void setBorderColor(unsigned int sampler, const Color<float> &borderColor);
- void setMaxAnisotropy(unsigned int stage, float maxAnisotropy);
- void setHighPrecisionFiltering(unsigned int sampler, bool highPrecisionFiltering);
- void setSwizzleR(unsigned int sampler, SwizzleType swizzleR);
- void setSwizzleG(unsigned int sampler, SwizzleType swizzleG);
- void setSwizzleB(unsigned int sampler, SwizzleType swizzleB);
- void setSwizzleA(unsigned int sampler, SwizzleType swizzleA);
- void setCompareFunc(unsigned int sampler, CompareFunc compare);
- void setBaseLevel(unsigned int sampler, int baseLevel);
- void setMaxLevel(unsigned int sampler, int maxLevel);
- void setMinLod(unsigned int sampler, float minLod);
- void setMaxLod(unsigned int sampler, float maxLod);
- void setSyncRequired(unsigned int sampler, bool isSincRequired);
-
- void setPointSize(float pointSize);
- void setPointSizeMin(float pointSizeMin);
- void setPointSizeMax(float pointSizeMax);
- void setPointScaleA(float pointScaleA);
- void setPointScaleB(float pointScaleB);
- void setPointScaleC(float pointScaleC);
-
- void setTransformFeedbackQueryEnabled(bool enable);
- void enableTransformFeedback(uint64_t enable);
-
- protected:
- const Matrix &getModelTransform(int i);
- const Matrix &getViewTransform();
-
- const State update(DrawType drawType);
- std::shared_ptr<Routine> routine(const State &state);
-
- bool isFixedFunction();
- void setRoutineCacheSize(int cacheSize);
-
- // Shader constants
- float4 c[VERTEX_UNIFORM_VECTORS + 1]; // One extra for indices out of range, c[VERTEX_UNIFORM_VECTORS] = {0, 0, 0, 0}
- int4 i[16];
- bool b[16];
-
- PointSprite point;
- FixedFunction ff;
-
- private:
- struct UniformBufferInfo
- {
- UniformBufferInfo();
-
- Resource* buffer;
- int offset;
- };
- UniformBufferInfo uniformBufferInfo[MAX_UNIFORM_BUFFER_BINDINGS];
-
- struct TransformFeedbackInfo
- {
- TransformFeedbackInfo();
-
- Resource* buffer;
- unsigned int offset;
- unsigned int reg;
- unsigned int row;
- unsigned int col;
- unsigned int stride;
- };
- TransformFeedbackInfo transformFeedbackInfo[MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS];
-
- void updateTransform();
- void setTransform(const Matrix &M, int i);
- void setCameraTransform(const Matrix &M, int i);
- void setNormalTransform(const Matrix &M, int i);
-
- Context *const context;
-
- RoutineCache<State> *routineCache;
-
- protected:
- Matrix M[12]; // Model/Geometry/World matrix
- Matrix V; // View/Camera/Eye matrix
- Matrix B; // Base matrix
- Matrix P; // Projection matrix
- Matrix PB; // P * B
- Matrix PBV; // P * B * V
- Matrix PBVM[12]; // P * B * V * M
-
- // Update hierarchy
- bool updateMatrix;
- bool updateModelMatrix[12];
- bool updateViewMatrix;
- bool updateBaseMatrix;
- bool updateProjectionMatrix;
- bool updateLighting;
- };
-}
-
-#endif // sw_VertexProcessor_hpp
diff --git a/src/Shader/Constants.cpp b/src/Shader/Constants.cpp
deleted file mode 100644
index 06dda32fa..000000000
--- a/src/Shader/Constants.cpp
+++ /dev/null
@@ -1,362 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Constants.hpp"
-
-#include "Common/Math.hpp"
-#include "Common/Half.hpp"
-
-#include <memory.h>
-
-namespace sw
-{
- Constants constants;
-
- Constants::Constants()
- {
- static const unsigned int transposeBit0[16] =
- {
- 0x00000000,
- 0x00000001,
- 0x00000010,
- 0x00000011,
- 0x00000100,
- 0x00000101,
- 0x00000110,
- 0x00000111,
- 0x00001000,
- 0x00001001,
- 0x00001010,
- 0x00001011,
- 0x00001100,
- 0x00001101,
- 0x00001110,
- 0x00001111
- };
-
- static const unsigned int transposeBit1[16] =
- {
- 0x00000000,
- 0x00000002,
- 0x00000020,
- 0x00000022,
- 0x00000200,
- 0x00000202,
- 0x00000220,
- 0x00000222,
- 0x00002000,
- 0x00002002,
- 0x00002020,
- 0x00002022,
- 0x00002200,
- 0x00002202,
- 0x00002220,
- 0x00002222
- };
-
- static const unsigned int transposeBit2[16] =
- {
- 0x00000000,
- 0x00000004,
- 0x00000040,
- 0x00000044,
- 0x00000400,
- 0x00000404,
- 0x00000440,
- 0x00000444,
- 0x00004000,
- 0x00004004,
- 0x00004040,
- 0x00004044,
- 0x00004400,
- 0x00004404,
- 0x00004440,
- 0x00004444
- };
-
- memcpy(&this->transposeBit0, transposeBit0, sizeof(transposeBit0));
- memcpy(&this->transposeBit1, transposeBit1, sizeof(transposeBit1));
- memcpy(&this->transposeBit2, transposeBit2, sizeof(transposeBit2));
-
- static const ushort4 cWeight[17] =
- {
- {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, // 0xFFFF / 1 = 0xFFFF
- {0xFFFF, 0xFFFF, 0xFFFF, 0xFFFF}, // 0xFFFF / 1 = 0xFFFF
- {0x8000, 0x8000, 0x8000, 0x8000}, // 0xFFFF / 2 = 0x8000
- {0x5555, 0x5555, 0x5555, 0x5555}, // 0xFFFF / 3 = 0x5555
- {0x4000, 0x4000, 0x4000, 0x4000}, // 0xFFFF / 4 = 0x4000
- {0x3333, 0x3333, 0x3333, 0x3333}, // 0xFFFF / 5 = 0x3333
- {0x2AAA, 0x2AAA, 0x2AAA, 0x2AAA}, // 0xFFFF / 6 = 0x2AAA
- {0x2492, 0x2492, 0x2492, 0x2492}, // 0xFFFF / 7 = 0x2492
- {0x2000, 0x2000, 0x2000, 0x2000}, // 0xFFFF / 8 = 0x2000
- {0x1C71, 0x1C71, 0x1C71, 0x1C71}, // 0xFFFF / 9 = 0x1C71
- {0x1999, 0x1999, 0x1999, 0x1999}, // 0xFFFF / 10 = 0x1999
- {0x1745, 0x1745, 0x1745, 0x1745}, // 0xFFFF / 11 = 0x1745
- {0x1555, 0x1555, 0x1555, 0x1555}, // 0xFFFF / 12 = 0x1555
- {0x13B1, 0x13B1, 0x13B1, 0x13B1}, // 0xFFFF / 13 = 0x13B1
- {0x1249, 0x1249, 0x1249, 0x1249}, // 0xFFFF / 14 = 0x1249
- {0x1111, 0x1111, 0x1111, 0x1111}, // 0xFFFF / 15 = 0x1111
- {0x1000, 0x1000, 0x1000, 0x1000}, // 0xFFFF / 16 = 0x1000
- };
-
- static const float4 uvWeight[17] =
- {
- {1.0f / 1.0f, 1.0f / 1.0f, 1.0f / 1.0f, 1.0f / 1.0f},
- {1.0f / 1.0f, 1.0f / 1.0f, 1.0f / 1.0f, 1.0f / 1.0f},
- {1.0f / 2.0f, 1.0f / 2.0f, 1.0f / 2.0f, 1.0f / 2.0f},
- {1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f, 1.0f / 3.0f},
- {1.0f / 4.0f, 1.0f / 4.0f, 1.0f / 4.0f, 1.0f / 4.0f},
- {1.0f / 5.0f, 1.0f / 5.0f, 1.0f / 5.0f, 1.0f / 5.0f},
- {1.0f / 6.0f, 1.0f / 6.0f, 1.0f / 6.0f, 1.0f / 6.0f},
- {1.0f / 7.0f, 1.0f / 7.0f, 1.0f / 7.0f, 1.0f / 7.0f},
- {1.0f / 8.0f, 1.0f / 8.0f, 1.0f / 8.0f, 1.0f / 8.0f},
- {1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9.0f, 1.0f / 9.0f},
- {1.0f / 10.0f, 1.0f / 10.0f, 1.0f / 10.0f, 1.0f / 10.0f},
- {1.0f / 11.0f, 1.0f / 11.0f, 1.0f / 11.0f, 1.0f / 11.0f},
- {1.0f / 12.0f, 1.0f / 12.0f, 1.0f / 12.0f, 1.0f / 12.0f},
- {1.0f / 13.0f, 1.0f / 13.0f, 1.0f / 13.0f, 1.0f / 13.0f},
- {1.0f / 14.0f, 1.0f / 14.0f, 1.0f / 14.0f, 1.0f / 14.0f},
- {1.0f / 15.0f, 1.0f / 15.0f, 1.0f / 15.0f, 1.0f / 15.0f},
- {1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f, 1.0f / 16.0f},
- };
-
- static const float4 uvStart[17] =
- {
- {-0.0f / 2.0f, -0.0f / 2.0f, -0.0f / 2.0f, -0.0f / 2.0f},
- {-0.0f / 2.0f, -0.0f / 2.0f, -0.0f / 2.0f, -0.0f / 2.0f},
- {-1.0f / 4.0f, -1.0f / 4.0f, -1.0f / 4.0f, -1.0f / 4.0f},
- {-2.0f / 6.0f, -2.0f / 6.0f, -2.0f / 6.0f, -2.0f / 6.0f},
- {-3.0f / 8.0f, -3.0f / 8.0f, -3.0f / 8.0f, -3.0f / 8.0f},
- {-4.0f / 10.0f, -4.0f / 10.0f, -4.0f / 10.0f, -4.0f / 10.0f},
- {-5.0f / 12.0f, -5.0f / 12.0f, -5.0f / 12.0f, -5.0f / 12.0f},
- {-6.0f / 14.0f, -6.0f / 14.0f, -6.0f / 14.0f, -6.0f / 14.0f},
- {-7.0f / 16.0f, -7.0f / 16.0f, -7.0f / 16.0f, -7.0f / 16.0f},
- {-8.0f / 18.0f, -8.0f / 18.0f, -8.0f / 18.0f, -8.0f / 18.0f},
- {-9.0f / 20.0f, -9.0f / 20.0f, -9.0f / 20.0f, -9.0f / 20.0f},
- {-10.0f / 22.0f, -10.0f / 22.0f, -10.0f / 22.0f, -10.0f / 22.0f},
- {-11.0f / 24.0f, -11.0f / 24.0f, -11.0f / 24.0f, -11.0f / 24.0f},
- {-12.0f / 26.0f, -12.0f / 26.0f, -12.0f / 26.0f, -12.0f / 26.0f},
- {-13.0f / 28.0f, -13.0f / 28.0f, -13.0f / 28.0f, -13.0f / 28.0f},
- {-14.0f / 30.0f, -14.0f / 30.0f, -14.0f / 30.0f, -14.0f / 30.0f},
- {-15.0f / 32.0f, -15.0f / 32.0f, -15.0f / 32.0f, -15.0f / 32.0f},
- };
-
- memcpy(&this->cWeight, cWeight, sizeof(cWeight));
- memcpy(&this->uvWeight, uvWeight, sizeof(uvWeight));
- memcpy(&this->uvStart, uvStart, sizeof(uvStart));
-
- static const unsigned int occlusionCount[16] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
-
- memcpy(&this->occlusionCount, &occlusionCount, sizeof(occlusionCount));
-
- for(int i = 0; i < 16; i++)
- {
- maskB4Q[i][0] = -(i >> 0 & 1);
- maskB4Q[i][1] = -(i >> 1 & 1);
- maskB4Q[i][2] = -(i >> 2 & 1);
- maskB4Q[i][3] = -(i >> 3 & 1);
- maskB4Q[i][4] = -(i >> 0 & 1);
- maskB4Q[i][5] = -(i >> 1 & 1);
- maskB4Q[i][6] = -(i >> 2 & 1);
- maskB4Q[i][7] = -(i >> 3 & 1);
-
- invMaskB4Q[i][0] = ~maskB4Q[i][0];
- invMaskB4Q[i][1] = ~maskB4Q[i][1];
- invMaskB4Q[i][2] = ~maskB4Q[i][2];
- invMaskB4Q[i][3] = ~maskB4Q[i][3];
- invMaskB4Q[i][4] = ~maskB4Q[i][4];
- invMaskB4Q[i][5] = ~maskB4Q[i][5];
- invMaskB4Q[i][6] = ~maskB4Q[i][6];
- invMaskB4Q[i][7] = ~maskB4Q[i][7];
-
- maskW4Q[i][0] = -(i >> 0 & 1);
- maskW4Q[i][1] = -(i >> 1 & 1);
- maskW4Q[i][2] = -(i >> 2 & 1);
- maskW4Q[i][3] = -(i >> 3 & 1);
-
- invMaskW4Q[i][0] = ~maskW4Q[i][0];
- invMaskW4Q[i][1] = ~maskW4Q[i][1];
- invMaskW4Q[i][2] = ~maskW4Q[i][2];
- invMaskW4Q[i][3] = ~maskW4Q[i][3];
-
- maskD4X[i][0] = -(i >> 0 & 1);
- maskD4X[i][1] = -(i >> 1 & 1);
- maskD4X[i][2] = -(i >> 2 & 1);
- maskD4X[i][3] = -(i >> 3 & 1);
-
- invMaskD4X[i][0] = ~maskD4X[i][0];
- invMaskD4X[i][1] = ~maskD4X[i][1];
- invMaskD4X[i][2] = ~maskD4X[i][2];
- invMaskD4X[i][3] = ~maskD4X[i][3];
-
- maskQ0Q[i] = -(i >> 0 & 1);
- maskQ1Q[i] = -(i >> 1 & 1);
- maskQ2Q[i] = -(i >> 2 & 1);
- maskQ3Q[i] = -(i >> 3 & 1);
-
- invMaskQ0Q[i] = ~maskQ0Q[i];
- invMaskQ1Q[i] = ~maskQ1Q[i];
- invMaskQ2Q[i] = ~maskQ2Q[i];
- invMaskQ3Q[i] = ~maskQ3Q[i];
-
- maskX0X[i][0] = maskX0X[i][1] = maskX0X[i][2] = maskX0X[i][3] = -(i >> 0 & 1);
- maskX1X[i][0] = maskX1X[i][1] = maskX1X[i][2] = maskX1X[i][3] = -(i >> 1 & 1);
- maskX2X[i][0] = maskX2X[i][1] = maskX2X[i][2] = maskX2X[i][3] = -(i >> 2 & 1);
- maskX3X[i][0] = maskX3X[i][1] = maskX3X[i][2] = maskX3X[i][3] = -(i >> 3 & 1);
-
- invMaskX0X[i][0] = invMaskX0X[i][1] = invMaskX0X[i][2] = invMaskX0X[i][3] = ~maskX0X[i][0];
- invMaskX1X[i][0] = invMaskX1X[i][1] = invMaskX1X[i][2] = invMaskX1X[i][3] = ~maskX1X[i][0];
- invMaskX2X[i][0] = invMaskX2X[i][1] = invMaskX2X[i][2] = invMaskX2X[i][3] = ~maskX2X[i][0];
- invMaskX3X[i][0] = invMaskX3X[i][1] = invMaskX3X[i][2] = invMaskX3X[i][3] = ~maskX3X[i][0];
-
- maskD01Q[i][0] = -(i >> 0 & 1);
- maskD01Q[i][1] = -(i >> 1 & 1);
- maskD23Q[i][0] = -(i >> 2 & 1);
- maskD23Q[i][1] = -(i >> 3 & 1);
-
- invMaskD01Q[i][0] = ~maskD01Q[i][0];
- invMaskD01Q[i][1] = ~maskD01Q[i][1];
- invMaskD23Q[i][0] = ~maskD23Q[i][0];
- invMaskD23Q[i][1] = ~maskD23Q[i][1];
-
- maskQ01X[i][0] = -(i >> 0 & 1);
- maskQ01X[i][1] = -(i >> 1 & 1);
- maskQ23X[i][0] = -(i >> 2 & 1);
- maskQ23X[i][1] = -(i >> 3 & 1);
-
- invMaskQ01X[i][0] = ~maskQ01X[i][0];
- invMaskQ01X[i][1] = ~maskQ01X[i][1];
- invMaskQ23X[i][0] = ~maskQ23X[i][0];
- invMaskQ23X[i][1] = ~maskQ23X[i][1];
- }
-
- for(int i = 0; i < 8; i++)
- {
- mask565Q[i][0] =
- mask565Q[i][1] =
- mask565Q[i][2] =
- mask565Q[i][3] = (i & 0x1 ? 0x001F : 0) | (i & 0x2 ? 0x07E0 : 0) | (i & 0x4 ? 0xF800 : 0);
- }
-
- for(int i = 0; i < 4; i++)
- {
- maskW01Q[i][0] = -(i >> 0 & 1);
- maskW01Q[i][1] = -(i >> 1 & 1);
- maskW01Q[i][2] = -(i >> 0 & 1);
- maskW01Q[i][3] = -(i >> 1 & 1);
-
- maskD01X[i][0] = -(i >> 0 & 1);
- maskD01X[i][1] = -(i >> 1 & 1);
- maskD01X[i][2] = -(i >> 0 & 1);
- maskD01X[i][3] = -(i >> 1 & 1);
- }
-
- for(int i = 0; i < 256; i++)
- {
- sRGBtoLinear8_16[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0xFF) * 0xFFFF + 0.5f);
- }
-
- for(int i = 0; i < 64; i++)
- {
- sRGBtoLinear6_16[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0x3F) * 0xFFFF + 0.5f);
- }
-
- for(int i = 0; i < 32; i++)
- {
- sRGBtoLinear5_16[i] = (unsigned short)(sw::sRGBtoLinear((float)i / 0x1F) * 0xFFFF + 0.5f);
- }
-
- for(int i = 0; i < 0x1000; i++)
- {
- linearToSRGB12_16[i] = (unsigned short)(clamp(sw::linearToSRGB((float)i / 0x0FFF) * 0xFFFF + 0.5f, 0.0f, (float)0xFFFF));
- sRGBtoLinear12_16[i] = (unsigned short)(clamp(sw::sRGBtoLinear((float)i / 0x0FFF) * 0xFFFF + 0.5f, 0.0f, (float)0xFFFF));
- }
-
- for(int q = 0; q < 4; q++)
- {
- for(int c = 0; c < 16; c++)
- {
- for(int i = 0; i < 4; i++)
- {
- const float X[4] = {+0.3125f, -0.3125f, -0.1250f, +0.1250f};
- const float Y[4] = {+0.1250f, -0.1250f, +0.3125f, -0.3125f};
-
- sampleX[q][c][i] = c & (1 << i) ? X[q] : 0.0f;
- sampleY[q][c][i] = c & (1 << i) ? Y[q] : 0.0f;
- weight[c][i] = c & (1 << i) ? 1.0f : 0.0f;
- }
- }
- }
-
- const int Xf[4] = {-5, +5, +2, -2}; // Fragment offsets
- const int Yf[4] = {-2, +2, -5, +5}; // Fragment offsets
-
- memcpy(&this->Xf, &Xf, sizeof(Xf));
- memcpy(&this->Yf, &Yf, sizeof(Yf));
-
- static const float4 X[4] = {{-0.3125f, -0.3125f, -0.3125f, -0.3125f},
- {+0.3125f, +0.3125f, +0.3125f, +0.3125f},
- {+0.1250f, +0.1250f, +0.1250f, +0.1250f},
- {-0.1250f, -0.1250f, -0.1250f, -0.1250f}};
-
- static const float4 Y[4] = {{-0.1250f, -0.1250f, -0.1250f, -0.1250f},
- {+0.1250f, +0.1250f, +0.1250f, +0.1250f},
- {-0.3125f, -0.3125f, -0.3125f, -0.3125f},
- {+0.3125f, +0.3125f, +0.3125f, +0.3125f}};
-
- memcpy(&this->X, &X, sizeof(X));
- memcpy(&this->Y, &Y, sizeof(Y));
-
- const dword maxX[16] = {0x00000000, 0x00000001, 0x00000100, 0x00000101, 0x00010000, 0x00010001, 0x00010100, 0x00010101, 0x01000000, 0x01000001, 0x01000100, 0x01000101, 0x01010000, 0x01010001, 0x01010100, 0x01010101};
- const dword maxY[16] = {0x00000000, 0x00000002, 0x00000200, 0x00000202, 0x00020000, 0x00020002, 0x00020200, 0x00020202, 0x02000000, 0x02000002, 0x02000200, 0x02000202, 0x02020000, 0x02020002, 0x02020200, 0x02020202};
- const dword maxZ[16] = {0x00000000, 0x00000004, 0x00000400, 0x00000404, 0x00040000, 0x00040004, 0x00040400, 0x00040404, 0x04000000, 0x04000004, 0x04000400, 0x04000404, 0x04040000, 0x04040004, 0x04040400, 0x04040404};
- const dword minX[16] = {0x00000000, 0x00000008, 0x00000800, 0x00000808, 0x00080000, 0x00080008, 0x00080800, 0x00080808, 0x08000000, 0x08000008, 0x08000800, 0x08000808, 0x08080000, 0x08080008, 0x08080800, 0x08080808};
- const dword minY[16] = {0x00000000, 0x00000010, 0x00001000, 0x00001010, 0x00100000, 0x00100010, 0x00101000, 0x00101010, 0x10000000, 0x10000010, 0x10001000, 0x10001010, 0x10100000, 0x10100010, 0x10101000, 0x10101010};
- const dword minZ[16] = {0x00000000, 0x00000020, 0x00002000, 0x00002020, 0x00200000, 0x00200020, 0x00202000, 0x00202020, 0x20000000, 0x20000020, 0x20002000, 0x20002020, 0x20200000, 0x20200020, 0x20202000, 0x20202020};
- const dword fini[16] = {0x00000000, 0x00000080, 0x00008000, 0x00008080, 0x00800000, 0x00800080, 0x00808000, 0x00808080, 0x80000000, 0x80000080, 0x80008000, 0x80008080, 0x80800000, 0x80800080, 0x80808000, 0x80808080};
-
- memcpy(&this->maxX, &maxX, sizeof(maxX));
- memcpy(&this->maxY, &maxY, sizeof(maxY));
- memcpy(&this->maxZ, &maxZ, sizeof(maxZ));
- memcpy(&this->minX, &minX, sizeof(minX));
- memcpy(&this->minY, &minY, sizeof(minY));
- memcpy(&this->minZ, &minZ, sizeof(minZ));
- memcpy(&this->fini, &fini, sizeof(fini));
-
- static const dword4 maxPos = {0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFF, 0x7F7FFFFE};
-
- memcpy(&this->maxPos, &maxPos, sizeof(maxPos));
-
- static const float4 unscaleByte = {1.0f / 0xFF, 1.0f / 0xFF, 1.0f / 0xFF, 1.0f / 0xFF};
- static const float4 unscaleSByte = {1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F, 1.0f / 0x7F};
- static const float4 unscaleShort = {1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF, 1.0f / 0x7FFF};
- static const float4 unscaleUShort = {1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF, 1.0f / 0xFFFF};
- static const float4 unscaleInt = {1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF, 1.0f / 0x7FFFFFFF};
- static const float4 unscaleUInt = {1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF, 1.0f / 0xFFFFFFFF};
- static const float4 unscaleFixed = {1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000, 1.0f / 0x00010000};
-
- memcpy(&this->unscaleByte, &unscaleByte, sizeof(unscaleByte));
- memcpy(&this->unscaleSByte, &unscaleSByte, sizeof(unscaleSByte));
- memcpy(&this->unscaleShort, &unscaleShort, sizeof(unscaleShort));
- memcpy(&this->unscaleUShort, &unscaleUShort, sizeof(unscaleUShort));
- memcpy(&this->unscaleInt, &unscaleInt, sizeof(unscaleInt));
- memcpy(&this->unscaleUInt, &unscaleUInt, sizeof(unscaleUInt));
- memcpy(&this->unscaleFixed, &unscaleFixed, sizeof(unscaleFixed));
-
- for(int i = 0; i <= 0xFFFF; i++)
- {
- half2float[i] = (float)reinterpret_cast<half&>(i);
- }
- }
-} \ No newline at end of file
diff --git a/src/Shader/Constants.hpp b/src/Shader/Constants.hpp
deleted file mode 100644
index 6b70e0441..000000000
--- a/src/Shader/Constants.hpp
+++ /dev/null
@@ -1,113 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Constants_hpp
-#define sw_Constants_hpp
-
-#include "Common/Types.hpp"
-
-namespace sw
-{
- struct Constants
- {
- Constants();
-
- unsigned int transposeBit0[16];
- unsigned int transposeBit1[16];
- unsigned int transposeBit2[16];
-
- ushort4 cWeight[17];
- float4 uvWeight[17];
- float4 uvStart[17];
-
- unsigned int occlusionCount[16];
-
- byte8 maskB4Q[16];
- byte8 invMaskB4Q[16];
- word4 maskW4Q[16];
- word4 invMaskW4Q[16];
- dword4 maskD4X[16];
- dword4 invMaskD4X[16];
- qword maskQ0Q[16];
- qword maskQ1Q[16];
- qword maskQ2Q[16];
- qword maskQ3Q[16];
- qword invMaskQ0Q[16];
- qword invMaskQ1Q[16];
- qword invMaskQ2Q[16];
- qword invMaskQ3Q[16];
- dword4 maskX0X[16];
- dword4 maskX1X[16];
- dword4 maskX2X[16];
- dword4 maskX3X[16];
- dword4 invMaskX0X[16];
- dword4 invMaskX1X[16];
- dword4 invMaskX2X[16];
- dword4 invMaskX3X[16];
- dword2 maskD01Q[16];
- dword2 maskD23Q[16];
- dword2 invMaskD01Q[16];
- dword2 invMaskD23Q[16];
- qword2 maskQ01X[16];
- qword2 maskQ23X[16];
- qword2 invMaskQ01X[16];
- qword2 invMaskQ23X[16];
- word4 maskW01Q[4];
- dword4 maskD01X[4];
- word4 mask565Q[8];
-
- unsigned short sRGBtoLinear8_16[256];
- unsigned short sRGBtoLinear6_16[64];
- unsigned short sRGBtoLinear5_16[32];
-
- unsigned short linearToSRGB12_16[4096];
- unsigned short sRGBtoLinear12_16[4096];
-
- // Centroid parameters
- float4 sampleX[4][16];
- float4 sampleY[4][16];
- float4 weight[16];
-
- // Fragment offsets
- int Xf[4];
- int Yf[4];
-
- float4 X[4];
- float4 Y[4];
-
- dword maxX[16];
- dword maxY[16];
- dword maxZ[16];
- dword minX[16];
- dword minY[16];
- dword minZ[16];
- dword fini[16];
-
- dword4 maxPos;
-
- float4 unscaleByte;
- float4 unscaleSByte;
- float4 unscaleShort;
- float4 unscaleUShort;
- float4 unscaleInt;
- float4 unscaleUInt;
- float4 unscaleFixed;
-
- float half2float[65536];
- };
-
- extern Constants constants;
-}
-
-#endif // sw_Constants_hpp
diff --git a/src/Shader/PixelPipeline.cpp b/src/Shader/PixelPipeline.cpp
deleted file mode 100644
index d4faebdcc..000000000
--- a/src/Shader/PixelPipeline.cpp
+++ /dev/null
@@ -1,1959 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PixelPipeline.hpp"
-#include "SamplerCore.hpp"
-#include "Renderer/Renderer.hpp"
-
-namespace sw
-{
- extern bool postBlendSRGB;
-
- void PixelPipeline::setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w)
- {
- if(state.color[0].component & 0x1) diffuse.x = convertFixed12(v[0].x); else diffuse.x = Short4(0x1000);
- if(state.color[0].component & 0x2) diffuse.y = convertFixed12(v[0].y); else diffuse.y = Short4(0x1000);
- if(state.color[0].component & 0x4) diffuse.z = convertFixed12(v[0].z); else diffuse.z = Short4(0x1000);
- if(state.color[0].component & 0x8) diffuse.w = convertFixed12(v[0].w); else diffuse.w = Short4(0x1000);
-
- if(state.color[1].component & 0x1) specular.x = convertFixed12(v[1].x); else specular.x = Short4(0x0000);
- if(state.color[1].component & 0x2) specular.y = convertFixed12(v[1].y); else specular.y = Short4(0x0000);
- if(state.color[1].component & 0x4) specular.z = convertFixed12(v[1].z); else specular.z = Short4(0x0000);
- if(state.color[1].component & 0x8) specular.w = convertFixed12(v[1].w); else specular.w = Short4(0x0000);
- }
-
- void PixelPipeline::fixedFunction()
- {
- current = diffuse;
- Vector4s temp(0x0000, 0x0000, 0x0000, 0x0000);
-
- for(int stage = 0; stage < 8; stage++)
- {
- if(state.textureStage[stage].stageOperation == TextureStage::STAGE_DISABLE)
- {
- break;
- }
-
- Vector4s texture;
-
- if(state.textureStage[stage].usesTexture)
- {
- texture = sampleTexture(stage, stage);
- }
-
- blendTexture(temp, texture, stage);
- }
-
- specularPixel(current, specular);
- }
-
- void PixelPipeline::applyShader(Int cMask[4])
- {
- if(!shader)
- {
- fixedFunction();
- return;
- }
-
- int pad = 0; // Count number of texm3x3pad instructions
- Vector4s dPairing; // Destination for first pairing instruction
-
- for(size_t i = 0; i < shader->getLength(); i++)
- {
- const Shader::Instruction *instruction = shader->getInstruction(i);
- Shader::Opcode opcode = instruction->opcode;
-
- // #ifndef NDEBUG // FIXME: Centralize debug output control
- // shader->printInstruction(i, "debug.txt");
- // #endif
-
- if(opcode == Shader::OPCODE_DCL || opcode == Shader::OPCODE_DEF || opcode == Shader::OPCODE_DEFI || opcode == Shader::OPCODE_DEFB)
- {
- continue;
- }
-
- const Dst &dst = instruction->dst;
- const Src &src0 = instruction->src[0];
- const Src &src1 = instruction->src[1];
- const Src &src2 = instruction->src[2];
-
- unsigned short shaderModel = shader->getShaderModel();
- bool pairing = i + 1 < shader->getLength() && shader->getInstruction(i + 1)->coissue; // First instruction of pair
- bool coissue = instruction->coissue; // Second instruction of pair
-
- Vector4s d;
- Vector4s s0;
- Vector4s s1;
- Vector4s s2;
-
- if(src0.type != Shader::PARAMETER_VOID) s0 = fetchRegister(src0);
- if(src1.type != Shader::PARAMETER_VOID) s1 = fetchRegister(src1);
- if(src2.type != Shader::PARAMETER_VOID) s2 = fetchRegister(src2);
-
- Float4 x = shaderModel < 0x0104 ? v[2 + dst.index].x : v[2 + src0.index].x;
- Float4 y = shaderModel < 0x0104 ? v[2 + dst.index].y : v[2 + src0.index].y;
- Float4 z = shaderModel < 0x0104 ? v[2 + dst.index].z : v[2 + src0.index].z;
- Float4 w = shaderModel < 0x0104 ? v[2 + dst.index].w : v[2 + src0.index].w;
-
- switch(opcode)
- {
- case Shader::OPCODE_PS_1_0: break;
- case Shader::OPCODE_PS_1_1: break;
- case Shader::OPCODE_PS_1_2: break;
- case Shader::OPCODE_PS_1_3: break;
- case Shader::OPCODE_PS_1_4: break;
-
- case Shader::OPCODE_DEF: break;
-
- case Shader::OPCODE_NOP: break;
- case Shader::OPCODE_MOV: MOV(d, s0); break;
- case Shader::OPCODE_ADD: ADD(d, s0, s1); break;
- case Shader::OPCODE_SUB: SUB(d, s0, s1); break;
- case Shader::OPCODE_MAD: MAD(d, s0, s1, s2); break;
- case Shader::OPCODE_MUL: MUL(d, s0, s1); break;
- case Shader::OPCODE_DP3: DP3(d, s0, s1); break;
- case Shader::OPCODE_DP4: DP4(d, s0, s1); break;
- case Shader::OPCODE_LRP: LRP(d, s0, s1, s2); break;
- case Shader::OPCODE_TEXCOORD:
- if(shaderModel < 0x0104)
- {
- TEXCOORD(d, x, y, z, dst.index);
- }
- else
- {
- if((src0.swizzle & 0x30) == 0x20) // .xyz
- {
- TEXCRD(d, x, y, z, src0.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
- }
- else // .xwy
- {
- TEXCRD(d, x, y, w, src0.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
- }
- }
- break;
- case Shader::OPCODE_TEXKILL:
- if(shaderModel < 0x0104)
- {
- TEXKILL(cMask, x, y, z);
- }
- else if(shaderModel == 0x0104)
- {
- if(dst.type == Shader::PARAMETER_TEXTURE)
- {
- TEXKILL(cMask, x, y, z);
- }
- else
- {
- TEXKILL(cMask, rs[dst.index]);
- }
- }
- else ASSERT(false);
- break;
- case Shader::OPCODE_TEX:
- if(shaderModel < 0x0104)
- {
- TEX(d, x, y, z, dst.index, false);
- }
- else if(shaderModel == 0x0104)
- {
- if(src0.type == Shader::PARAMETER_TEXTURE)
- {
- if((src0.swizzle & 0x30) == 0x20) // .xyz
- {
- TEX(d, x, y, z, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
- }
- else // .xyw
- {
- TEX(d, x, y, w, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
- }
- }
- else
- {
- TEXLD(d, s0, dst.index, src0.modifier == Shader::MODIFIER_DZ || src0.modifier == Shader::MODIFIER_DW);
- }
- }
- else ASSERT(false);
- break;
- case Shader::OPCODE_TEXBEM: TEXBEM(d, s0, x, y, z, dst.index); break;
- case Shader::OPCODE_TEXBEML: TEXBEML(d, s0, x, y, z, dst.index); break;
- case Shader::OPCODE_TEXREG2AR: TEXREG2AR(d, s0, dst.index); break;
- case Shader::OPCODE_TEXREG2GB: TEXREG2GB(d, s0, dst.index); break;
- case Shader::OPCODE_TEXM3X2PAD: TEXM3X2PAD(x, y, z, s0, 0, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXM3X2TEX: TEXM3X2TEX(d, x, y, z, dst.index, s0, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXM3X3PAD: TEXM3X3PAD(x, y, z, s0, pad++ % 2, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXM3X3TEX: TEXM3X3TEX(d, x, y, z, dst.index, s0, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXM3X3SPEC: TEXM3X3SPEC(d, x, y, z, dst.index, s0, s1); break;
- case Shader::OPCODE_TEXM3X3VSPEC: TEXM3X3VSPEC(d, x, y, z, dst.index, s0); break;
- case Shader::OPCODE_CND: CND(d, s0, s1, s2); break;
- case Shader::OPCODE_TEXREG2RGB: TEXREG2RGB(d, s0, dst.index); break;
- case Shader::OPCODE_TEXDP3TEX: TEXDP3TEX(d, x, y, z, dst.index, s0); break;
- case Shader::OPCODE_TEXM3X2DEPTH: TEXM3X2DEPTH(d, x, y, z, s0, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXDP3: TEXDP3(d, x, y, z, s0); break;
- case Shader::OPCODE_TEXM3X3: TEXM3X3(d, x, y, z, s0, src0.modifier == Shader::MODIFIER_SIGN); break;
- case Shader::OPCODE_TEXDEPTH: TEXDEPTH(); break;
- case Shader::OPCODE_CMP0: CMP(d, s0, s1, s2); break;
- case Shader::OPCODE_BEM: BEM(d, s0, s1, dst.index); break;
- case Shader::OPCODE_PHASE: break;
- case Shader::OPCODE_END: break;
- default:
- ASSERT(false);
- }
-
- if(dst.type != Shader::PARAMETER_VOID && opcode != Shader::OPCODE_TEXKILL)
- {
- if(dst.shift > 0)
- {
- if(dst.mask & 0x1) { d.x = AddSat(d.x, d.x); if(dst.shift > 1) d.x = AddSat(d.x, d.x); if(dst.shift > 2) d.x = AddSat(d.x, d.x); }
- if(dst.mask & 0x2) { d.y = AddSat(d.y, d.y); if(dst.shift > 1) d.y = AddSat(d.y, d.y); if(dst.shift > 2) d.y = AddSat(d.y, d.y); }
- if(dst.mask & 0x4) { d.z = AddSat(d.z, d.z); if(dst.shift > 1) d.z = AddSat(d.z, d.z); if(dst.shift > 2) d.z = AddSat(d.z, d.z); }
- if(dst.mask & 0x8) { d.w = AddSat(d.w, d.w); if(dst.shift > 1) d.w = AddSat(d.w, d.w); if(dst.shift > 2) d.w = AddSat(d.w, d.w); }
- }
- else if(dst.shift < 0)
- {
- if(dst.mask & 0x1) d.x = d.x >> -dst.shift;
- if(dst.mask & 0x2) d.y = d.y >> -dst.shift;
- if(dst.mask & 0x4) d.z = d.z >> -dst.shift;
- if(dst.mask & 0x8) d.w = d.w >> -dst.shift;
- }
-
- if(dst.saturate)
- {
- if(dst.mask & 0x1) { d.x = Min(d.x, Short4(0x1000)); d.x = Max(d.x, Short4(0x0000)); }
- if(dst.mask & 0x2) { d.y = Min(d.y, Short4(0x1000)); d.y = Max(d.y, Short4(0x0000)); }
- if(dst.mask & 0x4) { d.z = Min(d.z, Short4(0x1000)); d.z = Max(d.z, Short4(0x0000)); }
- if(dst.mask & 0x8) { d.w = Min(d.w, Short4(0x1000)); d.w = Max(d.w, Short4(0x0000)); }
- }
-
- if(pairing)
- {
- if(dst.mask & 0x1) dPairing.x = d.x;
- if(dst.mask & 0x2) dPairing.y = d.y;
- if(dst.mask & 0x4) dPairing.z = d.z;
- if(dst.mask & 0x8) dPairing.w = d.w;
- }
-
- if(coissue)
- {
- const Dst &dst = shader->getInstruction(i - 1)->dst;
-
- writeDestination(dPairing, dst);
- }
-
- if(!pairing)
- {
- writeDestination(d, dst);
- }
- }
- }
-
- current.x = Min(current.x, Short4(0x0FFF)); current.x = Max(current.x, Short4(0x0000));
- current.y = Min(current.y, Short4(0x0FFF)); current.y = Max(current.y, Short4(0x0000));
- current.z = Min(current.z, Short4(0x0FFF)); current.z = Max(current.z, Short4(0x0000));
- current.w = Min(current.w, Short4(0x0FFF)); current.w = Max(current.w, Short4(0x0000));
- }
-
- Bool PixelPipeline::alphaTest(Int cMask[4])
- {
- if(!state.alphaTestActive())
- {
- return true;
- }
-
- Int aMask;
-
- if(state.transparencyAntialiasing == TRANSPARENCY_NONE)
- {
- PixelRoutine::alphaTest(aMask, current.w);
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= aMask;
- }
- }
- else if(state.transparencyAntialiasing == TRANSPARENCY_ALPHA_TO_COVERAGE)
- {
- Float4 alpha = Float4(current.w) * Float4(1.0f / 0x1000);
-
- alphaToCoverage(cMask, alpha);
- }
- else ASSERT(false);
-
- Int pass = cMask[0];
-
- for(unsigned int q = 1; q < state.multiSample; q++)
- {
- pass = pass | cMask[q];
- }
-
- return pass != 0x0;
- }
-
- void PixelPipeline::rasterOperation(Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4])
- {
- if(!state.colorWriteActive(0))
- {
- return;
- }
-
- Vector4f oC;
-
- switch(state.targetFormat[0])
- {
- case FORMAT_R5G6B5:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_A8:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- if(!postBlendSRGB && state.writeSRGB)
- {
- linearToSRGB12_16(current);
- }
- else
- {
- current.x <<= 4;
- current.y <<= 4;
- current.z <<= 4;
- current.w <<= 4;
- }
-
- if(state.targetFormat[0] == FORMAT_R5G6B5)
- {
- current.x &= Short4(0xF800u);
- current.y &= Short4(0xFC00u);
- current.z &= Short4(0xF800u);
- }
-
- fogBlend(current, fog);
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Pointer<Byte> buffer = cBuffer[0] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[0]));
- Vector4s color = current;
-
- if(state.multiSampleMask & (1 << q))
- {
- alphaBlend(0, buffer, color, x);
- logicOperation(0, buffer, color, x);
- writeColor(0, buffer, x, color, sMask[q], zMask[q], cMask[q]);
- }
- }
- break;
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- // case FORMAT_X32B32G32R32F_UNSIGNED: // Not renderable in any fixed-function API.
- convertSigned12(oC, current);
- PixelRoutine::fogBlend(oC, fog);
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Pointer<Byte> buffer = cBuffer[0] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[0]));
- Vector4f color = oC;
-
- if(state.multiSampleMask & (1 << q))
- {
- alphaBlend(0, buffer, color, x);
- writeColor(0, buffer, x, color, sMask[q], zMask[q], cMask[q]);
- }
- }
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelPipeline::blendTexture(Vector4s &temp, Vector4s &texture, int stage)
- {
- Vector4s *arg1 = nullptr;
- Vector4s *arg2 = nullptr;
- Vector4s *arg3 = nullptr;
- Vector4s res;
-
- Vector4s constant;
- Vector4s tfactor;
-
- const TextureStage::State &textureStage = state.textureStage[stage];
-
- if(textureStage.firstArgument == TextureStage::SOURCE_CONSTANT ||
- textureStage.firstArgumentAlpha == TextureStage::SOURCE_CONSTANT ||
- textureStage.secondArgument == TextureStage::SOURCE_CONSTANT ||
- textureStage.secondArgumentAlpha == TextureStage::SOURCE_CONSTANT ||
- textureStage.thirdArgument == TextureStage::SOURCE_CONSTANT ||
- textureStage.thirdArgumentAlpha == TextureStage::SOURCE_CONSTANT)
- {
- constant.x = *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].constantColor4[0]));
- constant.y = *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].constantColor4[1]));
- constant.z = *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].constantColor4[2]));
- constant.w = *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].constantColor4[3]));
- }
-
- if(textureStage.firstArgument == TextureStage::SOURCE_TFACTOR ||
- textureStage.firstArgumentAlpha == TextureStage::SOURCE_TFACTOR ||
- textureStage.secondArgument == TextureStage::SOURCE_TFACTOR ||
- textureStage.secondArgumentAlpha == TextureStage::SOURCE_TFACTOR ||
- textureStage.thirdArgument == TextureStage::SOURCE_TFACTOR ||
- textureStage.thirdArgumentAlpha == TextureStage::SOURCE_TFACTOR)
- {
- tfactor.x = *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[0]));
- tfactor.y = *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[1]));
- tfactor.z = *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[2]));
- tfactor.w = *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[3]));
- }
-
- // Premodulate
- if(stage > 0 && textureStage.usesTexture)
- {
- if(state.textureStage[stage - 1].stageOperation == TextureStage::STAGE_PREMODULATE)
- {
- current.x = MulHigh(current.x, texture.x) << 4;
- current.y = MulHigh(current.y, texture.y) << 4;
- current.z = MulHigh(current.z, texture.z) << 4;
- }
-
- if(state.textureStage[stage - 1].stageOperationAlpha == TextureStage::STAGE_PREMODULATE)
- {
- current.w = MulHigh(current.w, texture.w) << 4;
- }
- }
-
- if(luminance)
- {
- texture.x = MulHigh(texture.x, L) << 4;
- texture.y = MulHigh(texture.y, L) << 4;
- texture.z = MulHigh(texture.z, L) << 4;
-
- luminance = false;
- }
-
- switch(textureStage.firstArgument)
- {
- case TextureStage::SOURCE_TEXTURE: arg1 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg1 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg1 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg1 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg1 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg1 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg1 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.secondArgument)
- {
- case TextureStage::SOURCE_TEXTURE: arg2 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg2 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg2 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg2 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg2 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg2 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg2 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.thirdArgument)
- {
- case TextureStage::SOURCE_TEXTURE: arg3 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg3 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg3 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg3 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg3 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg3 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg3 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- Vector4s mod1;
- Vector4s mod2;
- Vector4s mod3;
-
- switch(textureStage.firstModifier)
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod1.x = SubSat(Short4(0x1000), arg1->x);
- mod1.y = SubSat(Short4(0x1000), arg1->y);
- mod1.z = SubSat(Short4(0x1000), arg1->z);
- mod1.w = SubSat(Short4(0x1000), arg1->w);
-
- arg1 = &mod1;
- break;
- case TextureStage::MODIFIER_ALPHA:
- mod1.x = arg1->w;
- mod1.y = arg1->w;
- mod1.z = arg1->w;
- mod1.w = arg1->w;
-
- arg1 = &mod1;
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod1.x = SubSat(Short4(0x1000), arg1->w);
- mod1.y = SubSat(Short4(0x1000), arg1->w);
- mod1.z = SubSat(Short4(0x1000), arg1->w);
- mod1.w = SubSat(Short4(0x1000), arg1->w);
-
- arg1 = &mod1;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.secondModifier)
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod2.x = SubSat(Short4(0x1000), arg2->x);
- mod2.y = SubSat(Short4(0x1000), arg2->y);
- mod2.z = SubSat(Short4(0x1000), arg2->z);
- mod2.w = SubSat(Short4(0x1000), arg2->w);
-
- arg2 = &mod2;
- break;
- case TextureStage::MODIFIER_ALPHA:
- mod2.x = arg2->w;
- mod2.y = arg2->w;
- mod2.z = arg2->w;
- mod2.w = arg2->w;
-
- arg2 = &mod2;
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod2.x = SubSat(Short4(0x1000), arg2->w);
- mod2.y = SubSat(Short4(0x1000), arg2->w);
- mod2.z = SubSat(Short4(0x1000), arg2->w);
- mod2.w = SubSat(Short4(0x1000), arg2->w);
-
- arg2 = &mod2;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.thirdModifier)
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod3.x = SubSat(Short4(0x1000), arg3->x);
- mod3.y = SubSat(Short4(0x1000), arg3->y);
- mod3.z = SubSat(Short4(0x1000), arg3->z);
- mod3.w = SubSat(Short4(0x1000), arg3->w);
-
- arg3 = &mod3;
- break;
- case TextureStage::MODIFIER_ALPHA:
- mod3.x = arg3->w;
- mod3.y = arg3->w;
- mod3.z = arg3->w;
- mod3.w = arg3->w;
-
- arg3 = &mod3;
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod3.x = SubSat(Short4(0x1000), arg3->w);
- mod3.y = SubSat(Short4(0x1000), arg3->w);
- mod3.z = SubSat(Short4(0x1000), arg3->w);
- mod3.w = SubSat(Short4(0x1000), arg3->w);
-
- arg3 = &mod3;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.stageOperation)
- {
- case TextureStage::STAGE_DISABLE:
- break;
- case TextureStage::STAGE_SELECTARG1: // Arg1
- res.x = arg1->x;
- res.y = arg1->y;
- res.z = arg1->z;
- break;
- case TextureStage::STAGE_SELECTARG2: // Arg2
- res.x = arg2->x;
- res.y = arg2->y;
- res.z = arg2->z;
- break;
- case TextureStage::STAGE_SELECTARG3: // Arg3
- res.x = arg3->x;
- res.y = arg3->y;
- res.z = arg3->z;
- break;
- case TextureStage::STAGE_MODULATE: // Arg1 * Arg2
- res.x = MulHigh(arg1->x, arg2->x) << 4;
- res.y = MulHigh(arg1->y, arg2->y) << 4;
- res.z = MulHigh(arg1->z, arg2->z) << 4;
- break;
- case TextureStage::STAGE_MODULATE2X: // Arg1 * Arg2 * 2
- res.x = MulHigh(arg1->x, arg2->x) << 5;
- res.y = MulHigh(arg1->y, arg2->y) << 5;
- res.z = MulHigh(arg1->z, arg2->z) << 5;
- break;
- case TextureStage::STAGE_MODULATE4X: // Arg1 * Arg2 * 4
- res.x = MulHigh(arg1->x, arg2->x) << 6;
- res.y = MulHigh(arg1->y, arg2->y) << 6;
- res.z = MulHigh(arg1->z, arg2->z) << 6;
- break;
- case TextureStage::STAGE_ADD: // Arg1 + Arg2
- res.x = AddSat(arg1->x, arg2->x);
- res.y = AddSat(arg1->y, arg2->y);
- res.z = AddSat(arg1->z, arg2->z);
- break;
- case TextureStage::STAGE_ADDSIGNED: // Arg1 + Arg2 - 0.5
- res.x = AddSat(arg1->x, arg2->x);
- res.y = AddSat(arg1->y, arg2->y);
- res.z = AddSat(arg1->z, arg2->z);
-
- res.x = SubSat(res.x, Short4(0x0800));
- res.y = SubSat(res.y, Short4(0x0800));
- res.z = SubSat(res.z, Short4(0x0800));
- break;
- case TextureStage::STAGE_ADDSIGNED2X: // (Arg1 + Arg2 - 0.5) << 1
- res.x = AddSat(arg1->x, arg2->x);
- res.y = AddSat(arg1->y, arg2->y);
- res.z = AddSat(arg1->z, arg2->z);
-
- res.x = SubSat(res.x, Short4(0x0800));
- res.y = SubSat(res.y, Short4(0x0800));
- res.z = SubSat(res.z, Short4(0x0800));
-
- res.x = AddSat(res.x, res.x);
- res.y = AddSat(res.y, res.y);
- res.z = AddSat(res.z, res.z);
- break;
- case TextureStage::STAGE_SUBTRACT: // Arg1 - Arg2
- res.x = SubSat(arg1->x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z);
- break;
- case TextureStage::STAGE_ADDSMOOTH: // Arg1 + Arg2 - Arg1 * Arg2
- {
- Short4 tmp;
-
- tmp = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(arg1->x, arg2->x); res.x = SubSat(res.x, tmp);
- tmp = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(arg1->y, arg2->y); res.y = SubSat(res.y, tmp);
- tmp = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(arg1->z, arg2->z); res.z = SubSat(res.z, tmp);
- }
- break;
- case TextureStage::STAGE_MULTIPLYADD: // Arg3 + Arg1 * Arg2
- res.x = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(res.x, arg3->x);
- res.y = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(res.y, arg3->y);
- res.z = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(res.z, arg3->z);
- break;
- case TextureStage::STAGE_LERP: // Arg3 * (Arg1 - Arg2) + Arg2
- res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, arg3->x) << 4; res.x = AddSat(res.x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, arg3->y) << 4; res.y = AddSat(res.y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, arg3->z) << 4; res.z = AddSat(res.z, arg2->z);
- break;
- case TextureStage::STAGE_DOT3: // 2 * (Arg1.x - 0.5) * 2 * (Arg2.x - 0.5) + 2 * (Arg1.y - 0.5) * 2 * (Arg2.y - 0.5) + 2 * (Arg1.z - 0.5) * 2 * (Arg2.z - 0.5)
- {
- Short4 tmp;
-
- res.x = SubSat(arg1->x, Short4(0x0800)); tmp = SubSat(arg2->x, Short4(0x0800)); res.x = MulHigh(res.x, tmp);
- res.y = SubSat(arg1->y, Short4(0x0800)); tmp = SubSat(arg2->y, Short4(0x0800)); res.y = MulHigh(res.y, tmp);
- res.z = SubSat(arg1->z, Short4(0x0800)); tmp = SubSat(arg2->z, Short4(0x0800)); res.z = MulHigh(res.z, tmp);
-
- res.x = res.x << 6;
- res.y = res.y << 6;
- res.z = res.z << 6;
-
- res.x = AddSat(res.x, res.y);
- res.x = AddSat(res.x, res.z);
-
- // Clamp to [0, 1]
- res.x = Max(res.x, Short4(0x0000));
- res.x = Min(res.x, Short4(0x1000));
-
- res.y = res.x;
- res.z = res.x;
- res.w = res.x;
- }
- break;
- case TextureStage::STAGE_BLENDCURRENTALPHA: // Alpha * (Arg1 - Arg2) + Arg2
- res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, current.w) << 4; res.x = AddSat(res.x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, current.w) << 4; res.y = AddSat(res.y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, current.w) << 4; res.z = AddSat(res.z, arg2->z);
- break;
- case TextureStage::STAGE_BLENDDIFFUSEALPHA: // Alpha * (Arg1 - Arg2) + Arg2
- res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, diffuse.w) << 4; res.x = AddSat(res.x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, diffuse.w) << 4; res.y = AddSat(res.y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, diffuse.w) << 4; res.z = AddSat(res.z, arg2->z);
- break;
- case TextureStage::STAGE_BLENDFACTORALPHA: // Alpha * (Arg1 - Arg2) + Arg2
- res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[3]))) << 4; res.x = AddSat(res.x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[3]))) << 4; res.y = AddSat(res.y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[3]))) << 4; res.z = AddSat(res.z, arg2->z);
- break;
- case TextureStage::STAGE_BLENDTEXTUREALPHA: // Alpha * (Arg1 - Arg2) + Arg2
- res.x = SubSat(arg1->x, arg2->x); res.x = MulHigh(res.x, texture.w) << 4; res.x = AddSat(res.x, arg2->x);
- res.y = SubSat(arg1->y, arg2->y); res.y = MulHigh(res.y, texture.w) << 4; res.y = AddSat(res.y, arg2->y);
- res.z = SubSat(arg1->z, arg2->z); res.z = MulHigh(res.z, texture.w) << 4; res.z = AddSat(res.z, arg2->z);
- break;
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM: // Arg1 + Arg2 * (1 - Alpha)
- res.x = SubSat(Short4(0x1000), texture.w); res.x = MulHigh(res.x, arg2->x) << 4; res.x = AddSat(res.x, arg1->x);
- res.y = SubSat(Short4(0x1000), texture.w); res.y = MulHigh(res.y, arg2->y) << 4; res.y = AddSat(res.y, arg1->y);
- res.z = SubSat(Short4(0x1000), texture.w); res.z = MulHigh(res.z, arg2->z) << 4; res.z = AddSat(res.z, arg1->z);
- break;
- case TextureStage::STAGE_PREMODULATE:
- res.x = arg1->x;
- res.y = arg1->y;
- res.z = arg1->z;
- break;
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR: // Arg1 + Arg1.w * Arg2
- res.x = MulHigh(arg1->w, arg2->x) << 4; res.x = AddSat(res.x, arg1->x);
- res.y = MulHigh(arg1->w, arg2->y) << 4; res.y = AddSat(res.y, arg1->y);
- res.z = MulHigh(arg1->w, arg2->z) << 4; res.z = AddSat(res.z, arg1->z);
- break;
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA: // Arg1 * Arg2 + Arg1.w
- res.x = MulHigh(arg1->x, arg2->x) << 4; res.x = AddSat(res.x, arg1->w);
- res.y = MulHigh(arg1->y, arg2->y) << 4; res.y = AddSat(res.y, arg1->w);
- res.z = MulHigh(arg1->z, arg2->z) << 4; res.z = AddSat(res.z, arg1->w);
- break;
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR: // (1 - Arg1.w) * Arg2 + Arg1
- {
- Short4 tmp;
-
- res.x = AddSat(arg1->x, arg2->x); tmp = MulHigh(arg1->w, arg2->x) << 4; res.x = SubSat(res.x, tmp);
- res.y = AddSat(arg1->y, arg2->y); tmp = MulHigh(arg1->w, arg2->y) << 4; res.y = SubSat(res.y, tmp);
- res.z = AddSat(arg1->z, arg2->z); tmp = MulHigh(arg1->w, arg2->z) << 4; res.z = SubSat(res.z, tmp);
- }
- break;
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA: // (1 - Arg1) * Arg2 + Arg1.w
- {
- Short4 tmp;
-
- res.x = AddSat(arg1->w, arg2->x); tmp = MulHigh(arg1->x, arg2->x) << 4; res.x = SubSat(res.x, tmp);
- res.y = AddSat(arg1->w, arg2->y); tmp = MulHigh(arg1->y, arg2->y) << 4; res.y = SubSat(res.y, tmp);
- res.z = AddSat(arg1->w, arg2->z); tmp = MulHigh(arg1->z, arg2->z) << 4; res.z = SubSat(res.z, tmp);
- }
- break;
- case TextureStage::STAGE_BUMPENVMAP:
- {
- du = Float4(texture.x) * Float4(1.0f / 0x0FE0);
- dv = Float4(texture.y) * Float4(1.0f / 0x0FE0);
-
- Float4 du2;
- Float4 dv2;
-
- du2 = du;
- dv2 = dv;
- du *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][0]));
- dv2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][0]));
- du += dv2;
- dv *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][1]));
- du2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][1]));
- dv += du2;
-
- perturbate = true;
-
- res.x = current.x;
- res.y = current.y;
- res.z = current.z;
- res.w = current.w;
- }
- break;
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- {
- du = Float4(texture.x) * Float4(1.0f / 0x0FE0);
- dv = Float4(texture.y) * Float4(1.0f / 0x0FE0);
-
- Float4 du2;
- Float4 dv2;
-
- du2 = du;
- dv2 = dv;
-
- du *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][0]));
- dv2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][0]));
- du += dv2;
- dv *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][1]));
- du2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][1]));
- dv += du2;
-
- perturbate = true;
-
- L = texture.z;
- L = MulHigh(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceScale4)));
- L = L << 4;
- L = AddSat(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceOffset4)));
- L = Max(L, Short4(0x0000));
- L = Min(L, Short4(0x1000));
-
- luminance = true;
-
- res.x = current.x;
- res.y = current.y;
- res.z = current.z;
- res.w = current.w;
- }
- break;
- default:
- ASSERT(false);
- }
-
- if(textureStage.stageOperation != TextureStage::STAGE_DOT3)
- {
- switch(textureStage.firstArgumentAlpha)
- {
- case TextureStage::SOURCE_TEXTURE: arg1 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg1 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg1 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg1 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg1 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg1 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg1 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.secondArgumentAlpha)
- {
- case TextureStage::SOURCE_TEXTURE: arg2 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg2 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg2 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg2 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg2 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg2 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg2 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.thirdArgumentAlpha)
- {
- case TextureStage::SOURCE_TEXTURE: arg3 = &texture; break;
- case TextureStage::SOURCE_CONSTANT: arg3 = &constant; break;
- case TextureStage::SOURCE_CURRENT: arg3 = &current; break;
- case TextureStage::SOURCE_DIFFUSE: arg3 = &diffuse; break;
- case TextureStage::SOURCE_SPECULAR: arg3 = &specular; break;
- case TextureStage::SOURCE_TEMP: arg3 = &temp; break;
- case TextureStage::SOURCE_TFACTOR: arg3 = &tfactor; break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.firstModifierAlpha) // FIXME: Check if actually used
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod1.w = SubSat(Short4(0x1000), arg1->w);
-
- arg1 = &mod1;
- break;
- case TextureStage::MODIFIER_ALPHA:
- // Redudant
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod1.w = SubSat(Short4(0x1000), arg1->w);
-
- arg1 = &mod1;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.secondModifierAlpha) // FIXME: Check if actually used
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod2.w = SubSat(Short4(0x1000), arg2->w);
-
- arg2 = &mod2;
- break;
- case TextureStage::MODIFIER_ALPHA:
- // Redudant
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod2.w = SubSat(Short4(0x1000), arg2->w);
-
- arg2 = &mod2;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.thirdModifierAlpha) // FIXME: Check if actually used
- {
- case TextureStage::MODIFIER_COLOR:
- break;
- case TextureStage::MODIFIER_INVCOLOR:
- mod3.w = SubSat(Short4(0x1000), arg3->w);
-
- arg3 = &mod3;
- break;
- case TextureStage::MODIFIER_ALPHA:
- // Redudant
- break;
- case TextureStage::MODIFIER_INVALPHA:
- mod3.w = SubSat(Short4(0x1000), arg3->w);
-
- arg3 = &mod3;
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.stageOperationAlpha)
- {
- case TextureStage::STAGE_DISABLE:
- break;
- case TextureStage::STAGE_SELECTARG1: // Arg1
- res.w = arg1->w;
- break;
- case TextureStage::STAGE_SELECTARG2: // Arg2
- res.w = arg2->w;
- break;
- case TextureStage::STAGE_SELECTARG3: // Arg3
- res.w = arg3->w;
- break;
- case TextureStage::STAGE_MODULATE: // Arg1 * Arg2
- res.w = MulHigh(arg1->w, arg2->w) << 4;
- break;
- case TextureStage::STAGE_MODULATE2X: // Arg1 * Arg2 * 2
- res.w = MulHigh(arg1->w, arg2->w) << 5;
- break;
- case TextureStage::STAGE_MODULATE4X: // Arg1 * Arg2 * 4
- res.w = MulHigh(arg1->w, arg2->w) << 6;
- break;
- case TextureStage::STAGE_ADD: // Arg1 + Arg2
- res.w = AddSat(arg1->w, arg2->w);
- break;
- case TextureStage::STAGE_ADDSIGNED: // Arg1 + Arg2 - 0.5
- res.w = AddSat(arg1->w, arg2->w);
- res.w = SubSat(res.w, Short4(0x0800));
- break;
- case TextureStage::STAGE_ADDSIGNED2X: // (Arg1 + Arg2 - 0.5) << 1
- res.w = AddSat(arg1->w, arg2->w);
- res.w = SubSat(res.w, Short4(0x0800));
- res.w = AddSat(res.w, res.w);
- break;
- case TextureStage::STAGE_SUBTRACT: // Arg1 - Arg2
- res.w = SubSat(arg1->w, arg2->w);
- break;
- case TextureStage::STAGE_ADDSMOOTH: // Arg1 + Arg2 - Arg1 * Arg2
- {
- Short4 tmp;
-
- tmp = MulHigh(arg1->w, arg2->w) << 4; res.w = AddSat(arg1->w, arg2->w); res.w = SubSat(res.w, tmp);
- }
- break;
- case TextureStage::STAGE_MULTIPLYADD: // Arg3 + Arg1 * Arg2
- res.w = MulHigh(arg1->w, arg2->w) << 4; res.w = AddSat(res.w, arg3->w);
- break;
- case TextureStage::STAGE_LERP: // Arg3 * (Arg1 - Arg2) + Arg2
- res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, arg3->w) << 4; res.w = AddSat(res.w, arg2->w);
- break;
- case TextureStage::STAGE_DOT3:
- break; // Already computed in color channel
- case TextureStage::STAGE_BLENDCURRENTALPHA: // Alpha * (Arg1 - Arg2) + Arg2
- res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, current.w) << 4; res.w = AddSat(res.w, arg2->w);
- break;
- case TextureStage::STAGE_BLENDDIFFUSEALPHA: // Arg1 * (Alpha) + Arg2 * (1 - Alpha)
- res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, diffuse.w) << 4; res.w = AddSat(res.w, arg2->w);
- break;
- case TextureStage::STAGE_BLENDFACTORALPHA:
- res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, *Pointer<Short4>(data + OFFSET(DrawData, factor.textureFactor4[3]))) << 4; res.w = AddSat(res.w, arg2->w);
- break;
- case TextureStage::STAGE_BLENDTEXTUREALPHA: // Arg1 * (Alpha) + Arg2 * (1 - Alpha)
- res.w = SubSat(arg1->w, arg2->w); res.w = MulHigh(res.w, texture.w) << 4; res.w = AddSat(res.w, arg2->w);
- break;
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM: // Arg1 + Arg2 * (1 - Alpha)
- res.w = SubSat(Short4(0x1000), texture.w); res.w = MulHigh(res.w, arg2->w) << 4; res.w = AddSat(res.w, arg1->w);
- break;
- case TextureStage::STAGE_PREMODULATE:
- res.w = arg1->w;
- break;
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
- case TextureStage::STAGE_BUMPENVMAP:
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- break; // Invalid alpha operations
- default:
- ASSERT(false);
- }
- }
-
- // Clamp result to [0, 1]
-
- switch(textureStage.stageOperation)
- {
- case TextureStage::STAGE_DISABLE:
- case TextureStage::STAGE_SELECTARG1:
- case TextureStage::STAGE_SELECTARG2:
- case TextureStage::STAGE_SELECTARG3:
- case TextureStage::STAGE_MODULATE:
- case TextureStage::STAGE_MODULATE2X:
- case TextureStage::STAGE_MODULATE4X:
- case TextureStage::STAGE_ADD:
- case TextureStage::STAGE_MULTIPLYADD:
- case TextureStage::STAGE_LERP:
- case TextureStage::STAGE_BLENDCURRENTALPHA:
- case TextureStage::STAGE_BLENDDIFFUSEALPHA:
- case TextureStage::STAGE_BLENDFACTORALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
- case TextureStage::STAGE_DOT3: // Already clamped
- case TextureStage::STAGE_PREMODULATE:
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
- case TextureStage::STAGE_BUMPENVMAP:
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- if(state.textureStage[stage].cantUnderflow)
- {
- break; // Can't go below zero
- }
- case TextureStage::STAGE_ADDSIGNED:
- case TextureStage::STAGE_ADDSIGNED2X:
- case TextureStage::STAGE_SUBTRACT:
- case TextureStage::STAGE_ADDSMOOTH:
- res.x = Max(res.x, Short4(0x0000));
- res.y = Max(res.y, Short4(0x0000));
- res.z = Max(res.z, Short4(0x0000));
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.stageOperationAlpha)
- {
- case TextureStage::STAGE_DISABLE:
- case TextureStage::STAGE_SELECTARG1:
- case TextureStage::STAGE_SELECTARG2:
- case TextureStage::STAGE_SELECTARG3:
- case TextureStage::STAGE_MODULATE:
- case TextureStage::STAGE_MODULATE2X:
- case TextureStage::STAGE_MODULATE4X:
- case TextureStage::STAGE_ADD:
- case TextureStage::STAGE_MULTIPLYADD:
- case TextureStage::STAGE_LERP:
- case TextureStage::STAGE_BLENDCURRENTALPHA:
- case TextureStage::STAGE_BLENDDIFFUSEALPHA:
- case TextureStage::STAGE_BLENDFACTORALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
- case TextureStage::STAGE_DOT3: // Already clamped
- case TextureStage::STAGE_PREMODULATE:
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
- case TextureStage::STAGE_BUMPENVMAP:
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- if(state.textureStage[stage].cantUnderflow)
- {
- break; // Can't go below zero
- }
- case TextureStage::STAGE_ADDSIGNED:
- case TextureStage::STAGE_ADDSIGNED2X:
- case TextureStage::STAGE_SUBTRACT:
- case TextureStage::STAGE_ADDSMOOTH:
- res.w = Max(res.w, Short4(0x0000));
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.stageOperation)
- {
- case TextureStage::STAGE_DISABLE:
- case TextureStage::STAGE_SELECTARG1:
- case TextureStage::STAGE_SELECTARG2:
- case TextureStage::STAGE_SELECTARG3:
- case TextureStage::STAGE_MODULATE:
- case TextureStage::STAGE_SUBTRACT:
- case TextureStage::STAGE_ADDSMOOTH:
- case TextureStage::STAGE_LERP:
- case TextureStage::STAGE_BLENDCURRENTALPHA:
- case TextureStage::STAGE_BLENDDIFFUSEALPHA:
- case TextureStage::STAGE_BLENDFACTORALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHA:
- case TextureStage::STAGE_DOT3: // Already clamped
- case TextureStage::STAGE_PREMODULATE:
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
- case TextureStage::STAGE_BUMPENVMAP:
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- break; // Can't go above one
- case TextureStage::STAGE_MODULATE2X:
- case TextureStage::STAGE_MODULATE4X:
- case TextureStage::STAGE_ADD:
- case TextureStage::STAGE_ADDSIGNED:
- case TextureStage::STAGE_ADDSIGNED2X:
- case TextureStage::STAGE_MULTIPLYADD:
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
- res.x = Min(res.x, Short4(0x1000));
- res.y = Min(res.y, Short4(0x1000));
- res.z = Min(res.z, Short4(0x1000));
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.stageOperationAlpha)
- {
- case TextureStage::STAGE_DISABLE:
- case TextureStage::STAGE_SELECTARG1:
- case TextureStage::STAGE_SELECTARG2:
- case TextureStage::STAGE_SELECTARG3:
- case TextureStage::STAGE_MODULATE:
- case TextureStage::STAGE_SUBTRACT:
- case TextureStage::STAGE_ADDSMOOTH:
- case TextureStage::STAGE_LERP:
- case TextureStage::STAGE_BLENDCURRENTALPHA:
- case TextureStage::STAGE_BLENDDIFFUSEALPHA:
- case TextureStage::STAGE_BLENDFACTORALPHA:
- case TextureStage::STAGE_BLENDTEXTUREALPHA:
- case TextureStage::STAGE_DOT3: // Already clamped
- case TextureStage::STAGE_PREMODULATE:
- case TextureStage::STAGE_MODULATEINVALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATEINVCOLOR_ADDALPHA:
- case TextureStage::STAGE_BUMPENVMAP:
- case TextureStage::STAGE_BUMPENVMAPLUMINANCE:
- break; // Can't go above one
- case TextureStage::STAGE_MODULATE2X:
- case TextureStage::STAGE_MODULATE4X:
- case TextureStage::STAGE_ADD:
- case TextureStage::STAGE_ADDSIGNED:
- case TextureStage::STAGE_ADDSIGNED2X:
- case TextureStage::STAGE_MULTIPLYADD:
- case TextureStage::STAGE_BLENDTEXTUREALPHAPM:
- case TextureStage::STAGE_MODULATEALPHA_ADDCOLOR:
- case TextureStage::STAGE_MODULATECOLOR_ADDALPHA:
- res.w = Min(res.w, Short4(0x1000));
- break;
- default:
- ASSERT(false);
- }
-
- switch(textureStage.destinationArgument)
- {
- case TextureStage::DESTINATION_CURRENT:
- current.x = res.x;
- current.y = res.y;
- current.z = res.z;
- current.w = res.w;
- break;
- case TextureStage::DESTINATION_TEMP:
- temp.x = res.x;
- temp.y = res.y;
- temp.z = res.z;
- temp.w = res.w;
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelPipeline::fogBlend(Vector4s &current, Float4 &f)
- {
- if(!state.fogActive)
- {
- return;
- }
-
- if(state.pixelFogMode != FOG_NONE)
- {
- pixelFog(f);
- }
-
- UShort4 fog = convertFixed16(f, true);
-
- current.x = As<Short4>(MulHigh(As<UShort4>(current.x), fog));
- current.y = As<Short4>(MulHigh(As<UShort4>(current.y), fog));
- current.z = As<Short4>(MulHigh(As<UShort4>(current.z), fog));
-
- UShort4 invFog = UShort4(0xFFFFu) - fog;
-
- current.x += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(data + OFFSET(DrawData, fog.color4[0]))));
- current.y += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(data + OFFSET(DrawData, fog.color4[1]))));
- current.z += As<Short4>(MulHigh(invFog, *Pointer<UShort4>(data + OFFSET(DrawData, fog.color4[2]))));
- }
-
- void PixelPipeline::specularPixel(Vector4s &current, Vector4s &specular)
- {
- if(!state.specularAdd)
- {
- return;
- }
-
- current.x = AddSat(current.x, specular.x);
- current.y = AddSat(current.y, specular.y);
- current.z = AddSat(current.z, specular.z);
- }
-
- Vector4s PixelPipeline::sampleTexture(int coordinates, int stage, bool project)
- {
- Float4 x = v[2 + coordinates].x;
- Float4 y = v[2 + coordinates].y;
- Float4 z = v[2 + coordinates].z;
- Float4 w = v[2 + coordinates].w;
-
- if(perturbate)
- {
- x += du;
- y += dv;
-
- perturbate = false;
- }
-
- return sampleTexture(stage, x, y, z, w, project);
- }
-
- Vector4s PixelPipeline::sampleTexture(int stage, Float4 &u, Float4 &v, Float4 &w, Float4 &q, bool project)
- {
- Vector4s c;
-
- #if PERF_PROFILE
- Long texTime = Ticks();
- #endif
-
- Vector4f dsx;
- Vector4f dsy;
-
- Pointer<Byte> texture = data + OFFSET(DrawData, mipmap) + stage * sizeof(Texture);
-
- if(!project)
- {
- c = SamplerCore(constants, state.sampler[stage]).sampleTexture(texture, u, v, w, q, q, dsx, dsy);
- }
- else
- {
- Float4 rq = reciprocal(q);
-
- Float4 u_q = u * rq;
- Float4 v_q = v * rq;
- Float4 w_q = w * rq;
-
- c = SamplerCore(constants, state.sampler[stage]).sampleTexture(texture, u_q, v_q, w_q, q, q, dsx, dsy);
- }
-
- #if PERF_PROFILE
- cycles[PERF_TEX] += Ticks() - texTime;
- #endif
-
- return c;
- }
-
- Short4 PixelPipeline::convertFixed12(RValue<Float4> cf)
- {
- return RoundShort4(cf * Float4(0x1000));
- }
-
- void PixelPipeline::convertFixed12(Vector4s &cs, Vector4f &cf)
- {
- cs.x = convertFixed12(cf.x);
- cs.y = convertFixed12(cf.y);
- cs.z = convertFixed12(cf.z);
- cs.w = convertFixed12(cf.w);
- }
-
- Float4 PixelPipeline::convertSigned12(Short4 &cs)
- {
- return Float4(cs) * Float4(1.0f / 0x0FFE);
- }
-
- void PixelPipeline::convertSigned12(Vector4f &cf, Vector4s &cs)
- {
- cf.x = convertSigned12(cs.x);
- cf.y = convertSigned12(cs.y);
- cf.z = convertSigned12(cs.z);
- cf.w = convertSigned12(cs.w);
- }
-
- void PixelPipeline::writeDestination(Vector4s &d, const Dst &dst)
- {
- switch(dst.type)
- {
- case Shader::PARAMETER_TEMP:
- if(dst.mask & 0x1) rs[dst.index].x = d.x;
- if(dst.mask & 0x2) rs[dst.index].y = d.y;
- if(dst.mask & 0x4) rs[dst.index].z = d.z;
- if(dst.mask & 0x8) rs[dst.index].w = d.w;
- break;
- case Shader::PARAMETER_INPUT:
- if(dst.mask & 0x1) vs[dst.index].x = d.x;
- if(dst.mask & 0x2) vs[dst.index].y = d.y;
- if(dst.mask & 0x4) vs[dst.index].z = d.z;
- if(dst.mask & 0x8) vs[dst.index].w = d.w;
- break;
- case Shader::PARAMETER_CONST: ASSERT(false); break;
- case Shader::PARAMETER_TEXTURE:
- if(dst.mask & 0x1) ts[dst.index].x = d.x;
- if(dst.mask & 0x2) ts[dst.index].y = d.y;
- if(dst.mask & 0x4) ts[dst.index].z = d.z;
- if(dst.mask & 0x8) ts[dst.index].w = d.w;
- break;
- case Shader::PARAMETER_COLOROUT:
- if(dst.mask & 0x1) vs[dst.index].x = d.x;
- if(dst.mask & 0x2) vs[dst.index].y = d.y;
- if(dst.mask & 0x4) vs[dst.index].z = d.z;
- if(dst.mask & 0x8) vs[dst.index].w = d.w;
- break;
- default:
- ASSERT(false);
- }
- }
-
- Vector4s PixelPipeline::fetchRegister(const Src &src)
- {
- Vector4s *reg;
- int i = src.index;
-
- Vector4s c;
-
- if(src.type == Shader::PARAMETER_CONST)
- {
- c.x = *Pointer<Short4>(data + OFFSET(DrawData, ps.cW[i][0]));
- c.y = *Pointer<Short4>(data + OFFSET(DrawData, ps.cW[i][1]));
- c.z = *Pointer<Short4>(data + OFFSET(DrawData, ps.cW[i][2]));
- c.w = *Pointer<Short4>(data + OFFSET(DrawData, ps.cW[i][3]));
- }
-
- switch(src.type)
- {
- case Shader::PARAMETER_TEMP: reg = &rs[i]; break;
- case Shader::PARAMETER_INPUT: reg = &vs[i]; break;
- case Shader::PARAMETER_CONST: reg = &c; break;
- case Shader::PARAMETER_TEXTURE: reg = &ts[i]; break;
- case Shader::PARAMETER_VOID: return rs[0]; // Dummy
- case Shader::PARAMETER_FLOAT4LITERAL: return rs[0]; // Dummy
- default: ASSERT(false); return rs[0];
- }
-
- const Short4 &x = (*reg)[(src.swizzle >> 0) & 0x3];
- const Short4 &y = (*reg)[(src.swizzle >> 2) & 0x3];
- const Short4 &z = (*reg)[(src.swizzle >> 4) & 0x3];
- const Short4 &w = (*reg)[(src.swizzle >> 6) & 0x3];
-
- Vector4s mod;
-
- switch(src.modifier)
- {
- case Shader::MODIFIER_NONE:
- mod.x = x;
- mod.y = y;
- mod.z = z;
- mod.w = w;
- break;
- case Shader::MODIFIER_BIAS:
- mod.x = SubSat(x, Short4(0x0800));
- mod.y = SubSat(y, Short4(0x0800));
- mod.z = SubSat(z, Short4(0x0800));
- mod.w = SubSat(w, Short4(0x0800));
- break;
- case Shader::MODIFIER_BIAS_NEGATE:
- mod.x = SubSat(Short4(0x0800), x);
- mod.y = SubSat(Short4(0x0800), y);
- mod.z = SubSat(Short4(0x0800), z);
- mod.w = SubSat(Short4(0x0800), w);
- break;
- case Shader::MODIFIER_COMPLEMENT:
- mod.x = SubSat(Short4(0x1000), x);
- mod.y = SubSat(Short4(0x1000), y);
- mod.z = SubSat(Short4(0x1000), z);
- mod.w = SubSat(Short4(0x1000), w);
- break;
- case Shader::MODIFIER_NEGATE:
- mod.x = -x;
- mod.y = -y;
- mod.z = -z;
- mod.w = -w;
- break;
- case Shader::MODIFIER_X2:
- mod.x = AddSat(x, x);
- mod.y = AddSat(y, y);
- mod.z = AddSat(z, z);
- mod.w = AddSat(w, w);
- break;
- case Shader::MODIFIER_X2_NEGATE:
- mod.x = -AddSat(x, x);
- mod.y = -AddSat(y, y);
- mod.z = -AddSat(z, z);
- mod.w = -AddSat(w, w);
- break;
- case Shader::MODIFIER_SIGN:
- mod.x = SubSat(x, Short4(0x0800));
- mod.y = SubSat(y, Short4(0x0800));
- mod.z = SubSat(z, Short4(0x0800));
- mod.w = SubSat(w, Short4(0x0800));
- mod.x = AddSat(mod.x, mod.x);
- mod.y = AddSat(mod.y, mod.y);
- mod.z = AddSat(mod.z, mod.z);
- mod.w = AddSat(mod.w, mod.w);
- break;
- case Shader::MODIFIER_SIGN_NEGATE:
- mod.x = SubSat(Short4(0x0800), x);
- mod.y = SubSat(Short4(0x0800), y);
- mod.z = SubSat(Short4(0x0800), z);
- mod.w = SubSat(Short4(0x0800), w);
- mod.x = AddSat(mod.x, mod.x);
- mod.y = AddSat(mod.y, mod.y);
- mod.z = AddSat(mod.z, mod.z);
- mod.w = AddSat(mod.w, mod.w);
- break;
- case Shader::MODIFIER_DZ:
- mod.x = x;
- mod.y = y;
- mod.z = z;
- mod.w = w;
- // Projection performed by texture sampler
- break;
- case Shader::MODIFIER_DW:
- mod.x = x;
- mod.y = y;
- mod.z = z;
- mod.w = w;
- // Projection performed by texture sampler
- break;
- default:
- ASSERT(false);
- }
-
- if(src.type == Shader::PARAMETER_CONST && (src.modifier == Shader::MODIFIER_X2 || src.modifier == Shader::MODIFIER_X2_NEGATE))
- {
- mod.x = Min(mod.x, Short4(0x1000)); mod.x = Max(mod.x, Short4(-0x1000));
- mod.y = Min(mod.y, Short4(0x1000)); mod.y = Max(mod.y, Short4(-0x1000));
- mod.z = Min(mod.z, Short4(0x1000)); mod.z = Max(mod.z, Short4(-0x1000));
- mod.w = Min(mod.w, Short4(0x1000)); mod.w = Max(mod.w, Short4(-0x1000));
- }
-
- return mod;
- }
-
- void PixelPipeline::MOV(Vector4s &dst, Vector4s &src0)
- {
- dst.x = src0.x;
- dst.y = src0.y;
- dst.z = src0.z;
- dst.w = src0.w;
- }
-
- void PixelPipeline::ADD(Vector4s &dst, Vector4s &src0, Vector4s &src1)
- {
- dst.x = AddSat(src0.x, src1.x);
- dst.y = AddSat(src0.y, src1.y);
- dst.z = AddSat(src0.z, src1.z);
- dst.w = AddSat(src0.w, src1.w);
- }
-
- void PixelPipeline::SUB(Vector4s &dst, Vector4s &src0, Vector4s &src1)
- {
- dst.x = SubSat(src0.x, src1.x);
- dst.y = SubSat(src0.y, src1.y);
- dst.z = SubSat(src0.z, src1.z);
- dst.w = SubSat(src0.w, src1.w);
- }
-
- void PixelPipeline::MAD(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
- {
- // FIXME: Long fixed-point multiply fixup
- { dst.x = MulHigh(src0.x, src1.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, src2.x); }
- { dst.y = MulHigh(src0.y, src1.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, src2.y); }
- { dst.z = MulHigh(src0.z, src1.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, src2.z); }
- { dst.w = MulHigh(src0.w, src1.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, src2.w); }
- }
-
- void PixelPipeline::MUL(Vector4s &dst, Vector4s &src0, Vector4s &src1)
- {
- // FIXME: Long fixed-point multiply fixup
- { dst.x = MulHigh(src0.x, src1.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); }
- { dst.y = MulHigh(src0.y, src1.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); }
- { dst.z = MulHigh(src0.z, src1.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); }
- { dst.w = MulHigh(src0.w, src1.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); }
- }
-
- void PixelPipeline::DP3(Vector4s &dst, Vector4s &src0, Vector4s &src1)
- {
- Short4 t0;
- Short4 t1;
-
- // FIXME: Long fixed-point multiply fixup
- t0 = MulHigh(src0.x, src1.x); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0);
- t1 = MulHigh(src0.y, src1.y); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1);
- t0 = AddSat(t0, t1);
- t1 = MulHigh(src0.z, src1.z); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1);
- t0 = AddSat(t0, t1);
-
- dst.x = t0;
- dst.y = t0;
- dst.z = t0;
- dst.w = t0;
- }
-
- void PixelPipeline::DP4(Vector4s &dst, Vector4s &src0, Vector4s &src1)
- {
- Short4 t0;
- Short4 t1;
-
- // FIXME: Long fixed-point multiply fixup
- t0 = MulHigh(src0.x, src1.x); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0); t0 = AddSat(t0, t0);
- t1 = MulHigh(src0.y, src1.y); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1);
- t0 = AddSat(t0, t1);
- t1 = MulHigh(src0.z, src1.z); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1);
- t0 = AddSat(t0, t1);
- t1 = MulHigh(src0.w, src1.w); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1); t1 = AddSat(t1, t1);
- t0 = AddSat(t0, t1);
-
- dst.x = t0;
- dst.y = t0;
- dst.z = t0;
- dst.w = t0;
- }
-
- void PixelPipeline::LRP(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
- {
- // FIXME: Long fixed-point multiply fixup
- { dst.x = SubSat(src1.x, src2.x); dst.x = MulHigh(dst.x, src0.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, dst.x); dst.x = AddSat(dst.x, src2.x); }
- {
- dst.y = SubSat(src1.y, src2.y); dst.y = MulHigh(dst.y, src0.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, dst.y); dst.y = AddSat(dst.y, src2.y);
- }
- {dst.z = SubSat(src1.z, src2.z); dst.z = MulHigh(dst.z, src0.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, dst.z); dst.z = AddSat(dst.z, src2.z); }
- {dst.w = SubSat(src1.w, src2.w); dst.w = MulHigh(dst.w, src0.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, dst.w); dst.w = AddSat(dst.w, src2.w); }
- }
-
- void PixelPipeline::TEXCOORD(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate)
- {
- Float4 uw;
- Float4 vw;
- Float4 sw;
-
- if(state.interpolant[2 + coordinate].component & 0x01)
- {
- uw = Max(u, Float4(0.0f));
- uw = Min(uw, Float4(1.0f));
- dst.x = convertFixed12(uw);
- }
- else
- {
- dst.x = Short4(0x0000);
- }
-
- if(state.interpolant[2 + coordinate].component & 0x02)
- {
- vw = Max(v, Float4(0.0f));
- vw = Min(vw, Float4(1.0f));
- dst.y = convertFixed12(vw);
- }
- else
- {
- dst.y = Short4(0x0000);
- }
-
- if(state.interpolant[2 + coordinate].component & 0x04)
- {
- sw = Max(s, Float4(0.0f));
- sw = Min(sw, Float4(1.0f));
- dst.z = convertFixed12(sw);
- }
- else
- {
- dst.z = Short4(0x0000);
- }
-
- dst.w = Short4(0x1000);
- }
-
- void PixelPipeline::TEXCRD(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate, bool project)
- {
- Float4 uw = u;
- Float4 vw = v;
- Float4 sw = s;
-
- if(project)
- {
- uw *= Rcp_pp(s);
- vw *= Rcp_pp(s);
- }
-
- if(state.interpolant[2 + coordinate].component & 0x01)
- {
- uw *= Float4(0x1000);
- uw = Max(uw, Float4(-0x8000));
- uw = Min(uw, Float4(0x7FFF));
- dst.x = RoundShort4(uw);
- }
- else
- {
- dst.x = Short4(0x0000);
- }
-
- if(state.interpolant[2 + coordinate].component & 0x02)
- {
- vw *= Float4(0x1000);
- vw = Max(vw, Float4(-0x8000));
- vw = Min(vw, Float4(0x7FFF));
- dst.y = RoundShort4(vw);
- }
- else
- {
- dst.y = Short4(0x0000);
- }
-
- if(state.interpolant[2 + coordinate].component & 0x04)
- {
- sw *= Float4(0x1000);
- sw = Max(sw, Float4(-0x8000));
- sw = Min(sw, Float4(0x7FFF));
- dst.z = RoundShort4(sw);
- }
- else
- {
- dst.z = Short4(0x0000);
- }
- }
-
- void PixelPipeline::TEXDP3(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src)
- {
- TEXM3X3PAD(u, v, s, src, 0, false);
-
- Short4 t0 = RoundShort4(u_ * Float4(0x1000));
-
- dst.x = t0;
- dst.y = t0;
- dst.z = t0;
- dst.w = t0;
- }
-
- void PixelPipeline::TEXDP3TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0)
- {
- TEXM3X3PAD(u, v, s, src0, 0, false);
-
- v_ = Float4(0.0f);
- w_ = Float4(0.0f);
-
- dst = sampleTexture(stage, u_, v_, w_, w_);
- }
-
- void PixelPipeline::TEXKILL(Int cMask[4], Float4 &u, Float4 &v, Float4 &s)
- {
- Int kill = SignMask(CmpNLT(u, Float4(0.0f))) &
- SignMask(CmpNLT(v, Float4(0.0f))) &
- SignMask(CmpNLT(s, Float4(0.0f)));
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= kill;
- }
- }
-
- void PixelPipeline::TEXKILL(Int cMask[4], Vector4s &src)
- {
- Short4 test = src.x | src.y | src.z;
- Int kill = SignMask(PackSigned(test, test)) ^ 0x0000000F;
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= kill;
- }
- }
-
- void PixelPipeline::TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int sampler, bool project)
- {
- dst = sampleTexture(sampler, u, v, s, s, project);
- }
-
- void PixelPipeline::TEXLD(Vector4s &dst, Vector4s &src, int sampler, bool project)
- {
- Float4 u = Float4(src.x) * Float4(1.0f / 0x0FFE);
- Float4 v = Float4(src.y) * Float4(1.0f / 0x0FFE);
- Float4 s = Float4(src.z) * Float4(1.0f / 0x0FFE);
-
- dst = sampleTexture(sampler, u, v, s, s, project);
- }
-
- void PixelPipeline::TEXBEM(Vector4s &dst, Vector4s &src, Float4 &u, Float4 &v, Float4 &s, int stage)
- {
- Float4 du = Float4(src.x) * Float4(1.0f / 0x0FFE);
- Float4 dv = Float4(src.y) * Float4(1.0f / 0x0FFE);
-
- Float4 du2 = du;
- Float4 dv2 = dv;
-
- du *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][0]));
- dv2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][0]));
- du += dv2;
- dv *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][1]));
- du2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][1]));
- dv += du2;
-
- Float4 u_ = u + du;
- Float4 v_ = v + dv;
-
- dst = sampleTexture(stage, u_, v_, s, s);
- }
-
- void PixelPipeline::TEXBEML(Vector4s &dst, Vector4s &src, Float4 &u, Float4 &v, Float4 &s, int stage)
- {
- Float4 du = Float4(src.x) * Float4(1.0f / 0x0FFE);
- Float4 dv = Float4(src.y) * Float4(1.0f / 0x0FFE);
-
- Float4 du2 = du;
- Float4 dv2 = dv;
-
- du *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][0]));
- dv2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][0]));
- du += dv2;
- dv *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[1][1]));
- du2 *= *Pointer<Float4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4F[0][1]));
- dv += du2;
-
- Float4 u_ = u + du;
- Float4 v_ = v + dv;
-
- dst = sampleTexture(stage, u_, v_, s, s);
-
- Short4 L;
-
- L = src.z;
- L = MulHigh(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceScale4)));
- L = L << 4;
- L = AddSat(L, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].luminanceOffset4)));
- L = Max(L, Short4(0x0000));
- L = Min(L, Short4(0x1000));
-
- dst.x = MulHigh(dst.x, L); dst.x = dst.x << 4;
- dst.y = MulHigh(dst.y, L); dst.y = dst.y << 4;
- dst.z = MulHigh(dst.z, L); dst.z = dst.z << 4;
- }
-
- void PixelPipeline::TEXREG2AR(Vector4s &dst, Vector4s &src0, int stage)
- {
- Float4 u = Float4(src0.w) * Float4(1.0f / 0x0FFE);
- Float4 v = Float4(src0.x) * Float4(1.0f / 0x0FFE);
- Float4 s = Float4(src0.z) * Float4(1.0f / 0x0FFE);
-
- dst = sampleTexture(stage, u, v, s, s);
- }
-
- void PixelPipeline::TEXREG2GB(Vector4s &dst, Vector4s &src0, int stage)
- {
- Float4 u = Float4(src0.y) * Float4(1.0f / 0x0FFE);
- Float4 v = Float4(src0.z) * Float4(1.0f / 0x0FFE);
- Float4 s = v;
-
- dst = sampleTexture(stage, u, v, s, s);
- }
-
- void PixelPipeline::TEXREG2RGB(Vector4s &dst, Vector4s &src0, int stage)
- {
- Float4 u = Float4(src0.x) * Float4(1.0f / 0x0FFE);
- Float4 v = Float4(src0.y) * Float4(1.0f / 0x0FFE);
- Float4 s = Float4(src0.z) * Float4(1.0f / 0x0FFE);
-
- dst = sampleTexture(stage, u, v, s, s);
- }
-
- void PixelPipeline::TEXM3X2DEPTH(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src, bool signedScaling)
- {
- TEXM3X2PAD(u, v, s, src, 1, signedScaling);
-
- // z / w
- u_ *= Rcp_pp(v_); // FIXME: Set result to 1.0 when division by zero
-
- oDepth = u_;
- }
-
- void PixelPipeline::TEXM3X2PAD(Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, int component, bool signedScaling)
- {
- TEXM3X3PAD(u, v, s, src0, component, signedScaling);
- }
-
- void PixelPipeline::TEXM3X2TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, bool signedScaling)
- {
- TEXM3X2PAD(u, v, s, src0, 1, signedScaling);
-
- w_ = Float4(0.0f);
-
- dst = sampleTexture(stage, u_, v_, w_, w_);
- }
-
- void PixelPipeline::TEXM3X3(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, bool signedScaling)
- {
- TEXM3X3PAD(u, v, s, src0, 2, signedScaling);
-
- dst.x = RoundShort4(u_ * Float4(0x1000));
- dst.y = RoundShort4(v_ * Float4(0x1000));
- dst.z = RoundShort4(w_ * Float4(0x1000));
- dst.w = Short4(0x1000);
- }
-
- void PixelPipeline::TEXM3X3PAD(Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, int component, bool signedScaling)
- {
- if(component == 0 || previousScaling != signedScaling) // FIXME: Other source modifiers?
- {
- U = Float4(src0.x);
- V = Float4(src0.y);
- W = Float4(src0.z);
-
- previousScaling = signedScaling;
- }
-
- Float4 x = U * u + V * v + W * s;
-
- x *= Float4(1.0f / 0x1000);
-
- switch(component)
- {
- case 0: u_ = x; break;
- case 1: v_ = x; break;
- case 2: w_ = x; break;
- default: ASSERT(false);
- }
- }
-
- void PixelPipeline::TEXM3X3SPEC(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, Vector4s &src1)
- {
- TEXM3X3PAD(u, v, s, src0, 2, false);
-
- Float4 E[3]; // Eye vector
-
- E[0] = Float4(src1.x) * Float4(1.0f / 0x0FFE);
- E[1] = Float4(src1.y) * Float4(1.0f / 0x0FFE);
- E[2] = Float4(src1.z) * Float4(1.0f / 0x0FFE);
-
- // Reflection
- Float4 u__;
- Float4 v__;
- Float4 w__;
-
- // (u'', v'', w'') = 2 * (N . E) * N - E * (N . N)
- u__ = u_ * E[0];
- v__ = v_ * E[1];
- w__ = w_ * E[2];
- u__ += v__ + w__;
- u__ += u__;
- v__ = u__;
- w__ = u__;
- u__ *= u_;
- v__ *= v_;
- w__ *= w_;
- u_ *= u_;
- v_ *= v_;
- w_ *= w_;
- u_ += v_ + w_;
- u__ -= E[0] * u_;
- v__ -= E[1] * u_;
- w__ -= E[2] * u_;
-
- dst = sampleTexture(stage, u__, v__, w__, w__);
- }
-
- void PixelPipeline::TEXM3X3TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, bool signedScaling)
- {
- TEXM3X3PAD(u, v, s, src0, 2, signedScaling);
-
- dst = sampleTexture(stage, u_, v_, w_, w_);
- }
-
- void PixelPipeline::TEXM3X3VSPEC(Vector4s &dst, Float4 &x, Float4 &y, Float4 &z, int stage, Vector4s &src0)
- {
- TEXM3X3PAD(x, y, z, src0, 2, false);
-
- Float4 E[3]; // Eye vector
-
- E[0] = v[2 + stage - 2].w;
- E[1] = v[2 + stage - 1].w;
- E[2] = v[2 + stage - 0].w;
-
- // Reflection
- Float4 u__;
- Float4 v__;
- Float4 w__;
-
- // (u'', v'', w'') = 2 * (N . E) * N - E * (N . N)
- u__ = u_ * E[0];
- v__ = v_ * E[1];
- w__ = w_ * E[2];
- u__ += v__ + w__;
- u__ += u__;
- v__ = u__;
- w__ = u__;
- u__ *= u_;
- v__ *= v_;
- w__ *= w_;
- u_ *= u_;
- v_ *= v_;
- w_ *= w_;
- u_ += v_ + w_;
- u__ -= E[0] * u_;
- v__ -= E[1] * u_;
- w__ -= E[2] * u_;
-
- dst = sampleTexture(stage, u__, v__, w__, w__);
- }
-
- void PixelPipeline::TEXDEPTH()
- {
- u_ = Float4(rs[5].x);
- v_ = Float4(rs[5].y);
-
- // z / w
- u_ *= Rcp_pp(v_); // FIXME: Set result to 1.0 when division by zero
-
- oDepth = u_;
- }
-
- void PixelPipeline::CND(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
- {
- {Short4 t0; t0 = src0.x; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.x; t1 = t1 & t0; t0 = ~t0 & src2.x; t0 = t0 | t1; dst.x = t0; };
- {Short4 t0; t0 = src0.y; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.y; t1 = t1 & t0; t0 = ~t0 & src2.y; t0 = t0 | t1; dst.y = t0; };
- {Short4 t0; t0 = src0.z; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.z; t1 = t1 & t0; t0 = ~t0 & src2.z; t0 = t0 | t1; dst.z = t0; };
- {Short4 t0; t0 = src0.w; t0 = CmpGT(t0, Short4(0x0800)); Short4 t1; t1 = src1.w; t1 = t1 & t0; t0 = ~t0 & src2.w; t0 = t0 | t1; dst.w = t0; };
- }
-
- void PixelPipeline::CMP(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2)
- {
- {Short4 t0 = CmpGT(Short4(0x0000), src0.x); Short4 t1; t1 = src2.x; t1 &= t0; t0 = ~t0 & src1.x; t0 |= t1; dst.x = t0; };
- {Short4 t0 = CmpGT(Short4(0x0000), src0.y); Short4 t1; t1 = src2.y; t1 &= t0; t0 = ~t0 & src1.y; t0 |= t1; dst.y = t0; };
- {Short4 t0 = CmpGT(Short4(0x0000), src0.z); Short4 t1; t1 = src2.z; t1 &= t0; t0 = ~t0 & src1.z; t0 |= t1; dst.z = t0; };
- {Short4 t0 = CmpGT(Short4(0x0000), src0.w); Short4 t1; t1 = src2.w; t1 &= t0; t0 = ~t0 & src1.w; t0 |= t1; dst.w = t0; };
- }
-
- void PixelPipeline::BEM(Vector4s &dst, Vector4s &src0, Vector4s &src1, int stage)
- {
- Short4 t0;
- Short4 t1;
-
- // dst.x = src0.x + BUMPENVMAT00(stage) * src1.x + BUMPENVMAT10(stage) * src1.y
- t0 = MulHigh(src1.x, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4W[0][0]))); t0 = t0 << 4; // FIXME: Matrix components range? Overflow hazard.
- t1 = MulHigh(src1.y, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4W[1][0]))); t1 = t1 << 4; // FIXME: Matrix components range? Overflow hazard.
- t0 = AddSat(t0, t1);
- t0 = AddSat(t0, src0.x);
- dst.x = t0;
-
- // dst.y = src0.y + BUMPENVMAT01(stage) * src1.x + BUMPENVMAT11(stage) * src1.y
- t0 = MulHigh(src1.x, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4W[0][1]))); t0 = t0 << 4; // FIXME: Matrix components range? Overflow hazard.
- t1 = MulHigh(src1.y, *Pointer<Short4>(data + OFFSET(DrawData, textureStage[stage].bumpmapMatrix4W[1][1]))); t1 = t1 << 4; // FIXME: Matrix components range? Overflow hazard.
- t0 = AddSat(t0, t1);
- t0 = AddSat(t0, src0.y);
- dst.y = t0;
- }
-}
-
diff --git a/src/Shader/PixelPipeline.hpp b/src/Shader/PixelPipeline.hpp
deleted file mode 100644
index 66f0ec7a9..000000000
--- a/src/Shader/PixelPipeline.hpp
+++ /dev/null
@@ -1,114 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_PixelPipeline_hpp
-#define sw_PixelPipeline_hpp
-
-#include "PixelRoutine.hpp"
-
-namespace sw
-{
- class PixelPipeline : public PixelRoutine
- {
- public:
- PixelPipeline(const PixelProcessor::State &state, const PixelShader *shader) :
- PixelRoutine(state, shader), current(rs[0]), diffuse(vs[0]), specular(vs[1]), perturbate(false), luminance(false), previousScaling(false) {}
- virtual ~PixelPipeline() {}
-
- protected:
- virtual void setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w);
- virtual void applyShader(Int cMask[4]);
- virtual Bool alphaTest(Int cMask[4]);
- virtual void rasterOperation(Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]);
-
- private:
- Vector4s &current;
- Vector4s &diffuse;
- Vector4s &specular;
-
- Vector4s rs[6];
- Vector4s vs[2];
- Vector4s ts[6];
-
- // bem(l) offsets and luminance
- Float4 du;
- Float4 dv;
- Short4 L;
-
- // texm3x3 temporaries
- Float4 u_; // FIXME
- Float4 v_; // FIXME
- Float4 w_; // FIXME
- Float4 U; // FIXME
- Float4 V; // FIXME
- Float4 W; // FIXME
-
- void fixedFunction();
- void blendTexture(Vector4s &temp, Vector4s &texture, int stage);
- void fogBlend(Vector4s &current, Float4 &fog);
- void specularPixel(Vector4s &current, Vector4s &specular);
-
- Vector4s sampleTexture(int coordinates, int sampler, bool project = false);
- Vector4s sampleTexture(int sampler, Float4 &u, Float4 &v, Float4 &w, Float4 &q, bool project = false);
-
- Short4 convertFixed12(RValue<Float4> cf);
- void convertFixed12(Vector4s &cs, Vector4f &cf);
- Float4 convertSigned12(Short4 &cs);
- void convertSigned12(Vector4f &cf, Vector4s &cs);
-
- void writeDestination(Vector4s &d, const Dst &dst);
- Vector4s fetchRegister(const Src &src);
-
- // Instructions
- void MOV(Vector4s &dst, Vector4s &src0);
- void ADD(Vector4s &dst, Vector4s &src0, Vector4s &src1);
- void SUB(Vector4s &dst, Vector4s &src0, Vector4s &src1);
- void MAD(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2);
- void MUL(Vector4s &dst, Vector4s &src0, Vector4s &src1);
- void DP3(Vector4s &dst, Vector4s &src0, Vector4s &src1);
- void DP4(Vector4s &dst, Vector4s &src0, Vector4s &src1);
- void LRP(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2);
- void TEXCOORD(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate);
- void TEXCRD(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int coordinate, bool project);
- void TEXDP3(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src);
- void TEXDP3TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0);
- void TEXKILL(Int cMask[4], Float4 &u, Float4 &v, Float4 &s);
- void TEXKILL(Int cMask[4], Vector4s &dst);
- void TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, bool project);
- void TEXLD(Vector4s &dst, Vector4s &src, int stage, bool project);
- void TEXBEM(Vector4s &dst, Vector4s &src, Float4 &u, Float4 &v, Float4 &s, int stage);
- void TEXBEML(Vector4s &dst, Vector4s &src, Float4 &u, Float4 &v, Float4 &s, int stage);
- void TEXREG2AR(Vector4s &dst, Vector4s &src0, int stage);
- void TEXREG2GB(Vector4s &dst, Vector4s &src0, int stage);
- void TEXREG2RGB(Vector4s &dst, Vector4s &src0, int stage);
- void TEXM3X2DEPTH(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src, bool signedScaling);
- void TEXM3X2PAD(Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, int component, bool signedScaling);
- void TEXM3X2TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, bool signedScaling);
- void TEXM3X3(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, bool signedScaling);
- void TEXM3X3PAD(Float4 &u, Float4 &v, Float4 &s, Vector4s &src0, int component, bool signedScaling);
- void TEXM3X3SPEC(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, Vector4s &src1);
- void TEXM3X3TEX(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0, bool singedScaling);
- void TEXM3X3VSPEC(Vector4s &dst, Float4 &u, Float4 &v, Float4 &s, int stage, Vector4s &src0);
- void TEXDEPTH();
- void CND(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2);
- void CMP(Vector4s &dst, Vector4s &src0, Vector4s &src1, Vector4s &src2);
- void BEM(Vector4s &dst, Vector4s &src0, Vector4s &src1, int stage);
-
- bool perturbate;
- bool luminance;
- bool previousScaling;
- };
-}
-
-#endif
diff --git a/src/Shader/PixelProgram.cpp b/src/Shader/PixelProgram.cpp
deleted file mode 100644
index 959e63e2c..000000000
--- a/src/Shader/PixelProgram.cpp
+++ /dev/null
@@ -1,1897 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PixelProgram.hpp"
-
-#include "SamplerCore.hpp"
-#include "Renderer/Primitive.hpp"
-#include "Renderer/Renderer.hpp"
-
-namespace sw
-{
- extern bool postBlendSRGB;
- extern bool booleanFaceRegister;
- extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
- extern bool fullPixelPositionRegister;
-
- PixelProgram::PixelProgram(const PixelProcessor::State &state, const PixelShader *shader) :
- PixelRoutine(state, shader),
- r(shader->indirectAddressableTemporaries),
- aL(shader->getLimits().loops),
- increment(shader->getLimits().loops),
- iteration(shader->getLimits().loops),
- callStack(shader->getLimits().stack)
- {
- auto limits = shader->getLimits();
- ifFalseBlock.resize(limits.ifs);
- loopRepTestBlock.resize(limits.loops);
- loopRepEndBlock.resize(limits.loops);
- labelBlock.resize(limits.maxLabel + 1);
- isConditionalIf.resize(limits.ifs);
-
- loopDepth = -1;
- enableStack[0] = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
-
- if(shader->containsBreakInstruction())
- {
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- if(shader->containsContinueInstruction())
- {
- enableContinue = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
- }
-
- void PixelProgram::setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w)
- {
- if(shader->getShaderModel() >= 0x0300)
- {
- if(shader->isVPosDeclared())
- {
- if(!halfIntegerCoordinates)
- {
- vPos.x = Float4(Float(x)) + Float4(0, 1, 0, 1);
- vPos.y = Float4(Float(y)) + Float4(0, 0, 1, 1);
- }
- else
- {
- vPos.x = Float4(Float(x)) + Float4(0.5f, 1.5f, 0.5f, 1.5f);
- vPos.y = Float4(Float(y)) + Float4(0.5f, 0.5f, 1.5f, 1.5f);
- }
-
- if(fullPixelPositionRegister)
- {
- vPos.z = z[0]; // FIXME: Centroid?
- vPos.w = w; // FIXME: Centroid?
- }
- }
-
- if(shader->isVFaceDeclared())
- {
- Float4 face = *Pointer<Float>(primitive + OFFSET(Primitive, area));
-
- if(booleanFaceRegister)
- {
- face = As<Float4>(state.frontFaceCCW ? CmpNLT(face, Float4(0.0f)) : CmpLT(face, Float4(0.0f)));
- }
-
- vFace.x = face;
- vFace.y = face;
- vFace.z = face;
- vFace.w = face;
- }
- }
- }
-
- void PixelProgram::applyShader(Int cMask[4])
- {
- enableIndex = 0;
- stackIndex = 0;
-
- if(shader->containsLeaveInstruction())
- {
- enableLeave = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- if(state.targetFormat[i] != FORMAT_NULL)
- {
- oC[i] = Vector4f(0.0f, 0.0f, 0.0f, 0.0f);
- }
- }
-
- // Create all call site return blocks up front
- for(size_t i = 0; i < shader->getLength(); i++)
- {
- const Shader::Instruction *instruction = shader->getInstruction(i);
- Shader::Opcode opcode = instruction->opcode;
-
- if(opcode == Shader::OPCODE_CALL || opcode == Shader::OPCODE_CALLNZ)
- {
- const Dst &dst = instruction->dst;
-
- ASSERT(callRetBlock[dst.label].size() == dst.callSite);
- callRetBlock[dst.label].push_back(Nucleus::createBasicBlock());
- }
- }
-
- bool broadcastColor0 = true;
-
- for(size_t i = 0; i < shader->getLength(); i++)
- {
- const Shader::Instruction *instruction = shader->getInstruction(i);
- Shader::Opcode opcode = instruction->opcode;
-
- if(opcode == Shader::OPCODE_DCL || opcode == Shader::OPCODE_DEF || opcode == Shader::OPCODE_DEFI || opcode == Shader::OPCODE_DEFB)
- {
- continue;
- }
-
- const Dst &dst = instruction->dst;
- const Src &src0 = instruction->src[0];
- const Src &src1 = instruction->src[1];
- const Src &src2 = instruction->src[2];
- const Src &src3 = instruction->src[3];
- const Src &src4 = instruction->src[4];
-
- bool predicate = instruction->predicate;
- Control control = instruction->control;
- bool pp = dst.partialPrecision;
- bool project = instruction->project;
- bool bias = instruction->bias;
-
- Vector4f d;
- Vector4f s0;
- Vector4f s1;
- Vector4f s2;
- Vector4f s3;
- Vector4f s4;
-
- if(opcode == Shader::OPCODE_TEXKILL) // Takes destination as input
- {
- if(dst.type == Shader::PARAMETER_TEXTURE)
- {
- d.x = v[2 + dst.index].x;
- d.y = v[2 + dst.index].y;
- d.z = v[2 + dst.index].z;
- d.w = v[2 + dst.index].w;
- }
- else
- {
- d = r[dst.index];
- }
- }
-
- if(src0.type != Shader::PARAMETER_VOID) s0 = fetchRegister(src0);
- if(src1.type != Shader::PARAMETER_VOID) s1 = fetchRegister(src1);
- if(src2.type != Shader::PARAMETER_VOID) s2 = fetchRegister(src2);
- if(src3.type != Shader::PARAMETER_VOID) s3 = fetchRegister(src3);
- if(src4.type != Shader::PARAMETER_VOID) s4 = fetchRegister(src4);
-
- switch(opcode)
- {
- case Shader::OPCODE_PS_2_0: break;
- case Shader::OPCODE_PS_2_x: break;
- case Shader::OPCODE_PS_3_0: break;
- case Shader::OPCODE_DEF: break;
- case Shader::OPCODE_DCL: break;
- case Shader::OPCODE_NOP: break;
- case Shader::OPCODE_MOV: mov(d, s0); break;
- case Shader::OPCODE_NEG: neg(d, s0); break;
- case Shader::OPCODE_INEG: ineg(d, s0); break;
- case Shader::OPCODE_F2B: f2b(d, s0); break;
- case Shader::OPCODE_B2F: b2f(d, s0); break;
- case Shader::OPCODE_F2I: f2i(d, s0); break;
- case Shader::OPCODE_I2F: i2f(d, s0); break;
- case Shader::OPCODE_F2U: f2u(d, s0); break;
- case Shader::OPCODE_U2F: u2f(d, s0); break;
- case Shader::OPCODE_I2B: i2b(d, s0); break;
- case Shader::OPCODE_B2I: b2i(d, s0); break;
- case Shader::OPCODE_ADD: add(d, s0, s1); break;
- case Shader::OPCODE_IADD: iadd(d, s0, s1); break;
- case Shader::OPCODE_SUB: sub(d, s0, s1); break;
- case Shader::OPCODE_ISUB: isub(d, s0, s1); break;
- case Shader::OPCODE_MUL: mul(d, s0, s1); break;
- case Shader::OPCODE_IMUL: imul(d, s0, s1); break;
- case Shader::OPCODE_MAD: mad(d, s0, s1, s2); break;
- case Shader::OPCODE_IMAD: imad(d, s0, s1, s2); break;
- case Shader::OPCODE_DP1: dp1(d, s0, s1); break;
- case Shader::OPCODE_DP2: dp2(d, s0, s1); break;
- case Shader::OPCODE_DP2ADD: dp2add(d, s0, s1, s2); break;
- case Shader::OPCODE_DP3: dp3(d, s0, s1); break;
- case Shader::OPCODE_DP4: dp4(d, s0, s1); break;
- case Shader::OPCODE_DET2: det2(d, s0, s1); break;
- case Shader::OPCODE_DET3: det3(d, s0, s1, s2); break;
- case Shader::OPCODE_DET4: det4(d, s0, s1, s2, s3); break;
- case Shader::OPCODE_CMP0: cmp0(d, s0, s1, s2); break;
- case Shader::OPCODE_ICMP: icmp(d, s0, s1, control); break;
- case Shader::OPCODE_UCMP: ucmp(d, s0, s1, control); break;
- case Shader::OPCODE_SELECT: select(d, s0, s1, s2); break;
- case Shader::OPCODE_EXTRACT: extract(d.x, s0, s1.x); break;
- case Shader::OPCODE_INSERT: insert(d, s0, s1.x, s2.x); break;
- case Shader::OPCODE_FRC: frc(d, s0); break;
- case Shader::OPCODE_TRUNC: trunc(d, s0); break;
- case Shader::OPCODE_FLOOR: floor(d, s0); break;
- case Shader::OPCODE_ROUND: round(d, s0); break;
- case Shader::OPCODE_ROUNDEVEN: roundEven(d, s0); break;
- case Shader::OPCODE_CEIL: ceil(d, s0); break;
- case Shader::OPCODE_EXP2X: exp2x(d, s0, pp); break;
- case Shader::OPCODE_EXP2: exp2(d, s0, pp); break;
- case Shader::OPCODE_LOG2X: log2x(d, s0, pp); break;
- case Shader::OPCODE_LOG2: log2(d, s0, pp); break;
- case Shader::OPCODE_EXP: exp(d, s0, pp); break;
- case Shader::OPCODE_LOG: log(d, s0, pp); break;
- case Shader::OPCODE_RCPX: rcpx(d, s0, pp); break;
- case Shader::OPCODE_DIV: div(d, s0, s1); break;
- case Shader::OPCODE_IDIV: idiv(d, s0, s1); break;
- case Shader::OPCODE_UDIV: udiv(d, s0, s1); break;
- case Shader::OPCODE_MOD: mod(d, s0, s1); break;
- case Shader::OPCODE_IMOD: imod(d, s0, s1); break;
- case Shader::OPCODE_UMOD: umod(d, s0, s1); break;
- case Shader::OPCODE_SHL: shl(d, s0, s1); break;
- case Shader::OPCODE_ISHR: ishr(d, s0, s1); break;
- case Shader::OPCODE_USHR: ushr(d, s0, s1); break;
- case Shader::OPCODE_RSQX: rsqx(d, s0, pp); break;
- case Shader::OPCODE_SQRT: sqrt(d, s0, pp); break;
- case Shader::OPCODE_RSQ: rsq(d, s0, pp); break;
- case Shader::OPCODE_LEN2: len2(d.x, s0, pp); break;
- case Shader::OPCODE_LEN3: len3(d.x, s0, pp); break;
- case Shader::OPCODE_LEN4: len4(d.x, s0, pp); break;
- case Shader::OPCODE_DIST1: dist1(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST2: dist2(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST3: dist3(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST4: dist4(d.x, s0, s1, pp); break;
- case Shader::OPCODE_MIN: min(d, s0, s1); break;
- case Shader::OPCODE_IMIN: imin(d, s0, s1); break;
- case Shader::OPCODE_UMIN: umin(d, s0, s1); break;
- case Shader::OPCODE_MAX: max(d, s0, s1); break;
- case Shader::OPCODE_IMAX: imax(d, s0, s1); break;
- case Shader::OPCODE_UMAX: umax(d, s0, s1); break;
- case Shader::OPCODE_LRP: lrp(d, s0, s1, s2); break;
- case Shader::OPCODE_STEP: step(d, s0, s1); break;
- case Shader::OPCODE_SMOOTH: smooth(d, s0, s1, s2); break;
- case Shader::OPCODE_ISINF: isinf(d, s0); break;
- case Shader::OPCODE_ISNAN: isnan(d, s0); break;
- case Shader::OPCODE_FLOATBITSTOINT:
- case Shader::OPCODE_FLOATBITSTOUINT:
- case Shader::OPCODE_INTBITSTOFLOAT:
- case Shader::OPCODE_UINTBITSTOFLOAT: d = s0; break;
- case Shader::OPCODE_PACKSNORM2x16: packSnorm2x16(d, s0); break;
- case Shader::OPCODE_PACKUNORM2x16: packUnorm2x16(d, s0); break;
- case Shader::OPCODE_PACKHALF2x16: packHalf2x16(d, s0); break;
- case Shader::OPCODE_UNPACKSNORM2x16: unpackSnorm2x16(d, s0); break;
- case Shader::OPCODE_UNPACKUNORM2x16: unpackUnorm2x16(d, s0); break;
- case Shader::OPCODE_UNPACKHALF2x16: unpackHalf2x16(d, s0); break;
- case Shader::OPCODE_POWX: powx(d, s0, s1, pp); break;
- case Shader::OPCODE_POW: pow(d, s0, s1, pp); break;
- case Shader::OPCODE_SGN: sgn(d, s0); break;
- case Shader::OPCODE_ISGN: isgn(d, s0); break;
- case Shader::OPCODE_CRS: crs(d, s0, s1); break;
- case Shader::OPCODE_FORWARD1: forward1(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD2: forward2(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD3: forward3(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD4: forward4(d, s0, s1, s2); break;
- case Shader::OPCODE_REFLECT1: reflect1(d, s0, s1); break;
- case Shader::OPCODE_REFLECT2: reflect2(d, s0, s1); break;
- case Shader::OPCODE_REFLECT3: reflect3(d, s0, s1); break;
- case Shader::OPCODE_REFLECT4: reflect4(d, s0, s1); break;
- case Shader::OPCODE_REFRACT1: refract1(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT2: refract2(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT3: refract3(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT4: refract4(d, s0, s1, s2.x); break;
- case Shader::OPCODE_NRM2: nrm2(d, s0, pp); break;
- case Shader::OPCODE_NRM3: nrm3(d, s0, pp); break;
- case Shader::OPCODE_NRM4: nrm4(d, s0, pp); break;
- case Shader::OPCODE_ABS: abs(d, s0); break;
- case Shader::OPCODE_IABS: iabs(d, s0); break;
- case Shader::OPCODE_SINCOS: sincos(d, s0, pp); break;
- case Shader::OPCODE_COS: cos(d, s0, pp); break;
- case Shader::OPCODE_SIN: sin(d, s0, pp); break;
- case Shader::OPCODE_TAN: tan(d, s0, pp); break;
- case Shader::OPCODE_ACOS: acos(d, s0, pp); break;
- case Shader::OPCODE_ASIN: asin(d, s0, pp); break;
- case Shader::OPCODE_ATAN: atan(d, s0, pp); break;
- case Shader::OPCODE_ATAN2: atan2(d, s0, s1, pp); break;
- case Shader::OPCODE_COSH: cosh(d, s0, pp); break;
- case Shader::OPCODE_SINH: sinh(d, s0, pp); break;
- case Shader::OPCODE_TANH: tanh(d, s0, pp); break;
- case Shader::OPCODE_ACOSH: acosh(d, s0, pp); break;
- case Shader::OPCODE_ASINH: asinh(d, s0, pp); break;
- case Shader::OPCODE_ATANH: atanh(d, s0, pp); break;
- case Shader::OPCODE_M4X4: M4X4(d, s0, src1); break;
- case Shader::OPCODE_M4X3: M4X3(d, s0, src1); break;
- case Shader::OPCODE_M3X4: M3X4(d, s0, src1); break;
- case Shader::OPCODE_M3X3: M3X3(d, s0, src1); break;
- case Shader::OPCODE_M3X2: M3X2(d, s0, src1); break;
- case Shader::OPCODE_TEX: TEX(d, s0, src1, project, bias); break;
- case Shader::OPCODE_TEXLDD: TEXGRAD(d, s0, src1, s2, s3); break;
- case Shader::OPCODE_TEXLDL: TEXLOD(d, s0, src1, s0.w); break;
- case Shader::OPCODE_TEXLOD: TEXLOD(d, s0, src1, s2.x); break;
- case Shader::OPCODE_TEXSIZE: TEXSIZE(d, s0.x, src1); break;
- case Shader::OPCODE_TEXKILL: TEXKILL(cMask, d, dst.mask); break;
- case Shader::OPCODE_TEXOFFSET: TEXOFFSET(d, s0, src1, s2); break;
- case Shader::OPCODE_TEXLODOFFSET: TEXLODOFFSET(d, s0, src1, s2, s3.x); break;
- case Shader::OPCODE_TEXELFETCH: TEXELFETCH(d, s0, src1, s2.x); break;
- case Shader::OPCODE_TEXELFETCHOFFSET: TEXELFETCHOFFSET(d, s0, src1, s2, s3.x); break;
- case Shader::OPCODE_TEXGRAD: TEXGRAD(d, s0, src1, s2, s3); break;
- case Shader::OPCODE_TEXGRADOFFSET: TEXGRADOFFSET(d, s0, src1, s2, s3, s4); break;
- case Shader::OPCODE_TEXBIAS: TEXBIAS(d, s0, src1, s2.x); break;
- case Shader::OPCODE_TEXOFFSETBIAS: TEXOFFSETBIAS(d, s0, src1, s2, s3.x); break;
- case Shader::OPCODE_DISCARD: DISCARD(cMask, instruction); break;
- case Shader::OPCODE_DFDX: DFDX(d, s0); break;
- case Shader::OPCODE_DFDY: DFDY(d, s0); break;
- case Shader::OPCODE_FWIDTH: FWIDTH(d, s0); break;
- case Shader::OPCODE_BREAK: BREAK(); break;
- case Shader::OPCODE_BREAKC: BREAKC(s0, s1, control); break;
- case Shader::OPCODE_BREAKP: BREAKP(src0); break;
- case Shader::OPCODE_CONTINUE: CONTINUE(); break;
- case Shader::OPCODE_TEST: TEST(); break;
- case Shader::OPCODE_SCALAR: SCALAR(); break;
- case Shader::OPCODE_CALL: CALL(dst.label, dst.callSite); break;
- case Shader::OPCODE_CALLNZ: CALLNZ(dst.label, dst.callSite, src0); break;
- case Shader::OPCODE_ELSE: ELSE(); break;
- case Shader::OPCODE_ENDIF: ENDIF(); break;
- case Shader::OPCODE_ENDLOOP: ENDLOOP(); break;
- case Shader::OPCODE_ENDREP: ENDREP(); break;
- case Shader::OPCODE_ENDWHILE: ENDWHILE(); break;
- case Shader::OPCODE_ENDSWITCH: ENDSWITCH(); break;
- case Shader::OPCODE_IF: IF(src0); break;
- case Shader::OPCODE_IFC: IFC(s0, s1, control); break;
- case Shader::OPCODE_LABEL: LABEL(dst.index); break;
- case Shader::OPCODE_LOOP: LOOP(src1); break;
- case Shader::OPCODE_REP: REP(src0); break;
- case Shader::OPCODE_WHILE: WHILE(src0); break;
- case Shader::OPCODE_SWITCH: SWITCH(); break;
- case Shader::OPCODE_RET: RET(); break;
- case Shader::OPCODE_LEAVE: LEAVE(); break;
- case Shader::OPCODE_CMP: cmp(d, s0, s1, control); break;
- case Shader::OPCODE_ALL: all(d.x, s0); break;
- case Shader::OPCODE_ANY: any(d.x, s0); break;
- case Shader::OPCODE_NOT: bitwise_not(d, s0); break;
- case Shader::OPCODE_OR: bitwise_or(d, s0, s1); break;
- case Shader::OPCODE_XOR: bitwise_xor(d, s0, s1); break;
- case Shader::OPCODE_AND: bitwise_and(d, s0, s1); break;
- case Shader::OPCODE_EQ: equal(d, s0, s1); break;
- case Shader::OPCODE_NE: notEqual(d, s0, s1); break;
- case Shader::OPCODE_END: break;
- default:
- ASSERT(false);
- }
-
- if(dst.type != Shader::PARAMETER_VOID && dst.type != Shader::PARAMETER_LABEL && opcode != Shader::OPCODE_TEXKILL && opcode != Shader::OPCODE_NOP)
- {
- if(dst.saturate)
- {
- if(dst.x) d.x = Max(d.x, Float4(0.0f));
- if(dst.y) d.y = Max(d.y, Float4(0.0f));
- if(dst.z) d.z = Max(d.z, Float4(0.0f));
- if(dst.w) d.w = Max(d.w, Float4(0.0f));
-
- if(dst.x) d.x = Min(d.x, Float4(1.0f));
- if(dst.y) d.y = Min(d.y, Float4(1.0f));
- if(dst.z) d.z = Min(d.z, Float4(1.0f));
- if(dst.w) d.w = Min(d.w, Float4(1.0f));
- }
-
- if(instruction->isPredicated())
- {
- Vector4f pDst; // FIXME: Rename
-
- switch(dst.type)
- {
- case Shader::PARAMETER_TEMP:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- if(dst.x) pDst.x = r[dst.index].x;
- if(dst.y) pDst.y = r[dst.index].y;
- if(dst.z) pDst.z = r[dst.index].z;
- if(dst.w) pDst.w = r[dst.index].w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) pDst.x = r[a].x;
- if(dst.y) pDst.y = r[a].y;
- if(dst.z) pDst.z = r[a].z;
- if(dst.w) pDst.w = r[a].w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) pDst.x = r[a].x;
- if(dst.y) pDst.y = r[a].y;
- if(dst.z) pDst.z = r[a].z;
- if(dst.w) pDst.w = r[a].w;
- }
- break;
- case Shader::PARAMETER_COLOROUT:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- if(dst.x) pDst.x = oC[dst.index].x;
- if(dst.y) pDst.y = oC[dst.index].y;
- if(dst.z) pDst.z = oC[dst.index].z;
- if(dst.w) pDst.w = oC[dst.index].w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) pDst.x = oC[a].x;
- if(dst.y) pDst.y = oC[a].y;
- if(dst.z) pDst.z = oC[a].z;
- if(dst.w) pDst.w = oC[a].w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) pDst.x = oC[a].x;
- if(dst.y) pDst.y = oC[a].y;
- if(dst.z) pDst.z = oC[a].z;
- if(dst.w) pDst.w = oC[a].w;
- }
- break;
- case Shader::PARAMETER_PREDICATE:
- if(dst.x) pDst.x = p0.x;
- if(dst.y) pDst.y = p0.y;
- if(dst.z) pDst.z = p0.z;
- if(dst.w) pDst.w = p0.w;
- break;
- case Shader::PARAMETER_DEPTHOUT:
- pDst.x = oDepth;
- break;
- default:
- ASSERT(false);
- }
-
- Int4 enable = enableMask(instruction);
-
- Int4 xEnable = enable;
- Int4 yEnable = enable;
- Int4 zEnable = enable;
- Int4 wEnable = enable;
-
- if(predicate)
- {
- unsigned char pSwizzle = instruction->predicateSwizzle;
-
- Float4 xPredicate = p0[(pSwizzle >> 0) & 0x03];
- Float4 yPredicate = p0[(pSwizzle >> 2) & 0x03];
- Float4 zPredicate = p0[(pSwizzle >> 4) & 0x03];
- Float4 wPredicate = p0[(pSwizzle >> 6) & 0x03];
-
- if(!instruction->predicateNot)
- {
- if(dst.x) xEnable = xEnable & As<Int4>(xPredicate);
- if(dst.y) yEnable = yEnable & As<Int4>(yPredicate);
- if(dst.z) zEnable = zEnable & As<Int4>(zPredicate);
- if(dst.w) wEnable = wEnable & As<Int4>(wPredicate);
- }
- else
- {
- if(dst.x) xEnable = xEnable & ~As<Int4>(xPredicate);
- if(dst.y) yEnable = yEnable & ~As<Int4>(yPredicate);
- if(dst.z) zEnable = zEnable & ~As<Int4>(zPredicate);
- if(dst.w) wEnable = wEnable & ~As<Int4>(wPredicate);
- }
- }
-
- if(dst.x) d.x = As<Float4>(As<Int4>(d.x) & xEnable);
- if(dst.y) d.y = As<Float4>(As<Int4>(d.y) & yEnable);
- if(dst.z) d.z = As<Float4>(As<Int4>(d.z) & zEnable);
- if(dst.w) d.w = As<Float4>(As<Int4>(d.w) & wEnable);
-
- if(dst.x) d.x = As<Float4>(As<Int4>(d.x) | (As<Int4>(pDst.x) & ~xEnable));
- if(dst.y) d.y = As<Float4>(As<Int4>(d.y) | (As<Int4>(pDst.y) & ~yEnable));
- if(dst.z) d.z = As<Float4>(As<Int4>(d.z) | (As<Int4>(pDst.z) & ~zEnable));
- if(dst.w) d.w = As<Float4>(As<Int4>(d.w) | (As<Int4>(pDst.w) & ~wEnable));
- }
-
- switch(dst.type)
- {
- case Shader::PARAMETER_TEMP:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- if(dst.x) r[dst.index].x = d.x;
- if(dst.y) r[dst.index].y = d.y;
- if(dst.z) r[dst.index].z = d.z;
- if(dst.w) r[dst.index].w = d.w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) r[a].x = d.x;
- if(dst.y) r[a].y = d.y;
- if(dst.z) r[a].z = d.z;
- if(dst.w) r[a].w = d.w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) r.scatter_x(a, d.x);
- if(dst.y) r.scatter_y(a, d.y);
- if(dst.z) r.scatter_z(a, d.z);
- if(dst.w) r.scatter_w(a, d.w);
- }
- break;
- case Shader::PARAMETER_COLOROUT:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- broadcastColor0 = (dst.index == 0) && broadcastColor0;
-
- if(dst.x) oC[dst.index].x = d.x;
- if(dst.y) oC[dst.index].y = d.y;
- if(dst.z) oC[dst.index].z = d.z;
- if(dst.w) oC[dst.index].w = d.w;
- }
- else if(!dst.rel.dynamic)
- {
- broadcastColor0 = false;
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) oC[a].x = d.x;
- if(dst.y) oC[a].y = d.y;
- if(dst.z) oC[a].z = d.z;
- if(dst.w) oC[a].w = d.w;
- }
- else
- {
- broadcastColor0 = false;
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) oC.scatter_x(a, d.x);
- if(dst.y) oC.scatter_y(a, d.y);
- if(dst.z) oC.scatter_z(a, d.z);
- if(dst.w) oC.scatter_w(a, d.w);
- }
- break;
- case Shader::PARAMETER_PREDICATE:
- if(dst.x) p0.x = d.x;
- if(dst.y) p0.y = d.y;
- if(dst.z) p0.z = d.z;
- if(dst.w) p0.w = d.w;
- break;
- case Shader::PARAMETER_DEPTHOUT:
- oDepth = d.x;
- break;
- default:
- ASSERT(false);
- }
- }
- }
-
- if(currentLabel != -1)
- {
- Nucleus::setInsertBlock(returnBlock);
- }
-
- if(broadcastColor0)
- {
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- c[i] = oC[0];
- }
- }
- else
- {
- for(int i = 0; i < RENDERTARGETS; i++)
- {
- c[i] = oC[i];
- }
- }
-
- clampColor(c);
-
- if(state.depthOverride)
- {
- oDepth = Min(Max(oDepth, Float4(0.0f)), Float4(1.0f));
- }
- }
-
- Bool PixelProgram::alphaTest(Int cMask[4])
- {
- if(!state.alphaTestActive())
- {
- return true;
- }
-
- Int aMask;
-
- if(state.transparencyAntialiasing == TRANSPARENCY_NONE)
- {
- Short4 alpha = RoundShort4(c[0].w * Float4(0x1000));
-
- PixelRoutine::alphaTest(aMask, alpha);
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= aMask;
- }
- }
- else if(state.transparencyAntialiasing == TRANSPARENCY_ALPHA_TO_COVERAGE)
- {
- alphaToCoverage(cMask, c[0].w);
- }
- else ASSERT(false);
-
- Int pass = cMask[0];
-
- for(unsigned int q = 1; q < state.multiSample; q++)
- {
- pass = pass | cMask[q];
- }
-
- return pass != 0x0;
- }
-
- void PixelProgram::rasterOperation(Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4])
- {
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- if(!state.colorWriteActive(index))
- {
- continue;
- }
-
- if(!postBlendSRGB && state.writeSRGB && !isSRGB(index))
- {
- c[index].x = linearToSRGB(c[index].x);
- c[index].y = linearToSRGB(c[index].y);
- c[index].z = linearToSRGB(c[index].z);
- }
-
- if(index == 0)
- {
- fogBlend(c[index], fog);
- }
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R5G6B5:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_G8R8:
- case FORMAT_R8:
- case FORMAT_A8:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
- Vector4s color;
-
- if(state.targetFormat[index] == FORMAT_R5G6B5)
- {
- color.x = UShort4(c[index].x * Float4(0xFBFF), false);
- color.y = UShort4(c[index].y * Float4(0xFDFF), false);
- color.z = UShort4(c[index].z * Float4(0xFBFF), false);
- color.w = UShort4(c[index].w * Float4(0xFFFF), false);
- }
- else
- {
- color.x = convertFixed16(c[index].x, false);
- color.y = convertFixed16(c[index].y, false);
- color.z = convertFixed16(c[index].z, false);
- color.w = convertFixed16(c[index].w, false);
- }
-
- if(state.multiSampleMask & (1 << q))
- {
- alphaBlend(index, buffer, color, x);
- logicOperation(index, buffer, color, x);
- writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
- }
- }
- break;
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_R32I:
- case FORMAT_G32R32I:
- case FORMAT_A32B32G32R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32UI:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_R16I:
- case FORMAT_G16R16I:
- case FORMAT_A16B16G16R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16UI:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_R8I:
- case FORMAT_G8R8I:
- case FORMAT_A8B8G8R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8UI:
- case FORMAT_A8B8G8R8UI:
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Pointer<Byte> buffer = cBuffer[index] + q * *Pointer<Int>(data + OFFSET(DrawData, colorSliceB[index]));
- Vector4f color = c[index];
-
- if(state.multiSampleMask & (1 << q))
- {
- alphaBlend(index, buffer, color, x);
- writeColor(index, buffer, x, color, sMask[q], zMask[q], cMask[q]);
- }
- }
- break;
- default:
- ASSERT(false);
- }
- }
- }
-
- Vector4f PixelProgram::sampleTexture(const Src &sampler, Vector4f &uvwq, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function)
- {
- Vector4f tmp;
-
- if(sampler.type == Shader::PARAMETER_SAMPLER && sampler.rel.type == Shader::PARAMETER_VOID)
- {
- tmp = sampleTexture(sampler.index, uvwq, bias, dsx, dsy, offset, function);
- }
- else
- {
- Int index = As<Int>(Float(fetchRegister(sampler).x.x));
-
- for(int i = 0; i < TEXTURE_IMAGE_UNITS; i++)
- {
- if(shader->usesSampler(i))
- {
- If(index == i)
- {
- tmp = sampleTexture(i, uvwq, bias, dsx, dsy, offset, function);
- // FIXME: When the sampler states are the same, we could use one sampler and just index the texture
- }
- }
- }
- }
-
- Vector4f c;
- c.x = tmp[(sampler.swizzle >> 0) & 0x3];
- c.y = tmp[(sampler.swizzle >> 2) & 0x3];
- c.z = tmp[(sampler.swizzle >> 4) & 0x3];
- c.w = tmp[(sampler.swizzle >> 6) & 0x3];
-
- return c;
- }
-
- Vector4f PixelProgram::sampleTexture(int samplerIndex, Vector4f &uvwq, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function)
- {
- #if PERF_PROFILE
- Long texTime = Ticks();
- #endif
-
- Pointer<Byte> texture = data + OFFSET(DrawData, mipmap) + samplerIndex * sizeof(Texture);
- Vector4f c = SamplerCore(constants, state.sampler[samplerIndex]).sampleTexture(texture, uvwq.x, uvwq.y, uvwq.z, uvwq.w, bias, dsx, dsy, offset, function);
-
- #if PERF_PROFILE
- cycles[PERF_TEX] += Ticks() - texTime;
- #endif
-
- return c;
- }
-
- void PixelProgram::clampColor(Vector4f oC[RENDERTARGETS])
- {
- for(int index = 0; index < RENDERTARGETS; index++)
- {
- if(!state.colorWriteActive(index) && !(index == 0 && state.alphaTestActive()))
- {
- continue;
- }
-
- switch(state.targetFormat[index])
- {
- case FORMAT_NULL:
- break;
- case FORMAT_R5G6B5:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_G8R8:
- case FORMAT_R8:
- case FORMAT_A8:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- oC[index].x = Max(oC[index].x, Float4(0.0f)); oC[index].x = Min(oC[index].x, Float4(1.0f));
- oC[index].y = Max(oC[index].y, Float4(0.0f)); oC[index].y = Min(oC[index].y, Float4(1.0f));
- oC[index].z = Max(oC[index].z, Float4(0.0f)); oC[index].z = Min(oC[index].z, Float4(1.0f));
- oC[index].w = Max(oC[index].w, Float4(0.0f)); oC[index].w = Min(oC[index].w, Float4(1.0f));
- break;
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_R32I:
- case FORMAT_G32R32I:
- case FORMAT_A32B32G32R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32UI:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_R16I:
- case FORMAT_G16R16I:
- case FORMAT_A16B16G16R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16UI:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_R8I:
- case FORMAT_G8R8I:
- case FORMAT_A8B8G8R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8UI:
- case FORMAT_A8B8G8R8UI:
- break;
- case FORMAT_X32B32G32R32F_UNSIGNED:
- oC[index].x = Max(oC[index].x, Float4(0.0f));
- oC[index].y = Max(oC[index].y, Float4(0.0f));
- oC[index].z = Max(oC[index].z, Float4(0.0f));
- oC[index].w = Max(oC[index].w, Float4(0.0f));
- break;
- default:
- ASSERT(false);
- }
- }
- }
-
- Int4 PixelProgram::enableMask(const Shader::Instruction *instruction)
- {
- if(scalar)
- {
- return Int4(0xFFFFFFFF);
- }
-
- Int4 enable = instruction->analysisBranch ? Int4(enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))]) : Int4(0xFFFFFFFF);
-
- if(shader->containsBreakInstruction() && instruction->analysisBreak)
- {
- enable &= enableBreak;
- }
-
- if(shader->containsContinueInstruction() && instruction->analysisContinue)
- {
- enable &= enableContinue;
- }
-
- if(shader->containsLeaveInstruction() && instruction->analysisLeave)
- {
- enable &= enableLeave;
- }
-
- return enable;
- }
-
- Vector4f PixelProgram::fetchRegister(const Src &src, unsigned int offset)
- {
- Vector4f reg;
- unsigned int i = src.index + offset;
-
- switch(src.type)
- {
- case Shader::PARAMETER_TEMP:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg = r[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = r[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = r[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_INPUT:
- if(src.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- reg = v[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = v[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = v[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_CONST:
- reg = readConstant(src, offset);
- break;
- case Shader::PARAMETER_TEXTURE:
- reg = v[2 + i];
- break;
- case Shader::PARAMETER_MISCTYPE:
- if(src.index == Shader::VPosIndex) reg = vPos;
- if(src.index == Shader::VFaceIndex) reg = vFace;
- break;
- case Shader::PARAMETER_SAMPLER:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg.x = As<Float4>(Int4(i));
- }
- else if(src.rel.type == Shader::PARAMETER_TEMP)
- {
- reg.x = As<Float4>(Int4(i) + As<Int4>(r[src.rel.index].x));
- }
- return reg;
- case Shader::PARAMETER_PREDICATE: return reg; // Dummy
- case Shader::PARAMETER_VOID: return reg; // Dummy
- case Shader::PARAMETER_FLOAT4LITERAL:
- // This is used for all literal types, and since Reactor doesn't guarantee
- // preserving the bit pattern of float constants, we must construct them
- // as integer constants and bitcast.
- reg.x = As<Float4>(Int4(src.integer[0]));
- reg.y = As<Float4>(Int4(src.integer[1]));
- reg.z = As<Float4>(Int4(src.integer[2]));
- reg.w = As<Float4>(Int4(src.integer[3]));
- break;
- case Shader::PARAMETER_CONSTINT: return reg; // Dummy
- case Shader::PARAMETER_CONSTBOOL: return reg; // Dummy
- case Shader::PARAMETER_LOOP: return reg; // Dummy
- case Shader::PARAMETER_COLOROUT:
- if(src.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- reg = oC[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = oC[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = oC[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_DEPTHOUT:
- reg.x = oDepth;
- break;
- default:
- ASSERT(false);
- }
-
- const Float4 &x = reg[(src.swizzle >> 0) & 0x3];
- const Float4 &y = reg[(src.swizzle >> 2) & 0x3];
- const Float4 &z = reg[(src.swizzle >> 4) & 0x3];
- const Float4 &w = reg[(src.swizzle >> 6) & 0x3];
-
- Vector4f mod;
-
- switch(src.modifier)
- {
- case Shader::MODIFIER_NONE:
- mod.x = x;
- mod.y = y;
- mod.z = z;
- mod.w = w;
- break;
- case Shader::MODIFIER_NEGATE:
- mod.x = -x;
- mod.y = -y;
- mod.z = -z;
- mod.w = -w;
- break;
- case Shader::MODIFIER_ABS:
- mod.x = Abs(x);
- mod.y = Abs(y);
- mod.z = Abs(z);
- mod.w = Abs(w);
- break;
- case Shader::MODIFIER_ABS_NEGATE:
- mod.x = -Abs(x);
- mod.y = -Abs(y);
- mod.z = -Abs(z);
- mod.w = -Abs(w);
- break;
- case Shader::MODIFIER_NOT:
- mod.x = As<Float4>(As<Int4>(x) ^ Int4(0xFFFFFFFF));
- mod.y = As<Float4>(As<Int4>(y) ^ Int4(0xFFFFFFFF));
- mod.z = As<Float4>(As<Int4>(z) ^ Int4(0xFFFFFFFF));
- mod.w = As<Float4>(As<Int4>(w) ^ Int4(0xFFFFFFFF));
- break;
- default:
- ASSERT(false);
- }
-
- return mod;
- }
-
- RValue<Pointer<Byte>> PixelProgram::uniformAddress(int bufferIndex, unsigned int index)
- {
- if(bufferIndex == -1)
- {
- return data + OFFSET(DrawData, ps.c[index]);
- }
- else
- {
- return *Pointer<Pointer<Byte>>(data + OFFSET(DrawData, ps.u[bufferIndex])) + index;
- }
- }
-
- RValue<Pointer<Byte>> PixelProgram::uniformAddress(int bufferIndex, unsigned int index, Int& offset)
- {
- return uniformAddress(bufferIndex, index) + offset * sizeof(float4);
- }
-
- Vector4f PixelProgram::readConstant(const Src &src, unsigned int offset)
- {
- Vector4f c;
- unsigned int i = src.index + offset;
-
- if(src.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i));
-
- c.x = c.x.xxxx;
- c.y = c.y.yyyy;
- c.z = c.z.zzzz;
- c.w = c.w.wwww;
-
- if(shader->containsDefineInstruction()) // Constant may be known at compile time
- {
- for(size_t j = 0; j < shader->getLength(); j++)
- {
- const Shader::Instruction &instruction = *shader->getInstruction(j);
-
- if(instruction.opcode == Shader::OPCODE_DEF)
- {
- if(instruction.dst.index == i)
- {
- c.x = Float4(instruction.src[0].value[0]);
- c.y = Float4(instruction.src[0].value[1]);
- c.z = Float4(instruction.src[0].value[2]);
- c.w = Float4(instruction.src[0].value[3]);
-
- break;
- }
- }
- }
- }
- }
- else if(!src.rel.dynamic || src.rel.type == Shader::PARAMETER_LOOP)
- {
- Int a = relativeAddress(src.rel, src.bufferIndex);
-
- c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i, a));
-
- c.x = c.x.xxxx;
- c.y = c.y.yyyy;
- c.z = c.z.zzzz;
- c.w = c.w.wwww;
- }
- else
- {
- int component = src.rel.swizzle & 0x03;
- Float4 a;
-
- switch(src.rel.type)
- {
- case Shader::PARAMETER_TEMP: a = r[src.rel.index][component]; break;
- case Shader::PARAMETER_INPUT: a = v[src.rel.index][component]; break;
- case Shader::PARAMETER_OUTPUT: a = oC[src.rel.index][component]; break;
- case Shader::PARAMETER_CONST: a = *Pointer<Float>(uniformAddress(src.bufferIndex, src.rel.index) + component * sizeof(float)); break;
- case Shader::PARAMETER_MISCTYPE:
- switch(src.rel.index)
- {
- case Shader::VPosIndex: a = vPos.x; break;
- case Shader::VFaceIndex: a = vFace.x; break;
- default: ASSERT(false);
- }
- break;
- default: ASSERT(false);
- }
-
- Int4 index = Int4(i) + As<Int4>(a) * Int4(src.rel.scale);
-
- if (src.bufferIndex == -1)
- {
- index = Min(As<UInt4>(index), UInt4(VERTEX_UNIFORM_VECTORS)); // Clamp to constant register range, c[VERTEX_UNIFORM_VECTORS] = {0, 0, 0, 0}
- }
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- c.x = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index0), 16);
- c.y = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index1), 16);
- c.z = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index2), 16);
- c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index3), 16);
-
- transpose4x4(c.x, c.y, c.z, c.w);
- }
-
- return c;
- }
-
- Int PixelProgram::relativeAddress(const Shader::Relative &rel, int bufferIndex)
- {
- ASSERT(!rel.dynamic);
-
- if(rel.type == Shader::PARAMETER_TEMP)
- {
- return As<Int>(Extract(r[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_INPUT)
- {
- return As<Int>(Extract(v[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_OUTPUT)
- {
- return As<Int>(Extract(oC[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_CONST)
- {
- return *Pointer<Int>(uniformAddress(bufferIndex, rel.index)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_LOOP)
- {
- return aL[loopDepth];
- }
- else ASSERT(false);
-
- return 0;
- }
-
- Int4 PixelProgram::dynamicAddress(const Shader::Relative &rel)
- {
- int component = rel.swizzle & 0x03;
- Float4 a;
-
- switch(rel.type)
- {
- case Shader::PARAMETER_TEMP: a = r[rel.index][component]; break;
- case Shader::PARAMETER_INPUT: a = v[rel.index][component]; break;
- case Shader::PARAMETER_OUTPUT: a = oC[rel.index][component]; break;
- case Shader::PARAMETER_MISCTYPE:
- switch(rel.index)
- {
- case Shader::VPosIndex: a = vPos.x; break;
- case Shader::VFaceIndex: a = vFace.x; break;
- default: ASSERT(false);
- }
- break;
- default: ASSERT(false);
- }
-
- return As<Int4>(a) * Int4(rel.scale);
- }
-
- Float4 PixelProgram::linearToSRGB(const Float4 &x) // Approximates x^(1.0/2.2)
- {
- Float4 sqrtx = Rcp_pp(RcpSqrt_pp(x));
- Float4 sRGB = sqrtx * Float4(1.14f) - x * Float4(0.14f);
-
- return Min(Max(sRGB, Float4(0.0f)), Float4(1.0f));
- }
-
- void PixelProgram::M3X2(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- }
-
- void PixelProgram::M3X3(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- dst.z = dot3(src0, row2);
- }
-
- void PixelProgram::M3X4(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
- Vector4f row3 = fetchRegister(src1, 3);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- dst.z = dot3(src0, row2);
- dst.w = dot3(src0, row3);
- }
-
- void PixelProgram::M4X3(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
-
- dst.x = dot4(src0, row0);
- dst.y = dot4(src0, row1);
- dst.z = dot4(src0, row2);
- }
-
- void PixelProgram::M4X4(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
- Vector4f row3 = fetchRegister(src1, 3);
-
- dst.x = dot4(src0, row0);
- dst.y = dot4(src0, row1);
- dst.z = dot4(src0, row2);
- dst.w = dot4(src0, row3);
- }
-
- void PixelProgram::TEX(Vector4f &dst, Vector4f &src0, const Src &src1, bool project, bool bias)
- {
- if(project)
- {
- Vector4f proj;
- Float4 rw = reciprocal(src0.w);
- proj.x = src0.x * rw;
- proj.y = src0.y * rw;
- proj.z = src0.z * rw;
-
- dst = sampleTexture(src1, proj, src0.x, (src0), (src0), (src0), Implicit);
- }
- else
- {
- dst = sampleTexture(src1, src0, src0.x, (src0), (src0), (src0), bias ? Bias : Implicit);
- }
- }
-
- void PixelProgram::TEXOFFSET(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset)
- {
- dst = sampleTexture(src1, src0, (src0.x), (src0), (src0), offset, {Implicit, Offset});
- }
-
- void PixelProgram::TEXLODOFFSET(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), offset, {Lod, Offset});
- }
-
- void PixelProgram::TEXBIAS(Vector4f &dst, Vector4f &src0, const Src &src1, Float4 &bias)
- {
- dst = sampleTexture(src1, src0, bias, (src0), (src0), (src0), Bias);
- }
-
- void PixelProgram::TEXOFFSETBIAS(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset, Float4 &bias)
- {
- dst = sampleTexture(src1, src0, bias, (src0), (src0), offset, {Bias, Offset});
- }
-
- void PixelProgram::TEXELFETCH(Vector4f &dst, Vector4f &src0, const Src& src1, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), (src0), Fetch);
- }
-
- void PixelProgram::TEXELFETCHOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &offset, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), offset, {Fetch, Offset});
- }
-
- void PixelProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &dsx, Vector4f &dsy)
- {
- dst = sampleTexture(src1, src0, (src0.x), dsx, dsy, (src0), Grad);
- }
-
- void PixelProgram::TEXGRADOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &dsx, Vector4f &dsy, Vector4f &offset)
- {
- dst = sampleTexture(src1, src0, (src0.x), dsx, dsy, offset, {Grad, Offset});
- }
-
- void PixelProgram::TEXLOD(Vector4f &dst, Vector4f &src0, const Src &src1, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), (src0), Lod);
- }
-
- void PixelProgram::TEXSIZE(Vector4f &dst, Float4 &lod, const Src &src1)
- {
- bool uniformSampler = (src1.type == Shader::PARAMETER_SAMPLER && src1.rel.type == Shader::PARAMETER_VOID);
- Int offset = uniformSampler ? src1.index * sizeof(Texture) : As<Int>(Float(fetchRegister(src1).x.x)) * sizeof(Texture);
- Pointer<Byte> texture = data + OFFSET(DrawData, mipmap) + offset;
-
- dst = SamplerCore::textureSize(texture, lod);
- }
-
- void PixelProgram::TEXKILL(Int cMask[4], Vector4f &src, unsigned char mask)
- {
- Int kill = -1;
-
- if(mask & 0x1) kill &= SignMask(CmpNLT(src.x, Float4(0.0f)));
- if(mask & 0x2) kill &= SignMask(CmpNLT(src.y, Float4(0.0f)));
- if(mask & 0x4) kill &= SignMask(CmpNLT(src.z, Float4(0.0f)));
- if(mask & 0x8) kill &= SignMask(CmpNLT(src.w, Float4(0.0f)));
-
- // FIXME: Dynamic branching affects TEXKILL?
- // if(shader->containsDynamicBranching())
- // {
- // kill = ~SignMask(enableMask());
- // }
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= kill;
- }
-
- // FIXME: Branch to end of shader if all killed?
- }
-
- void PixelProgram::DISCARD(Int cMask[4], const Shader::Instruction *instruction)
- {
- Int kill = 0;
-
- if(shader->containsDynamicBranching())
- {
- kill = ~SignMask(enableMask(instruction));
- }
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- cMask[q] &= kill;
- }
-
- // FIXME: Branch to end of shader if all killed?
- }
-
- void PixelProgram::DFDX(Vector4f &dst, Vector4f &src)
- {
- dst.x = src.x.yyww - src.x.xxzz;
- dst.y = src.y.yyww - src.y.xxzz;
- dst.z = src.z.yyww - src.z.xxzz;
- dst.w = src.w.yyww - src.w.xxzz;
- }
-
- void PixelProgram::DFDY(Vector4f &dst, Vector4f &src)
- {
- dst.x = src.x.zwzw - src.x.xyxy;
- dst.y = src.y.zwzw - src.y.xyxy;
- dst.z = src.z.zwzw - src.z.xyxy;
- dst.w = src.w.zwzw - src.w.xyxy;
- }
-
- void PixelProgram::FWIDTH(Vector4f &dst, Vector4f &src)
- {
- // abs(dFdx(src)) + abs(dFdy(src));
- dst.x = Abs(src.x.yyww - src.x.xxzz) + Abs(src.x.zwzw - src.x.xyxy);
- dst.y = Abs(src.y.yyww - src.y.xxzz) + Abs(src.y.zwzw - src.y.xyxy);
- dst.z = Abs(src.z.yyww - src.z.xxzz) + Abs(src.z.zwzw - src.z.xyxy);
- dst.w = Abs(src.w.yyww - src.w.xxzz) + Abs(src.w.zwzw - src.w.xyxy);
- }
-
- void PixelProgram::BREAK()
- {
- enableBreak = enableBreak & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
-
- void PixelProgram::BREAKC(Vector4f &src0, Vector4f &src1, Control control)
- {
- Int4 condition;
-
- switch(control)
- {
- case Shader::CONTROL_GT: condition = CmpNLE(src0.x, src1.x); break;
- case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x); break;
- case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x); break;
- case Shader::CONTROL_LT: condition = CmpLT(src0.x, src1.x); break;
- case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x); break;
- case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x); break;
- default:
- ASSERT(false);
- }
-
- BREAK(condition);
- }
-
- void PixelProgram::BREAKP(const Src &predicateRegister) // FIXME: Factor out parts common with BREAKC
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- BREAK(condition);
- }
-
- void PixelProgram::BREAK(Int4 &condition)
- {
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- enableBreak = enableBreak & ~condition;
- }
-
- void PixelProgram::CONTINUE()
- {
- enableContinue = enableContinue & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
-
- void PixelProgram::TEST()
- {
- enableContinue = restoreContinue.back();
- restoreContinue.pop_back();
- }
-
- void PixelProgram::SCALAR()
- {
- scalar = true;
- }
-
- void PixelProgram::CALL(int labelIndex, int callSiteIndex)
- {
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- Int4 restoreLeave = enableLeave;
-
- Nucleus::createBr(labelBlock[labelIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableLeave = restoreLeave;
- }
-
- void PixelProgram::CALLNZ(int labelIndex, int callSiteIndex, const Src &src)
- {
- if(src.type == Shader::PARAMETER_CONSTBOOL)
- {
- CALLNZb(labelIndex, callSiteIndex, src);
- }
- else if(src.type == Shader::PARAMETER_PREDICATE)
- {
- CALLNZp(labelIndex, callSiteIndex, src);
- }
- else ASSERT(false);
- }
-
- void PixelProgram::CALLNZb(int labelIndex, int callSiteIndex, const Src &boolRegister)
- {
- Bool condition = (*Pointer<Byte>(data + OFFSET(DrawData, ps.b[boolRegister.index])) != Byte(0)); // FIXME
-
- if(boolRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = !condition;
- }
-
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- Int4 restoreLeave = enableLeave;
-
- branch(condition, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableLeave = restoreLeave;
- }
-
- void PixelProgram::CALLNZp(int labelIndex, int callSiteIndex, const Src &predicateRegister)
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- enableIndex++;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
- Int4 restoreLeave = enableLeave;
-
- Bool notAllFalse = SignMask(condition) != 0;
- branch(notAllFalse, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableIndex--;
- enableLeave = restoreLeave;
- }
-
- void PixelProgram::ELSE()
- {
- ifDepth--;
-
- BasicBlock *falseBlock = ifFalseBlock[ifDepth];
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- if(isConditionalIf[ifDepth])
- {
- Int4 condition = ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] & enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- Bool notAllFalse = SignMask(condition) != 0;
-
- branch(notAllFalse, falseBlock, endBlock);
-
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] & enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
- else
- {
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(falseBlock);
- }
-
- ifFalseBlock[ifDepth] = endBlock;
-
- ifDepth++;
- }
-
- void PixelProgram::ENDIF()
- {
- ifDepth--;
-
- BasicBlock *endBlock = ifFalseBlock[ifDepth];
-
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(endBlock);
-
- if(isConditionalIf[ifDepth])
- {
- enableIndex--;
- }
- }
-
- void PixelProgram::ENDLOOP()
- {
- loopRepDepth--;
-
- aL[loopDepth] = aL[loopDepth] + increment[loopDepth]; // FIXME: +=
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- loopDepth--;
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- void PixelProgram::ENDREP()
- {
- loopRepDepth--;
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- loopDepth--;
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- void PixelProgram::ENDWHILE()
- {
- loopRepDepth--;
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- enableIndex--;
- scalar = false;
- }
-
- void PixelProgram::ENDSWITCH()
- {
- loopRepDepth--;
-
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(endBlock);
- }
-
- void PixelProgram::IF(const Src &src)
- {
- if(src.type == Shader::PARAMETER_CONSTBOOL)
- {
- IFb(src);
- }
- else if(src.type == Shader::PARAMETER_PREDICATE)
- {
- IFp(src);
- }
- else
- {
- Int4 condition = As<Int4>(fetchRegister(src).x);
- IF(condition);
- }
- }
-
- void PixelProgram::IFb(const Src &boolRegister)
- {
- ASSERT(ifDepth < 24 + 4);
-
- Bool condition = (*Pointer<Byte>(data + OFFSET(DrawData, ps.b[boolRegister.index])) != Byte(0)); // FIXME
-
- if(boolRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = !condition;
- }
-
- BasicBlock *trueBlock = Nucleus::createBasicBlock();
- BasicBlock *falseBlock = Nucleus::createBasicBlock();
-
- branch(condition, trueBlock, falseBlock);
-
- isConditionalIf[ifDepth] = false;
- ifFalseBlock[ifDepth] = falseBlock;
-
- ifDepth++;
- }
-
- void PixelProgram::IFp(const Src &predicateRegister)
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- IF(condition);
- }
-
- void PixelProgram::IFC(Vector4f &src0, Vector4f &src1, Control control)
- {
- Int4 condition;
-
- switch(control)
- {
- case Shader::CONTROL_GT: condition = CmpNLE(src0.x, src1.x); break;
- case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x); break;
- case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x); break;
- case Shader::CONTROL_LT: condition = CmpLT(src0.x, src1.x); break;
- case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x); break;
- case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x); break;
- default:
- ASSERT(false);
- }
-
- IF(condition);
- }
-
- void PixelProgram::IF(Int4 &condition)
- {
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- enableIndex++;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
-
- BasicBlock *trueBlock = Nucleus::createBasicBlock();
- BasicBlock *falseBlock = Nucleus::createBasicBlock();
-
- Bool notAllFalse = SignMask(condition) != 0;
-
- branch(notAllFalse, trueBlock, falseBlock);
-
- isConditionalIf[ifDepth] = true;
- ifFalseBlock[ifDepth] = falseBlock;
-
- ifDepth++;
- }
-
- void PixelProgram::LABEL(int labelIndex)
- {
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- Nucleus::setInsertBlock(labelBlock[labelIndex]);
- currentLabel = labelIndex;
- }
-
- void PixelProgram::LOOP(const Src &integerRegister)
- {
- loopDepth++;
-
- iteration[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData, ps.i[integerRegister.index][0]));
- aL[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData, ps.i[integerRegister.index][1]));
- increment[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData, ps.i[integerRegister.index][2]));
-
- // If(increment[loopDepth] == 0)
- // {
- // increment[loopDepth] = 1;
- // }
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- // FIXME: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- branch(iteration[loopDepth] > 0, loopBlock, endBlock);
- Nucleus::setInsertBlock(loopBlock);
-
- iteration[loopDepth] = iteration[loopDepth] - 1; // FIXME: --
-
- loopRepDepth++;
- }
-
- void PixelProgram::REP(const Src &integerRegister)
- {
- loopDepth++;
-
- iteration[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData, ps.i[integerRegister.index][0]));
- aL[loopDepth] = aL[loopDepth - 1];
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- // FIXME: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- branch(iteration[loopDepth] > 0, loopBlock, endBlock);
- Nucleus::setInsertBlock(loopBlock);
-
- iteration[loopDepth] = iteration[loopDepth] - 1; // FIXME: --
-
- loopRepDepth++;
- }
-
- void PixelProgram::WHILE(const Src &temporaryRegister)
- {
- enableIndex++;
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- Int4 restoreBreak = enableBreak;
- restoreContinue.push_back(enableContinue);
-
- // TODO: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- const Vector4f &src = fetchRegister(temporaryRegister);
- Int4 condition = As<Int4>(src.x);
- condition &= enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- if(shader->containsLeaveInstruction()) condition &= enableLeave;
- if(shader->containsBreakInstruction()) condition &= enableBreak;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
-
- Bool notAllFalse = SignMask(condition) != 0;
- branch(notAllFalse, loopBlock, endBlock);
-
- Nucleus::setInsertBlock(endBlock);
- enableBreak = restoreBreak;
-
- Nucleus::setInsertBlock(loopBlock);
-
- loopRepDepth++;
- scalar = false;
- }
-
- void PixelProgram::SWITCH()
- {
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = nullptr;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- Int4 restoreBreak = enableBreak;
-
- BasicBlock *currentBlock = Nucleus::getInsertBlock();
-
- Nucleus::setInsertBlock(endBlock);
- enableBreak = restoreBreak;
-
- Nucleus::setInsertBlock(currentBlock);
-
- loopRepDepth++;
- }
-
- void PixelProgram::RET()
- {
- if(currentLabel == -1)
- {
- returnBlock = Nucleus::createBasicBlock();
- Nucleus::createBr(returnBlock);
- }
- else
- {
- BasicBlock *unreachableBlock = Nucleus::createBasicBlock();
-
- if(callRetBlock[currentLabel].size() > 1) // Pop the return destination from the call stack
- {
- // FIXME: Encapsulate
- UInt index = callStack[--stackIndex];
-
- Value *value = index.loadValue();
- SwitchCases *switchCases = Nucleus::createSwitch(value, unreachableBlock, (int)callRetBlock[currentLabel].size());
-
- for(unsigned int i = 0; i < callRetBlock[currentLabel].size(); i++)
- {
- Nucleus::addSwitchCase(switchCases, i, callRetBlock[currentLabel][i]);
- }
- }
- else if(callRetBlock[currentLabel].size() == 1) // Jump directly to the unique return destination
- {
- Nucleus::createBr(callRetBlock[currentLabel][0]);
- }
- else // Function isn't called
- {
- Nucleus::createBr(unreachableBlock);
- }
-
- Nucleus::setInsertBlock(unreachableBlock);
- Nucleus::createUnreachable();
- }
- }
-
- void PixelProgram::LEAVE()
- {
- enableLeave = enableLeave & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- // FIXME: Return from function if all instances left
- // FIXME: Use enableLeave in other control-flow constructs
- }
-}
diff --git a/src/Shader/PixelProgram.hpp b/src/Shader/PixelProgram.hpp
deleted file mode 100644
index 351e12e80..000000000
--- a/src/Shader/PixelProgram.hpp
+++ /dev/null
@@ -1,153 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_PixelProgram_hpp
-#define sw_PixelProgram_hpp
-
-#include "PixelRoutine.hpp"
-#include "SamplerCore.hpp"
-
-#include <unordered_map>
-
-namespace sw
-{
- class PixelProgram : public PixelRoutine
- {
- public:
- PixelProgram(const PixelProcessor::State &state, const PixelShader *shader);
- virtual ~PixelProgram() {}
-
- protected:
- virtual void setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w);
- virtual void applyShader(Int cMask[4]);
- virtual Bool alphaTest(Int cMask[4]);
- virtual void rasterOperation(Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]);
-
- private:
- // Temporary registers
- RegisterArray<NUM_TEMPORARY_REGISTERS> r;
-
- // Color outputs
- Vector4f c[RENDERTARGETS];
- RegisterArray<RENDERTARGETS, true> oC;
-
- // Shader variables
- Vector4f vPos;
- Vector4f vFace;
-
- // DX9 specific variables
- Vector4f p0;
- Array<Int> aL; // loop counter register
- Array<Int> increment; // increment value per loop
- Array<Int> iteration; // iteration count
-
- Int loopDepth; // FIXME: Add support for switch
- Int stackIndex; // FIXME: Inc/decrement callStack
- Array<UInt> callStack;
-
- // Per pixel based on conditions reached
- Int enableIndex;
- Array<Int4, MAX_SHADER_ENABLE_STACK_SIZE> enableStack;
- Int4 enableBreak;
- Int4 enableContinue;
- Int4 enableLeave;
-
- Vector4f sampleTexture(const Src &sampler, Vector4f &uvwq, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
- Vector4f sampleTexture(int samplerIndex, Vector4f &uvwq, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
-
- // Raster operations
- void clampColor(Vector4f oC[RENDERTARGETS]);
-
- Int4 enableMask(const Shader::Instruction *instruction);
-
- Vector4f fetchRegister(const Src &src, unsigned int offset = 0);
- Vector4f readConstant(const Src &src, unsigned int offset = 0);
- RValue<Pointer<Byte>> uniformAddress(int bufferIndex, unsigned int index);
- RValue<Pointer<Byte>> uniformAddress(int bufferIndex, unsigned int index, Int& offset);
- Int relativeAddress(const Shader::Relative &rel, int bufferIndex = -1);
- Int4 dynamicAddress(const Shader::Relative &rel);
-
- Float4 linearToSRGB(const Float4 &x);
-
- // Instructions
- typedef Shader::Control Control;
-
- void M3X2(Vector4f &dst, Vector4f &src0, const Src &src1);
- void M3X3(Vector4f &dst, Vector4f &src0, const Src &src1);
- void M3X4(Vector4f &dst, Vector4f &src0, const Src &src1);
- void M4X3(Vector4f &dst, Vector4f &src0, const Src &src1);
- void M4X4(Vector4f &dst, Vector4f &src0, const Src &src1);
- void TEX(Vector4f &dst, Vector4f &src0, const Src &src1, bool project, bool bias);
- void TEXLOD(Vector4f &dst, Vector4f &src0, const Src &src1, Float4 &lod);
- void TEXBIAS(Vector4f &dst, Vector4f &src0, const Src &src1, Float4 &bias);
- void TEXSIZE(Vector4f &dst, Float4 &lod, const Src &src1);
- void TEXKILL(Int cMask[4], Vector4f &src, unsigned char mask);
- void TEXOFFSET(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset);
- void TEXOFFSETBIAS(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset, Float4 &bias);
- void TEXLODOFFSET(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &offset, Float4 &lod);
- void TEXELFETCH(Vector4f &dst, Vector4f &src, const Src &, Float4 &lod);
- void TEXELFETCHOFFSET(Vector4f &dst, Vector4f &src, const Src &, Vector4f &offset, Float4 &lod);
- void TEXGRAD(Vector4f &dst, Vector4f &src0, const Src &src1, Vector4f &dsx, Vector4f &dsy);
- void TEXGRADOFFSET(Vector4f &dst, Vector4f &src, const Src &, Vector4f &dsx, Vector4f &dsy, Vector4f &offset);
- void DISCARD(Int cMask[4], const Shader::Instruction *instruction);
- void DFDX(Vector4f &dst, Vector4f &src);
- void DFDY(Vector4f &dst, Vector4f &src);
- void FWIDTH(Vector4f &dst, Vector4f &src);
- void BREAK();
- void BREAKC(Vector4f &src0, Vector4f &src1, Control);
- void BREAKP(const Src &predicateRegister);
- void BREAK(Int4 &condition);
- void CONTINUE();
- void TEST();
- void SCALAR();
- void CALL(int labelIndex, int callSiteIndex);
- void CALLNZ(int labelIndex, int callSiteIndex, const Src &src);
- void CALLNZb(int labelIndex, int callSiteIndex, const Src &boolRegister);
- void CALLNZp(int labelIndex, int callSiteIndex, const Src &predicateRegister);
- void ELSE();
- void ENDIF();
- void ENDLOOP();
- void ENDREP();
- void ENDWHILE();
- void ENDSWITCH();
- void IF(const Src &src);
- void IFb(const Src &boolRegister);
- void IFp(const Src &predicateRegister);
- void IFC(Vector4f &src0, Vector4f &src1, Control);
- void IF(Int4 &condition);
- void LABEL(int labelIndex);
- void LOOP(const Src &integerRegister);
- void REP(const Src &integerRegister);
- void WHILE(const Src &temporaryRegister);
- void SWITCH();
- void RET();
- void LEAVE();
-
- int ifDepth = 0;
- int loopRepDepth = 0;
- int currentLabel = -1;
- bool scalar = false;
-
- std::vector<BasicBlock*> ifFalseBlock;
- std::vector<BasicBlock*> loopRepTestBlock;
- std::vector<BasicBlock*> loopRepEndBlock;
- std::vector<BasicBlock*> labelBlock;
- std::unordered_map<unsigned int, std::vector<BasicBlock*>> callRetBlock; // label -> list of call sites
- BasicBlock *returnBlock;
- std::vector<bool> isConditionalIf;
- std::vector<Int4> restoreContinue;
- };
-}
-
-#endif
diff --git a/src/Shader/PixelRoutine.cpp b/src/Shader/PixelRoutine.cpp
deleted file mode 100644
index 31673a165..000000000
--- a/src/Shader/PixelRoutine.cpp
+++ /dev/null
@@ -1,2731 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PixelRoutine.hpp"
-
-#include "SamplerCore.hpp"
-#include "Constants.hpp"
-#include "Renderer/Renderer.hpp"
-#include "Renderer/QuadRasterizer.hpp"
-#include "Renderer/Surface.hpp"
-#include "Renderer/Primitive.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- extern bool complementaryDepthBuffer;
- extern bool postBlendSRGB;
- extern bool exactColorRounding;
- extern bool forceClearRegisters;
-
- PixelRoutine::PixelRoutine(const PixelProcessor::State &state, const PixelShader *shader)
- : QuadRasterizer(state, shader), v(shader && shader->indirectAddressableInput)
- {
- if(!shader || shader->getShaderModel() < 0x0200 || forceClearRegisters)
- {
- for(int i = 0; i < MAX_FRAGMENT_INPUTS; i++)
- {
- v[i].x = Float4(0.0f);
- v[i].y = Float4(0.0f);
- v[i].z = Float4(0.0f);
- v[i].w = Float4(0.0f);
- }
- }
- }
-
- PixelRoutine::~PixelRoutine()
- {
- }
-
- void PixelRoutine::quad(Pointer<Byte> cBuffer[RENDERTARGETS], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x)
- {
- #if PERF_PROFILE
- Long pipeTime = Ticks();
- #endif
-
- const bool earlyDepthTest = !state.depthOverride && !state.alphaTestActive();
-
- Int zMask[4]; // Depth mask
- Int sMask[4]; // Stencil mask
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- zMask[q] = cMask[q];
- sMask[q] = cMask[q];
- }
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- stencilTest(sBuffer, q, x, sMask[q], cMask[q]);
- }
-
- Float4 f;
- Float4 rhwCentroid;
-
- Float4 xxxx = Float4(Float(x)) + *Pointer<Float4>(primitive + OFFSET(Primitive,xQuad), 16);
-
- if(interpolateZ())
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- Float4 x = xxxx;
-
- if(state.multiSample > 1)
- {
- x -= *Pointer<Float4>(constants + OFFSET(Constants,X) + q * sizeof(float4));
- }
-
- z[q] = interpolate(x, Dz[q], z[q], primitive + OFFSET(Primitive,z), false, false, state.depthClamp);
- }
- }
-
- Bool depthPass = false;
-
- if(earlyDepthTest)
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- depthPass = depthPass || depthTest(zBuffer, q, x, z[q], sMask[q], zMask[q], cMask[q]);
- }
- }
-
- If(depthPass || Bool(!earlyDepthTest))
- {
- #if PERF_PROFILE
- Long interpTime = Ticks();
- #endif
-
- Float4 yyyy = Float4(Float(y)) + *Pointer<Float4>(primitive + OFFSET(Primitive,yQuad), 16);
-
- // Centroid locations
- Float4 XXXX = Float4(0.0f);
- Float4 YYYY = Float4(0.0f);
-
- if(state.centroid)
- {
- Float4 WWWW(1.0e-9f);
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- XXXX += *Pointer<Float4>(constants + OFFSET(Constants,sampleX[q]) + 16 * cMask[q]);
- YYYY += *Pointer<Float4>(constants + OFFSET(Constants,sampleY[q]) + 16 * cMask[q]);
- WWWW += *Pointer<Float4>(constants + OFFSET(Constants,weight) + 16 * cMask[q]);
- }
-
- WWWW = Rcp_pp(WWWW);
- XXXX *= WWWW;
- YYYY *= WWWW;
-
- XXXX += xxxx;
- YYYY += yyyy;
- }
-
- if(interpolateW())
- {
- w = interpolate(xxxx, Dw, rhw, primitive + OFFSET(Primitive,w), false, false, false);
- rhw = reciprocal(w, false, false, true);
-
- if(state.centroid)
- {
- rhwCentroid = reciprocal(interpolateCentroid(XXXX, YYYY, rhwCentroid, primitive + OFFSET(Primitive,w), false, false));
- }
- }
-
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(state.interpolant[interpolant].component & (1 << component))
- {
- if(!state.interpolant[interpolant].centroid)
- {
- v[interpolant][component] = interpolate(xxxx, Dv[interpolant][component], rhw, primitive + OFFSET(Primitive, V[interpolant][component]), (state.interpolant[interpolant].flat & (1 << component)) != 0, state.perspective, false);
- }
- else
- {
- v[interpolant][component] = interpolateCentroid(XXXX, YYYY, rhwCentroid, primitive + OFFSET(Primitive, V[interpolant][component]), (state.interpolant[interpolant].flat & (1 << component)) != 0, state.perspective);
- }
- }
- }
-
- Float4 rcp;
-
- switch(state.interpolant[interpolant].project)
- {
- case 0:
- break;
- case 1:
- rcp = reciprocal(v[interpolant].y);
- v[interpolant].x = v[interpolant].x * rcp;
- break;
- case 2:
- rcp = reciprocal(v[interpolant].z);
- v[interpolant].x = v[interpolant].x * rcp;
- v[interpolant].y = v[interpolant].y * rcp;
- break;
- case 3:
- rcp = reciprocal(v[interpolant].w);
- v[interpolant].x = v[interpolant].x * rcp;
- v[interpolant].y = v[interpolant].y * rcp;
- v[interpolant].z = v[interpolant].z * rcp;
- break;
- }
- }
-
- if(state.fog.component)
- {
- f = interpolate(xxxx, Df, rhw, primitive + OFFSET(Primitive,f), state.fog.flat & 0x01, state.perspective, false);
- }
-
- setBuiltins(x, y, z, w);
-
- #if PERF_PROFILE
- cycles[PERF_INTERP] += Ticks() - interpTime;
- #endif
-
- Bool alphaPass = true;
-
- if(colorUsed())
- {
- #if PERF_PROFILE
- Long shaderTime = Ticks();
- #endif
-
- applyShader(cMask);
-
- #if PERF_PROFILE
- cycles[PERF_SHADER] += Ticks() - shaderTime;
- #endif
-
- alphaPass = alphaTest(cMask);
-
- if((shader && shader->containsKill()) || state.alphaTestActive())
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- zMask[q] &= cMask[q];
- sMask[q] &= cMask[q];
- }
- }
- }
-
- If(alphaPass)
- {
- if(!earlyDepthTest)
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- depthPass = depthPass || depthTest(zBuffer, q, x, z[q], sMask[q], zMask[q], cMask[q]);
- }
- }
-
- #if PERF_PROFILE
- Long ropTime = Ticks();
- #endif
-
- If(depthPass || Bool(earlyDepthTest))
- {
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- if(state.multiSampleMask & (1 << q))
- {
- writeDepth(zBuffer, q, x, z[q], zMask[q]);
-
- if(state.occlusionEnabled)
- {
- occlusion += *Pointer<UInt>(constants + OFFSET(Constants,occlusionCount) + 4 * (zMask[q] & sMask[q]));
- }
- }
- }
-
- if(colorUsed())
- {
- #if PERF_PROFILE
- AddAtomic(Pointer<Long>(&profiler.ropOperations), 4);
- #endif
-
- rasterOperation(f, cBuffer, x, sMask, zMask, cMask);
- }
- }
-
- #if PERF_PROFILE
- cycles[PERF_ROP] += Ticks() - ropTime;
- #endif
- }
- }
-
- for(unsigned int q = 0; q < state.multiSample; q++)
- {
- if(state.multiSampleMask & (1 << q))
- {
- writeStencil(sBuffer, q, x, sMask[q], zMask[q], cMask[q]);
- }
- }
-
- #if PERF_PROFILE
- cycles[PERF_PIPE] += Ticks() - pipeTime;
- #endif
- }
-
- Float4 PixelRoutine::interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective)
- {
- Float4 interpolant = *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,C), 16);
-
- if(!flat)
- {
- interpolant += x * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,A), 16) +
- y * *Pointer<Float4>(planeEquation + OFFSET(PlaneEquation,B), 16);
-
- if(perspective)
- {
- interpolant *= rhw;
- }
- }
-
- return interpolant;
- }
-
- void PixelRoutine::stencilTest(Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask)
- {
- if(!state.stencilActive)
- {
- return;
- }
-
- // (StencilRef & StencilMask) CompFunc (StencilBufferValue & StencilMask)
-
- Pointer<Byte> buffer = sBuffer + 2 * x;
-
- if(q > 0)
- {
- buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
- }
-
- Byte8 value = *Pointer<Byte8>(buffer);
- Byte8 valueCCW = value;
-
- if(!state.noStencilMask)
- {
- value &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[0].testMaskQ));
- }
-
- stencilTest(value, state.stencilCompareMode, false);
-
- if(state.twoSidedStencil)
- {
- if(!state.noStencilMaskCCW)
- {
- valueCCW &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[1].testMaskQ));
- }
-
- stencilTest(valueCCW, state.stencilCompareModeCCW, true);
-
- value &= *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask));
- valueCCW &= *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask));
- value |= valueCCW;
- }
-
- sMask = SignMask(value) & cMask;
- }
-
- void PixelRoutine::stencilTest(Byte8 &value, StencilCompareMode stencilCompareMode, bool CCW)
- {
- Byte8 equal;
-
- switch(stencilCompareMode)
- {
- case STENCIL_ALWAYS:
- value = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case STENCIL_NEVER:
- value = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- break;
- case STENCIL_LESS: // a < b ~ b > a
- value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
- value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
- break;
- case STENCIL_EQUAL:
- value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
- break;
- case STENCIL_NOTEQUAL: // a != b ~ !(a == b)
- value = CmpEQ(value, *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
- value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case STENCIL_LESSEQUAL: // a <= b ~ (b > a) || (a == b)
- equal = value;
- equal = CmpEQ(equal, *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedQ)));
- value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
- value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
- value |= equal;
- break;
- case STENCIL_GREATER: // a > b
- equal = *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ));
- value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
- equal = CmpGT(As<SByte8>(equal), As<SByte8>(value));
- value = equal;
- break;
- case STENCIL_GREATEREQUAL: // a >= b ~ !(a < b) ~ !(b > a)
- value += Byte8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
- value = CmpGT(As<SByte8>(value), *Pointer<SByte8>(data + OFFSET(DrawData,stencil[CCW].referenceMaskedSignedQ)));
- value ^= Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- default:
- ASSERT(false);
- }
- }
-
- Bool PixelRoutine::depthTest(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask)
- {
- if(!state.depthTestActive)
- {
- return true;
- }
-
- Float4 Z = z;
-
- if(shader && shader->depthOverride())
- {
- if(complementaryDepthBuffer)
- {
- Z = Float4(1.0f) - oDepth;
- }
- else
- {
- Z = oDepth;
- }
- }
-
- Pointer<Byte> buffer;
- Int pitch;
-
- if(!state.quadLayoutDepthBuffer)
- {
- buffer = zBuffer + 4 * x;
- pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
- }
- else
- {
- buffer = zBuffer + 8 * x;
- }
-
- if(q > 0)
- {
- buffer += q * *Pointer<Int>(data + OFFSET(DrawData,depthSliceB));
- }
-
- Float4 zValue;
-
- if(state.depthCompareMode != DEPTH_NEVER || (state.depthCompareMode != DEPTH_ALWAYS && !state.depthWriteEnable))
- {
- if(!state.quadLayoutDepthBuffer)
- {
- // FIXME: Properly optimizes?
- zValue.xy = *Pointer<Float4>(buffer);
- zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
- }
- else
- {
- zValue = *Pointer<Float4>(buffer, 16);
- }
- }
-
- Int4 zTest;
-
- switch(state.depthCompareMode)
- {
- case DEPTH_ALWAYS:
- // Optimized
- break;
- case DEPTH_NEVER:
- // Optimized
- break;
- case DEPTH_EQUAL:
- zTest = CmpEQ(zValue, Z);
- break;
- case DEPTH_NOTEQUAL:
- zTest = CmpNEQ(zValue, Z);
- break;
- case DEPTH_LESS:
- if(complementaryDepthBuffer)
- {
- zTest = CmpLT(zValue, Z);
- }
- else
- {
- zTest = CmpNLE(zValue, Z);
- }
- break;
- case DEPTH_GREATEREQUAL:
- if(complementaryDepthBuffer)
- {
- zTest = CmpNLT(zValue, Z);
- }
- else
- {
- zTest = CmpLE(zValue, Z);
- }
- break;
- case DEPTH_LESSEQUAL:
- if(complementaryDepthBuffer)
- {
- zTest = CmpLE(zValue, Z);
- }
- else
- {
- zTest = CmpNLT(zValue, Z);
- }
- break;
- case DEPTH_GREATER:
- if(complementaryDepthBuffer)
- {
- zTest = CmpNLE(zValue, Z);
- }
- else
- {
- zTest = CmpLT(zValue, Z);
- }
- break;
- default:
- ASSERT(false);
- }
-
- switch(state.depthCompareMode)
- {
- case DEPTH_ALWAYS:
- zMask = cMask;
- break;
- case DEPTH_NEVER:
- zMask = 0x0;
- break;
- default:
- zMask = SignMask(zTest) & cMask;
- break;
- }
-
- if(state.stencilActive)
- {
- zMask &= sMask;
- }
-
- return zMask != 0;
- }
-
- void PixelRoutine::alphaTest(Int &aMask, Short4 &alpha)
- {
- Short4 cmp;
- Short4 equal;
-
- switch(state.alphaCompareMode)
- {
- case ALPHA_ALWAYS:
- aMask = 0xF;
- break;
- case ALPHA_NEVER:
- aMask = 0x0;
- break;
- case ALPHA_EQUAL:
- cmp = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- case ALPHA_NOTEQUAL: // a != b ~ !(a == b)
- cmp = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4(0xFFFFu); // FIXME
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- case ALPHA_LESS: // a < b ~ b > a
- cmp = CmpGT(*Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)), alpha);
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- case ALPHA_GREATEREQUAL: // a >= b ~ (a > b) || (a == b) ~ !(b > a) // TODO: Approximate
- equal = CmpEQ(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
- cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
- cmp |= equal;
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- case ALPHA_LESSEQUAL: // a <= b ~ !(a > b)
- cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4))) ^ Short4(0xFFFFu); // FIXME
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- case ALPHA_GREATER: // a > b
- cmp = CmpGT(alpha, *Pointer<Short4>(data + OFFSET(DrawData,factor.alphaReference4)));
- aMask = SignMask(PackSigned(cmp, Short4(0x0000)));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::alphaToCoverage(Int cMask[4], Float4 &alpha)
- {
- Int4 coverage0 = CmpNLT(alpha, *Pointer<Float4>(data + OFFSET(DrawData,a2c0)));
- Int4 coverage1 = CmpNLT(alpha, *Pointer<Float4>(data + OFFSET(DrawData,a2c1)));
- Int4 coverage2 = CmpNLT(alpha, *Pointer<Float4>(data + OFFSET(DrawData,a2c2)));
- Int4 coverage3 = CmpNLT(alpha, *Pointer<Float4>(data + OFFSET(DrawData,a2c3)));
-
- Int aMask0 = SignMask(coverage0);
- Int aMask1 = SignMask(coverage1);
- Int aMask2 = SignMask(coverage2);
- Int aMask3 = SignMask(coverage3);
-
- cMask[0] &= aMask0;
- cMask[1] &= aMask1;
- cMask[2] &= aMask2;
- cMask[3] &= aMask3;
- }
-
- void PixelRoutine::fogBlend(Vector4f &c0, Float4 &fog)
- {
- if(!state.fogActive)
- {
- return;
- }
-
- if(state.pixelFogMode != FOG_NONE)
- {
- pixelFog(fog);
-
- fog = Min(fog, Float4(1.0f));
- fog = Max(fog, Float4(0.0f));
- }
-
- c0.x -= *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[0]));
- c0.y -= *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[1]));
- c0.z -= *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[2]));
-
- c0.x *= fog;
- c0.y *= fog;
- c0.z *= fog;
-
- c0.x += *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[0]));
- c0.y += *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[1]));
- c0.z += *Pointer<Float4>(data + OFFSET(DrawData,fog.colorF[2]));
- }
-
- void PixelRoutine::pixelFog(Float4 &visibility)
- {
- Float4 &zw = visibility;
-
- if(state.pixelFogMode != FOG_NONE)
- {
- if(state.wBasedFog)
- {
- zw = rhw;
- }
- else
- {
- if(complementaryDepthBuffer)
- {
- zw = Float4(1.0f) - z[0];
- }
- else
- {
- zw = z[0];
- }
- }
- }
-
- switch(state.pixelFogMode)
- {
- case FOG_NONE:
- break;
- case FOG_LINEAR:
- zw *= *Pointer<Float4>(data + OFFSET(DrawData,fog.scale));
- zw += *Pointer<Float4>(data + OFFSET(DrawData,fog.offset));
- break;
- case FOG_EXP:
- zw *= *Pointer<Float4>(data + OFFSET(DrawData,fog.densityE));
- zw = exponential2(zw, true);
- break;
- case FOG_EXP2:
- zw *= zw;
- zw *= *Pointer<Float4>(data + OFFSET(DrawData,fog.density2E));
- zw = exponential2(zw, true);
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::writeDepth(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask)
- {
- if(!state.depthWriteEnable)
- {
- return;
- }
-
- Float4 Z = z;
-
- if(shader && shader->depthOverride())
- {
- if(complementaryDepthBuffer)
- {
- Z = Float4(1.0f) - oDepth;
- }
- else
- {
- Z = oDepth;
- }
- }
-
- Pointer<Byte> buffer;
- Int pitch;
-
- if(!state.quadLayoutDepthBuffer)
- {
- buffer = zBuffer + 4 * x;
- pitch = *Pointer<Int>(data + OFFSET(DrawData,depthPitchB));
- }
- else
- {
- buffer = zBuffer + 8 * x;
- }
-
- if(q > 0)
- {
- buffer += q * *Pointer<Int>(data + OFFSET(DrawData,depthSliceB));
- }
-
- Float4 zValue;
-
- if(state.depthCompareMode != DEPTH_NEVER || (state.depthCompareMode != DEPTH_ALWAYS && !state.depthWriteEnable))
- {
- if(!state.quadLayoutDepthBuffer)
- {
- // FIXME: Properly optimizes?
- zValue.xy = *Pointer<Float4>(buffer);
- zValue.zw = *Pointer<Float4>(buffer + pitch - 8);
- }
- else
- {
- zValue = *Pointer<Float4>(buffer, 16);
- }
- }
-
- Z = As<Float4>(As<Int4>(Z) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X) + zMask * 16, 16));
- zValue = As<Float4>(As<Int4>(zValue) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X) + zMask * 16, 16));
- Z = As<Float4>(As<Int4>(Z) | As<Int4>(zValue));
-
- if(!state.quadLayoutDepthBuffer)
- {
- // FIXME: Properly optimizes?
- *Pointer<Float2>(buffer) = Float2(Z.xy);
- *Pointer<Float2>(buffer + pitch) = Float2(Z.zw);
- }
- else
- {
- *Pointer<Float4>(buffer, 16) = Z;
- }
- }
-
- void PixelRoutine::writeStencil(Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &zMask, Int &cMask)
- {
- if(!state.stencilActive)
- {
- return;
- }
-
- if(state.stencilPassOperation == OPERATION_KEEP && state.stencilZFailOperation == OPERATION_KEEP && state.stencilFailOperation == OPERATION_KEEP)
- {
- if(!state.twoSidedStencil || (state.stencilPassOperationCCW == OPERATION_KEEP && state.stencilZFailOperationCCW == OPERATION_KEEP && state.stencilFailOperationCCW == OPERATION_KEEP))
- {
- return;
- }
- }
-
- if(state.stencilWriteMasked && (!state.twoSidedStencil || state.stencilWriteMaskedCCW))
- {
- return;
- }
-
- Pointer<Byte> buffer = sBuffer + 2 * x;
-
- if(q > 0)
- {
- buffer += q * *Pointer<Int>(data + OFFSET(DrawData,stencilSliceB));
- }
-
- Byte8 bufferValue = *Pointer<Byte8>(buffer);
-
- Byte8 newValue;
- stencilOperation(newValue, bufferValue, state.stencilPassOperation, state.stencilZFailOperation, state.stencilFailOperation, false, zMask, sMask);
-
- if(!state.noStencilWriteMask)
- {
- Byte8 maskedValue = bufferValue;
- newValue &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[0].writeMaskQ));
- maskedValue &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[0].invWriteMaskQ));
- newValue |= maskedValue;
- }
-
- if(state.twoSidedStencil)
- {
- Byte8 newValueCCW;
-
- stencilOperation(newValueCCW, bufferValue, state.stencilPassOperationCCW, state.stencilZFailOperationCCW, state.stencilFailOperationCCW, true, zMask, sMask);
-
- if(!state.noStencilWriteMaskCCW)
- {
- Byte8 maskedValue = bufferValue;
- newValueCCW &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[1].writeMaskQ));
- maskedValue &= *Pointer<Byte8>(data + OFFSET(DrawData,stencil[1].invWriteMaskQ));
- newValueCCW |= maskedValue;
- }
-
- newValue &= *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask));
- newValueCCW &= *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask));
- newValue |= newValueCCW;
- }
-
- newValue &= *Pointer<Byte8>(constants + OFFSET(Constants,maskB4Q) + 8 * cMask);
- bufferValue &= *Pointer<Byte8>(constants + OFFSET(Constants,invMaskB4Q) + 8 * cMask);
- newValue |= bufferValue;
-
- *Pointer<Byte4>(buffer) = Byte4(newValue);
- }
-
- void PixelRoutine::stencilOperation(Byte8 &newValue, Byte8 &bufferValue, StencilOperation stencilPassOperation, StencilOperation stencilZFailOperation, StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask)
- {
- Byte8 &pass = newValue;
- Byte8 fail;
- Byte8 zFail;
-
- stencilOperation(pass, bufferValue, stencilPassOperation, CCW);
-
- if(stencilZFailOperation != stencilPassOperation)
- {
- stencilOperation(zFail, bufferValue, stencilZFailOperation, CCW);
- }
-
- if(stencilFailOperation != stencilPassOperation || stencilFailOperation != stencilZFailOperation)
- {
- stencilOperation(fail, bufferValue, stencilFailOperation, CCW);
- }
-
- if(stencilFailOperation != stencilPassOperation || stencilFailOperation != stencilZFailOperation)
- {
- if(state.depthTestActive && stencilZFailOperation != stencilPassOperation) // zMask valid and values not the same
- {
- pass &= *Pointer<Byte8>(constants + OFFSET(Constants,maskB4Q) + 8 * zMask);
- zFail &= *Pointer<Byte8>(constants + OFFSET(Constants,invMaskB4Q) + 8 * zMask);
- pass |= zFail;
- }
-
- pass &= *Pointer<Byte8>(constants + OFFSET(Constants,maskB4Q) + 8 * sMask);
- fail &= *Pointer<Byte8>(constants + OFFSET(Constants,invMaskB4Q) + 8 * sMask);
- pass |= fail;
- }
- }
-
- void PixelRoutine::stencilOperation(Byte8 &output, Byte8 &bufferValue, StencilOperation operation, bool CCW)
- {
- switch(operation)
- {
- case OPERATION_KEEP:
- output = bufferValue;
- break;
- case OPERATION_ZERO:
- output = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- break;
- case OPERATION_REPLACE:
- output = *Pointer<Byte8>(data + OFFSET(DrawData,stencil[CCW].referenceQ));
- break;
- case OPERATION_INCRSAT:
- output = AddSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
- break;
- case OPERATION_DECRSAT:
- output = SubSat(bufferValue, Byte8(1, 1, 1, 1, 1, 1, 1, 1));
- break;
- case OPERATION_INVERT:
- output = bufferValue ^ Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- break;
- case OPERATION_INCR:
- output = bufferValue + Byte8(1, 1, 1, 1, 1, 1, 1, 1);
- break;
- case OPERATION_DECR:
- output = bufferValue - Byte8(1, 1, 1, 1, 1, 1, 1, 1);
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::blendFactor(Vector4s &blendFactor, const Vector4s &current, const Vector4s &pixel, BlendFactor blendFactorActive)
- {
- switch(blendFactorActive)
- {
- case BLEND_ZERO:
- // Optimized
- break;
- case BLEND_ONE:
- // Optimized
- break;
- case BLEND_SOURCE:
- blendFactor.x = current.x;
- blendFactor.y = current.y;
- blendFactor.z = current.z;
- break;
- case BLEND_INVSOURCE:
- blendFactor.x = Short4(0xFFFFu) - current.x;
- blendFactor.y = Short4(0xFFFFu) - current.y;
- blendFactor.z = Short4(0xFFFFu) - current.z;
- break;
- case BLEND_DEST:
- blendFactor.x = pixel.x;
- blendFactor.y = pixel.y;
- blendFactor.z = pixel.z;
- break;
- case BLEND_INVDEST:
- blendFactor.x = Short4(0xFFFFu) - pixel.x;
- blendFactor.y = Short4(0xFFFFu) - pixel.y;
- blendFactor.z = Short4(0xFFFFu) - pixel.z;
- break;
- case BLEND_SOURCEALPHA:
- blendFactor.x = current.w;
- blendFactor.y = current.w;
- blendFactor.z = current.w;
- break;
- case BLEND_INVSOURCEALPHA:
- blendFactor.x = Short4(0xFFFFu) - current.w;
- blendFactor.y = Short4(0xFFFFu) - current.w;
- blendFactor.z = Short4(0xFFFFu) - current.w;
- break;
- case BLEND_DESTALPHA:
- blendFactor.x = pixel.w;
- blendFactor.y = pixel.w;
- blendFactor.z = pixel.w;
- break;
- case BLEND_INVDESTALPHA:
- blendFactor.x = Short4(0xFFFFu) - pixel.w;
- blendFactor.y = Short4(0xFFFFu) - pixel.w;
- blendFactor.z = Short4(0xFFFFu) - pixel.w;
- break;
- case BLEND_SRCALPHASAT:
- blendFactor.x = Short4(0xFFFFu) - pixel.w;
- blendFactor.x = Min(As<UShort4>(blendFactor.x), As<UShort4>(current.w));
- blendFactor.y = blendFactor.x;
- blendFactor.z = blendFactor.x;
- break;
- case BLEND_CONSTANT:
- blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[0]));
- blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[1]));
- blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[2]));
- break;
- case BLEND_INVCONSTANT:
- blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[0]));
- blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[1]));
- blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[2]));
- break;
- case BLEND_CONSTANTALPHA:
- blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[3]));
- blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[3]));
- blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[3]));
- break;
- case BLEND_INVCONSTANTALPHA:
- blendFactor.x = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
- blendFactor.y = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
- blendFactor.z = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::blendFactorAlpha(Vector4s &blendFactor, const Vector4s &current, const Vector4s &pixel, BlendFactor blendFactorAlphaActive)
- {
- switch(blendFactorAlphaActive)
- {
- case BLEND_ZERO:
- // Optimized
- break;
- case BLEND_ONE:
- // Optimized
- break;
- case BLEND_SOURCE:
- blendFactor.w = current.w;
- break;
- case BLEND_INVSOURCE:
- blendFactor.w = Short4(0xFFFFu) - current.w;
- break;
- case BLEND_DEST:
- blendFactor.w = pixel.w;
- break;
- case BLEND_INVDEST:
- blendFactor.w = Short4(0xFFFFu) - pixel.w;
- break;
- case BLEND_SOURCEALPHA:
- blendFactor.w = current.w;
- break;
- case BLEND_INVSOURCEALPHA:
- blendFactor.w = Short4(0xFFFFu) - current.w;
- break;
- case BLEND_DESTALPHA:
- blendFactor.w = pixel.w;
- break;
- case BLEND_INVDESTALPHA:
- blendFactor.w = Short4(0xFFFFu) - pixel.w;
- break;
- case BLEND_SRCALPHASAT:
- blendFactor.w = Short4(0xFFFFu);
- break;
- case BLEND_CONSTANT:
- case BLEND_CONSTANTALPHA:
- blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData,factor.blendConstant4W[3]));
- break;
- case BLEND_INVCONSTANT:
- case BLEND_INVCONSTANTALPHA:
- blendFactor.w = *Pointer<Short4>(data + OFFSET(DrawData,factor.invBlendConstant4W[3]));
- break;
- default:
- ASSERT(false);
- }
- }
-
- bool PixelRoutine::isSRGB(int index) const
- {
- return Surface::isSRGBformat(state.targetFormat[index]);
- }
-
- void PixelRoutine::readPixel(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &pixel)
- {
- Short4 c01;
- Short4 c23;
- Pointer<Byte> buffer;
- Pointer<Byte> buffer2;
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R5G6B5:
- buffer = cBuffer + 2 * x;
- buffer2 = buffer + *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c01 = As<Short4>(Int2(*Pointer<Int>(buffer), *Pointer<Int>(buffer2)));
-
- pixel.x = c01 & Short4(0xF800u);
- pixel.y = (c01 & Short4(0x07E0u)) << 5;
- pixel.z = (c01 & Short4(0x001Fu)) << 11;
- pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_A8R8G8B8:
- buffer = cBuffer + 4 * x;
- c01 = *Pointer<Short4>(buffer);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c23 = *Pointer<Short4>(buffer);
- pixel.z = c01;
- pixel.y = c01;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
- pixel.x = pixel.z;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
- pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
- pixel.y = pixel.z;
- pixel.w = pixel.x;
- pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
- pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_A8:
- buffer = cBuffer + 4 * x;
- c01 = *Pointer<Short4>(buffer);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c23 = *Pointer<Short4>(buffer);
- pixel.z = c01;
- pixel.y = c01;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
- pixel.x = pixel.z;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
- pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
- pixel.y = pixel.z;
- pixel.w = pixel.x;
- pixel.x = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
- pixel.z = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
- pixel.w = UnpackHigh(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
- break;
- case FORMAT_A8:
- buffer = cBuffer + 1 * x;
- pixel.w = Insert(pixel.w, *Pointer<Short>(buffer), 0);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- pixel.w = Insert(pixel.w, *Pointer<Short>(buffer), 1);
- pixel.w = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
- pixel.x = Short4(0x0000);
- pixel.y = Short4(0x0000);
- pixel.z = Short4(0x0000);
- break;
- case FORMAT_R8:
- buffer = cBuffer + 1 * x;
- pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 0);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- pixel.x = Insert(pixel.x, *Pointer<Short>(buffer), 1);
- pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
- pixel.y = Short4(0x0000);
- pixel.z = Short4(0x0000);
- pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_X8R8G8B8:
- buffer = cBuffer + 4 * x;
- c01 = *Pointer<Short4>(buffer);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c23 = *Pointer<Short4>(buffer);
- pixel.z = c01;
- pixel.y = c01;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
- pixel.x = pixel.z;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
- pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
- pixel.y = pixel.z;
- pixel.x = UnpackLow(As<Byte8>(pixel.x), As<Byte8>(pixel.x));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
- pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_G8R8:
- buffer = cBuffer + 2 * x;
- c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 0));
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c01 = As<Short4>(Insert(As<Int2>(c01), *Pointer<Int>(buffer), 1));
- pixel.x = (c01 & Short4(0x00FFu)) | (c01 << 8);
- pixel.y = (c01 & Short4(0xFF00u)) | As<Short4>(As<UShort4>(c01) >> 8);
- pixel.z = Short4(0x0000u);
- pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_SRGB8_X8:
- buffer = cBuffer + 4 * x;
- c01 = *Pointer<Short4>(buffer);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- c23 = *Pointer<Short4>(buffer);
- pixel.z = c01;
- pixel.y = c01;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(c23));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(c23));
- pixel.x = pixel.z;
- pixel.z = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.y));
- pixel.x = UnpackHigh(As<Byte8>(pixel.x), As<Byte8>(pixel.y));
- pixel.y = pixel.z;
- pixel.w = pixel.x;
- pixel.x = UnpackLow(As<Byte8>(pixel.z), As<Byte8>(pixel.z));
- pixel.y = UnpackHigh(As<Byte8>(pixel.y), As<Byte8>(pixel.y));
- pixel.z = UnpackLow(As<Byte8>(pixel.w), As<Byte8>(pixel.w));
- pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_A8G8R8B8Q:
- UNIMPLEMENTED();
- // pixel.z = UnpackLow(As<Byte8>(pixel.z), *Pointer<Byte8>(cBuffer + 8 * x + 0));
- // pixel.x = UnpackHigh(As<Byte8>(pixel.x), *Pointer<Byte8>(cBuffer + 8 * x + 0));
- // pixel.y = UnpackLow(As<Byte8>(pixel.y), *Pointer<Byte8>(cBuffer + 8 * x + 8));
- // pixel.w = UnpackHigh(As<Byte8>(pixel.w), *Pointer<Byte8>(cBuffer + 8 * x + 8));
- break;
- case FORMAT_X8G8R8B8Q:
- UNIMPLEMENTED();
- // pixel.z = UnpackLow(As<Byte8>(pixel.z), *Pointer<Byte8>(cBuffer + 8 * x + 0));
- // pixel.x = UnpackHigh(As<Byte8>(pixel.x), *Pointer<Byte8>(cBuffer + 8 * x + 0));
- // pixel.y = UnpackLow(As<Byte8>(pixel.y), *Pointer<Byte8>(cBuffer + 8 * x + 8));
- // pixel.w = Short4(0xFFFFu);
- break;
- case FORMAT_A16B16G16R16:
- buffer = cBuffer;
- pixel.x = *Pointer<Short4>(buffer + 8 * x);
- pixel.y = *Pointer<Short4>(buffer + 8 * x + 8);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- pixel.z = *Pointer<Short4>(buffer + 8 * x);
- pixel.w = *Pointer<Short4>(buffer + 8 * x + 8);
- transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
- break;
- case FORMAT_G16R16:
- buffer = cBuffer;
- pixel.x = *Pointer<Short4>(buffer + 4 * x);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- pixel.y = *Pointer<Short4>(buffer + 4 * x);
- pixel.z = pixel.x;
- pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.y));
- pixel.z = As<Short4>(UnpackHigh(pixel.z, pixel.y));
- pixel.y = pixel.z;
- pixel.x = As<Short4>(UnpackLow(pixel.x, pixel.z));
- pixel.y = As<Short4>(UnpackHigh(pixel.y, pixel.z));
- pixel.z = Short4(0xFFFFu);
- pixel.w = Short4(0xFFFFu);
- break;
- default:
- ASSERT(false);
- }
-
- if((postBlendSRGB && state.writeSRGB) || isSRGB(index))
- {
- sRGBtoLinear16_12_16(pixel);
- }
- }
-
- void PixelRoutine::alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x)
- {
- if(!state.alphaBlendActive)
- {
- return;
- }
-
- Vector4s pixel;
- readPixel(index, cBuffer, x, pixel);
-
- // Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
- Vector4s sourceFactor;
- Vector4s destFactor;
-
- blendFactor(sourceFactor, current, pixel, state.sourceBlendFactor);
- blendFactor(destFactor, current, pixel, state.destBlendFactor);
-
- if(state.sourceBlendFactor != BLEND_ONE && state.sourceBlendFactor != BLEND_ZERO)
- {
- current.x = MulHigh(As<UShort4>(current.x), As<UShort4>(sourceFactor.x));
- current.y = MulHigh(As<UShort4>(current.y), As<UShort4>(sourceFactor.y));
- current.z = MulHigh(As<UShort4>(current.z), As<UShort4>(sourceFactor.z));
- }
-
- if(state.destBlendFactor != BLEND_ONE && state.destBlendFactor != BLEND_ZERO)
- {
- pixel.x = MulHigh(As<UShort4>(pixel.x), As<UShort4>(destFactor.x));
- pixel.y = MulHigh(As<UShort4>(pixel.y), As<UShort4>(destFactor.y));
- pixel.z = MulHigh(As<UShort4>(pixel.z), As<UShort4>(destFactor.z));
- }
-
- switch(state.blendOperation)
- {
- case BLENDOP_ADD:
- current.x = AddSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
- current.y = AddSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
- current.z = AddSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
- break;
- case BLENDOP_SUB:
- current.x = SubSat(As<UShort4>(current.x), As<UShort4>(pixel.x));
- current.y = SubSat(As<UShort4>(current.y), As<UShort4>(pixel.y));
- current.z = SubSat(As<UShort4>(current.z), As<UShort4>(pixel.z));
- break;
- case BLENDOP_INVSUB:
- current.x = SubSat(As<UShort4>(pixel.x), As<UShort4>(current.x));
- current.y = SubSat(As<UShort4>(pixel.y), As<UShort4>(current.y));
- current.z = SubSat(As<UShort4>(pixel.z), As<UShort4>(current.z));
- break;
- case BLENDOP_MIN:
- current.x = Min(As<UShort4>(current.x), As<UShort4>(pixel.x));
- current.y = Min(As<UShort4>(current.y), As<UShort4>(pixel.y));
- current.z = Min(As<UShort4>(current.z), As<UShort4>(pixel.z));
- break;
- case BLENDOP_MAX:
- current.x = Max(As<UShort4>(current.x), As<UShort4>(pixel.x));
- current.y = Max(As<UShort4>(current.y), As<UShort4>(pixel.y));
- current.z = Max(As<UShort4>(current.z), As<UShort4>(pixel.z));
- break;
- case BLENDOP_SOURCE:
- // No operation
- break;
- case BLENDOP_DEST:
- current.x = pixel.x;
- current.y = pixel.y;
- current.z = pixel.z;
- break;
- case BLENDOP_NULL:
- current.x = Short4(0x0000);
- current.y = Short4(0x0000);
- current.z = Short4(0x0000);
- break;
- default:
- ASSERT(false);
- }
-
- blendFactorAlpha(sourceFactor, current, pixel, state.sourceBlendFactorAlpha);
- blendFactorAlpha(destFactor, current, pixel, state.destBlendFactorAlpha);
-
- if(state.sourceBlendFactorAlpha != BLEND_ONE && state.sourceBlendFactorAlpha != BLEND_ZERO)
- {
- current.w = MulHigh(As<UShort4>(current.w), As<UShort4>(sourceFactor.w));
- }
-
- if(state.destBlendFactorAlpha != BLEND_ONE && state.destBlendFactorAlpha != BLEND_ZERO)
- {
- pixel.w = MulHigh(As<UShort4>(pixel.w), As<UShort4>(destFactor.w));
- }
-
- switch(state.blendOperationAlpha)
- {
- case BLENDOP_ADD:
- current.w = AddSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
- break;
- case BLENDOP_SUB:
- current.w = SubSat(As<UShort4>(current.w), As<UShort4>(pixel.w));
- break;
- case BLENDOP_INVSUB:
- current.w = SubSat(As<UShort4>(pixel.w), As<UShort4>(current.w));
- break;
- case BLENDOP_MIN:
- current.w = Min(As<UShort4>(current.w), As<UShort4>(pixel.w));
- break;
- case BLENDOP_MAX:
- current.w = Max(As<UShort4>(current.w), As<UShort4>(pixel.w));
- break;
- case BLENDOP_SOURCE:
- // No operation
- break;
- case BLENDOP_DEST:
- current.w = pixel.w;
- break;
- case BLENDOP_NULL:
- current.w = Short4(0x0000);
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::logicOperation(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x)
- {
- if(state.logicalOperation == LOGICALOP_COPY)
- {
- return;
- }
-
- Vector4s pixel;
- readPixel(index, cBuffer, x, pixel);
-
- switch(state.logicalOperation)
- {
- case LOGICALOP_CLEAR:
- current.x = UShort4(0);
- current.y = UShort4(0);
- current.z = UShort4(0);
- break;
- case LOGICALOP_SET:
- current.x = UShort4(0xFFFFu);
- current.y = UShort4(0xFFFFu);
- current.z = UShort4(0xFFFFu);
- break;
- case LOGICALOP_COPY:
- ASSERT(false); // Optimized out
- break;
- case LOGICALOP_COPY_INVERTED:
- current.x = ~current.x;
- current.y = ~current.y;
- current.z = ~current.z;
- break;
- case LOGICALOP_NOOP:
- current.x = pixel.x;
- current.y = pixel.y;
- current.z = pixel.z;
- break;
- case LOGICALOP_INVERT:
- current.x = ~pixel.x;
- current.y = ~pixel.y;
- current.z = ~pixel.z;
- break;
- case LOGICALOP_AND:
- current.x = pixel.x & current.x;
- current.y = pixel.y & current.y;
- current.z = pixel.z & current.z;
- break;
- case LOGICALOP_NAND:
- current.x = ~(pixel.x & current.x);
- current.y = ~(pixel.y & current.y);
- current.z = ~(pixel.z & current.z);
- break;
- case LOGICALOP_OR:
- current.x = pixel.x | current.x;
- current.y = pixel.y | current.y;
- current.z = pixel.z | current.z;
- break;
- case LOGICALOP_NOR:
- current.x = ~(pixel.x | current.x);
- current.y = ~(pixel.y | current.y);
- current.z = ~(pixel.z | current.z);
- break;
- case LOGICALOP_XOR:
- current.x = pixel.x ^ current.x;
- current.y = pixel.y ^ current.y;
- current.z = pixel.z ^ current.z;
- break;
- case LOGICALOP_EQUIV:
- current.x = ~(pixel.x ^ current.x);
- current.y = ~(pixel.y ^ current.y);
- current.z = ~(pixel.z ^ current.z);
- break;
- case LOGICALOP_AND_REVERSE:
- current.x = ~pixel.x & current.x;
- current.y = ~pixel.y & current.y;
- current.z = ~pixel.z & current.z;
- break;
- case LOGICALOP_AND_INVERTED:
- current.x = pixel.x & ~current.x;
- current.y = pixel.y & ~current.y;
- current.z = pixel.z & ~current.z;
- break;
- case LOGICALOP_OR_REVERSE:
- current.x = ~pixel.x | current.x;
- current.y = ~pixel.y | current.y;
- current.z = ~pixel.z | current.z;
- break;
- case LOGICALOP_OR_INVERTED:
- current.x = pixel.x | ~current.x;
- current.y = pixel.y | ~current.y;
- current.z = pixel.z | ~current.z;
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::writeColor(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &current, Int &sMask, Int &zMask, Int &cMask)
- {
- if((postBlendSRGB && state.writeSRGB) || isSRGB(index))
- {
- linearToSRGB16_12_16(current);
- }
-
- if(exactColorRounding)
- {
- switch(state.targetFormat[index])
- {
- case FORMAT_R5G6B5:
- current.x = AddSat(As<UShort4>(current.x), UShort4(0x0400));
- current.y = AddSat(As<UShort4>(current.y), UShort4(0x0200));
- current.z = AddSat(As<UShort4>(current.z), UShort4(0x0400));
- break;
- case FORMAT_X8G8R8B8Q:
- case FORMAT_A8G8R8B8Q:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_G8R8:
- case FORMAT_R8:
- current.x = current.x - As<Short4>(As<UShort4>(current.x) >> 8) + Short4(0x0080);
- current.y = current.y - As<Short4>(As<UShort4>(current.y) >> 8) + Short4(0x0080);
- current.z = current.z - As<Short4>(As<UShort4>(current.z) >> 8) + Short4(0x0080);
- current.w = current.w - As<Short4>(As<UShort4>(current.w) >> 8) + Short4(0x0080);
- break;
- default:
- break;
- }
- }
-
- int rgbaWriteMask = state.colorWriteActive(index);
- int bgraWriteMask = (rgbaWriteMask & 0x0000000A) | (rgbaWriteMask & 0x00000001) << 2 | (rgbaWriteMask & 0x00000004) >> 2;
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R5G6B5:
- {
- current.x = current.x & Short4(0xF800u);
- current.y = As<UShort4>(current.y & Short4(0xFC00u)) >> 5;
- current.z = As<UShort4>(current.z) >> 11;
-
- current.x = current.x | current.y | current.z;
- }
- break;
- case FORMAT_X8G8R8B8Q:
- UNIMPLEMENTED();
- // current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- // current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- // current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-
- // current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
- // current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.y)));
- break;
- case FORMAT_A8G8R8B8Q:
- UNIMPLEMENTED();
- // current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- // current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- // current.z = As<Short4>(As<UShort4>(current.z) >> 8);
- // current.w = As<Short4>(As<UShort4>(current.w) >> 8);
-
- // current.z = As<Short4>(Pack(As<UShort4>(current.z), As<UShort4>(current.x)));
- // current.y = As<Short4>(Pack(As<UShort4>(current.y), As<UShort4>(current.w)));
- break;
- case FORMAT_X8R8G8B8:
- case FORMAT_A8R8G8B8:
- if(state.targetFormat[index] == FORMAT_X8R8G8B8 || rgbaWriteMask == 0x7)
- {
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-
- current.z = As<Short4>(PackUnsigned(current.z, current.x));
- current.y = As<Short4>(PackUnsigned(current.y, current.y));
-
- current.x = current.z;
- current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
- current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
- current.y = current.z;
- current.z = As<Short4>(UnpackLow(current.z, current.x));
- current.y = As<Short4>(UnpackHigh(current.y, current.x));
- }
- else
- {
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- current.z = As<Short4>(As<UShort4>(current.z) >> 8);
- current.w = As<Short4>(As<UShort4>(current.w) >> 8);
-
- current.z = As<Short4>(PackUnsigned(current.z, current.x));
- current.y = As<Short4>(PackUnsigned(current.y, current.w));
-
- current.x = current.z;
- current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
- current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
- current.y = current.z;
- current.z = As<Short4>(UnpackLow(current.z, current.x));
- current.y = As<Short4>(UnpackHigh(current.y, current.x));
- }
- break;
- case FORMAT_X8B8G8R8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- if(state.targetFormat[index] == FORMAT_X8B8G8R8 || state.targetFormat[index] == FORMAT_SRGB8_X8 || rgbaWriteMask == 0x7)
- {
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- current.z = As<Short4>(As<UShort4>(current.z) >> 8);
-
- current.z = As<Short4>(PackUnsigned(current.x, current.z));
- current.y = As<Short4>(PackUnsigned(current.y, current.y));
-
- current.x = current.z;
- current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
- current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
- current.y = current.z;
- current.z = As<Short4>(UnpackLow(current.z, current.x));
- current.y = As<Short4>(UnpackHigh(current.y, current.x));
- }
- else
- {
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- current.z = As<Short4>(As<UShort4>(current.z) >> 8);
- current.w = As<Short4>(As<UShort4>(current.w) >> 8);
-
- current.z = As<Short4>(PackUnsigned(current.x, current.z));
- current.y = As<Short4>(PackUnsigned(current.y, current.w));
-
- current.x = current.z;
- current.z = UnpackLow(As<Byte8>(current.z), As<Byte8>(current.y));
- current.x = UnpackHigh(As<Byte8>(current.x), As<Byte8>(current.y));
- current.y = current.z;
- current.z = As<Short4>(UnpackLow(current.z, current.x));
- current.y = As<Short4>(UnpackHigh(current.y, current.x));
- }
- break;
- case FORMAT_G8R8:
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.y = As<Short4>(As<UShort4>(current.y) >> 8);
- current.x = As<Short4>(PackUnsigned(current.x, current.x));
- current.y = As<Short4>(PackUnsigned(current.y, current.y));
- current.x = UnpackLow(As<Byte8>(current.x), As<Byte8>(current.y));
- break;
- case FORMAT_R8:
- current.x = As<Short4>(As<UShort4>(current.x) >> 8);
- current.x = As<Short4>(PackUnsigned(current.x, current.x));
- break;
- case FORMAT_A8:
- current.w = As<Short4>(As<UShort4>(current.w) >> 8);
- current.w = As<Short4>(PackUnsigned(current.w, current.w));
- break;
- case FORMAT_G16R16:
- current.z = current.x;
- current.x = As<Short4>(UnpackLow(current.x, current.y));
- current.z = As<Short4>(UnpackHigh(current.z, current.y));
- current.y = current.z;
- break;
- case FORMAT_A16B16G16R16:
- transpose4x4(current.x, current.y, current.z, current.w);
- break;
- default:
- ASSERT(false);
- }
-
- Short4 c01 = current.z;
- Short4 c23 = current.y;
-
- Int xMask; // Combination of all masks
-
- if(state.depthTestActive)
- {
- xMask = zMask;
- }
- else
- {
- xMask = cMask;
- }
-
- if(state.stencilActive)
- {
- xMask &= sMask;
- }
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R5G6B5:
- {
- Pointer<Byte> buffer = cBuffer + 2 * x;
- Int value = *Pointer<Int>(buffer);
-
- Int c01 = Extract(As<Int2>(current.x), 0);
-
- if((bgraWriteMask & 0x00000007) != 0x00000007)
- {
- Int masked = value;
- c01 &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[bgraWriteMask & 0x7][0]));
- masked &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[~bgraWriteMask & 0x7][0]));
- c01 |= masked;
- }
-
- c01 &= *Pointer<Int>(constants + OFFSET(Constants,maskW4Q[0][0]) + xMask * 8);
- value &= *Pointer<Int>(constants + OFFSET(Constants,invMaskW4Q[0][0]) + xMask * 8);
- c01 |= value;
- *Pointer<Int>(buffer) = c01;
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- value = *Pointer<Int>(buffer);
-
- Int c23 = Extract(As<Int2>(current.x), 1);
-
- if((bgraWriteMask & 0x00000007) != 0x00000007)
- {
- Int masked = value;
- c23 &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[bgraWriteMask & 0x7][0]));
- masked &= *Pointer<Int>(constants + OFFSET(Constants,mask565Q[~bgraWriteMask & 0x7][0]));
- c23 |= masked;
- }
-
- c23 &= *Pointer<Int>(constants + OFFSET(Constants,maskW4Q[0][2]) + xMask * 8);
- value &= *Pointer<Int>(constants + OFFSET(Constants,invMaskW4Q[0][2]) + xMask * 8);
- c23 |= value;
- *Pointer<Int>(buffer) = c23;
- }
- break;
- case FORMAT_A8G8R8B8Q:
- case FORMAT_X8G8R8B8Q: // FIXME: Don't touch alpha?
- UNIMPLEMENTED();
- // value = *Pointer<Short4>(cBuffer + 8 * x + 0);
-
- // if((state.targetFormat[index] == FORMAT_A8G8R8B8Q && bgraWriteMask != 0x0000000F) ||
- // ((state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x00000007) &&
- // (state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x0000000F))) // FIXME: Need for masking when XRGB && Fh?
- // {
- // Short4 masked = value;
- // c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
- // masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
- // c01 |= masked;
- // }
-
- // c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD01Q) + xMask * 8);
- // value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
- // c01 |= value;
- // *Pointer<Short4>(cBuffer + 8 * x + 0) = c01;
-
- // value = *Pointer<Short4>(cBuffer + 8 * x + 8);
-
- // if((state.targetFormat[index] == FORMAT_A8G8R8B8Q && bgraWriteMask != 0x0000000F) ||
- // ((state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x00000007) &&
- // (state.targetFormat[index] == FORMAT_X8G8R8B8Q && bgraWriteMask != 0x0000000F))) // FIXME: Need for masking when XRGB && Fh?
- // {
- // Short4 masked = value;
- // c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
- // masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
- // c23 |= masked;
- // }
-
- // c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD23Q) + xMask * 8);
- // value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
- // c23 |= value;
- // *Pointer<Short4>(cBuffer + 8 * x + 8) = c23;
- break;
- case FORMAT_A8R8G8B8:
- case FORMAT_X8R8G8B8: // FIXME: Don't touch alpha?
- {
- Pointer<Byte> buffer = cBuffer + x * 4;
- Short4 value = *Pointer<Short4>(buffer);
-
- if((state.targetFormat[index] == FORMAT_A8R8G8B8 && bgraWriteMask != 0x0000000F) ||
- ((state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x00000007) &&
- (state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x0000000F))) // FIXME: Need for masking when XRGB && Fh?
- {
- Short4 masked = value;
- c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
- c01 |= masked;
- }
-
- c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD01Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
- c01 |= value;
- *Pointer<Short4>(buffer) = c01;
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- value = *Pointer<Short4>(buffer);
-
- if((state.targetFormat[index] == FORMAT_A8R8G8B8 && bgraWriteMask != 0x0000000F) ||
- ((state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x00000007) &&
- (state.targetFormat[index] == FORMAT_X8R8G8B8 && bgraWriteMask != 0x0000000F))) // FIXME: Need for masking when XRGB && Fh?
- {
- Short4 masked = value;
- c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[bgraWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[bgraWriteMask][0]));
- c23 |= masked;
- }
-
-#ifdef __APPLE__
- // On Mac we render directly to an IOSurface that isn't vertically padded. So we
- // only render the bottom half of quads when it won't overflow the buffer.
- If ((y + 1) < yMax)
-#endif
- {
- c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD23Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
- c23 |= value;
- *Pointer<Short4>(buffer) = c23;
- }
- }
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_X8B8G8R8: // FIXME: Don't touch alpha?
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- {
- Pointer<Byte> buffer = cBuffer + x * 4;
- Short4 value = *Pointer<Short4>(buffer);
-
- bool masked = (((state.targetFormat[index] == FORMAT_A8B8G8R8 || state.targetFormat[index] == FORMAT_SRGB8_A8) && rgbaWriteMask != 0x0000000F) ||
- (((state.targetFormat[index] == FORMAT_X8B8G8R8 || state.targetFormat[index] == FORMAT_SRGB8_X8) && rgbaWriteMask != 0x00000007) &&
- ((state.targetFormat[index] == FORMAT_X8B8G8R8 || state.targetFormat[index] == FORMAT_SRGB8_X8) && rgbaWriteMask != 0x0000000F))); // FIXME: Need for masking when XBGR && Fh?
-
- if(masked)
- {
- Short4 masked = value;
- c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[rgbaWriteMask][0]));
- c01 |= masked;
- }
-
- c01 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD01Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
- c01 |= value;
- *Pointer<Short4>(buffer) = c01;
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- value = *Pointer<Short4>(buffer);
-
- if(masked)
- {
- Short4 masked = value;
- c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q[rgbaWriteMask][0]));
- c23 |= masked;
- }
-
- c23 &= *Pointer<Short4>(constants + OFFSET(Constants,maskD23Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
- c23 |= value;
- *Pointer<Short4>(buffer) = c23;
- }
- break;
- case FORMAT_G8R8:
- if((rgbaWriteMask & 0x00000003) != 0x0)
- {
- Pointer<Byte> buffer = cBuffer + 2 * x;
- Int2 value;
- value = Insert(value, *Pointer<Int>(buffer), 0);
- Int pitch = *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- value = Insert(value, *Pointer<Int>(buffer + pitch), 1);
-
- Int2 packedCol = As<Int2>(current.x);
-
- UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
- if((rgbaWriteMask & 0x3) != 0x3)
- {
- Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
- UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
- mergedMask &= rgbaMask;
- }
-
- packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask));
-
- *Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
- *Pointer<UInt>(buffer + pitch) = As<UInt>(Extract(packedCol, 1));
- }
- break;
- case FORMAT_R8:
- if(rgbaWriteMask & 0x00000001)
- {
- Pointer<Byte> buffer = cBuffer + 1 * x;
- Short4 value;
- value = Insert(value, *Pointer<Short>(buffer), 0);
- Int pitch = *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- value = Insert(value, *Pointer<Short>(buffer + pitch), 1);
-
- current.x &= *Pointer<Short4>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask);
- value &= *Pointer<Short4>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask);
- current.x |= value;
-
- *Pointer<Short>(buffer) = Extract(current.x, 0);
- *Pointer<Short>(buffer + pitch) = Extract(current.x, 1);
- }
- break;
- case FORMAT_A8:
- if(rgbaWriteMask & 0x00000008)
- {
- Pointer<Byte> buffer = cBuffer + 1 * x;
- Short4 value;
- value = Insert(value, *Pointer<Short>(buffer), 0);
- Int pitch = *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- value = Insert(value, *Pointer<Short>(buffer + pitch), 1);
-
- current.w &= *Pointer<Short4>(constants + OFFSET(Constants,maskB4Q) + 8 * xMask);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskB4Q) + 8 * xMask);
- current.w |= value;
-
- *Pointer<Short>(buffer) = Extract(current.w, 0);
- *Pointer<Short>(buffer + pitch) = Extract(current.w, 1);
- }
- break;
- case FORMAT_G16R16:
- {
- Pointer<Byte> buffer = cBuffer + 4 * x;
-
- Short4 value = *Pointer<Short4>(buffer);
-
- if((rgbaWriteMask & 0x00000003) != 0x00000003)
- {
- Short4 masked = value;
- current.x &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[~rgbaWriteMask & 0x3][0]));
- current.x |= masked;
- }
-
- current.x &= *Pointer<Short4>(constants + OFFSET(Constants,maskD01Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD01Q) + xMask * 8);
- current.x |= value;
- *Pointer<Short4>(buffer) = current.x;
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- value = *Pointer<Short4>(buffer);
-
- if((rgbaWriteMask & 0x00000003) != 0x00000003)
- {
- Short4 masked = value;
- current.y &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[rgbaWriteMask & 0x3][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,maskW01Q[~rgbaWriteMask & 0x3][0]));
- current.y |= masked;
- }
-
- current.y &= *Pointer<Short4>(constants + OFFSET(Constants,maskD23Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskD23Q) + xMask * 8);
- current.y |= value;
- *Pointer<Short4>(buffer) = current.y;
- }
- break;
- case FORMAT_A16B16G16R16:
- {
- Pointer<Byte> buffer = cBuffer + 8 * x;
-
- {
- Short4 value = *Pointer<Short4>(buffer);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Short4 masked = value;
- current.x &= *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
- current.x |= masked;
- }
-
- current.x &= *Pointer<Short4>(constants + OFFSET(Constants,maskQ0Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskQ0Q) + xMask * 8);
- current.x |= value;
- *Pointer<Short4>(buffer) = current.x;
- }
-
- {
- Short4 value = *Pointer<Short4>(buffer + 8);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Short4 masked = value;
- current.y &= *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
- current.y |= masked;
- }
-
- current.y &= *Pointer<Short4>(constants + OFFSET(Constants,maskQ1Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskQ1Q) + xMask * 8);
- current.y |= value;
- *Pointer<Short4>(buffer + 8) = current.y;
- }
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- {
- Short4 value = *Pointer<Short4>(buffer);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Short4 masked = value;
- current.z &= *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
- current.z |= masked;
- }
-
- current.z &= *Pointer<Short4>(constants + OFFSET(Constants,maskQ2Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskQ2Q) + xMask * 8);
- current.z |= value;
- *Pointer<Short4>(buffer) = current.z;
- }
-
- {
- Short4 value = *Pointer<Short4>(buffer + 8);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Short4 masked = value;
- current.w &= *Pointer<Short4>(constants + OFFSET(Constants,maskW4Q[rgbaWriteMask][0]));
- masked &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskW4Q[rgbaWriteMask][0]));
- current.w |= masked;
- }
-
- current.w &= *Pointer<Short4>(constants + OFFSET(Constants,maskQ3Q) + xMask * 8);
- value &= *Pointer<Short4>(constants + OFFSET(Constants,invMaskQ3Q) + xMask * 8);
- current.w |= value;
- *Pointer<Short4>(buffer + 8) = current.w;
- }
- }
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::blendFactor(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorActive)
- {
- switch(blendFactorActive)
- {
- case BLEND_ZERO:
- // Optimized
- break;
- case BLEND_ONE:
- // Optimized
- break;
- case BLEND_SOURCE:
- blendFactor.x = oC.x;
- blendFactor.y = oC.y;
- blendFactor.z = oC.z;
- break;
- case BLEND_INVSOURCE:
- blendFactor.x = Float4(1.0f) - oC.x;
- blendFactor.y = Float4(1.0f) - oC.y;
- blendFactor.z = Float4(1.0f) - oC.z;
- break;
- case BLEND_DEST:
- blendFactor.x = pixel.x;
- blendFactor.y = pixel.y;
- blendFactor.z = pixel.z;
- break;
- case BLEND_INVDEST:
- blendFactor.x = Float4(1.0f) - pixel.x;
- blendFactor.y = Float4(1.0f) - pixel.y;
- blendFactor.z = Float4(1.0f) - pixel.z;
- break;
- case BLEND_SOURCEALPHA:
- blendFactor.x = oC.w;
- blendFactor.y = oC.w;
- blendFactor.z = oC.w;
- break;
- case BLEND_INVSOURCEALPHA:
- blendFactor.x = Float4(1.0f) - oC.w;
- blendFactor.y = Float4(1.0f) - oC.w;
- blendFactor.z = Float4(1.0f) - oC.w;
- break;
- case BLEND_DESTALPHA:
- blendFactor.x = pixel.w;
- blendFactor.y = pixel.w;
- blendFactor.z = pixel.w;
- break;
- case BLEND_INVDESTALPHA:
- blendFactor.x = Float4(1.0f) - pixel.w;
- blendFactor.y = Float4(1.0f) - pixel.w;
- blendFactor.z = Float4(1.0f) - pixel.w;
- break;
- case BLEND_SRCALPHASAT:
- blendFactor.x = Float4(1.0f) - pixel.w;
- blendFactor.x = Min(blendFactor.x, oC.w);
- blendFactor.y = blendFactor.x;
- blendFactor.z = blendFactor.x;
- break;
- case BLEND_CONSTANT:
- blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData,factor.blendConstant4F[0]));
- blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData,factor.blendConstant4F[1]));
- blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData,factor.blendConstant4F[2]));
- break;
- case BLEND_INVCONSTANT:
- blendFactor.x = *Pointer<Float4>(data + OFFSET(DrawData,factor.invBlendConstant4F[0]));
- blendFactor.y = *Pointer<Float4>(data + OFFSET(DrawData,factor.invBlendConstant4F[1]));
- blendFactor.z = *Pointer<Float4>(data + OFFSET(DrawData,factor.invBlendConstant4F[2]));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::blendFactorAlpha(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorAlphaActive)
- {
- switch(blendFactorAlphaActive)
- {
- case BLEND_ZERO:
- // Optimized
- break;
- case BLEND_ONE:
- // Optimized
- break;
- case BLEND_SOURCE:
- blendFactor.w = oC.w;
- break;
- case BLEND_INVSOURCE:
- blendFactor.w = Float4(1.0f) - oC.w;
- break;
- case BLEND_DEST:
- blendFactor.w = pixel.w;
- break;
- case BLEND_INVDEST:
- blendFactor.w = Float4(1.0f) - pixel.w;
- break;
- case BLEND_SOURCEALPHA:
- blendFactor.w = oC.w;
- break;
- case BLEND_INVSOURCEALPHA:
- blendFactor.w = Float4(1.0f) - oC.w;
- break;
- case BLEND_DESTALPHA:
- blendFactor.w = pixel.w;
- break;
- case BLEND_INVDESTALPHA:
- blendFactor.w = Float4(1.0f) - pixel.w;
- break;
- case BLEND_SRCALPHASAT:
- blendFactor.w = Float4(1.0f);
- break;
- case BLEND_CONSTANT:
- blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData,factor.blendConstant4F[3]));
- break;
- case BLEND_INVCONSTANT:
- blendFactor.w = *Pointer<Float4>(data + OFFSET(DrawData,factor.invBlendConstant4F[3]));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x)
- {
- if(!state.alphaBlendActive)
- {
- return;
- }
-
- Pointer<Byte> buffer;
- Vector4f pixel;
-
- Vector4s color;
- Short4 c01;
- Short4 c23;
-
- Float4 one;
- if(Surface::isFloatFormat(state.targetFormat[index]))
- {
- one = Float4(1.0f);
- }
- else if(Surface::isNonNormalizedInteger(state.targetFormat[index]))
- {
- one = As<Float4>(Surface::isUnsignedComponent(state.targetFormat[index], 0) ? Int4(0xFFFFFFFF) : Int4(0x7FFFFFFF));
- }
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_R32F:
- buffer = cBuffer;
- // FIXME: movlps
- pixel.x.x = *Pointer<Float>(buffer + 4 * x + 0);
- pixel.x.y = *Pointer<Float>(buffer + 4 * x + 4);
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- // FIXME: movhps
- pixel.x.z = *Pointer<Float>(buffer + 4 * x + 0);
- pixel.x.w = *Pointer<Float>(buffer + 4 * x + 4);
- pixel.y = pixel.z = pixel.w = one;
- break;
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_G32R32F:
- buffer = cBuffer;
- pixel.x = *Pointer<Float4>(buffer + 8 * x, 16);
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- pixel.y = *Pointer<Float4>(buffer + 8 * x, 16);
- pixel.z = pixel.x;
- pixel.x = ShuffleLowHigh(pixel.x, pixel.y, 0x0202);
- pixel.z = ShuffleLowHigh(pixel.z, pixel.y, 0x1313);
- pixel.y = pixel.z;
- pixel.z = pixel.w = one;
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- buffer = cBuffer;
- pixel.x = *Pointer<Float4>(buffer + 16 * x, 16);
- pixel.y = *Pointer<Float4>(buffer + 16 * x + 16, 16);
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
- pixel.z = *Pointer<Float4>(buffer + 16 * x, 16);
- pixel.w = *Pointer<Float4>(buffer + 16 * x + 16, 16);
- transpose4x4(pixel.x, pixel.y, pixel.z, pixel.w);
- if(state.targetFormat[index] == FORMAT_X32B32G32R32F ||
- state.targetFormat[index] == FORMAT_X32B32G32R32F_UNSIGNED)
- {
- pixel.w = Float4(1.0f);
- }
- break;
- default:
- ASSERT(false);
- }
-
- if((postBlendSRGB && state.writeSRGB) || isSRGB(index))
- {
- sRGBtoLinear(pixel.x);
- sRGBtoLinear(pixel.y);
- sRGBtoLinear(pixel.z);
- }
-
- // Final Color = ObjectColor * SourceBlendFactor + PixelColor * DestinationBlendFactor
- Vector4f sourceFactor;
- Vector4f destFactor;
-
- blendFactor(sourceFactor, oC, pixel, state.sourceBlendFactor);
- blendFactor(destFactor, oC, pixel, state.destBlendFactor);
-
- if(state.sourceBlendFactor != BLEND_ONE && state.sourceBlendFactor != BLEND_ZERO)
- {
- oC.x *= sourceFactor.x;
- oC.y *= sourceFactor.y;
- oC.z *= sourceFactor.z;
- }
-
- if(state.destBlendFactor != BLEND_ONE && state.destBlendFactor != BLEND_ZERO)
- {
- pixel.x *= destFactor.x;
- pixel.y *= destFactor.y;
- pixel.z *= destFactor.z;
- }
-
- switch(state.blendOperation)
- {
- case BLENDOP_ADD:
- oC.x += pixel.x;
- oC.y += pixel.y;
- oC.z += pixel.z;
- break;
- case BLENDOP_SUB:
- oC.x -= pixel.x;
- oC.y -= pixel.y;
- oC.z -= pixel.z;
- break;
- case BLENDOP_INVSUB:
- oC.x = pixel.x - oC.x;
- oC.y = pixel.y - oC.y;
- oC.z = pixel.z - oC.z;
- break;
- case BLENDOP_MIN:
- oC.x = Min(oC.x, pixel.x);
- oC.y = Min(oC.y, pixel.y);
- oC.z = Min(oC.z, pixel.z);
- break;
- case BLENDOP_MAX:
- oC.x = Max(oC.x, pixel.x);
- oC.y = Max(oC.y, pixel.y);
- oC.z = Max(oC.z, pixel.z);
- break;
- case BLENDOP_SOURCE:
- // No operation
- break;
- case BLENDOP_DEST:
- oC.x = pixel.x;
- oC.y = pixel.y;
- oC.z = pixel.z;
- break;
- case BLENDOP_NULL:
- oC.x = Float4(0.0f);
- oC.y = Float4(0.0f);
- oC.z = Float4(0.0f);
- break;
- default:
- ASSERT(false);
- }
-
- blendFactorAlpha(sourceFactor, oC, pixel, state.sourceBlendFactorAlpha);
- blendFactorAlpha(destFactor, oC, pixel, state.destBlendFactorAlpha);
-
- if(state.sourceBlendFactorAlpha != BLEND_ONE && state.sourceBlendFactorAlpha != BLEND_ZERO)
- {
- oC.w *= sourceFactor.w;
- }
-
- if(state.destBlendFactorAlpha != BLEND_ONE && state.destBlendFactorAlpha != BLEND_ZERO)
- {
- pixel.w *= destFactor.w;
- }
-
- switch(state.blendOperationAlpha)
- {
- case BLENDOP_ADD:
- oC.w += pixel.w;
- break;
- case BLENDOP_SUB:
- oC.w -= pixel.w;
- break;
- case BLENDOP_INVSUB:
- pixel.w -= oC.w;
- oC.w = pixel.w;
- break;
- case BLENDOP_MIN:
- oC.w = Min(oC.w, pixel.w);
- break;
- case BLENDOP_MAX:
- oC.w = Max(oC.w, pixel.w);
- break;
- case BLENDOP_SOURCE:
- // No operation
- break;
- case BLENDOP_DEST:
- oC.w = pixel.w;
- break;
- case BLENDOP_NULL:
- oC.w = Float4(0.0f);
- break;
- default:
- ASSERT(false);
- }
- }
-
- void PixelRoutine::writeColor(int index, Pointer<Byte> &cBuffer, Int &x, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask)
- {
- switch(state.targetFormat[index])
- {
- case FORMAT_R32F:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- break;
- case FORMAT_G32R32F:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- oC.z = oC.x;
- oC.x = UnpackLow(oC.x, oC.y);
- oC.z = UnpackHigh(oC.z, oC.y);
- oC.y = oC.z;
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- transpose4x4(oC.x, oC.y, oC.z, oC.w);
- break;
- default:
- ASSERT(false);
- }
-
- int rgbaWriteMask = state.colorWriteActive(index);
-
- Int xMask; // Combination of all masks
-
- if(state.depthTestActive)
- {
- xMask = zMask;
- }
- else
- {
- xMask = cMask;
- }
-
- if(state.stencilActive)
- {
- xMask &= sMask;
- }
-
- Pointer<Byte> buffer;
- Float4 value;
-
- switch(state.targetFormat[index])
- {
- case FORMAT_R32F:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- if(rgbaWriteMask & 0x00000001)
- {
- buffer = cBuffer + 4 * x;
-
- // FIXME: movlps
- value.x = *Pointer<Float>(buffer + 0);
- value.y = *Pointer<Float>(buffer + 4);
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- // FIXME: movhps
- value.z = *Pointer<Float>(buffer + 0);
- value.w = *Pointer<Float>(buffer + 4);
-
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X) + xMask * 16, 16));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-
- // FIXME: movhps
- *Pointer<Float>(buffer + 0) = oC.x.z;
- *Pointer<Float>(buffer + 4) = oC.x.w;
-
- buffer -= *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- // FIXME: movlps
- *Pointer<Float>(buffer + 0) = oC.x.x;
- *Pointer<Float>(buffer + 4) = oC.x.y;
- }
- break;
- case FORMAT_R16I:
- case FORMAT_R16UI:
- if(rgbaWriteMask & 0x00000001)
- {
- buffer = cBuffer + 2 * x;
-
- UShort4 xyzw;
- xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 0));
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- xyzw = As<UShort4>(Insert(As<Int2>(xyzw), *Pointer<Int>(buffer), 1));
- value = As<Float4>(Int4(xyzw));
-
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants, maskD4X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants, invMaskD4X) + xMask * 16, 16));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
-
- if(state.targetFormat[index] == FORMAT_R16I)
- {
- Float component = oC.x.z;
- *Pointer<Short>(buffer + 0) = Short(As<Int>(component));
- component = oC.x.w;
- *Pointer<Short>(buffer + 2) = Short(As<Int>(component));
-
- buffer -= *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- component = oC.x.x;
- *Pointer<Short>(buffer + 0) = Short(As<Int>(component));
- component = oC.x.y;
- *Pointer<Short>(buffer + 2) = Short(As<Int>(component));
- }
- else // FORMAT_R16UI
- {
- Float component = oC.x.z;
- *Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
- component = oC.x.w;
- *Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
-
- buffer -= *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- component = oC.x.x;
- *Pointer<UShort>(buffer + 0) = UShort(As<Int>(component));
- component = oC.x.y;
- *Pointer<UShort>(buffer + 2) = UShort(As<Int>(component));
- }
- }
- break;
- case FORMAT_R8I:
- case FORMAT_R8UI:
- if(rgbaWriteMask & 0x00000001)
- {
- buffer = cBuffer + x;
-
- UInt xyzw, packedCol;
-
- xyzw = UInt(*Pointer<UShort>(buffer)) & 0xFFFF;
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- xyzw |= UInt(*Pointer<UShort>(buffer)) << 16;
-
- Short4 tmpCol = Short4(As<Int4>(oC.x));
- if(state.targetFormat[index] == FORMAT_R8I)
- {
- tmpCol = As<Short4>(PackSigned(tmpCol, tmpCol));
- }
- else
- {
- tmpCol = As<Short4>(PackUnsigned(tmpCol, tmpCol));
- }
- packedCol = Extract(As<Int2>(tmpCol), 0);
-
- packedCol = (packedCol & *Pointer<UInt>(constants + OFFSET(Constants, maskB4Q) + 8 * xMask)) |
- (xyzw & *Pointer<UInt>(constants + OFFSET(Constants, invMaskB4Q) + 8 * xMask));
-
- *Pointer<UShort>(buffer) = UShort(packedCol >> 16);
- buffer -= *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- *Pointer<UShort>(buffer) = UShort(packedCol);
- }
- break;
- case FORMAT_G32R32F:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- buffer = cBuffer + 8 * x;
-
- value = *Pointer<Float4>(buffer);
-
- if((rgbaWriteMask & 0x00000003) != 0x00000003)
- {
- Float4 masked = value;
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[~rgbaWriteMask & 0x3][0])));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
- }
-
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskQ01X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskQ01X) + xMask * 16, 16));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
- *Pointer<Float4>(buffer) = oC.x;
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- value = *Pointer<Float4>(buffer);
-
- if((rgbaWriteMask & 0x00000003) != 0x00000003)
- {
- Float4 masked;
-
- masked = value;
- oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[rgbaWriteMask & 0x3][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,maskD01X[~rgbaWriteMask & 0x3][0])));
- oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
- }
-
- oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants,maskQ23X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskQ23X) + xMask * 16, 16));
- oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
- *Pointer<Float4>(buffer) = oC.y;
- break;
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- if((rgbaWriteMask & 0x00000003) != 0x0)
- {
- buffer = cBuffer + 4 * x;
-
- UInt2 rgbaMask;
- UShort4 packedCol = UShort4(As<Int4>(oC.x));
- UShort4 value = *Pointer<UShort4>(buffer);
- UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
- if((rgbaWriteMask & 0x3) != 0x3)
- {
- Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask & 0x3][0]));
- rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
- mergedMask &= rgbaMask;
- }
- *Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- packedCol = UShort4(As<Int4>(oC.y));
- value = *Pointer<UShort4>(buffer);
- mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
- if((rgbaWriteMask & 0x3) != 0x3)
- {
- mergedMask &= rgbaMask;
- }
- *Pointer<UInt2>(buffer) = (As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(value) & ~mergedMask);
- }
- break;
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- if((rgbaWriteMask & 0x00000003) != 0x0)
- {
- buffer = cBuffer + 2 * x;
-
- Int2 xyzw, packedCol;
-
- xyzw = Insert(xyzw, *Pointer<Int>(buffer), 0);
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- xyzw = Insert(xyzw, *Pointer<Int>(buffer), 1);
-
- if(state.targetFormat[index] == FORMAT_G8R8I)
- {
- packedCol = As<Int2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
- }
- else
- {
- packedCol = As<Int2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
- }
-
- UInt2 mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q) + xMask * 8);
- if((rgbaWriteMask & 0x3) != 0x3)
- {
- Int tmpMask = *Pointer<Int>(constants + OFFSET(Constants, maskB4Q[5 * (rgbaWriteMask & 0x3)][0]));
- UInt2 rgbaMask = As<UInt2>(Int2(tmpMask, tmpMask));
- mergedMask &= rgbaMask;
- }
-
- packedCol = As<Int2>((As<UInt2>(packedCol) & mergedMask) | (As<UInt2>(xyzw) & ~mergedMask));
-
- *Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 1));
- buffer -= *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
- *Pointer<UInt>(buffer) = As<UInt>(Extract(packedCol, 0));
- }
- break;
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- buffer = cBuffer + 16 * x;
-
- {
- value = *Pointer<Float4>(buffer, 16);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Float4 masked = value;
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(masked));
- }
-
- oC.x = As<Float4>(As<Int4>(oC.x) & *Pointer<Int4>(constants + OFFSET(Constants,maskX0X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskX0X) + xMask * 16, 16));
- oC.x = As<Float4>(As<Int4>(oC.x) | As<Int4>(value));
- *Pointer<Float4>(buffer, 16) = oC.x;
- }
-
- {
- value = *Pointer<Float4>(buffer + 16, 16);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Float4 masked = value;
- oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
- oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(masked));
- }
-
- oC.y = As<Float4>(As<Int4>(oC.y) & *Pointer<Int4>(constants + OFFSET(Constants,maskX1X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskX1X) + xMask * 16, 16));
- oC.y = As<Float4>(As<Int4>(oC.y) | As<Int4>(value));
- *Pointer<Float4>(buffer + 16, 16) = oC.y;
- }
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData,colorPitchB[index]));
-
- {
- value = *Pointer<Float4>(buffer, 16);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Float4 masked = value;
- oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
- oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(masked));
- }
-
- oC.z = As<Float4>(As<Int4>(oC.z) & *Pointer<Int4>(constants + OFFSET(Constants,maskX2X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskX2X) + xMask * 16, 16));
- oC.z = As<Float4>(As<Int4>(oC.z) | As<Int4>(value));
- *Pointer<Float4>(buffer, 16) = oC.z;
- }
-
- {
- value = *Pointer<Float4>(buffer + 16, 16);
-
- if(rgbaWriteMask != 0x0000000F)
- {
- Float4 masked = value;
- oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants,maskD4X[rgbaWriteMask][0])));
- masked = As<Float4>(As<Int4>(masked) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskD4X[rgbaWriteMask][0])));
- oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(masked));
- }
-
- oC.w = As<Float4>(As<Int4>(oC.w) & *Pointer<Int4>(constants + OFFSET(Constants,maskX3X) + xMask * 16, 16));
- value = As<Float4>(As<Int4>(value) & *Pointer<Int4>(constants + OFFSET(Constants,invMaskX3X) + xMask * 16, 16));
- oC.w = As<Float4>(As<Int4>(oC.w) | As<Int4>(value));
- *Pointer<Float4>(buffer + 16, 16) = oC.w;
- }
- break;
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- if((rgbaWriteMask & 0x0000000F) != 0x0)
- {
- buffer = cBuffer + 8 * x;
-
- UInt4 rgbaMask;
- UShort8 value = *Pointer<UShort8>(buffer);
- UShort8 packedCol = UShort8(UShort4(As<Int4>(oC.x)), UShort4(As<Int4>(oC.y)));
- UInt4 mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ01X) + xMask * 16);
- if((rgbaWriteMask & 0xF) != 0xF)
- {
- UInt2 tmpMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskW4Q[rgbaWriteMask][0]));
- rgbaMask = UInt4(tmpMask, tmpMask);
- mergedMask &= rgbaMask;
- }
- *Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- value = *Pointer<UShort8>(buffer);
- packedCol = UShort8(UShort4(As<Int4>(oC.z)), UShort4(As<Int4>(oC.w)));
- mergedMask = *Pointer<UInt4>(constants + OFFSET(Constants, maskQ23X) + xMask * 16);
- if((rgbaWriteMask & 0xF) != 0xF)
- {
- mergedMask &= rgbaMask;
- }
- *Pointer<UInt4>(buffer) = (As<UInt4>(packedCol) & mergedMask) | (As<UInt4>(value) & ~mergedMask);
- }
- break;
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- if((rgbaWriteMask & 0x0000000F) != 0x0)
- {
- UInt2 value, packedCol, mergedMask;
-
- buffer = cBuffer + 4 * x;
-
- if(state.targetFormat[index] == FORMAT_A8B8G8R8I)
- {
- packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
- }
- else
- {
- packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.x)), Short4(As<Int4>(oC.y))));
- }
- value = *Pointer<UInt2>(buffer, 16);
- mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD01Q) + xMask * 8);
- if(rgbaWriteMask != 0xF)
- {
- mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
- }
- *Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
-
- buffer += *Pointer<Int>(data + OFFSET(DrawData, colorPitchB[index]));
-
- if(state.targetFormat[index] == FORMAT_A8B8G8R8I)
- {
- packedCol = As<UInt2>(PackSigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
- }
- else
- {
- packedCol = As<UInt2>(PackUnsigned(Short4(As<Int4>(oC.z)), Short4(As<Int4>(oC.w))));
- }
- value = *Pointer<UInt2>(buffer, 16);
- mergedMask = *Pointer<UInt2>(constants + OFFSET(Constants, maskD23Q) + xMask * 8);
- if(rgbaWriteMask != 0xF)
- {
- mergedMask &= *Pointer<UInt2>(constants + OFFSET(Constants, maskB4Q[rgbaWriteMask][0]));
- }
- *Pointer<UInt2>(buffer) = (packedCol & mergedMask) | (value & ~mergedMask);
- }
- break;
- default:
- ASSERT(false);
- }
- }
-
- UShort4 PixelRoutine::convertFixed16(Float4 &cf, bool saturate)
- {
- return UShort4(cf * Float4(0xFFFF), saturate);
- }
-
- void PixelRoutine::sRGBtoLinear16_12_16(Vector4s &c)
- {
- Pointer<Byte> LUT = constants + OFFSET(Constants,sRGBtoLinear12_16);
-
- c.x = As<UShort4>(c.x) >> 4;
- c.y = As<UShort4>(c.y) >> 4;
- c.z = As<UShort4>(c.z) >> 4;
-
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 2))), 2);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 3))), 3);
-
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 0))), 0);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 1))), 1);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 2))), 2);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 3))), 3);
-
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 0))), 0);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 1))), 1);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 2))), 2);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 3))), 3);
- }
-
- void PixelRoutine::linearToSRGB16_12_16(Vector4s &c)
- {
- c.x = As<UShort4>(c.x) >> 4;
- c.y = As<UShort4>(c.y) >> 4;
- c.z = As<UShort4>(c.z) >> 4;
-
- linearToSRGB12_16(c);
- }
-
- void PixelRoutine::linearToSRGB12_16(Vector4s &c)
- {
- Pointer<Byte> LUT = constants + OFFSET(Constants,linearToSRGB12_16);
-
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 0))), 0);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 1))), 1);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 2))), 2);
- c.x = Insert(c.x, *Pointer<Short>(LUT + 2 * Int(Extract(c.x, 3))), 3);
-
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 0))), 0);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 1))), 1);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 2))), 2);
- c.y = Insert(c.y, *Pointer<Short>(LUT + 2 * Int(Extract(c.y, 3))), 3);
-
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 0))), 0);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 1))), 1);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 2))), 2);
- c.z = Insert(c.z, *Pointer<Short>(LUT + 2 * Int(Extract(c.z, 3))), 3);
- }
-
- Float4 PixelRoutine::sRGBtoLinear(const Float4 &x) // Approximates x^2.2
- {
- Float4 linear = x * x;
- linear = linear * Float4(0.73f) + linear * x * Float4(0.27f);
-
- return Min(Max(linear, Float4(0.0f)), Float4(1.0f));
- }
-
- bool PixelRoutine::colorUsed()
- {
- return state.colorWriteMask || state.alphaTestActive() || state.shaderContainsKill;
- }
-}
diff --git a/src/Shader/PixelRoutine.hpp b/src/Shader/PixelRoutine.hpp
deleted file mode 100644
index ad78fc7c5..000000000
--- a/src/Shader/PixelRoutine.hpp
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_PixelRoutine_hpp
-#define sw_PixelRoutine_hpp
-
-#include "Renderer/QuadRasterizer.hpp"
-
-namespace sw
-{
- class PixelShader;
- class SamplerCore;
-
- class PixelRoutine : public sw::QuadRasterizer, public ShaderCore
- {
- public:
- PixelRoutine(const PixelProcessor::State &state, const PixelShader *shader);
-
- virtual ~PixelRoutine();
-
- protected:
- Float4 z[4]; // Multisampled z
- Float4 w; // Used as is
- Float4 rhw; // Reciprocal w
-
- RegisterArray<MAX_FRAGMENT_INPUTS> v; // Varying registers
-
- // Depth output
- Float4 oDepth;
-
- typedef Shader::SourceParameter Src;
- typedef Shader::DestinationParameter Dst;
-
- virtual void setBuiltins(Int &x, Int &y, Float4(&z)[4], Float4 &w) = 0;
- virtual void applyShader(Int cMask[4]) = 0;
- virtual Bool alphaTest(Int cMask[4]) = 0;
- virtual void rasterOperation(Float4 &fog, Pointer<Byte> cBuffer[4], Int &x, Int sMask[4], Int zMask[4], Int cMask[4]) = 0;
-
- virtual void quad(Pointer<Byte> cBuffer[4], Pointer<Byte> &zBuffer, Pointer<Byte> &sBuffer, Int cMask[4], Int &x);
-
- void alphaTest(Int &aMask, Short4 &alpha);
- void alphaToCoverage(Int cMask[4], Float4 &alpha);
- void fogBlend(Vector4f &c0, Float4 &fog);
- void pixelFog(Float4 &visibility);
-
- // Raster operations
- void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x);
- void logicOperation(int index, Pointer<Byte> &cBuffer, Vector4s &current, Int &x);
- void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4s &current, Int &sMask, Int &zMask, Int &cMask);
- void alphaBlend(int index, Pointer<Byte> &cBuffer, Vector4f &oC, Int &x);
- void writeColor(int index, Pointer<Byte> &cBuffer, Int &i, Vector4f &oC, Int &sMask, Int &zMask, Int &cMask);
-
- bool isSRGB(int index) const;
- UShort4 convertFixed16(Float4 &cf, bool saturate = true);
- void linearToSRGB12_16(Vector4s &c);
-
- private:
- Float4 interpolateCentroid(Float4 &x, Float4 &y, Float4 &rhw, Pointer<Byte> planeEquation, bool flat, bool perspective);
- void stencilTest(Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &cMask);
- void stencilTest(Byte8 &value, StencilCompareMode stencilCompareMode, bool CCW);
- void stencilOperation(Byte8 &newValue, Byte8 &bufferValue, StencilOperation stencilPassOperation, StencilOperation stencilZFailOperation, StencilOperation stencilFailOperation, bool CCW, Int &zMask, Int &sMask);
- void stencilOperation(Byte8 &output, Byte8 &bufferValue, StencilOperation operation, bool CCW);
- Bool depthTest(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &sMask, Int &zMask, Int &cMask);
-
- // Raster operations
- void blendFactor(Vector4s &blendFactor, const Vector4s &current, const Vector4s &pixel, BlendFactor blendFactorActive);
- void blendFactorAlpha(Vector4s &blendFactor, const Vector4s &current, const Vector4s &pixel, BlendFactor blendFactorAlphaActive);
- void readPixel(int index, Pointer<Byte> &cBuffer, Int &x, Vector4s &pixel);
- void blendFactor(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorActive);
- void blendFactorAlpha(Vector4f &blendFactor, const Vector4f &oC, const Vector4f &pixel, BlendFactor blendFactorAlphaActive);
- void writeStencil(Pointer<Byte> &sBuffer, int q, Int &x, Int &sMask, Int &zMask, Int &cMask);
- void writeDepth(Pointer<Byte> &zBuffer, int q, Int &x, Float4 &z, Int &zMask);
-
- void sRGBtoLinear16_12_16(Vector4s &c);
- void linearToSRGB16_12_16(Vector4s &c);
- Float4 sRGBtoLinear(const Float4 &x);
-
- bool colorUsed();
- };
-}
-
-#endif // sw_PixelRoutine_hpp
diff --git a/src/Shader/PixelShader.cpp b/src/Shader/PixelShader.cpp
deleted file mode 100644
index 1af50d82b..000000000
--- a/src/Shader/PixelShader.cpp
+++ /dev/null
@@ -1,747 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "PixelShader.hpp"
-
-#include "Common/Debug.hpp"
-
-#include <string.h>
-
-namespace sw
-{
- PixelShader::PixelShader(const PixelShader *ps) : Shader()
- {
- shaderModel = 0x0300;
- vPosDeclared = false;
- vFaceDeclared = false;
- centroid = false;
-
- if(ps) // Make a copy
- {
- for(size_t i = 0; i < ps->getLength(); i++)
- {
- append(new sw::Shader::Instruction(*ps->getInstruction(i)));
- }
-
- memcpy(input, ps->input, sizeof(input));
- vPosDeclared = ps->vPosDeclared;
- vFaceDeclared = ps->vFaceDeclared;
- usedSamplers = ps->usedSamplers;
-
- optimize();
- analyze();
- }
- }
-
- PixelShader::PixelShader(const unsigned long *token) : Shader()
- {
- parse(token);
-
- vPosDeclared = false;
- vFaceDeclared = false;
- centroid = false;
-
- optimize();
- analyze();
- }
-
- PixelShader::~PixelShader()
- {
- }
-
- int PixelShader::validate(const unsigned long *const token)
- {
- if(!token)
- {
- return 0;
- }
-
- unsigned short version = (unsigned short)(token[0] & 0x0000FFFF);
- // unsigned char minorVersion = (unsigned char)(token[0] & 0x000000FF);
- unsigned char majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8);
- ShaderType shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16);
-
- if(shaderType != SHADER_PIXEL || majorVersion > 3)
- {
- return 0;
- }
-
- int instructionCount = 1;
-
- for(int i = 0; token[i] != 0x0000FFFF; i++)
- {
- if((token[i] & 0x0000FFFF) == 0x0000FFFE) // Comment token
- {
- int length = (token[i] & 0x7FFF0000) >> 16;
-
- i += length;
- }
- else
- {
- Shader::Opcode opcode = (Shader::Opcode)(token[i] & 0x0000FFFF);
-
- switch(opcode)
- {
- case Shader::OPCODE_RESERVED0:
- case Shader::OPCODE_MOVA:
- return 0; // Unsupported operation
- default:
- instructionCount++;
- break;
- }
-
- i += size(token[i], version);
- }
- }
-
- return instructionCount;
- }
-
- bool PixelShader::depthOverride() const
- {
- return zOverride;
- }
-
- bool PixelShader::containsKill() const
- {
- return kill;
- }
-
- bool PixelShader::containsCentroid() const
- {
- return centroid;
- }
-
- bool PixelShader::usesDiffuse(int component) const
- {
- return input[0][component].active();
- }
-
- bool PixelShader::usesSpecular(int component) const
- {
- return input[1][component].active();
- }
-
- bool PixelShader::usesTexture(int coordinate, int component) const
- {
- return input[2 + coordinate][component].active();
- }
-
- void PixelShader::setInput(int inputIdx, int nbComponents, const sw::Shader::Semantic& semantic)
- {
- for(int i = 0; i < nbComponents; ++i)
- {
- input[inputIdx][i] = semantic;
- }
- }
-
- const sw::Shader::Semantic& PixelShader::getInput(int inputIdx, int component) const
- {
- return input[inputIdx][component];
- }
-
- void PixelShader::analyze()
- {
- analyzeZOverride();
- analyzeKill();
- analyzeInterpolants();
- analyzeDirtyConstants();
- analyzeDynamicBranching();
- analyzeSamplers();
- analyzeCallSites();
- analyzeIndirectAddressing();
- analyzeLimits();
- }
-
- void PixelShader::analyzeZOverride()
- {
- zOverride = false;
-
- for(const auto &inst : instruction)
- {
- if(inst->opcode == Shader::OPCODE_TEXM3X2DEPTH ||
- inst->opcode == Shader::OPCODE_TEXDEPTH ||
- inst->dst.type == Shader::PARAMETER_DEPTHOUT)
- {
- zOverride = true;
-
- break;
- }
- }
- }
-
- void PixelShader::analyzeKill()
- {
- kill = false;
-
- for(const auto &inst : instruction)
- {
- if(inst->opcode == Shader::OPCODE_TEXKILL ||
- inst->opcode == Shader::OPCODE_DISCARD)
- {
- kill = true;
-
- break;
- }
- }
- }
-
- void PixelShader::analyzeInterpolants()
- {
- if(shaderModel < 0x0300)
- {
- // Set default mapping; disable unused interpolants below
- input[0][0] = Semantic(Shader::USAGE_COLOR, 0);
- input[0][1] = Semantic(Shader::USAGE_COLOR, 0);
- input[0][2] = Semantic(Shader::USAGE_COLOR, 0);
- input[0][3] = Semantic(Shader::USAGE_COLOR, 0);
-
- input[1][0] = Semantic(Shader::USAGE_COLOR, 1);
- input[1][1] = Semantic(Shader::USAGE_COLOR, 1);
- input[1][2] = Semantic(Shader::USAGE_COLOR, 1);
- input[1][3] = Semantic(Shader::USAGE_COLOR, 1);
-
- for(int i = 0; i < 8; i++)
- {
- input[2 + i][0] = Semantic(Shader::USAGE_TEXCOORD, i);
- input[2 + i][1] = Semantic(Shader::USAGE_TEXCOORD, i);
- input[2 + i][2] = Semantic(Shader::USAGE_TEXCOORD, i);
- input[2 + i][3] = Semantic(Shader::USAGE_TEXCOORD, i);
- }
-
- Shader::SamplerType samplerType[16];
-
- for(int i = 0; i < 16; i++)
- {
- samplerType[i] = Shader::SAMPLER_UNKNOWN;
- }
-
- for(const auto &inst : instruction)
- {
- if(inst->dst.type == Shader::PARAMETER_SAMPLER)
- {
- int sampler = inst->dst.index;
-
- samplerType[sampler] = inst->samplerType;
- }
- }
-
- bool interpolant[MAX_FRAGMENT_INPUTS][4] = {{false}}; // Interpolants in use
-
- for(const auto &inst : instruction)
- {
- if(inst->dst.type == Shader::PARAMETER_TEXTURE)
- {
- int index = inst->dst.index + 2;
-
- switch(inst->opcode)
- {
- case Shader::OPCODE_TEX:
- case Shader::OPCODE_TEXBEM:
- case Shader::OPCODE_TEXBEML:
- case Shader::OPCODE_TEXCOORD:
- case Shader::OPCODE_TEXDP3:
- case Shader::OPCODE_TEXDP3TEX:
- case Shader::OPCODE_TEXM3X2DEPTH:
- case Shader::OPCODE_TEXM3X2PAD:
- case Shader::OPCODE_TEXM3X2TEX:
- case Shader::OPCODE_TEXM3X3:
- case Shader::OPCODE_TEXM3X3PAD:
- case Shader::OPCODE_TEXM3X3TEX:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- break;
- case Shader::OPCODE_TEXKILL:
- if(majorVersion < 2)
- {
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- }
- else
- {
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- interpolant[index][3] = true;
- }
- break;
- case Shader::OPCODE_TEXM3X3VSPEC:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- interpolant[index - 2][3] = true;
- interpolant[index - 1][3] = true;
- interpolant[index - 0][3] = true;
- break;
- case Shader::OPCODE_DCL:
- break; // Ignore
- default: // Arithmetic instruction
- if(shaderModel >= 0x0104)
- {
- ASSERT(false);
- }
- }
- }
-
- for(int argument = 0; argument < 4; argument++)
- {
- if(inst->src[argument].type == Shader::PARAMETER_INPUT ||
- inst->src[argument].type == Shader::PARAMETER_TEXTURE)
- {
- int index = inst->src[argument].index;
- int swizzle = inst->src[argument].swizzle;
- int mask = inst->dst.mask;
-
- if(inst->src[argument].type == Shader::PARAMETER_TEXTURE)
- {
- index += 2;
- }
-
- switch(inst->opcode)
- {
- case Shader::OPCODE_TEX:
- case Shader::OPCODE_TEXLDD:
- case Shader::OPCODE_TEXLDL:
- case Shader::OPCODE_TEXLOD:
- case Shader::OPCODE_TEXBIAS:
- case Shader::OPCODE_TEXOFFSET:
- case Shader::OPCODE_TEXOFFSETBIAS:
- case Shader::OPCODE_TEXLODOFFSET:
- case Shader::OPCODE_TEXELFETCH:
- case Shader::OPCODE_TEXELFETCHOFFSET:
- case Shader::OPCODE_TEXGRAD:
- case Shader::OPCODE_TEXGRADOFFSET:
- {
- int sampler = inst->src[1].index;
-
- switch(samplerType[sampler])
- {
- case Shader::SAMPLER_UNKNOWN:
- if(shaderModel == 0x0104)
- {
- if((inst->src[0].swizzle & 0x30) == 0x20) // .xyz
- {
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- }
- else // .xyw
- {
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][3] = true;
- }
- }
- else
- {
- ASSERT(false);
- }
- break;
- case Shader::SAMPLER_1D:
- interpolant[index][0] = true;
- break;
- case Shader::SAMPLER_2D:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- break;
- case Shader::SAMPLER_CUBE:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- break;
- case Shader::SAMPLER_VOLUME:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- break;
- default:
- ASSERT(false);
- }
-
- if(inst->bias)
- {
- interpolant[index][3] = true;
- }
-
- if(inst->project)
- {
- interpolant[index][3] = true;
- }
-
- if(shaderModel == 0x0104 && inst->opcode == Shader::OPCODE_TEX)
- {
- if(inst->src[0].modifier == Shader::MODIFIER_DZ)
- {
- interpolant[index][2] = true;
- }
-
- if(inst->src[0].modifier == Shader::MODIFIER_DW)
- {
- interpolant[index][3] = true;
- }
- }
- }
- break;
- case Shader::OPCODE_M3X2:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(argument == 1)
- {
- if(mask & 0x2)
- {
- interpolant[index + 1][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 1][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 1][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 1][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
- }
- break;
- case Shader::OPCODE_M3X3:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(argument == 1)
- {
- if(mask & 0x2)
- {
- interpolant[index + 1][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 1][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 1][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 1][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(mask & 0x4)
- {
- interpolant[index + 2][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 2][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 2][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 2][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
- }
- break;
- case Shader::OPCODE_M3X4:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(argument == 1)
- {
- if(mask & 0x2)
- {
- interpolant[index + 1][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 1][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 1][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 1][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(mask & 0x4)
- {
- interpolant[index + 2][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 2][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 2][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 2][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
-
- if(mask & 0x8)
- {
- interpolant[index + 3][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index + 3][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index + 3][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index + 3][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- }
- }
- break;
- case Shader::OPCODE_M4X3:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index][3] |= swizzleContainsComponent(swizzle, 3);
- }
-
- if(argument == 1)
- {
- if(mask & 0x2)
- {
- interpolant[index + 1][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index + 1][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index + 1][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index + 1][3] |= swizzleContainsComponent(swizzle, 3);
- }
-
- if(mask & 0x4)
- {
- interpolant[index + 2][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index + 2][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index + 2][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index + 2][3] |= swizzleContainsComponent(swizzle, 3);
- }
- }
- break;
- case Shader::OPCODE_M4X4:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index][3] |= swizzleContainsComponent(swizzle, 3);
- }
-
- if(argument == 1)
- {
- if(mask & 0x2)
- {
- interpolant[index + 1][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index + 1][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index + 1][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index + 1][3] |= swizzleContainsComponent(swizzle, 3);
- }
-
- if(mask & 0x4)
- {
- interpolant[index + 2][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index + 2][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index + 2][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index + 2][3] |= swizzleContainsComponent(swizzle, 3);
- }
-
- if(mask & 0x8)
- {
- interpolant[index + 3][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index + 3][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index + 3][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index + 3][3] |= swizzleContainsComponent(swizzle, 3);
- }
- }
- break;
- case Shader::OPCODE_CRS:
- if(mask & 0x1)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x6);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x6);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x6);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x6);
- }
-
- if(mask & 0x2)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x5);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x5);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x5);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x5);
- }
-
- if(mask & 0x4)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x3);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x3);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x3);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x3);
- }
- break;
- case Shader::OPCODE_DP2ADD:
- if(argument == 0 || argument == 1)
- {
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x3);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x3);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x3);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x3);
- }
- else // argument == 2
- {
- interpolant[index][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index][3] |= swizzleContainsComponent(swizzle, 3);
- }
- break;
- case Shader::OPCODE_DP3:
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7);
- break;
- case Shader::OPCODE_DP4:
- interpolant[index][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index][3] |= swizzleContainsComponent(swizzle, 3);
- break;
- case Shader::OPCODE_SINCOS:
- case Shader::OPCODE_EXP2X:
- case Shader::OPCODE_LOG2X:
- case Shader::OPCODE_POWX:
- case Shader::OPCODE_RCPX:
- case Shader::OPCODE_RSQX:
- interpolant[index][0] |= swizzleContainsComponent(swizzle, 0);
- interpolant[index][1] |= swizzleContainsComponent(swizzle, 1);
- interpolant[index][2] |= swizzleContainsComponent(swizzle, 2);
- interpolant[index][3] |= swizzleContainsComponent(swizzle, 3);
- break;
- case Shader::OPCODE_NRM3:
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, 0x7 | mask);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, 0x7 | mask);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, 0x7 | mask);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, 0x7 | mask);
- break;
- case Shader::OPCODE_MOV:
- case Shader::OPCODE_ADD:
- case Shader::OPCODE_SUB:
- case Shader::OPCODE_MUL:
- case Shader::OPCODE_MAD:
- case Shader::OPCODE_ABS:
- case Shader::OPCODE_CMP0:
- case Shader::OPCODE_CND:
- case Shader::OPCODE_FRC:
- case Shader::OPCODE_LRP:
- case Shader::OPCODE_MAX:
- case Shader::OPCODE_MIN:
- case Shader::OPCODE_CMP:
- case Shader::OPCODE_BREAKC:
- case Shader::OPCODE_DFDX:
- case Shader::OPCODE_DFDY:
- interpolant[index][0] |= swizzleContainsComponentMasked(swizzle, 0, mask);
- interpolant[index][1] |= swizzleContainsComponentMasked(swizzle, 1, mask);
- interpolant[index][2] |= swizzleContainsComponentMasked(swizzle, 2, mask);
- interpolant[index][3] |= swizzleContainsComponentMasked(swizzle, 3, mask);
- break;
- case Shader::OPCODE_TEXCOORD:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- interpolant[index][3] = true;
- break;
- case Shader::OPCODE_TEXDP3:
- case Shader::OPCODE_TEXDP3TEX:
- case Shader::OPCODE_TEXM3X2PAD:
- case Shader::OPCODE_TEXM3X3PAD:
- case Shader::OPCODE_TEXM3X2TEX:
- case Shader::OPCODE_TEXM3X3SPEC:
- case Shader::OPCODE_TEXM3X3VSPEC:
- case Shader::OPCODE_TEXBEM:
- case Shader::OPCODE_TEXBEML:
- case Shader::OPCODE_TEXM3X2DEPTH:
- case Shader::OPCODE_TEXM3X3:
- case Shader::OPCODE_TEXM3X3TEX:
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- break;
- case Shader::OPCODE_TEXREG2AR:
- case Shader::OPCODE_TEXREG2GB:
- case Shader::OPCODE_TEXREG2RGB:
- break;
- default:
- // ASSERT(false); // Refine component usage
- interpolant[index][0] = true;
- interpolant[index][1] = true;
- interpolant[index][2] = true;
- interpolant[index][3] = true;
- }
- }
- }
- }
-
- for(int index = 0; index < MAX_FRAGMENT_INPUTS; index++)
- {
- for(int component = 0; component < 4; component++)
- {
- if(!interpolant[index][component])
- {
- input[index][component] = Semantic();
- }
- }
- }
- }
- else // Shader Model 3.0 input declaration; v# indexable
- {
- for(const auto &inst : instruction)
- {
- if(inst->opcode == Shader::OPCODE_DCL)
- {
- if(inst->dst.type == Shader::PARAMETER_INPUT)
- {
- unsigned char usage = inst->usage;
- unsigned char index = inst->usageIndex;
- unsigned char mask = inst->dst.mask;
- unsigned char reg = inst->dst.index;
-
- if(mask & 0x01) input[reg][0] = Semantic(usage, index);
- if(mask & 0x02) input[reg][1] = Semantic(usage, index);
- if(mask & 0x04) input[reg][2] = Semantic(usage, index);
- if(mask & 0x08) input[reg][3] = Semantic(usage, index);
- }
- else if(inst->dst.type == Shader::PARAMETER_MISCTYPE)
- {
- unsigned char index = inst->dst.index;
-
- if(index == Shader::VPosIndex)
- {
- vPosDeclared = true;
- }
- else if(index == Shader::VFaceIndex)
- {
- vFaceDeclared = true;
- }
- else ASSERT(false);
- }
- }
- }
- }
-
- if(shaderModel >= 0x0200)
- {
- for(const auto &inst : instruction)
- {
- if(inst->opcode == Shader::OPCODE_DCL)
- {
- bool centroid = inst->dst.centroid;
- unsigned char reg = inst->dst.index;
-
- switch(inst->dst.type)
- {
- case Shader::PARAMETER_INPUT:
- input[reg][0].centroid = centroid;
- break;
- case Shader::PARAMETER_TEXTURE:
- input[2 + reg][0].centroid = centroid;
- break;
- default:
- break;
- }
-
- this->centroid = this->centroid || centroid;
- }
- }
- }
- }
-}
diff --git a/src/Shader/PixelShader.hpp b/src/Shader/PixelShader.hpp
deleted file mode 100644
index a06aaaacf..000000000
--- a/src/Shader/PixelShader.hpp
+++ /dev/null
@@ -1,63 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_PixelShader_hpp
-#define sw_PixelShader_hpp
-
-#include "Shader.hpp"
-#include "Main/Config.hpp"
-
-namespace sw
-{
- class PixelShader : public Shader
- {
- public:
- explicit PixelShader(const PixelShader *ps = 0);
- explicit PixelShader(const unsigned long *token);
-
- virtual ~PixelShader();
-
- static int validate(const unsigned long *const token); // Returns number of instructions if valid
- bool depthOverride() const;
- bool containsKill() const;
- bool containsCentroid() const;
- bool usesDiffuse(int component) const;
- bool usesSpecular(int component) const;
- bool usesTexture(int coordinate, int component) const;
-
- void setInput(int inputIdx, int nbComponents, const Semantic& semantic);
- const Semantic& getInput(int inputIdx, int component) const;
-
- void declareVPos() { vPosDeclared = true; }
- void declareVFace() { vFaceDeclared = true; }
- bool isVPosDeclared() const { return vPosDeclared; }
- bool isVFaceDeclared() const { return vFaceDeclared; }
-
- private:
- void analyze();
- void analyzeZOverride();
- void analyzeKill();
- void analyzeInterpolants();
-
- Semantic input[MAX_FRAGMENT_INPUTS][4];
-
- bool vPosDeclared;
- bool vFaceDeclared;
- bool zOverride;
- bool kill;
- bool centroid;
- };
-}
-
-#endif // sw_PixelShader_hpp
diff --git a/src/Shader/SamplerCore.cpp b/src/Shader/SamplerCore.cpp
deleted file mode 100644
index 810874b62..000000000
--- a/src/Shader/SamplerCore.cpp
+++ /dev/null
@@ -1,3034 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "SamplerCore.hpp"
-
-#include "Constants.hpp"
-#include "Common/Debug.hpp"
-
-namespace
-{
- void applySwizzle(sw::SwizzleType swizzle, sw::Short4& s, const sw::Vector4s& c)
- {
- switch(swizzle)
- {
- case sw::SWIZZLE_RED: s = c.x; break;
- case sw::SWIZZLE_GREEN: s = c.y; break;
- case sw::SWIZZLE_BLUE: s = c.z; break;
- case sw::SWIZZLE_ALPHA: s = c.w; break;
- case sw::SWIZZLE_ZERO: s = sw::Short4(0x0000); break;
- case sw::SWIZZLE_ONE: s = sw::Short4(0x1000); break;
- default: ASSERT(false);
- }
- }
-
- void applySwizzle(sw::SwizzleType swizzle, sw::Float4& f, const sw::Vector4f& c)
- {
- switch(swizzle)
- {
- case sw::SWIZZLE_RED: f = c.x; break;
- case sw::SWIZZLE_GREEN: f = c.y; break;
- case sw::SWIZZLE_BLUE: f = c.z; break;
- case sw::SWIZZLE_ALPHA: f = c.w; break;
- case sw::SWIZZLE_ZERO: f = sw::Float4(0.0f, 0.0f, 0.0f, 0.0f); break;
- case sw::SWIZZLE_ONE: f = sw::Float4(1.0f, 1.0f, 1.0f, 1.0f); break;
- default: ASSERT(false);
- }
- }
-}
-
-namespace sw
-{
- extern bool colorsDefaultToZero;
-
- SamplerCore::SamplerCore(Pointer<Byte> &constants, const Sampler::State &state) : constants(constants), state(state)
- {
- }
-
- Vector4s SamplerCore::sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy)
- {
- return sampleTexture(texture, u, v, w, q, q, dsx, dsy, (dsx), Implicit, true);
- }
-
- Vector4s SamplerCore::sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function, bool fixed12)
- {
- Vector4s c;
-
- #if PERF_PROFILE
- AddAtomic(Pointer<Long>(&profiler.texOperations), 4);
-
- if(state.compressedFormat)
- {
- AddAtomic(Pointer<Long>(&profiler.compressedTex), 4);
- }
- #endif
-
- if(state.textureType == TEXTURE_NULL)
- {
- c.x = Short4(0x0000);
- c.y = Short4(0x0000);
- c.z = Short4(0x0000);
-
- if(fixed12) // FIXME: Convert to fixed12 at higher level, when required
- {
- c.w = Short4(0x1000);
- }
- else
- {
- c.w = Short4(0xFFFFu); // FIXME
- }
- }
- else
- {
- Float4 uuuu = u;
- Float4 vvvv = v;
- Float4 wwww = w;
- Float4 qqqq = q;
-
- Int face[4];
- Float lod;
- Float anisotropy;
- Float4 uDelta;
- Float4 vDelta;
-
- if(state.textureType != TEXTURE_3D)
- {
- if(state.textureType != TEXTURE_CUBE)
- {
- computeLod(texture, lod, anisotropy, uDelta, vDelta, uuuu, vvvv, bias.x, dsx, dsy, function);
- }
- else
- {
- Float4 M;
- cubeFace(face, uuuu, vvvv, u, v, w, M);
- computeLodCube(texture, lod, u, v, w, bias.x, dsx, dsy, M, function);
- }
- }
- else
- {
- computeLod3D(texture, lod, uuuu, vvvv, wwww, bias.x, dsx, dsy, function);
- }
-
- if(!hasFloatTexture())
- {
- c = sampleFilter(texture, uuuu, vvvv, wwww, offset, lod, anisotropy, uDelta, vDelta, face, function);
- }
- else
- {
- Vector4f cf = sampleFloatFilter(texture, uuuu, vvvv, wwww, qqqq, offset, lod, anisotropy, uDelta, vDelta, face, function);
-
- convertFixed12(c, cf);
- }
-
- if(fixed12)
- {
- if(!hasFloatTexture())
- {
- if(state.textureFormat == FORMAT_R5G6B5)
- {
- c.x = MulHigh(As<UShort4>(c.x), UShort4(0x10000000 / 0xF800));
- c.y = MulHigh(As<UShort4>(c.y), UShort4(0x10000000 / 0xFC00));
- c.z = MulHigh(As<UShort4>(c.z), UShort4(0x10000000 / 0xF800));
- }
- else
- {
- for(int component = 0; component < textureComponentCount(); component++)
- {
- if(hasUnsignedTextureComponent(component))
- {
- c[component] = As<UShort4>(c[component]) >> 4;
- }
- else
- {
- c[component] = c[component] >> 3;
- }
- }
- }
- }
-
- if(state.textureFilter != FILTER_GATHER)
- {
- int componentCount = textureComponentCount();
- short defaultColorValue = colorsDefaultToZero ? 0x0000 : 0x1000;
-
- switch(state.textureFormat)
- {
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8:
- case FORMAT_R5G6B5:
- case FORMAT_G8R8:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- if(componentCount < 2) c.y = Short4(defaultColorValue);
- if(componentCount < 3) c.z = Short4(defaultColorValue);
- if(componentCount < 4) c.w = Short4(0x1000);
- break;
- case FORMAT_A8:
- c.w = c.x;
- c.x = Short4(0x0000);
- c.y = Short4(0x0000);
- c.z = Short4(0x0000);
- break;
- case FORMAT_L8:
- case FORMAT_L16:
- c.y = c.x;
- c.z = c.x;
- c.w = Short4(0x1000);
- break;
- case FORMAT_A8L8:
- c.w = c.y;
- c.y = c.x;
- c.z = c.x;
- break;
- case FORMAT_R32F:
- c.y = Short4(defaultColorValue);
- case FORMAT_G32R32F:
- c.z = Short4(defaultColorValue);
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- c.w = Short4(0x1000);
- case FORMAT_A32B32G32R32F:
- break;
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- c.y = c.x;
- c.z = c.x;
- c.w = c.x;
- break;
- default:
- ASSERT(false);
- }
- }
-
- if((state.swizzleR != SWIZZLE_RED) ||
- (state.swizzleG != SWIZZLE_GREEN) ||
- (state.swizzleB != SWIZZLE_BLUE) ||
- (state.swizzleA != SWIZZLE_ALPHA))
- {
- const Vector4s col(c);
- applySwizzle(state.swizzleR, c.x, col);
- applySwizzle(state.swizzleG, c.y, col);
- applySwizzle(state.swizzleB, c.z, col);
- applySwizzle(state.swizzleA, c.w, col);
- }
- }
- }
-
- return c;
- }
-
- Vector4f SamplerCore::sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function)
- {
- Vector4f c;
-
- #if PERF_PROFILE
- AddAtomic(Pointer<Long>(&profiler.texOperations), 4);
-
- if(state.compressedFormat)
- {
- AddAtomic(Pointer<Long>(&profiler.compressedTex), 4);
- }
- #endif
-
- if(state.textureType == TEXTURE_NULL)
- {
- c.x = Float4(0.0f);
- c.y = Float4(0.0f);
- c.z = Float4(0.0f);
- c.w = Float4(1.0f);
- }
- else
- {
- // FIXME: YUV is not supported by the floating point path
- bool forceFloatFiltering = state.highPrecisionFiltering && !hasYuvFormat() && (state.textureFilter != FILTER_POINT);
- bool seamlessCube = (state.addressingModeU == ADDRESSING_SEAMLESS);
- bool rectangleTexture = (state.textureType == TEXTURE_RECTANGLE);
- if(hasFloatTexture() || hasUnnormalizedIntegerTexture() || forceFloatFiltering || seamlessCube || rectangleTexture) // FIXME: Mostly identical to integer sampling
- {
- Float4 uuuu = u;
- Float4 vvvv = v;
- Float4 wwww = w;
- Float4 qqqq = q;
-
- Int face[4];
- Float lod;
- Float anisotropy;
- Float4 uDelta;
- Float4 vDelta;
-
- if(state.textureType != TEXTURE_3D)
- {
- if(state.textureType != TEXTURE_CUBE)
- {
- computeLod(texture, lod, anisotropy, uDelta, vDelta, uuuu, vvvv, bias.x, dsx, dsy, function);
- }
- else
- {
- Float4 M;
- cubeFace(face, uuuu, vvvv, u, v, w, M);
- computeLodCube(texture, lod, u, v, w, bias.x, dsx, dsy, M, function);
- }
- }
- else
- {
- computeLod3D(texture, lod, uuuu, vvvv, wwww, bias.x, dsx, dsy, function);
- }
-
- c = sampleFloatFilter(texture, uuuu, vvvv, wwww, qqqq, offset, lod, anisotropy, uDelta, vDelta, face, function);
-
- if(!hasFloatTexture() && !hasUnnormalizedIntegerTexture())
- {
- if(has16bitTextureFormat())
- {
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5:
- c.x *= Float4(1.0f / 0xF800);
- c.y *= Float4(1.0f / 0xFC00);
- c.z *= Float4(1.0f / 0xF800);
- break;
- default:
- ASSERT(false);
- }
- }
- else
- {
- for(int component = 0; component < textureComponentCount(); component++)
- {
- c[component] *= Float4(hasUnsignedTextureComponent(component) ? 1.0f / 0xFFFF : 1.0f / 0x7FFF);
- }
- }
- }
- }
- else
- {
- Vector4s cs = sampleTexture(texture, u, v, w, q, bias, dsx, dsy, offset, function, false);
-
- if(state.textureFormat == FORMAT_R5G6B5)
- {
- c.x = Float4(As<UShort4>(cs.x)) * Float4(1.0f / 0xF800);
- c.y = Float4(As<UShort4>(cs.y)) * Float4(1.0f / 0xFC00);
- c.z = Float4(As<UShort4>(cs.z)) * Float4(1.0f / 0xF800);
- }
- else
- {
- for(int component = 0; component < textureComponentCount(); component++)
- {
- if(hasUnsignedTextureComponent(component))
- {
- convertUnsigned16(c[component], cs[component]);
- }
- else
- {
- convertSigned15(c[component], cs[component]);
- }
- }
- }
- }
-
- int componentCount = textureComponentCount();
- float defaultColorValue = colorsDefaultToZero ? 0.0f : 1.0f;
-
- if(state.textureFilter != FILTER_GATHER)
- {
- switch(state.textureFormat)
- {
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- c.y = As<Float4>(UInt4(0));
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- c.z = As<Float4>(UInt4(0));
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- c.w = As<Float4>(UInt4(1));
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- break;
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8:
- case FORMAT_R5G6B5:
- case FORMAT_G8R8:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- if(componentCount < 2) c.y = Float4(defaultColorValue);
- if(componentCount < 3) c.z = Float4(defaultColorValue);
- if(componentCount < 4) c.w = Float4(1.0f);
- break;
- case FORMAT_A8:
- c.w = c.x;
- c.x = Float4(0.0f);
- c.y = Float4(0.0f);
- c.z = Float4(0.0f);
- break;
- case FORMAT_L8:
- case FORMAT_L16:
- c.y = c.x;
- c.z = c.x;
- c.w = Float4(1.0f);
- break;
- case FORMAT_A8L8:
- c.w = c.y;
- c.y = c.x;
- c.z = c.x;
- break;
- case FORMAT_R32F:
- c.y = Float4(defaultColorValue);
- case FORMAT_G32R32F:
- c.z = Float4(defaultColorValue);
- case FORMAT_X32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- c.w = Float4(1.0f);
- case FORMAT_A32B32G32R32F:
- break;
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- c.y = Float4(0.0f);
- c.z = Float4(0.0f);
- c.w = Float4(1.0f);
- break;
- default:
- ASSERT(false);
- }
- }
-
- if((state.swizzleR != SWIZZLE_RED) ||
- (state.swizzleG != SWIZZLE_GREEN) ||
- (state.swizzleB != SWIZZLE_BLUE) ||
- (state.swizzleA != SWIZZLE_ALPHA))
- {
- const Vector4f col(c);
- applySwizzle(state.swizzleR, c.x, col);
- applySwizzle(state.swizzleG, c.y, col);
- applySwizzle(state.swizzleB, c.z, col);
- applySwizzle(state.swizzleA, c.w, col);
- }
- }
-
- return c;
- }
-
- Vector4f SamplerCore::textureSize(Pointer<Byte> &texture, Float4 &lod)
- {
- Vector4f size;
-
- for(int i = 0; i < 4; ++i)
- {
- Int baseLevel = *Pointer<Int>(texture + OFFSET(Texture, baseLevel));
- Int index = Min(As<UInt>(As<Int>(Extract(lod, i)) + baseLevel), MIPMAP_LEVELS - 1);
- Pointer<Byte> mipmap = texture + OFFSET(Texture, mipmap) + index * sizeof(Mipmap);
- size.x = Insert(size.x, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, width)))), i);
- size.y = Insert(size.y, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, height)))), i);
- size.z = Insert(size.z, As<Float>(Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, depth)))), i);
- }
-
- return size;
- }
-
- void SamplerCore::border(Short4 &mask, Float4 &coordinates)
- {
- Int4 border = As<Int4>(CmpLT(Abs(coordinates - Float4(0.5f)), Float4(0.5f)));
- mask = As<Short4>(Int2(As<Int4>(PackSigned(border, border))));
- }
-
- void SamplerCore::border(Int4 &mask, Float4 &coordinates)
- {
- mask = As<Int4>(CmpLT(Abs(coordinates - Float4(0.5f)), Float4(0.5f)));
- }
-
- Short4 SamplerCore::offsetSample(Short4 &uvw, Pointer<Byte> &mipmap, int halfOffset, bool wrap, int count, Float &lod)
- {
- Short4 offset = *Pointer<Short4>(mipmap + halfOffset);
-
- if(state.textureFilter == FILTER_MIN_LINEAR_MAG_POINT)
- {
- offset &= Short4(CmpNLE(Float4(lod), Float4(0.0f)));
- }
- else if(state.textureFilter == FILTER_MIN_POINT_MAG_LINEAR)
- {
- offset &= Short4(CmpLE(Float4(lod), Float4(0.0f)));
- }
-
- if(wrap)
- {
- switch(count)
- {
- case -1: return uvw - offset;
- case 0: return uvw;
- case +1: return uvw + offset;
- case 2: return uvw + offset + offset;
- }
- }
- else // Clamp or mirror
- {
- switch(count)
- {
- case -1: return SubSat(As<UShort4>(uvw), As<UShort4>(offset));
- case 0: return uvw;
- case +1: return AddSat(As<UShort4>(uvw), As<UShort4>(offset));
- case 2: return AddSat(AddSat(As<UShort4>(uvw), As<UShort4>(offset)), As<UShort4>(offset));
- }
- }
-
- return uvw;
- }
-
- Vector4s SamplerCore::sampleFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function)
- {
- Vector4s c = sampleAniso(texture, u, v, w, offset, lod, anisotropy, uDelta, vDelta, face, false, function);
-
- if(function == Fetch)
- {
- return c;
- }
-
- if(state.mipmapFilter == MIPMAP_LINEAR)
- {
- Vector4s cc = sampleAniso(texture, u, v, w, offset, lod, anisotropy, uDelta, vDelta, face, true, function);
-
- lod *= Float(1 << 16);
-
- UShort4 utri = UShort4(Float4(lod)); // FIXME: Optimize
- Short4 stri = utri >> 1; // FIXME: Optimize
-
- if(hasUnsignedTextureComponent(0)) cc.x = MulHigh(As<UShort4>(cc.x), utri); else cc.x = MulHigh(cc.x, stri);
- if(hasUnsignedTextureComponent(1)) cc.y = MulHigh(As<UShort4>(cc.y), utri); else cc.y = MulHigh(cc.y, stri);
- if(hasUnsignedTextureComponent(2)) cc.z = MulHigh(As<UShort4>(cc.z), utri); else cc.z = MulHigh(cc.z, stri);
- if(hasUnsignedTextureComponent(3)) cc.w = MulHigh(As<UShort4>(cc.w), utri); else cc.w = MulHigh(cc.w, stri);
-
- utri = ~utri;
- stri = Short4(0x7FFF) - stri;
-
- if(hasUnsignedTextureComponent(0)) c.x = MulHigh(As<UShort4>(c.x), utri); else c.x = MulHigh(c.x, stri);
- if(hasUnsignedTextureComponent(1)) c.y = MulHigh(As<UShort4>(c.y), utri); else c.y = MulHigh(c.y, stri);
- if(hasUnsignedTextureComponent(2)) c.z = MulHigh(As<UShort4>(c.z), utri); else c.z = MulHigh(c.z, stri);
- if(hasUnsignedTextureComponent(3)) c.w = MulHigh(As<UShort4>(c.w), utri); else c.w = MulHigh(c.w, stri);
-
- c.x += cc.x;
- c.y += cc.y;
- c.z += cc.z;
- c.w += cc.w;
-
- if(!hasUnsignedTextureComponent(0)) c.x += c.x;
- if(!hasUnsignedTextureComponent(1)) c.y += c.y;
- if(!hasUnsignedTextureComponent(2)) c.z += c.z;
- if(!hasUnsignedTextureComponent(3)) c.w += c.w;
- }
-
- Short4 borderMask;
-
- if(state.addressingModeU == ADDRESSING_BORDER)
- {
- Short4 u0;
-
- border(u0, u);
-
- borderMask = u0;
- }
-
- if(state.addressingModeV == ADDRESSING_BORDER)
- {
- Short4 v0;
-
- border(v0, v);
-
- if(state.addressingModeU == ADDRESSING_BORDER)
- {
- borderMask &= v0;
- }
- else
- {
- borderMask = v0;
- }
- }
-
- if(state.addressingModeW == ADDRESSING_BORDER && state.textureType == TEXTURE_3D)
- {
- Short4 s0;
-
- border(s0, w);
-
- if(state.addressingModeU == ADDRESSING_BORDER ||
- state.addressingModeV == ADDRESSING_BORDER)
- {
- borderMask &= s0;
- }
- else
- {
- borderMask = s0;
- }
- }
-
- if(state.addressingModeU == ADDRESSING_BORDER ||
- state.addressingModeV == ADDRESSING_BORDER ||
- (state.addressingModeW == ADDRESSING_BORDER && state.textureType == TEXTURE_3D))
- {
- Short4 b;
-
- c.x = (borderMask & c.x) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[0])) >> (hasUnsignedTextureComponent(0) ? 0 : 1)));
- c.y = (borderMask & c.y) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[1])) >> (hasUnsignedTextureComponent(1) ? 0 : 1)));
- c.z = (borderMask & c.z) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[2])) >> (hasUnsignedTextureComponent(2) ? 0 : 1)));
- c.w = (borderMask & c.w) | (~borderMask & (*Pointer<Short4>(texture + OFFSET(Texture,borderColor4[3])) >> (hasUnsignedTextureComponent(3) ? 0 : 1)));
- }
-
- return c;
- }
-
- Vector4s SamplerCore::sampleAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function)
- {
- Vector4s c;
-
- if(state.textureFilter != FILTER_ANISOTROPIC || function == Lod || function == Fetch)
- {
- c = sampleQuad(texture, u, v, w, offset, lod, face, secondLOD, function);
- }
- else
- {
- Int a = RoundInt(anisotropy);
-
- Vector4s cSum;
-
- cSum.x = Short4(0);
- cSum.y = Short4(0);
- cSum.z = Short4(0);
- cSum.w = Short4(0);
-
- Float4 A = *Pointer<Float4>(constants + OFFSET(Constants,uvWeight) + 16 * a);
- Float4 B = *Pointer<Float4>(constants + OFFSET(Constants,uvStart) + 16 * a);
- UShort4 cw = *Pointer<UShort4>(constants + OFFSET(Constants,cWeight) + 8 * a);
- Short4 sw = Short4(cw >> 1);
-
- Float4 du = uDelta;
- Float4 dv = vDelta;
-
- Float4 u0 = u + B * du;
- Float4 v0 = v + B * dv;
-
- du *= A;
- dv *= A;
-
- Int i = 0;
-
- Do
- {
- c = sampleQuad(texture, u0, v0, w, offset, lod, face, secondLOD, function);
-
- u0 += du;
- v0 += dv;
-
- if(hasUnsignedTextureComponent(0)) cSum.x += As<Short4>(MulHigh(As<UShort4>(c.x), cw)); else cSum.x += MulHigh(c.x, sw);
- if(hasUnsignedTextureComponent(1)) cSum.y += As<Short4>(MulHigh(As<UShort4>(c.y), cw)); else cSum.y += MulHigh(c.y, sw);
- if(hasUnsignedTextureComponent(2)) cSum.z += As<Short4>(MulHigh(As<UShort4>(c.z), cw)); else cSum.z += MulHigh(c.z, sw);
- if(hasUnsignedTextureComponent(3)) cSum.w += As<Short4>(MulHigh(As<UShort4>(c.w), cw)); else cSum.w += MulHigh(c.w, sw);
-
- i++;
- }
- Until(i >= a);
-
- if(hasUnsignedTextureComponent(0)) c.x = cSum.x; else c.x = AddSat(cSum.x, cSum.x);
- if(hasUnsignedTextureComponent(1)) c.y = cSum.y; else c.y = AddSat(cSum.y, cSum.y);
- if(hasUnsignedTextureComponent(2)) c.z = cSum.z; else c.z = AddSat(cSum.z, cSum.z);
- if(hasUnsignedTextureComponent(3)) c.w = cSum.w; else c.w = AddSat(cSum.w, cSum.w);
- }
-
- return c;
- }
-
- Vector4s SamplerCore::sampleQuad(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
- {
- if(state.textureType != TEXTURE_3D)
- {
- return sampleQuad2D(texture, u, v, w, offset, lod, face, secondLOD, function);
- }
- else
- {
- return sample3D(texture, u, v, w, offset, lod, secondLOD, function);
- }
- }
-
- Vector4s SamplerCore::sampleQuad2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
- {
- Vector4s c;
-
- int componentCount = textureComponentCount();
- bool gather = state.textureFilter == FILTER_GATHER;
-
- Pointer<Byte> mipmap;
- Pointer<Byte> buffer[4];
-
- selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
-
- bool texelFetch = (function == Fetch);
-
- Short4 uuuu = texelFetch ? Short4(As<Int4>(u)) : address(u, state.addressingModeU, mipmap);
- Short4 vvvv = texelFetch ? Short4(As<Int4>(v)) : address(v, state.addressingModeV, mipmap);
- Short4 wwww = texelFetch ? Short4(As<Int4>(w)) : address(w, state.addressingModeW, mipmap);
-
- if(state.textureFilter == FILTER_POINT || texelFetch)
- {
- c = sampleTexel(uuuu, vvvv, wwww, offset, mipmap, buffer, function);
- }
- else
- {
- Short4 uuuu0 = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, gather ? 0 : -1, lod);
- Short4 vvvv0 = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, gather ? 0 : -1, lod);
- Short4 uuuu1 = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, gather ? 2 : +1, lod);
- Short4 vvvv1 = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, gather ? 2 : +1, lod);
-
- Vector4s c0 = sampleTexel(uuuu0, vvvv0, wwww, offset, mipmap, buffer, function);
- Vector4s c1 = sampleTexel(uuuu1, vvvv0, wwww, offset, mipmap, buffer, function);
- Vector4s c2 = sampleTexel(uuuu0, vvvv1, wwww, offset, mipmap, buffer, function);
- Vector4s c3 = sampleTexel(uuuu1, vvvv1, wwww, offset, mipmap, buffer, function);
-
- if(!gather) // Blend
- {
- // Fractions
- UShort4 f0u = As<UShort4>(uuuu0) * *Pointer<UShort4>(mipmap + OFFSET(Mipmap,width));
- UShort4 f0v = As<UShort4>(vvvv0) * *Pointer<UShort4>(mipmap + OFFSET(Mipmap,height));
-
- UShort4 f1u = ~f0u;
- UShort4 f1v = ~f0v;
-
- UShort4 f0u0v = MulHigh(f0u, f0v);
- UShort4 f1u0v = MulHigh(f1u, f0v);
- UShort4 f0u1v = MulHigh(f0u, f1v);
- UShort4 f1u1v = MulHigh(f1u, f1v);
-
- // Signed fractions
- Short4 f1u1vs;
- Short4 f0u1vs;
- Short4 f1u0vs;
- Short4 f0u0vs;
-
- if(!hasUnsignedTextureComponent(0) || !hasUnsignedTextureComponent(1) || !hasUnsignedTextureComponent(2) || !hasUnsignedTextureComponent(3))
- {
- f1u1vs = f1u1v >> 1;
- f0u1vs = f0u1v >> 1;
- f1u0vs = f1u0v >> 1;
- f0u0vs = f0u0v >> 1;
- }
-
- // Bilinear interpolation
- if(componentCount >= 1)
- {
- if(has16bitTextureComponents() && hasUnsignedTextureComponent(0))
- {
- c0.x = As<UShort4>(c0.x) - MulHigh(As<UShort4>(c0.x), f0u) + MulHigh(As<UShort4>(c1.x), f0u);
- c2.x = As<UShort4>(c2.x) - MulHigh(As<UShort4>(c2.x), f0u) + MulHigh(As<UShort4>(c3.x), f0u);
- c.x = As<UShort4>(c0.x) - MulHigh(As<UShort4>(c0.x), f0v) + MulHigh(As<UShort4>(c2.x), f0v);
- }
- else
- {
- if(hasUnsignedTextureComponent(0))
- {
- c0.x = MulHigh(As<UShort4>(c0.x), f1u1v);
- c1.x = MulHigh(As<UShort4>(c1.x), f0u1v);
- c2.x = MulHigh(As<UShort4>(c2.x), f1u0v);
- c3.x = MulHigh(As<UShort4>(c3.x), f0u0v);
- }
- else
- {
- c0.x = MulHigh(c0.x, f1u1vs);
- c1.x = MulHigh(c1.x, f0u1vs);
- c2.x = MulHigh(c2.x, f1u0vs);
- c3.x = MulHigh(c3.x, f0u0vs);
- }
-
- c.x = (c0.x + c1.x) + (c2.x + c3.x);
- if(!hasUnsignedTextureComponent(0)) c.x = AddSat(c.x, c.x); // Correct for signed fractions
- }
- }
-
- if(componentCount >= 2)
- {
- if(has16bitTextureComponents() && hasUnsignedTextureComponent(1))
- {
- c0.y = As<UShort4>(c0.y) - MulHigh(As<UShort4>(c0.y), f0u) + MulHigh(As<UShort4>(c1.y), f0u);
- c2.y = As<UShort4>(c2.y) - MulHigh(As<UShort4>(c2.y), f0u) + MulHigh(As<UShort4>(c3.y), f0u);
- c.y = As<UShort4>(c0.y) - MulHigh(As<UShort4>(c0.y), f0v) + MulHigh(As<UShort4>(c2.y), f0v);
- }
- else
- {
- if(hasUnsignedTextureComponent(1))
- {
- c0.y = MulHigh(As<UShort4>(c0.y), f1u1v);
- c1.y = MulHigh(As<UShort4>(c1.y), f0u1v);
- c2.y = MulHigh(As<UShort4>(c2.y), f1u0v);
- c3.y = MulHigh(As<UShort4>(c3.y), f0u0v);
- }
- else
- {
- c0.y = MulHigh(c0.y, f1u1vs);
- c1.y = MulHigh(c1.y, f0u1vs);
- c2.y = MulHigh(c2.y, f1u0vs);
- c3.y = MulHigh(c3.y, f0u0vs);
- }
-
- c.y = (c0.y + c1.y) + (c2.y + c3.y);
- if(!hasUnsignedTextureComponent(1)) c.y = AddSat(c.y, c.y); // Correct for signed fractions
- }
- }
-
- if(componentCount >= 3)
- {
- if(has16bitTextureComponents() && hasUnsignedTextureComponent(2))
- {
- c0.z = As<UShort4>(c0.z) - MulHigh(As<UShort4>(c0.z), f0u) + MulHigh(As<UShort4>(c1.z), f0u);
- c2.z = As<UShort4>(c2.z) - MulHigh(As<UShort4>(c2.z), f0u) + MulHigh(As<UShort4>(c3.z), f0u);
- c.z = As<UShort4>(c0.z) - MulHigh(As<UShort4>(c0.z), f0v) + MulHigh(As<UShort4>(c2.z), f0v);
- }
- else
- {
- if(hasUnsignedTextureComponent(2))
- {
- c0.z = MulHigh(As<UShort4>(c0.z), f1u1v);
- c1.z = MulHigh(As<UShort4>(c1.z), f0u1v);
- c2.z = MulHigh(As<UShort4>(c2.z), f1u0v);
- c3.z = MulHigh(As<UShort4>(c3.z), f0u0v);
- }
- else
- {
- c0.z = MulHigh(c0.z, f1u1vs);
- c1.z = MulHigh(c1.z, f0u1vs);
- c2.z = MulHigh(c2.z, f1u0vs);
- c3.z = MulHigh(c3.z, f0u0vs);
- }
-
- c.z = (c0.z + c1.z) + (c2.z + c3.z);
- if(!hasUnsignedTextureComponent(2)) c.z = AddSat(c.z, c.z); // Correct for signed fractions
- }
- }
-
- if(componentCount >= 4)
- {
- if(has16bitTextureComponents() && hasUnsignedTextureComponent(3))
- {
- c0.w = As<UShort4>(c0.w) - MulHigh(As<UShort4>(c0.w), f0u) + MulHigh(As<UShort4>(c1.w), f0u);
- c2.w = As<UShort4>(c2.w) - MulHigh(As<UShort4>(c2.w), f0u) + MulHigh(As<UShort4>(c3.w), f0u);
- c.w = As<UShort4>(c0.w) - MulHigh(As<UShort4>(c0.w), f0v) + MulHigh(As<UShort4>(c2.w), f0v);
- }
- else
- {
- if(hasUnsignedTextureComponent(3))
- {
- c0.w = MulHigh(As<UShort4>(c0.w), f1u1v);
- c1.w = MulHigh(As<UShort4>(c1.w), f0u1v);
- c2.w = MulHigh(As<UShort4>(c2.w), f1u0v);
- c3.w = MulHigh(As<UShort4>(c3.w), f0u0v);
- }
- else
- {
- c0.w = MulHigh(c0.w, f1u1vs);
- c1.w = MulHigh(c1.w, f0u1vs);
- c2.w = MulHigh(c2.w, f1u0vs);
- c3.w = MulHigh(c3.w, f0u0vs);
- }
-
- c.w = (c0.w + c1.w) + (c2.w + c3.w);
- if(!hasUnsignedTextureComponent(3)) c.w = AddSat(c.w, c.w); // Correct for signed fractions
- }
- }
- }
- else
- {
- c.x = c1.x;
- c.y = c2.x;
- c.z = c3.x;
- c.w = c0.x;
- }
- }
-
- return c;
- }
-
- Vector4s SamplerCore::sample3D(Pointer<Byte> &texture, Float4 &u_, Float4 &v_, Float4 &w_, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function)
- {
- Vector4s c_;
-
- int componentCount = textureComponentCount();
-
- Pointer<Byte> mipmap;
- Pointer<Byte> buffer[4];
- Int face[4];
-
- selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
-
- bool texelFetch = (function == Fetch);
-
- Short4 uuuu = texelFetch ? Short4(As<Int4>(u_)) : address(u_, state.addressingModeU, mipmap);
- Short4 vvvv = texelFetch ? Short4(As<Int4>(v_)) : address(v_, state.addressingModeV, mipmap);
- Short4 wwww = texelFetch ? Short4(As<Int4>(w_)) : address(w_, state.addressingModeW, mipmap);
-
- if(state.textureFilter == FILTER_POINT || texelFetch)
- {
- c_ = sampleTexel(uuuu, vvvv, wwww, offset, mipmap, buffer, function);
- }
- else
- {
- Vector4s c[2][2][2];
-
- Short4 u[2][2][2];
- Short4 v[2][2][2];
- Short4 s[2][2][2];
-
- for(int i = 0; i < 2; i++)
- {
- for(int j = 0; j < 2; j++)
- {
- for(int k = 0; k < 2; k++)
- {
- u[i][j][k] = offsetSample(uuuu, mipmap, OFFSET(Mipmap,uHalf), state.addressingModeU == ADDRESSING_WRAP, i * 2 - 1, lod);
- v[i][j][k] = offsetSample(vvvv, mipmap, OFFSET(Mipmap,vHalf), state.addressingModeV == ADDRESSING_WRAP, j * 2 - 1, lod);
- s[i][j][k] = offsetSample(wwww, mipmap, OFFSET(Mipmap,wHalf), state.addressingModeW == ADDRESSING_WRAP, k * 2 - 1, lod);
- }
- }
- }
-
- // Fractions
- UShort4 f0u = As<UShort4>(u[0][0][0]) * *Pointer<UShort4>(mipmap + OFFSET(Mipmap,width));
- UShort4 f0v = As<UShort4>(v[0][0][0]) * *Pointer<UShort4>(mipmap + OFFSET(Mipmap,height));
- UShort4 f0s = As<UShort4>(s[0][0][0]) * *Pointer<UShort4>(mipmap + OFFSET(Mipmap,depth));
-
- UShort4 f1u = ~f0u;
- UShort4 f1v = ~f0v;
- UShort4 f1s = ~f0s;
-
- UShort4 f[2][2][2];
- Short4 fs[2][2][2];
-
- f[1][1][1] = MulHigh(f1u, f1v);
- f[0][1][1] = MulHigh(f0u, f1v);
- f[1][0][1] = MulHigh(f1u, f0v);
- f[0][0][1] = MulHigh(f0u, f0v);
- f[1][1][0] = MulHigh(f1u, f1v);
- f[0][1][0] = MulHigh(f0u, f1v);
- f[1][0][0] = MulHigh(f1u, f0v);
- f[0][0][0] = MulHigh(f0u, f0v);
-
- f[1][1][1] = MulHigh(f[1][1][1], f1s);
- f[0][1][1] = MulHigh(f[0][1][1], f1s);
- f[1][0][1] = MulHigh(f[1][0][1], f1s);
- f[0][0][1] = MulHigh(f[0][0][1], f1s);
- f[1][1][0] = MulHigh(f[1][1][0], f0s);
- f[0][1][0] = MulHigh(f[0][1][0], f0s);
- f[1][0][0] = MulHigh(f[1][0][0], f0s);
- f[0][0][0] = MulHigh(f[0][0][0], f0s);
-
- // Signed fractions
- if(!hasUnsignedTextureComponent(0) || !hasUnsignedTextureComponent(1) || !hasUnsignedTextureComponent(2) || !hasUnsignedTextureComponent(3))
- {
- fs[0][0][0] = f[0][0][0] >> 1;
- fs[0][0][1] = f[0][0][1] >> 1;
- fs[0][1][0] = f[0][1][0] >> 1;
- fs[0][1][1] = f[0][1][1] >> 1;
- fs[1][0][0] = f[1][0][0] >> 1;
- fs[1][0][1] = f[1][0][1] >> 1;
- fs[1][1][0] = f[1][1][0] >> 1;
- fs[1][1][1] = f[1][1][1] >> 1;
- }
-
- for(int i = 0; i < 2; i++)
- {
- for(int j = 0; j < 2; j++)
- {
- for(int k = 0; k < 2; k++)
- {
- c[i][j][k] = sampleTexel(u[i][j][k], v[i][j][k], s[i][j][k], offset, mipmap, buffer, function);
-
- if(componentCount >= 1) { if(hasUnsignedTextureComponent(0)) c[i][j][k].x = MulHigh(As<UShort4>(c[i][j][k].x), f[1 - i][1 - j][1 - k]); else c[i][j][k].x = MulHigh(c[i][j][k].x, fs[1 - i][1 - j][1 - k]); }
- if(componentCount >= 2) { if(hasUnsignedTextureComponent(1)) c[i][j][k].y = MulHigh(As<UShort4>(c[i][j][k].y), f[1 - i][1 - j][1 - k]); else c[i][j][k].y = MulHigh(c[i][j][k].y, fs[1 - i][1 - j][1 - k]); }
- if(componentCount >= 3) { if(hasUnsignedTextureComponent(2)) c[i][j][k].z = MulHigh(As<UShort4>(c[i][j][k].z), f[1 - i][1 - j][1 - k]); else c[i][j][k].z = MulHigh(c[i][j][k].z, fs[1 - i][1 - j][1 - k]); }
- if(componentCount >= 4) { if(hasUnsignedTextureComponent(3)) c[i][j][k].w = MulHigh(As<UShort4>(c[i][j][k].w), f[1 - i][1 - j][1 - k]); else c[i][j][k].w = MulHigh(c[i][j][k].w, fs[1 - i][1 - j][1 - k]); }
-
- if(i != 0 || j != 0 || k != 0)
- {
- if(componentCount >= 1) c[0][0][0].x += c[i][j][k].x;
- if(componentCount >= 2) c[0][0][0].y += c[i][j][k].y;
- if(componentCount >= 3) c[0][0][0].z += c[i][j][k].z;
- if(componentCount >= 4) c[0][0][0].w += c[i][j][k].w;
- }
- }
- }
- }
-
- if(componentCount >= 1) c_.x = c[0][0][0].x;
- if(componentCount >= 2) c_.y = c[0][0][0].y;
- if(componentCount >= 3) c_.z = c[0][0][0].z;
- if(componentCount >= 4) c_.w = c[0][0][0].w;
-
- // Correct for signed fractions
- if(componentCount >= 1) if(!hasUnsignedTextureComponent(0)) c_.x = AddSat(c_.x, c_.x);
- if(componentCount >= 2) if(!hasUnsignedTextureComponent(1)) c_.y = AddSat(c_.y, c_.y);
- if(componentCount >= 3) if(!hasUnsignedTextureComponent(2)) c_.z = AddSat(c_.z, c_.z);
- if(componentCount >= 4) if(!hasUnsignedTextureComponent(3)) c_.w = AddSat(c_.w, c_.w);
- }
-
- return c_;
- }
-
- Vector4f SamplerCore::sampleFloatFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function)
- {
- Vector4f c = sampleFloatAniso(texture, u, v, w, q, offset, lod, anisotropy, uDelta, vDelta, face, false, function);
-
- if(function == Fetch)
- {
- return c;
- }
-
- if(state.mipmapFilter == MIPMAP_LINEAR)
- {
- Vector4f cc = sampleFloatAniso(texture, u, v, w, q, offset, lod, anisotropy, uDelta, vDelta, face, true, function);
-
- Float4 lod4 = Float4(Frac(lod));
-
- c.x = (cc.x - c.x) * lod4 + c.x;
- c.y = (cc.y - c.y) * lod4 + c.y;
- c.z = (cc.z - c.z) * lod4 + c.z;
- c.w = (cc.w - c.w) * lod4 + c.w;
- }
-
- Int4 borderMask;
-
- if(state.addressingModeU == ADDRESSING_BORDER)
- {
- Int4 u0;
-
- border(u0, u);
-
- borderMask = u0;
- }
-
- if(state.addressingModeV == ADDRESSING_BORDER)
- {
- Int4 v0;
-
- border(v0, v);
-
- if(state.addressingModeU == ADDRESSING_BORDER)
- {
- borderMask &= v0;
- }
- else
- {
- borderMask = v0;
- }
- }
-
- if(state.addressingModeW == ADDRESSING_BORDER && state.textureType == TEXTURE_3D)
- {
- Int4 s0;
-
- border(s0, w);
-
- if(state.addressingModeU == ADDRESSING_BORDER ||
- state.addressingModeV == ADDRESSING_BORDER)
- {
- borderMask &= s0;
- }
- else
- {
- borderMask = s0;
- }
- }
-
- if(state.addressingModeU == ADDRESSING_BORDER ||
- state.addressingModeV == ADDRESSING_BORDER ||
- (state.addressingModeW == ADDRESSING_BORDER && state.textureType == TEXTURE_3D))
- {
- Int4 b;
-
- c.x = As<Float4>((borderMask & As<Int4>(c.x)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[0]))));
- c.y = As<Float4>((borderMask & As<Int4>(c.y)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[1]))));
- c.z = As<Float4>((borderMask & As<Int4>(c.z)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[2]))));
- c.w = As<Float4>((borderMask & As<Int4>(c.w)) | (~borderMask & *Pointer<Int4>(texture + OFFSET(Texture,borderColorF[3]))));
- }
-
- return c;
- }
-
- Vector4f SamplerCore::sampleFloatAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function)
- {
- Vector4f c;
-
- if(state.textureFilter != FILTER_ANISOTROPIC || function == Lod || function == Fetch)
- {
- c = sampleFloat(texture, u, v, w, q, offset, lod, face, secondLOD, function);
- }
- else
- {
- Int a = RoundInt(anisotropy);
-
- Vector4f cSum;
-
- cSum.x = Float4(0.0f);
- cSum.y = Float4(0.0f);
- cSum.z = Float4(0.0f);
- cSum.w = Float4(0.0f);
-
- Float4 A = *Pointer<Float4>(constants + OFFSET(Constants,uvWeight) + 16 * a);
- Float4 B = *Pointer<Float4>(constants + OFFSET(Constants,uvStart) + 16 * a);
-
- Float4 du = uDelta;
- Float4 dv = vDelta;
-
- Float4 u0 = u + B * du;
- Float4 v0 = v + B * dv;
-
- du *= A;
- dv *= A;
-
- Int i = 0;
-
- Do
- {
- c = sampleFloat(texture, u0, v0, w, q, offset, lod, face, secondLOD, function);
-
- u0 += du;
- v0 += dv;
-
- cSum.x += c.x * A;
- cSum.y += c.y * A;
- cSum.z += c.z * A;
- cSum.w += c.w * A;
-
- i++;
- }
- Until(i >= a);
-
- c.x = cSum.x;
- c.y = cSum.y;
- c.z = cSum.z;
- c.w = cSum.w;
- }
-
- return c;
- }
-
- Vector4f SamplerCore::sampleFloat(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
- {
- if(state.textureType != TEXTURE_3D)
- {
- return sampleFloat2D(texture, u, v, w, q, offset, lod, face, secondLOD, function);
- }
- else
- {
- return sampleFloat3D(texture, u, v, w, offset, lod, secondLOD, function);
- }
- }
-
- Vector4f SamplerCore::sampleFloat2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function)
- {
- Vector4f c;
-
- int componentCount = textureComponentCount();
- bool gather = state.textureFilter == FILTER_GATHER;
-
- Pointer<Byte> mipmap;
- Pointer<Byte> buffer[4];
-
- selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
-
- Int4 x0, x1, y0, y1, z0;
- Float4 fu, fv;
- Int4 filter = computeFilterOffset(lod);
- address(u, x0, x1, fu, mipmap, offset.x, filter, OFFSET(Mipmap, width), state.addressingModeU, function);
- address(v, y0, y1, fv, mipmap, offset.y, filter, OFFSET(Mipmap, height), state.addressingModeV, function);
- address(w, z0, z0, fv, mipmap, offset.z, filter, OFFSET(Mipmap, depth), state.addressingModeW, function);
-
- Int4 pitchP = *Pointer<Int4>(mipmap + OFFSET(Mipmap, pitchP), 16);
- y0 *= pitchP;
- if(hasThirdCoordinate())
- {
- Int4 sliceP = *Pointer<Int4>(mipmap + OFFSET(Mipmap, sliceP), 16);
- z0 *= sliceP;
- }
-
- if(state.textureFilter == FILTER_POINT || (function == Fetch))
- {
- c = sampleTexel(x0, y0, z0, q, mipmap, buffer, function);
- }
- else
- {
- y1 *= pitchP;
-
- Vector4f c0 = sampleTexel(x0, y0, z0, q, mipmap, buffer, function);
- Vector4f c1 = sampleTexel(x1, y0, z0, q, mipmap, buffer, function);
- Vector4f c2 = sampleTexel(x0, y1, z0, q, mipmap, buffer, function);
- Vector4f c3 = sampleTexel(x1, y1, z0, q, mipmap, buffer, function);
-
- if(!gather) // Blend
- {
- if(componentCount >= 1) c0.x = c0.x + fu * (c1.x - c0.x);
- if(componentCount >= 2) c0.y = c0.y + fu * (c1.y - c0.y);
- if(componentCount >= 3) c0.z = c0.z + fu * (c1.z - c0.z);
- if(componentCount >= 4) c0.w = c0.w + fu * (c1.w - c0.w);
-
- if(componentCount >= 1) c2.x = c2.x + fu * (c3.x - c2.x);
- if(componentCount >= 2) c2.y = c2.y + fu * (c3.y - c2.y);
- if(componentCount >= 3) c2.z = c2.z + fu * (c3.z - c2.z);
- if(componentCount >= 4) c2.w = c2.w + fu * (c3.w - c2.w);
-
- if(componentCount >= 1) c.x = c0.x + fv * (c2.x - c0.x);
- if(componentCount >= 2) c.y = c0.y + fv * (c2.y - c0.y);
- if(componentCount >= 3) c.z = c0.z + fv * (c2.z - c0.z);
- if(componentCount >= 4) c.w = c0.w + fv * (c2.w - c0.w);
- }
- else
- {
- c.x = c1.x;
- c.y = c2.x;
- c.z = c3.x;
- c.w = c0.x;
- }
- }
-
- return c;
- }
-
- Vector4f SamplerCore::sampleFloat3D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function)
- {
- Vector4f c;
-
- int componentCount = textureComponentCount();
-
- Pointer<Byte> mipmap;
- Pointer<Byte> buffer[4];
- Int face[4];
-
- selectMipmap(texture, buffer, mipmap, lod, face, secondLOD);
-
- Int4 x0, x1, y0, y1, z0, z1;
- Float4 fu, fv, fw;
- Int4 filter = computeFilterOffset(lod);
- address(u, x0, x1, fu, mipmap, offset.x, filter, OFFSET(Mipmap, width), state.addressingModeU, function);
- address(v, y0, y1, fv, mipmap, offset.y, filter, OFFSET(Mipmap, height), state.addressingModeV, function);
- address(w, z0, z1, fw, mipmap, offset.z, filter, OFFSET(Mipmap, depth), state.addressingModeW, function);
-
- Int4 pitchP = *Pointer<Int4>(mipmap + OFFSET(Mipmap, pitchP), 16);
- Int4 sliceP = *Pointer<Int4>(mipmap + OFFSET(Mipmap, sliceP), 16);
- y0 *= pitchP;
- z0 *= sliceP;
-
- if(state.textureFilter == FILTER_POINT || (function == Fetch))
- {
- c = sampleTexel(x0, y0, z0, w, mipmap, buffer, function);
- }
- else
- {
- y1 *= pitchP;
- z1 *= sliceP;
-
- Vector4f c0 = sampleTexel(x0, y0, z0, w, mipmap, buffer, function);
- Vector4f c1 = sampleTexel(x1, y0, z0, w, mipmap, buffer, function);
- Vector4f c2 = sampleTexel(x0, y1, z0, w, mipmap, buffer, function);
- Vector4f c3 = sampleTexel(x1, y1, z0, w, mipmap, buffer, function);
- Vector4f c4 = sampleTexel(x0, y0, z1, w, mipmap, buffer, function);
- Vector4f c5 = sampleTexel(x1, y0, z1, w, mipmap, buffer, function);
- Vector4f c6 = sampleTexel(x0, y1, z1, w, mipmap, buffer, function);
- Vector4f c7 = sampleTexel(x1, y1, z1, w, mipmap, buffer, function);
-
- // Blend first slice
- if(componentCount >= 1) c0.x = c0.x + fu * (c1.x - c0.x);
- if(componentCount >= 2) c0.y = c0.y + fu * (c1.y - c0.y);
- if(componentCount >= 3) c0.z = c0.z + fu * (c1.z - c0.z);
- if(componentCount >= 4) c0.w = c0.w + fu * (c1.w - c0.w);
-
- if(componentCount >= 1) c2.x = c2.x + fu * (c3.x - c2.x);
- if(componentCount >= 2) c2.y = c2.y + fu * (c3.y - c2.y);
- if(componentCount >= 3) c2.z = c2.z + fu * (c3.z - c2.z);
- if(componentCount >= 4) c2.w = c2.w + fu * (c3.w - c2.w);
-
- if(componentCount >= 1) c0.x = c0.x + fv * (c2.x - c0.x);
- if(componentCount >= 2) c0.y = c0.y + fv * (c2.y - c0.y);
- if(componentCount >= 3) c0.z = c0.z + fv * (c2.z - c0.z);
- if(componentCount >= 4) c0.w = c0.w + fv * (c2.w - c0.w);
-
- // Blend second slice
- if(componentCount >= 1) c4.x = c4.x + fu * (c5.x - c4.x);
- if(componentCount >= 2) c4.y = c4.y + fu * (c5.y - c4.y);
- if(componentCount >= 3) c4.z = c4.z + fu * (c5.z - c4.z);
- if(componentCount >= 4) c4.w = c4.w + fu * (c5.w - c4.w);
-
- if(componentCount >= 1) c6.x = c6.x + fu * (c7.x - c6.x);
- if(componentCount >= 2) c6.y = c6.y + fu * (c7.y - c6.y);
- if(componentCount >= 3) c6.z = c6.z + fu * (c7.z - c6.z);
- if(componentCount >= 4) c6.w = c6.w + fu * (c7.w - c6.w);
-
- if(componentCount >= 1) c4.x = c4.x + fv * (c6.x - c4.x);
- if(componentCount >= 2) c4.y = c4.y + fv * (c6.y - c4.y);
- if(componentCount >= 3) c4.z = c4.z + fv * (c6.z - c4.z);
- if(componentCount >= 4) c4.w = c4.w + fv * (c6.w - c4.w);
-
- // Blend slices
- if(componentCount >= 1) c.x = c0.x + fw * (c4.x - c0.x);
- if(componentCount >= 2) c.y = c0.y + fw * (c4.y - c0.y);
- if(componentCount >= 3) c.z = c0.z + fw * (c4.z - c0.z);
- if(componentCount >= 4) c.w = c0.w + fw * (c4.w - c0.w);
- }
-
- return c;
- }
-
- Float SamplerCore::log2sqrt(Float lod)
- {
- // log2(sqrt(lod)) // Equals 0.25 * log2(lod^2).
- lod *= lod; // Squaring doubles the exponent and produces an extra bit of precision.
- lod = Float(As<Int>(lod)) - Float(0x3F800000); // Interpret as integer and subtract the exponent bias.
- lod *= As<Float>(Int(0x33000000)); // Scale by 0.25 * 2^-23 (mantissa length).
-
- return lod;
- }
-
- Float SamplerCore::log2(Float lod)
- {
- lod *= lod; // Squaring doubles the exponent and produces an extra bit of precision.
- lod = Float(As<Int>(lod)) - Float(0x3F800000); // Interpret as integer and subtract the exponent bias.
- lod *= As<Float>(Int(0x33800000)); // Scale by 0.5 * 2^-23 (mantissa length).
-
- return lod;
- }
-
- void SamplerCore::computeLod(Pointer<Byte> &texture, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Float4 &uuuu, Float4 &vvvv, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function)
- {
- if(function != Lod && function != Fetch)
- {
- Float4 duvdxy;
-
- if(function != Grad) // Implicit
- {
- duvdxy = Float4(uuuu.yz, vvvv.yz) - Float4(uuuu.xx, vvvv.xx);
- }
- else
- {
- Float4 dudxy = Float4(dsx.x.xx, dsy.x.xx);
- Float4 dvdxy = Float4(dsx.y.xx, dsy.y.xx);
-
- duvdxy = Float4(dudxy.xz, dvdxy.xz);
- }
-
- // Scale by texture dimensions and global LOD.
- Float4 dUVdxy = duvdxy * *Pointer<Float4>(texture + OFFSET(Texture,widthHeightLOD));
-
- Float4 dUV2dxy = dUVdxy * dUVdxy;
- Float4 dUV2 = dUV2dxy.xy + dUV2dxy.zw;
-
- lod = Max(Float(dUV2.x), Float(dUV2.y)); // Square length of major axis
-
- if(state.textureFilter == FILTER_ANISOTROPIC)
- {
- Float det = Abs(Float(dUVdxy.x) * Float(dUVdxy.w) - Float(dUVdxy.y) * Float(dUVdxy.z));
-
- Float4 dudx = duvdxy.xxxx;
- Float4 dudy = duvdxy.yyyy;
- Float4 dvdx = duvdxy.zzzz;
- Float4 dvdy = duvdxy.wwww;
-
- Int4 mask = As<Int4>(CmpNLT(dUV2.x, dUV2.y));
- uDelta = As<Float4>((As<Int4>(dudx) & mask) | ((As<Int4>(dudy) & ~mask)));
- vDelta = As<Float4>((As<Int4>(dvdx) & mask) | ((As<Int4>(dvdy) & ~mask)));
-
- anisotropy = lod * Rcp_pp(det);
- anisotropy = Min(anisotropy, *Pointer<Float>(texture + OFFSET(Texture,maxAnisotropy)));
-
- lod *= Rcp_pp(anisotropy * anisotropy);
- }
-
- lod = log2sqrt(lod); // log2(sqrt(lod))
-
- if(function == Bias)
- {
- lod += lodBias;
- }
- }
- else if(function == Lod)
- {
- lod = lodBias;
- }
- else if(function == Fetch)
- {
- // TODO: Eliminate int-float-int conversion.
- lod = Float(As<Int>(lodBias));
- }
- else if(function == Base)
- {
- lod = Float(0);
- }
- else assert(false);
-
- lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
- lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
- }
-
- void SamplerCore::computeLodCube(Pointer<Byte> &texture, Float &lod, Float4 &u, Float4 &v, Float4 &w, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, Float4 &M, SamplerFunction function)
- {
- if(function != Lod && function != Fetch)
- {
- Float4 dudxy, dvdxy, dsdxy;
-
- if(function != Grad) // Implicit
- {
- Float4 U = u * M;
- Float4 V = v * M;
- Float4 W = w * M;
-
- dudxy = Abs(U - U.xxxx);
- dvdxy = Abs(V - V.xxxx);
- dsdxy = Abs(W - W.xxxx);
- }
- else
- {
- dudxy = Float4(dsx.x.xx, dsy.x.xx);
- dvdxy = Float4(dsx.y.xx, dsy.y.xx);
- dsdxy = Float4(dsx.z.xx, dsy.z.xx);
-
- dudxy = Abs(dudxy * Float4(M.x));
- dvdxy = Abs(dvdxy * Float4(M.x));
- dsdxy = Abs(dsdxy * Float4(M.x));
- }
-
- // Compute the largest Manhattan distance in two dimensions.
- // This takes the footprint across adjacent faces into account.
- Float4 duvdxy = dudxy + dvdxy;
- Float4 dusdxy = dudxy + dsdxy;
- Float4 dvsdxy = dvdxy + dsdxy;
-
- dudxy = Max(Max(duvdxy, dusdxy), dvsdxy);
-
- lod = Max(Float(dudxy.y), Float(dudxy.z)); // FIXME: Max(dudxy.y, dudxy.z);
-
- // Scale by texture dimension and global LOD.
- lod *= *Pointer<Float>(texture + OFFSET(Texture,widthLOD));
-
- lod = log2(lod);
-
- if(function == Bias)
- {
- lod += lodBias;
- }
- }
- else if(function == Lod)
- {
- lod = lodBias;
- }
- else if(function == Fetch)
- {
- // TODO: Eliminate int-float-int conversion.
- lod = Float(As<Int>(lodBias));
- }
- else if(function == Base)
- {
- lod = Float(0);
- }
- else assert(false);
-
- lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
- lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
- }
-
- void SamplerCore::computeLod3D(Pointer<Byte> &texture, Float &lod, Float4 &uuuu, Float4 &vvvv, Float4 &wwww, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function)
- {
- if(function != Lod && function != Fetch)
- {
- Float4 dudxy, dvdxy, dsdxy;
-
- if(function != Grad) // Implicit
- {
- dudxy = uuuu - uuuu.xxxx;
- dvdxy = vvvv - vvvv.xxxx;
- dsdxy = wwww - wwww.xxxx;
- }
- else
- {
- dudxy = Float4(dsx.x.xx, dsy.x.xx);
- dvdxy = Float4(dsx.y.xx, dsy.y.xx);
- dsdxy = Float4(dsx.z.xx, dsy.z.xx);
- }
-
- // Scale by texture dimensions and global LOD.
- dudxy *= *Pointer<Float4>(texture + OFFSET(Texture,widthLOD));
- dvdxy *= *Pointer<Float4>(texture + OFFSET(Texture,heightLOD));
- dsdxy *= *Pointer<Float4>(texture + OFFSET(Texture,depthLOD));
-
- dudxy *= dudxy;
- dvdxy *= dvdxy;
- dsdxy *= dsdxy;
-
- dudxy += dvdxy;
- dudxy += dsdxy;
-
- lod = Max(Float(dudxy.y), Float(dudxy.z)); // FIXME: Max(dudxy.y, dudxy.z);
-
- lod = log2sqrt(lod); // log2(sqrt(lod))
-
- if(function == Bias)
- {
- lod += lodBias;
- }
- }
- else if(function == Lod)
- {
- lod = lodBias;
- }
- else if(function == Fetch)
- {
- // TODO: Eliminate int-float-int conversion.
- lod = Float(As<Int>(lodBias));
- }
- else if(function == Base)
- {
- lod = Float(0);
- }
- else assert(false);
-
- lod = Max(lod, *Pointer<Float>(texture + OFFSET(Texture, minLod)));
- lod = Min(lod, *Pointer<Float>(texture + OFFSET(Texture, maxLod)));
- }
-
- void SamplerCore::cubeFace(Int face[4], Float4 &U, Float4 &V, Float4 &x, Float4 &y, Float4 &z, Float4 &M)
- {
- Int4 xn = CmpLT(x, Float4(0.0f)); // x < 0
- Int4 yn = CmpLT(y, Float4(0.0f)); // y < 0
- Int4 zn = CmpLT(z, Float4(0.0f)); // z < 0
-
- Float4 absX = Abs(x);
- Float4 absY = Abs(y);
- Float4 absZ = Abs(z);
-
- Int4 xy = CmpNLE(absX, absY); // abs(x) > abs(y)
- Int4 yz = CmpNLE(absY, absZ); // abs(y) > abs(z)
- Int4 zx = CmpNLE(absZ, absX); // abs(z) > abs(x)
- Int4 xMajor = xy & ~zx; // abs(x) > abs(y) && abs(x) > abs(z)
- Int4 yMajor = yz & ~xy; // abs(y) > abs(z) && abs(y) > abs(x)
- Int4 zMajor = zx & ~yz; // abs(z) > abs(x) && abs(z) > abs(y)
-
- // FACE_POSITIVE_X = 000b
- // FACE_NEGATIVE_X = 001b
- // FACE_POSITIVE_Y = 010b
- // FACE_NEGATIVE_Y = 011b
- // FACE_POSITIVE_Z = 100b
- // FACE_NEGATIVE_Z = 101b
-
- Int yAxis = SignMask(yMajor);
- Int zAxis = SignMask(zMajor);
-
- Int4 n = ((xn & xMajor) | (yn & yMajor) | (zn & zMajor)) & Int4(0x80000000);
- Int negative = SignMask(n);
-
- face[0] = *Pointer<Int>(constants + OFFSET(Constants,transposeBit0) + negative * 4);
- face[0] |= *Pointer<Int>(constants + OFFSET(Constants,transposeBit1) + yAxis * 4);
- face[0] |= *Pointer<Int>(constants + OFFSET(Constants,transposeBit2) + zAxis * 4);
- face[1] = (face[0] >> 4) & 0x7;
- face[2] = (face[0] >> 8) & 0x7;
- face[3] = (face[0] >> 12) & 0x7;
- face[0] &= 0x7;
-
- M = Max(Max(absX, absY), absZ);
-
- // U = xMajor ? (neg ^ -z) : ((zMajor & neg) ^ x)
- U = As<Float4>((xMajor & (n ^ As<Int4>(-z))) | (~xMajor & ((zMajor & n) ^ As<Int4>(x))));
-
- // V = !yMajor ? -y : (n ^ z)
- V = As<Float4>((~yMajor & As<Int4>(-y)) | (yMajor & (n ^ As<Int4>(z))));
-
- M = reciprocal(M) * Float4(0.5f);
- U = U * M + Float4(0.5f);
- V = V * M + Float4(0.5f);
- }
-
- Short4 SamplerCore::applyOffset(Short4 &uvw, Float4 &offset, const Int4 &whd, AddressingMode mode)
- {
- Int4 tmp = Int4(As<UShort4>(uvw));
- tmp = tmp + As<Int4>(offset);
-
- switch(mode)
- {
- case AddressingMode::ADDRESSING_WRAP:
- tmp = (tmp + whd * Int4(-MIN_PROGRAM_TEXEL_OFFSET)) % whd;
- break;
- case AddressingMode::ADDRESSING_CLAMP:
- case AddressingMode::ADDRESSING_MIRROR:
- case AddressingMode::ADDRESSING_MIRRORONCE:
- case AddressingMode::ADDRESSING_BORDER: // FIXME: Implement and test ADDRESSING_MIRROR, ADDRESSING_MIRRORONCE, ADDRESSING_BORDER
- tmp = Min(Max(tmp, Int4(0)), whd - Int4(1));
- break;
- case ADDRESSING_TEXELFETCH:
- break;
- case AddressingMode::ADDRESSING_SEAMLESS:
- ASSERT(false); // Cube sampling doesn't support offset.
- default:
- ASSERT(false);
- }
-
- return As<Short4>(UShort4(tmp));
- }
-
- void SamplerCore::computeIndices(UInt index[4], Short4 uuuu, Short4 vvvv, Short4 wwww, Vector4f &offset, const Pointer<Byte> &mipmap, SamplerFunction function)
- {
- bool texelFetch = (function == Fetch);
- bool hasOffset = (function.option == Offset);
-
- if(!texelFetch)
- {
- uuuu = MulHigh(As<UShort4>(uuuu), *Pointer<UShort4>(mipmap + OFFSET(Mipmap, width)));
- vvvv = MulHigh(As<UShort4>(vvvv), *Pointer<UShort4>(mipmap + OFFSET(Mipmap, height)));
- }
-
- if(hasOffset)
- {
- UShort4 w = *Pointer<UShort4>(mipmap + OFFSET(Mipmap, width));
- uuuu = applyOffset(uuuu, offset.x, Int4(w), texelFetch ? ADDRESSING_TEXELFETCH : state.addressingModeU);
- UShort4 h = *Pointer<UShort4>(mipmap + OFFSET(Mipmap, height));
- vvvv = applyOffset(vvvv, offset.y, Int4(h), texelFetch ? ADDRESSING_TEXELFETCH : state.addressingModeV);
- }
-
- Short4 uuu2 = uuuu;
- uuuu = As<Short4>(UnpackLow(uuuu, vvvv));
- uuu2 = As<Short4>(UnpackHigh(uuu2, vvvv));
- uuuu = As<Short4>(MulAdd(uuuu, *Pointer<Short4>(mipmap + OFFSET(Mipmap,onePitchP))));
- uuu2 = As<Short4>(MulAdd(uuu2, *Pointer<Short4>(mipmap + OFFSET(Mipmap,onePitchP))));
-
- if(hasThirdCoordinate())
- {
- if(state.textureType != TEXTURE_2D_ARRAY)
- {
- if(!texelFetch)
- {
- wwww = MulHigh(As<UShort4>(wwww), *Pointer<UShort4>(mipmap + OFFSET(Mipmap, depth)));
- }
-
- if(hasOffset)
- {
- UShort4 d = *Pointer<UShort4>(mipmap + OFFSET(Mipmap, depth));
- wwww = applyOffset(wwww, offset.z, Int4(d), texelFetch ? ADDRESSING_TEXELFETCH : state.addressingModeW);
- }
- }
-
- UInt4 uv(As<UInt2>(uuuu), As<UInt2>(uuu2));
- uv += As<UInt4>(Int4(As<UShort4>(wwww))) * *Pointer<UInt4>(mipmap + OFFSET(Mipmap, sliceP));
-
- index[0] = Extract(As<Int4>(uv), 0);
- index[1] = Extract(As<Int4>(uv), 1);
- index[2] = Extract(As<Int4>(uv), 2);
- index[3] = Extract(As<Int4>(uv), 3);
- }
- else
- {
- index[0] = Extract(As<Int2>(uuuu), 0);
- index[1] = Extract(As<Int2>(uuuu), 1);
- index[2] = Extract(As<Int2>(uuu2), 0);
- index[3] = Extract(As<Int2>(uuu2), 1);
- }
-
- if(texelFetch)
- {
- Int size = Int(*Pointer<Int>(mipmap + OFFSET(Mipmap, sliceP)));
- if(hasThirdCoordinate())
- {
- size *= Int(*Pointer<Short>(mipmap + OFFSET(Mipmap, depth)));
- }
- UInt min = 0;
- UInt max = size - 1;
-
- for(int i = 0; i < 4; i++)
- {
- index[i] = Min(Max(index[i], min), max);
- }
- }
- }
-
- void SamplerCore::computeIndices(UInt index[4], Int4& uuuu, Int4& vvvv, Int4& wwww, const Pointer<Byte> &mipmap, SamplerFunction function)
- {
- UInt4 indices = uuuu + vvvv;
-
- if(hasThirdCoordinate())
- {
- indices += As<UInt4>(wwww);
- }
-
- for(int i = 0; i < 4; i++)
- {
- index[i] = Extract(As<Int4>(indices), i);
- }
- }
-
- Vector4s SamplerCore::sampleTexel(UInt index[4], Pointer<Byte> buffer[4])
- {
- Vector4s c;
-
- int f0 = state.textureType == TEXTURE_CUBE ? 0 : 0;
- int f1 = state.textureType == TEXTURE_CUBE ? 1 : 0;
- int f2 = state.textureType == TEXTURE_CUBE ? 2 : 0;
- int f3 = state.textureType == TEXTURE_CUBE ? 3 : 0;
-
- if(has16bitTextureFormat())
- {
- c.x = Insert(c.x, Pointer<Short>(buffer[f0])[index[0]], 0);
- c.x = Insert(c.x, Pointer<Short>(buffer[f1])[index[1]], 1);
- c.x = Insert(c.x, Pointer<Short>(buffer[f2])[index[2]], 2);
- c.x = Insert(c.x, Pointer<Short>(buffer[f3])[index[3]], 3);
-
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5:
- c.z = (c.x & Short4(0x001Fu)) << 11;
- c.y = (c.x & Short4(0x07E0u)) << 5;
- c.x = (c.x & Short4(0xF800u));
- break;
- default:
- ASSERT(false);
- }
- }
- else if(has8bitTextureComponents())
- {
- switch(textureComponentCount())
- {
- case 4:
- {
- Byte4 c0 = Pointer<Byte4>(buffer[f0])[index[0]];
- Byte4 c1 = Pointer<Byte4>(buffer[f1])[index[1]];
- Byte4 c2 = Pointer<Byte4>(buffer[f2])[index[2]];
- Byte4 c3 = Pointer<Byte4>(buffer[f3])[index[3]];
- c.x = Unpack(c0, c1);
- c.y = Unpack(c2, c3);
-
- switch(state.textureFormat)
- {
- case FORMAT_A8R8G8B8:
- c.z = As<Short4>(UnpackLow(c.x, c.y));
- c.x = As<Short4>(UnpackHigh(c.x, c.y));
- c.y = c.z;
- c.w = c.x;
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(c.z));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(c.y));
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(c.x));
- c.w = UnpackHigh(As<Byte8>(c.w), As<Byte8>(c.w));
- break;
- case FORMAT_A8B8G8R8:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_Q8W8V8U8:
- case FORMAT_SRGB8_A8:
- c.z = As<Short4>(UnpackHigh(c.x, c.y));
- c.x = As<Short4>(UnpackLow(c.x, c.y));
- c.y = c.x;
- c.w = c.z;
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(c.x));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(c.y));
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(c.z));
- c.w = UnpackHigh(As<Byte8>(c.w), As<Byte8>(c.w));
- // Propagate sign bit
- if(state.textureFormat == FORMAT_A8B8G8R8I)
- {
- c.x >>= 8;
- c.y >>= 8;
- c.z >>= 8;
- c.w >>= 8;
- }
- break;
- case FORMAT_A8B8G8R8UI:
- c.z = As<Short4>(UnpackHigh(c.x, c.y));
- c.x = As<Short4>(UnpackLow(c.x, c.y));
- c.y = c.x;
- c.w = c.z;
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(Short4(0)));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(Short4(0)));
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(Short4(0)));
- c.w = UnpackHigh(As<Byte8>(c.w), As<Byte8>(Short4(0)));
- break;
- default:
- ASSERT(false);
- }
- }
- break;
- case 3:
- {
- Byte4 c0 = Pointer<Byte4>(buffer[f0])[index[0]];
- Byte4 c1 = Pointer<Byte4>(buffer[f1])[index[1]];
- Byte4 c2 = Pointer<Byte4>(buffer[f2])[index[2]];
- Byte4 c3 = Pointer<Byte4>(buffer[f3])[index[3]];
- c.x = Unpack(c0, c1);
- c.y = Unpack(c2, c3);
-
- switch(state.textureFormat)
- {
- case FORMAT_X8R8G8B8:
- c.z = As<Short4>(UnpackLow(c.x, c.y));
- c.x = As<Short4>(UnpackHigh(c.x, c.y));
- c.y = c.z;
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(c.z));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(c.y));
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(c.x));
- break;
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8:
- case FORMAT_X8L8V8U8:
- case FORMAT_SRGB8_X8:
- c.z = As<Short4>(UnpackHigh(c.x, c.y));
- c.x = As<Short4>(UnpackLow(c.x, c.y));
- c.y = c.x;
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(c.x));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(c.y));
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(c.z));
- // Propagate sign bit
- if(state.textureFormat == FORMAT_X8B8G8R8I)
- {
- c.x >>= 8;
- c.y >>= 8;
- c.z >>= 8;
- }
- break;
- case FORMAT_X8B8G8R8UI:
- c.z = As<Short4>(UnpackHigh(c.x, c.y));
- c.x = As<Short4>(UnpackLow(c.x, c.y));
- c.y = c.x;
- c.x = UnpackLow(As<Byte8>(c.x), As<Byte8>(Short4(0)));
- c.y = UnpackHigh(As<Byte8>(c.y), As<Byte8>(Short4(0)));
- c.z = UnpackLow(As<Byte8>(c.z), As<Byte8>(Short4(0)));
- break;
- default:
- ASSERT(false);
- }
- }
- break;
- case 2:
- c.x = Insert(c.x, Pointer<Short>(buffer[f0])[index[0]], 0);
- c.x = Insert(c.x, Pointer<Short>(buffer[f1])[index[1]], 1);
- c.x = Insert(c.x, Pointer<Short>(buffer[f2])[index[2]], 2);
- c.x = Insert(c.x, Pointer<Short>(buffer[f3])[index[3]], 3);
-
- switch(state.textureFormat)
- {
- case FORMAT_G8R8:
- case FORMAT_G8R8_SNORM:
- case FORMAT_V8U8:
- case FORMAT_A8L8:
- c.y = (c.x & Short4(0xFF00u)) | As<Short4>(As<UShort4>(c.x) >> 8);
- c.x = (c.x & Short4(0x00FFu)) | (c.x << 8);
- break;
- case FORMAT_G8R8I:
- c.y = c.x >> 8;
- c.x = (c.x << 8) >> 8; // Propagate sign bit
- break;
- case FORMAT_G8R8UI:
- c.y = As<Short4>(As<UShort4>(c.x) >> 8);
- c.x &= Short4(0x00FFu);
- break;
- default:
- ASSERT(false);
- }
- break;
- case 1:
- {
- Int c0 = Int(*Pointer<Byte>(buffer[f0] + index[0]));
- Int c1 = Int(*Pointer<Byte>(buffer[f1] + index[1]));
- Int c2 = Int(*Pointer<Byte>(buffer[f2] + index[2]));
- Int c3 = Int(*Pointer<Byte>(buffer[f3] + index[3]));
- c0 = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24); // TODO (b/148295813) : Optimize with pshufb
-
- switch(state.textureFormat)
- {
- case FORMAT_R8I:
- case FORMAT_R8UI:
- {
- Int zero(0);
- c.x = Unpack(As<Byte4>(c0), As<Byte4>(zero));
- // Propagate sign bit
- if(state.textureFormat == FORMAT_R8I)
- {
- c.x = (c.x << 8) >> 8;
- }
- }
- break;
- default:
- c.x = Unpack(As<Byte4>(c0));
- break;
- }
- }
- break;
- default:
- ASSERT(false);
- }
- }
- else if(has16bitTextureComponents())
- {
- switch(textureComponentCount())
- {
- case 4:
- c.x = Pointer<Short4>(buffer[f0])[index[0]];
- c.y = Pointer<Short4>(buffer[f1])[index[1]];
- c.z = Pointer<Short4>(buffer[f2])[index[2]];
- c.w = Pointer<Short4>(buffer[f3])[index[3]];
- transpose4x4(c.x, c.y, c.z, c.w);
- break;
- case 3:
- c.x = Pointer<Short4>(buffer[f0])[index[0]];
- c.y = Pointer<Short4>(buffer[f1])[index[1]];
- c.z = Pointer<Short4>(buffer[f2])[index[2]];
- c.w = Pointer<Short4>(buffer[f3])[index[3]];
- transpose4x3(c.x, c.y, c.z, c.w);
- break;
- case 2:
- c.x = *Pointer<Short4>(buffer[f0] + 4 * index[0]);
- c.x = As<Short4>(UnpackLow(c.x, *Pointer<Short4>(buffer[f1] + 4 * index[1])));
- c.z = *Pointer<Short4>(buffer[f2] + 4 * index[2]);
- c.z = As<Short4>(UnpackLow(c.z, *Pointer<Short4>(buffer[f3] + 4 * index[3])));
- c.y = c.x;
- c.x = UnpackLow(As<Int2>(c.x), As<Int2>(c.z));
- c.y = UnpackHigh(As<Int2>(c.y), As<Int2>(c.z));
- break;
- case 1:
- c.x = Insert(c.x, Pointer<Short>(buffer[f0])[index[0]], 0);
- c.x = Insert(c.x, Pointer<Short>(buffer[f1])[index[1]], 1);
- c.x = Insert(c.x, Pointer<Short>(buffer[f2])[index[2]], 2);
- c.x = Insert(c.x, Pointer<Short>(buffer[f3])[index[3]], 3);
- break;
- default:
- ASSERT(false);
- }
- }
- else ASSERT(false);
-
- if(state.sRGB)
- {
- if(state.textureFormat == FORMAT_R5G6B5)
- {
- sRGBtoLinear16_5_16(c.x);
- sRGBtoLinear16_6_16(c.y);
- sRGBtoLinear16_5_16(c.z);
- }
- else
- {
- for(int i = 0; i < textureComponentCount(); i++)
- {
- if(isRGBComponent(i))
- {
- sRGBtoLinear16_8_16(c[i]);
- }
- }
- }
- }
-
- return c;
- }
-
- Vector4s SamplerCore::sampleTexel(Short4 &uuuu, Short4 &vvvv, Short4 &wwww, Vector4f &offset, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function)
- {
- Vector4s c;
-
- UInt index[4];
- computeIndices(index, uuuu, vvvv, wwww, offset, mipmap, function);
-
- if(hasYuvFormat())
- {
- // Generic YPbPr to RGB transformation
- // R = Y + 2 * (1 - Kr) * Pr
- // G = Y - 2 * Kb * (1 - Kb) / Kg * Pb - 2 * Kr * (1 - Kr) / Kg * Pr
- // B = Y + 2 * (1 - Kb) * Pb
-
- float Kb = 0.114f;
- float Kr = 0.299f;
- int studioSwing = 1;
-
- switch(state.textureFormat)
- {
- case FORMAT_YV12_BT601:
- Kb = 0.114f;
- Kr = 0.299f;
- studioSwing = 1;
- break;
- case FORMAT_YV12_BT709:
- Kb = 0.0722f;
- Kr = 0.2126f;
- studioSwing = 1;
- break;
- case FORMAT_YV12_JFIF:
- Kb = 0.114f;
- Kr = 0.299f;
- studioSwing = 0;
- break;
- default:
- ASSERT(false);
- }
-
- const float Kg = 1.0f - Kr - Kb;
-
- const float Rr = 2 * (1 - Kr);
- const float Gb = -2 * Kb * (1 - Kb) / Kg;
- const float Gr = -2 * Kr * (1 - Kr) / Kg;
- const float Bb = 2 * (1 - Kb);
-
- // Scaling and bias for studio-swing range: Y = [16 .. 235], U/V = [16 .. 240]
- const float Yy = studioSwing ? 255.0f / (235 - 16) : 1.0f;
- const float Uu = studioSwing ? 255.0f / (240 - 16) : 1.0f;
- const float Vv = studioSwing ? 255.0f / (240 - 16) : 1.0f;
-
- const float Rv = Vv * Rr;
- const float Gu = Uu * Gb;
- const float Gv = Vv * Gr;
- const float Bu = Uu * Bb;
-
- const float R0 = (studioSwing * -16 * Yy - 128 * Rv) / 255;
- const float G0 = (studioSwing * -16 * Yy - 128 * Gu - 128 * Gv) / 255;
- const float B0 = (studioSwing * -16 * Yy - 128 * Bu) / 255;
-
- Int c0 = Int(buffer[0][index[0]]);
- Int c1 = Int(buffer[0][index[1]]);
- Int c2 = Int(buffer[0][index[2]]);
- Int c3 = Int(buffer[0][index[3]]);
- c0 = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24); // TODO (b/148295813) : Optimize with pshufb
- UShort4 Y = As<UShort4>(Unpack(As<Byte4>(c0)));
-
- computeIndices(index, uuuu, vvvv, wwww, offset, mipmap + sizeof(Mipmap), function);
- c0 = Int(buffer[1][index[0]]);
- c1 = Int(buffer[1][index[1]]);
- c2 = Int(buffer[1][index[2]]);
- c3 = Int(buffer[1][index[3]]);
- c0 = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24); // TODO (b/148295813) : Optimize with pshufb
- UShort4 V = As<UShort4>(Unpack(As<Byte4>(c0)));
-
- c0 = Int(buffer[2][index[0]]);
- c1 = Int(buffer[2][index[1]]);
- c2 = Int(buffer[2][index[2]]);
- c3 = Int(buffer[2][index[3]]);
- c0 = c0 | (c1 << 8) | (c2 << 16) | (c3 << 24); // TODO (b/148295813) : Optimize with pshufb
- UShort4 U = As<UShort4>(Unpack(As<Byte4>(c0)));
-
- const UShort4 yY = UShort4(iround(Yy * 0x4000));
- const UShort4 rV = UShort4(iround(Rv * 0x4000));
- const UShort4 gU = UShort4(iround(-Gu * 0x4000));
- const UShort4 gV = UShort4(iround(-Gv * 0x4000));
- const UShort4 bU = UShort4(iround(Bu * 0x4000));
-
- const UShort4 r0 = UShort4(iround(-R0 * 0x4000));
- const UShort4 g0 = UShort4(iround(G0 * 0x4000));
- const UShort4 b0 = UShort4(iround(-B0 * 0x4000));
-
- UShort4 y = MulHigh(Y, yY);
- UShort4 r = SubSat(y + MulHigh(V, rV), r0);
- UShort4 g = SubSat(y + g0, MulHigh(U, gU) + MulHigh(V, gV));
- UShort4 b = SubSat(y + MulHigh(U, bU), b0);
-
- c.x = Min(r, UShort4(0x3FFF)) << 2;
- c.y = Min(g, UShort4(0x3FFF)) << 2;
- c.z = Min(b, UShort4(0x3FFF)) << 2;
- }
- else
- {
- return sampleTexel(index, buffer);
- }
-
- return c;
- }
-
- Vector4f SamplerCore::sampleTexel(Int4 &uuuu, Int4 &vvvv, Int4 &wwww, Float4 &z, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function)
- {
- Vector4f c;
-
- UInt index[4];
- computeIndices(index, uuuu, vvvv, wwww, mipmap, function);
-
- if(hasFloatTexture() || has32bitIntegerTextureComponents())
- {
- int f0 = state.textureType == TEXTURE_CUBE ? 0 : 0;
- int f1 = state.textureType == TEXTURE_CUBE ? 1 : 0;
- int f2 = state.textureType == TEXTURE_CUBE ? 2 : 0;
- int f3 = state.textureType == TEXTURE_CUBE ? 3 : 0;
-
- // Read texels
- switch(textureComponentCount())
- {
- case 4:
- c.x = *Pointer<Float4>(buffer[f0] + index[0] * 16, 16);
- c.y = *Pointer<Float4>(buffer[f1] + index[1] * 16, 16);
- c.z = *Pointer<Float4>(buffer[f2] + index[2] * 16, 16);
- c.w = *Pointer<Float4>(buffer[f3] + index[3] * 16, 16);
- transpose4x4(c.x, c.y, c.z, c.w);
- break;
- case 3:
- c.x = *Pointer<Float4>(buffer[f0] + index[0] * 16, 16);
- c.y = *Pointer<Float4>(buffer[f1] + index[1] * 16, 16);
- c.z = *Pointer<Float4>(buffer[f2] + index[2] * 16, 16);
- c.w = *Pointer<Float4>(buffer[f3] + index[3] * 16, 16);
- transpose4x3(c.x, c.y, c.z, c.w);
- break;
- case 2:
- // FIXME: Optimal shuffling?
- c.x.xy = *Pointer<Float4>(buffer[f0] + index[0] * 8);
- c.x.zw = *Pointer<Float4>(buffer[f1] + index[1] * 8 - 8);
- c.z.xy = *Pointer<Float4>(buffer[f2] + index[2] * 8);
- c.z.zw = *Pointer<Float4>(buffer[f3] + index[3] * 8 - 8);
- c.y = c.x;
- c.x = Float4(c.x.xz, c.z.xz);
- c.y = Float4(c.y.yw, c.z.yw);
- break;
- case 1:
- // FIXME: Optimal shuffling?
- c.x.x = *Pointer<Float>(buffer[f0] + index[0] * 4);
- c.x.y = *Pointer<Float>(buffer[f1] + index[1] * 4);
- c.x.z = *Pointer<Float>(buffer[f2] + index[2] * 4);
- c.x.w = *Pointer<Float>(buffer[f3] + index[3] * 4);
- break;
- default:
- ASSERT(false);
- }
-
- if(state.compare != COMPARE_BYPASS)
- {
- Float4 ref = z;
-
- if(!hasFloatTexture())
- {
- ref = Min(Max(ref, Float4(0.0f)), Float4(1.0f));
- }
-
- Int4 boolean;
-
- switch(state.compare)
- {
- case COMPARE_LESSEQUAL: boolean = CmpLE(ref, c.x); break;
- case COMPARE_GREATEREQUAL: boolean = CmpNLT(ref, c.x); break;
- case COMPARE_LESS: boolean = CmpLT(ref, c.x); break;
- case COMPARE_GREATER: boolean = CmpNLE(ref, c.x); break;
- case COMPARE_EQUAL: boolean = CmpEQ(ref, c.x); break;
- case COMPARE_NOTEQUAL: boolean = CmpNEQ(ref, c.x); break;
- case COMPARE_ALWAYS: boolean = Int4(-1); break;
- case COMPARE_NEVER: boolean = Int4(0); break;
- default: ASSERT(false);
- }
-
- c.x = As<Float4>(boolean & As<Int4>(Float4(1.0f)));
- c.y = Float4(0.0f);
- c.z = Float4(0.0f);
- c.w = Float4(1.0f);
- }
- }
- else
- {
- ASSERT(!hasYuvFormat());
-
- Vector4s cs = sampleTexel(index, buffer);
-
- bool isInteger = Surface::isNonNormalizedInteger(state.textureFormat);
- int componentCount = textureComponentCount();
- for(int n = 0; n < componentCount; n++)
- {
- if(hasUnsignedTextureComponent(n))
- {
- if(isInteger)
- {
- c[n] = As<Float4>(Int4(As<UShort4>(cs[n])));
- }
- else
- {
- c[n] = Float4(As<UShort4>(cs[n]));
- }
- }
- else
- {
- if(isInteger)
- {
- c[n] = As<Float4>(Int4(cs[n]));
- }
- else
- {
- c[n] = Float4(cs[n]);
- }
- }
- }
- }
-
- return c;
- }
-
- void SamplerCore::selectMipmap(Pointer<Byte> &texture, Pointer<Byte> buffer[4], Pointer<Byte> &mipmap, Float &lod, Int face[4], bool secondLOD)
- {
- if(state.mipmapFilter == MIPMAP_NONE)
- {
- mipmap = texture + OFFSET(Texture,mipmap[0]);
- }
- else
- {
- Int ilod;
-
- if(state.mipmapFilter == MIPMAP_POINT)
- {
- ilod = RoundInt(lod);
- }
- else // MIPMAP_LINEAR
- {
- ilod = Int(lod);
- }
-
- mipmap = texture + OFFSET(Texture,mipmap) + ilod * sizeof(Mipmap) + secondLOD * sizeof(Mipmap);
- }
-
- if(state.textureType != TEXTURE_CUBE)
- {
- buffer[0] = *Pointer<Pointer<Byte> >(mipmap + OFFSET(Mipmap,buffer[0]));
-
- if(hasYuvFormat())
- {
- buffer[1] = *Pointer<Pointer<Byte> >(mipmap + OFFSET(Mipmap,buffer[1]));
- buffer[2] = *Pointer<Pointer<Byte> >(mipmap + OFFSET(Mipmap,buffer[2]));
- }
- }
- else
- {
- for(int i = 0; i < 4; i++)
- {
- buffer[i] = *Pointer<Pointer<Byte> >(mipmap + OFFSET(Mipmap,buffer) + face[i] * sizeof(void*));
- }
- }
- }
-
- Int4 SamplerCore::computeFilterOffset(Float &lod)
- {
- Int4 filter = -1;
-
- if(state.textureFilter == FILTER_POINT)
- {
- filter = 0;
- }
- else if(state.textureFilter == FILTER_MIN_LINEAR_MAG_POINT)
- {
- filter = CmpNLE(Float4(lod), Float4(0.0f));
- }
- else if(state.textureFilter == FILTER_MIN_POINT_MAG_LINEAR)
- {
- filter = CmpLE(Float4(lod), Float4(0.0f));
- }
-
- return filter;
- }
-
- Short4 SamplerCore::address(Float4 &uw, AddressingMode addressingMode, Pointer<Byte> &mipmap)
- {
- if(addressingMode == ADDRESSING_LAYER && state.textureType != TEXTURE_2D_ARRAY)
- {
- return Short4(); // Unused
- }
- else if(addressingMode == ADDRESSING_LAYER && state.textureType == TEXTURE_2D_ARRAY)
- {
- return Min(Max(Short4(RoundInt(uw)), Short4(0)), *Pointer<Short4>(mipmap + OFFSET(Mipmap, depth)) - Short4(1));
- }
- else if(addressingMode == ADDRESSING_CLAMP || addressingMode == ADDRESSING_BORDER)
- {
- Float4 clamp = Min(Max(uw, Float4(0.0f)), Float4(65535.0f / 65536.0f));
-
- return Short4(Int4(clamp * Float4(1 << 16)));
- }
- else if(addressingMode == ADDRESSING_MIRROR)
- {
- Int4 convert = Int4(uw * Float4(1 << 16));
- Int4 mirror = (convert << 15) >> 31;
-
- convert ^= mirror;
-
- return Short4(convert);
- }
- else if(addressingMode == ADDRESSING_MIRRORONCE)
- {
- // Absolute value
- Int4 convert = Int4(Abs(uw * Float4(1 << 16)));
-
- // Clamp
- convert -= Int4(0x00008000, 0x00008000, 0x00008000, 0x00008000);
- convert = As<Int4>(PackSigned(convert, convert));
-
- return As<Short4>(Int2(convert)) + Short4(0x8000u);
- }
- else // Wrap
- {
- return Short4(Int4(uw * Float4(1 << 16)));
- }
- }
-
- void SamplerCore::address(Float4 &uvw, Int4 &xyz0, Int4 &xyz1, Float4 &f, Pointer<Byte> &mipmap, Float4 &texOffset, Int4 &filter, int whd, AddressingMode addressingMode, SamplerFunction function)
- {
- if(addressingMode == ADDRESSING_LAYER && state.textureType != TEXTURE_2D_ARRAY)
- {
- return; // Unused
- }
-
- Int4 dim = Int4(*Pointer<Short4>(mipmap + whd, 16));
- Int4 maxXYZ = dim - Int4(1);
-
- if(function == Fetch)
- {
- xyz0 = Min(Max(((function.option == Offset) && (addressingMode != ADDRESSING_LAYER)) ? As<Int4>(uvw) + As<Int4>(texOffset) : As<Int4>(uvw), Int4(0)), maxXYZ);
- }
- else if(addressingMode == ADDRESSING_LAYER && state.textureType == TEXTURE_2D_ARRAY) // Note: Offset does not apply to array layers
- {
- xyz0 = Min(Max(RoundInt(uvw), Int4(0)), maxXYZ);
- }
- else
- {
- const int halfBits = 0x3EFFFFFF; // Value just under 0.5f
- const int oneBits = 0x3F7FFFFF; // Value just under 1.0f
- const int twoBits = 0x3FFFFFFF; // Value just under 2.0f
-
- Float4 coord = uvw;
-
- if(state.textureType == TEXTURE_RECTANGLE)
- {
- // According to https://www.khronos.org/registry/OpenGL/extensions/ARB/ARB_texture_rectangle.txt
- // "CLAMP_TO_EDGE causes the s coordinate to be clamped to the range[0.5, wt - 0.5].
- // CLAMP_TO_EDGE causes the t coordinate to be clamped to the range[0.5, ht - 0.5]."
- // Unless SwiftShader implements support for ADDRESSING_BORDER, other modes should be equivalent
- // to CLAMP_TO_EDGE. Rectangle textures have no support for any MIRROR or REPEAT modes.
- coord = Min(Max(coord, Float4(0.5f)), Float4(dim) - Float4(0.5f));
- }
- else
- {
- switch(addressingMode)
- {
- case ADDRESSING_CLAMP:
- case ADDRESSING_BORDER:
- case ADDRESSING_SEAMLESS:
- {
- // While cube face coordinates are nominally already in the
- // [0, 1] range due to the projection, and numerical
- // imprecision is tolerated due to the border of pixels for
- // seamless filtering, this isn't true for inf and NaN
- // values. So we always clamp.
- Float4 one = As<Float4>(Int4(oneBits));
- coord = Min(Max(coord, Float4(0.0f)), one);
- }
- break;
- case ADDRESSING_MIRROR:
- {
- Float4 half = As<Float4>(Int4(halfBits));
- Float4 one = As<Float4>(Int4(oneBits));
- Float4 two = As<Float4>(Int4(twoBits));
- coord = one - Abs(two * Frac(coord * half) - one);
- }
- break;
- case ADDRESSING_MIRRORONCE:
- {
- Float4 half = As<Float4>(Int4(halfBits));
- Float4 one = As<Float4>(Int4(oneBits));
- Float4 two = As<Float4>(Int4(twoBits));
- coord = one - Abs(two * Frac(Min(Max(coord, -one), two) * half) - one);
- }
- break;
- default: // Wrap
- coord = Frac(coord);
- break;
- }
-
- coord = coord * Float4(dim);
- }
-
- if(state.textureFilter == FILTER_POINT ||
- state.textureFilter == FILTER_GATHER)
- {
- xyz0 = Int4(coord);
- }
- else
- {
- if(state.textureFilter == FILTER_MIN_POINT_MAG_LINEAR ||
- state.textureFilter == FILTER_MIN_LINEAR_MAG_POINT)
- {
- coord -= As<Float4>(As<Int4>(Float4(0.5f)) & filter);
- }
- else
- {
- coord -= Float4(0.5f);
- }
-
- Float4 floor = Floor(coord);
- xyz0 = Int4(floor);
- f = coord - floor;
- }
-
- if(function.option == Offset)
- {
- xyz0 += As<Int4>(texOffset);
- }
-
- if(addressingMode == ADDRESSING_SEAMLESS)
- {
- xyz0 += Int4(1);
- }
-
- xyz1 = xyz0 - filter; // Increment
-
- if(function.option == Offset)
- {
- switch(addressingMode)
- {
- case ADDRESSING_SEAMLESS:
- ASSERT(false); // Cube sampling doesn't support offset.
- case ADDRESSING_MIRROR:
- case ADDRESSING_MIRRORONCE:
- case ADDRESSING_BORDER:
- // FIXME: Implement ADDRESSING_MIRROR, ADDRESSING_MIRRORONCE, and ADDRESSING_BORDER.
- // Fall through to Clamp.
- case ADDRESSING_CLAMP:
- xyz0 = Min(Max(xyz0, Int4(0)), maxXYZ);
- xyz1 = Min(Max(xyz1, Int4(0)), maxXYZ);
- break;
- default: // Wrap
- xyz0 = (xyz0 + dim * Int4(-MIN_PROGRAM_TEXEL_OFFSET)) % dim;
- xyz1 = (xyz1 + dim * Int4(-MIN_PROGRAM_TEXEL_OFFSET)) % dim;
- break;
- }
- }
- else if(state.textureFilter != FILTER_POINT)
- {
- switch(addressingMode)
- {
- case ADDRESSING_SEAMLESS:
- break;
- case ADDRESSING_MIRROR:
- case ADDRESSING_MIRRORONCE:
- case ADDRESSING_BORDER:
- case ADDRESSING_CLAMP:
- xyz0 = Max(xyz0, Int4(0));
- xyz1 = Min(xyz1, maxXYZ);
- break;
- default: // Wrap
- {
- Int4 under = CmpLT(xyz0, Int4(0));
- xyz0 = (under & maxXYZ) | (~under & xyz0); // xyz < 0 ? dim - 1 : xyz // TODO: IfThenElse()
-
- Int4 nover = CmpLT(xyz1, dim);
- xyz1 = nover & xyz1; // xyz >= dim ? 0 : xyz
- }
- break;
- }
- }
- }
- }
-
- void SamplerCore::convertFixed12(Short4 &cs, Float4 &cf)
- {
- cs = RoundShort4(cf * Float4(0x1000));
- }
-
- void SamplerCore::convertFixed12(Vector4s &cs, Vector4f &cf)
- {
- convertFixed12(cs.x, cf.x);
- convertFixed12(cs.y, cf.y);
- convertFixed12(cs.z, cf.z);
- convertFixed12(cs.w, cf.w);
- }
-
- void SamplerCore::convertSigned12(Float4 &cf, Short4 &cs)
- {
- cf = Float4(cs) * Float4(1.0f / 0x0FFE);
- }
-
-// void SamplerCore::convertSigned12(Vector4f &cf, Vector4s &cs)
-// {
-// convertSigned12(cf.x, cs.x);
-// convertSigned12(cf.y, cs.y);
-// convertSigned12(cf.z, cs.z);
-// convertSigned12(cf.w, cs.w);
-// }
-
- void SamplerCore::convertSigned15(Float4 &cf, Short4 &cs)
- {
- cf = Float4(cs) * Float4(1.0f / 0x7FFF);
- }
-
- void SamplerCore::convertUnsigned16(Float4 &cf, Short4 &cs)
- {
- cf = Float4(As<UShort4>(cs)) * Float4(1.0f / 0xFFFF);
- }
-
- void SamplerCore::sRGBtoLinear16_8_16(Short4 &c)
- {
- c = As<UShort4>(c) >> 8;
-
- Pointer<Byte> LUT = Pointer<Byte>(constants + OFFSET(Constants,sRGBtoLinear8_16));
-
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 0))), 0);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 1))), 1);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 2))), 2);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 3))), 3);
- }
-
- void SamplerCore::sRGBtoLinear16_6_16(Short4 &c)
- {
- c = As<UShort4>(c) >> 10;
-
- Pointer<Byte> LUT = Pointer<Byte>(constants + OFFSET(Constants,sRGBtoLinear6_16));
-
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 0))), 0);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 1))), 1);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 2))), 2);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 3))), 3);
- }
-
- void SamplerCore::sRGBtoLinear16_5_16(Short4 &c)
- {
- c = As<UShort4>(c) >> 11;
-
- Pointer<Byte> LUT = Pointer<Byte>(constants + OFFSET(Constants,sRGBtoLinear5_16));
-
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 0))), 0);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 1))), 1);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 2))), 2);
- c = Insert(c, *Pointer<Short>(LUT + 2 * Int(Extract(c, 3))), 3);
- }
-
- bool SamplerCore::hasFloatTexture() const
- {
- return Surface::isFloatFormat(state.textureFormat);
- }
-
- bool SamplerCore::hasUnnormalizedIntegerTexture() const
- {
- return Surface::isNonNormalizedInteger(state.textureFormat);
- }
-
- bool SamplerCore::hasUnsignedTextureComponent(int component) const
- {
- return Surface::isUnsignedComponent(state.textureFormat, component);
- }
-
- int SamplerCore::textureComponentCount() const
- {
- return Surface::componentCount(state.textureFormat);
- }
-
- bool SamplerCore::hasThirdCoordinate() const
- {
- return (state.textureType == TEXTURE_3D) || (state.textureType == TEXTURE_2D_ARRAY);
- }
-
- bool SamplerCore::has16bitTextureFormat() const
- {
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5:
- return true;
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_L16:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return false;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool SamplerCore::has8bitTextureComponents() const
- {
- switch(state.textureFormat)
- {
- case FORMAT_G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- return true;
- case FORMAT_R5G6B5:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_L16:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return false;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool SamplerCore::has16bitTextureComponents() const
- {
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5:
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return false;
- case FORMAT_L16:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- return true;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool SamplerCore::has32bitIntegerTextureComponents() const
- {
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5:
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_L16:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return false;
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- return true;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool SamplerCore::hasYuvFormat() const
- {
- switch(state.textureFormat)
- {
- case FORMAT_YV12_BT601:
- case FORMAT_YV12_BT709:
- case FORMAT_YV12_JFIF:
- return true;
- case FORMAT_R5G6B5:
- case FORMAT_R8_SNORM:
- case FORMAT_G8R8_SNORM:
- case FORMAT_X8B8G8R8_SNORM:
- case FORMAT_A8B8G8R8_SNORM:
- case FORMAT_R8I:
- case FORMAT_R8UI:
- case FORMAT_G8R8I:
- case FORMAT_G8R8UI:
- case FORMAT_X8B8G8R8I:
- case FORMAT_X8B8G8R8UI:
- case FORMAT_A8B8G8R8I:
- case FORMAT_A8B8G8R8UI:
- case FORMAT_R32I:
- case FORMAT_R32UI:
- case FORMAT_G32R32I:
- case FORMAT_G32R32UI:
- case FORMAT_X32B32G32R32I:
- case FORMAT_X32B32G32R32UI:
- case FORMAT_A32B32G32R32I:
- case FORMAT_A32B32G32R32UI:
- case FORMAT_G8R8:
- case FORMAT_X8R8G8B8:
- case FORMAT_X8B8G8R8:
- case FORMAT_A8R8G8B8:
- case FORMAT_A8B8G8R8:
- case FORMAT_SRGB8_X8:
- case FORMAT_SRGB8_A8:
- case FORMAT_V8U8:
- case FORMAT_Q8W8V8U8:
- case FORMAT_X8L8V8U8:
- case FORMAT_R32F:
- case FORMAT_G32R32F:
- case FORMAT_X32B32G32R32F:
- case FORMAT_A32B32G32R32F:
- case FORMAT_X32B32G32R32F_UNSIGNED:
- case FORMAT_A8:
- case FORMAT_R8:
- case FORMAT_L8:
- case FORMAT_A8L8:
- case FORMAT_D32F_LOCKABLE:
- case FORMAT_D32FS8_TEXTURE:
- case FORMAT_D32F_SHADOW:
- case FORMAT_D32FS8_SHADOW:
- case FORMAT_L16:
- case FORMAT_G16R16:
- case FORMAT_A16B16G16R16:
- case FORMAT_R16I:
- case FORMAT_R16UI:
- case FORMAT_G16R16I:
- case FORMAT_G16R16UI:
- case FORMAT_X16B16G16R16I:
- case FORMAT_X16B16G16R16UI:
- case FORMAT_A16B16G16R16I:
- case FORMAT_A16B16G16R16UI:
- case FORMAT_V16U16:
- case FORMAT_A16W16V16U16:
- case FORMAT_Q16W16V16U16:
- return false;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-
- bool SamplerCore::isRGBComponent(int component) const
- {
- switch(state.textureFormat)
- {
- case FORMAT_R5G6B5: return component < 3;
- case FORMAT_R8_SNORM: return component < 1;
- case FORMAT_G8R8_SNORM: return component < 2;
- case FORMAT_X8B8G8R8_SNORM: return component < 3;
- case FORMAT_A8B8G8R8_SNORM: return component < 3;
- case FORMAT_R8I: return component < 1;
- case FORMAT_R8UI: return component < 1;
- case FORMAT_G8R8I: return component < 2;
- case FORMAT_G8R8UI: return component < 2;
- case FORMAT_X8B8G8R8I: return component < 3;
- case FORMAT_X8B8G8R8UI: return component < 3;
- case FORMAT_A8B8G8R8I: return component < 3;
- case FORMAT_A8B8G8R8UI: return component < 3;
- case FORMAT_R32I: return component < 1;
- case FORMAT_R32UI: return component < 1;
- case FORMAT_G32R32I: return component < 2;
- case FORMAT_G32R32UI: return component < 2;
- case FORMAT_X32B32G32R32I: return component < 3;
- case FORMAT_X32B32G32R32UI: return component < 3;
- case FORMAT_A32B32G32R32I: return component < 3;
- case FORMAT_A32B32G32R32UI: return component < 3;
- case FORMAT_G8R8: return component < 2;
- case FORMAT_X8R8G8B8: return component < 3;
- case FORMAT_X8B8G8R8: return component < 3;
- case FORMAT_A8R8G8B8: return component < 3;
- case FORMAT_A8B8G8R8: return component < 3;
- case FORMAT_SRGB8_X8: return component < 3;
- case FORMAT_SRGB8_A8: return component < 3;
- case FORMAT_V8U8: return false;
- case FORMAT_Q8W8V8U8: return false;
- case FORMAT_X8L8V8U8: return false;
- case FORMAT_R32F: return component < 1;
- case FORMAT_G32R32F: return component < 2;
- case FORMAT_X32B32G32R32F: return component < 3;
- case FORMAT_A32B32G32R32F: return component < 3;
- case FORMAT_X32B32G32R32F_UNSIGNED: return component < 3;
- case FORMAT_A8: return false;
- case FORMAT_R8: return component < 1;
- case FORMAT_L8: return component < 1;
- case FORMAT_A8L8: return component < 1;
- case FORMAT_D32F_LOCKABLE: return false;
- case FORMAT_D32FS8_TEXTURE: return false;
- case FORMAT_D32F_SHADOW: return false;
- case FORMAT_D32FS8_SHADOW: return false;
- case FORMAT_L16: return component < 1;
- case FORMAT_G16R16: return component < 2;
- case FORMAT_A16B16G16R16: return component < 3;
- case FORMAT_R16I: return component < 1;
- case FORMAT_R16UI: return component < 1;
- case FORMAT_G16R16I: return component < 2;
- case FORMAT_G16R16UI: return component < 2;
- case FORMAT_X16B16G16R16I: return component < 3;
- case FORMAT_X16B16G16R16UI: return component < 3;
- case FORMAT_A16B16G16R16I: return component < 3;
- case FORMAT_A16B16G16R16UI: return component < 3;
- case FORMAT_V16U16: return false;
- case FORMAT_A16W16V16U16: return false;
- case FORMAT_Q16W16V16U16: return false;
- case FORMAT_YV12_BT601: return component < 3;
- case FORMAT_YV12_BT709: return component < 3;
- case FORMAT_YV12_JFIF: return component < 3;
- default:
- ASSERT(false);
- }
-
- return false;
- }
-}
diff --git a/src/Shader/SamplerCore.hpp b/src/Shader/SamplerCore.hpp
deleted file mode 100644
index 684c1a749..000000000
--- a/src/Shader/SamplerCore.hpp
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_SamplerCore_hpp
-#define sw_SamplerCore_hpp
-
-#include "PixelRoutine.hpp"
-#include "Reactor/Reactor.hpp"
-
-namespace sw
-{
- enum SamplerMethod
- {
- Implicit, // Compute gradients (pixel shader only).
- Bias, // Compute gradients and add provided bias.
- Lod, // Use provided LOD.
- Grad, // Use provided gradients.
- Fetch, // Use provided integer coordinates.
- Base // Sample base level.
- };
-
- enum SamplerOption
- {
- None,
- Offset // Offset sample location by provided integer coordinates.
- };
-
- struct SamplerFunction
- {
- SamplerFunction(SamplerMethod method, SamplerOption option = None) : method(method), option(option) {}
- operator SamplerMethod() { return method; }
-
- const SamplerMethod method;
- const SamplerOption option;
- };
-
- class SamplerCore
- {
- public:
- SamplerCore(Pointer<Byte> &constants, const Sampler::State &state);
-
- Vector4s sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy);
- Vector4f sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
- static Vector4f textureSize(Pointer<Byte> &mipmap, Float4 &lod);
-
- private:
- Vector4s sampleTexture(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Float4 &bias, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function, bool fixed12);
-
- void border(Short4 &mask, Float4 &coordinates);
- void border(Int4 &mask, Float4 &coordinates);
- Short4 offsetSample(Short4 &uvw, Pointer<Byte> &mipmap, int halfOffset, bool wrap, int count, Float &lod);
- Vector4s sampleFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function);
- Vector4s sampleAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4s sampleQuad(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4s sampleQuad2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4s sample3D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function);
- Vector4f sampleFloatFilter(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], SamplerFunction function);
- Vector4f sampleFloatAniso(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4f sampleFloat(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4f sampleFloat2D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Float4 &q, Vector4f &offset, Float &lod, Int face[4], bool secondLOD, SamplerFunction function);
- Vector4f sampleFloat3D(Pointer<Byte> &texture, Float4 &u, Float4 &v, Float4 &w, Vector4f &offset, Float &lod, bool secondLOD, SamplerFunction function);
- Float log2sqrt(Float lod);
- Float log2(Float lod);
- void computeLod(Pointer<Byte> &texture, Float &lod, Float &anisotropy, Float4 &uDelta, Float4 &vDelta, Float4 &u, Float4 &v, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function);
- void computeLodCube(Pointer<Byte> &texture, Float &lod, Float4 &u, Float4 &v, Float4 &w, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, Float4 &M, SamplerFunction function);
- void computeLod3D(Pointer<Byte> &texture, Float &lod, Float4 &u, Float4 &v, Float4 &w, const Float &lodBias, Vector4f &dsx, Vector4f &dsy, SamplerFunction function);
- void cubeFace(Int face[4], Float4 &U, Float4 &V, Float4 &x, Float4 &y, Float4 &z, Float4 &M);
- Short4 applyOffset(Short4 &uvw, Float4 &offset, const Int4 &whd, AddressingMode mode);
- void computeIndices(UInt index[4], Short4 uuuu, Short4 vvvv, Short4 wwww, Vector4f &offset, const Pointer<Byte> &mipmap, SamplerFunction function);
- void computeIndices(UInt index[4], Int4& uuuu, Int4& vvvv, Int4& wwww, const Pointer<Byte> &mipmap, SamplerFunction function);
- Vector4s sampleTexel(Short4 &u, Short4 &v, Short4 &s, Vector4f &offset, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function);
- Vector4s sampleTexel(UInt index[4], Pointer<Byte> buffer[4]);
- Vector4f sampleTexel(Int4 &u, Int4 &v, Int4 &s, Float4 &z, Pointer<Byte> &mipmap, Pointer<Byte> buffer[4], SamplerFunction function);
- void selectMipmap(Pointer<Byte> &texture, Pointer<Byte> buffer[4], Pointer<Byte> &mipmap, Float &lod, Int face[4], bool secondLOD);
- Short4 address(Float4 &uw, AddressingMode addressingMode, Pointer<Byte>& mipmap);
- void address(Float4 &uw, Int4& xyz0, Int4& xyz1, Float4& f, Pointer<Byte>& mipmap, Float4 &texOffset, Int4 &filter, int whd, AddressingMode addressingMode, SamplerFunction function);
- Int4 computeFilterOffset(Float &lod);
-
- void convertFixed12(Short4 &ci, Float4 &cf);
- void convertFixed12(Vector4s &cs, Vector4f &cf);
- void convertSigned12(Float4 &cf, Short4 &ci);
- void convertSigned15(Float4 &cf, Short4 &ci);
- void convertUnsigned16(Float4 &cf, Short4 &ci);
- void sRGBtoLinear16_8_16(Short4 &c);
- void sRGBtoLinear16_6_16(Short4 &c);
- void sRGBtoLinear16_5_16(Short4 &c);
-
- bool hasFloatTexture() const;
- bool hasUnnormalizedIntegerTexture() const;
- bool hasUnsignedTextureComponent(int component) const;
- int textureComponentCount() const;
- bool hasThirdCoordinate() const;
- bool has16bitTextureFormat() const;
- bool has8bitTextureComponents() const;
- bool has16bitTextureComponents() const;
- bool has32bitIntegerTextureComponents() const;
- bool hasYuvFormat() const;
- bool isRGBComponent(int component) const;
-
- Pointer<Byte> &constants;
- const Sampler::State &state;
- };
-}
-
-#endif // sw_SamplerCore_hpp
diff --git a/src/Shader/SetupRoutine.cpp b/src/Shader/SetupRoutine.cpp
deleted file mode 100644
index 14d6b761e..000000000
--- a/src/Shader/SetupRoutine.cpp
+++ /dev/null
@@ -1,672 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "SetupRoutine.hpp"
-
-#include "Constants.hpp"
-#include "Renderer/Primitive.hpp"
-#include "Renderer/Polygon.hpp"
-#include "Renderer/Renderer.hpp"
-#include "Reactor/Reactor.hpp"
-
-namespace sw
-{
- extern bool complementaryDepthBuffer;
- extern TranscendentalPrecision logPrecision;
- extern bool leadingVertexFirst;
-
- SetupRoutine::SetupRoutine(const SetupProcessor::State &state) : state(state)
- {
- routine = 0;
- }
-
- SetupRoutine::~SetupRoutine()
- {
- }
-
- void SetupRoutine::generate()
- {
- Function<Int(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)> function;
- {
- Pointer<Byte> primitive(function.Arg<0>());
- Pointer<Byte> tri(function.Arg<1>());
- Pointer<Byte> polygon(function.Arg<2>());
- Pointer<Byte> data(function.Arg<3>());
-
- Pointer<Byte> constants = *Pointer<Pointer<Byte> >(data + OFFSET(DrawData,constants));
-
- const bool point = state.isDrawPoint;
- const bool sprite = state.pointSprite;
- const bool line = state.isDrawLine;
- const bool triangle = state.isDrawSolidTriangle || sprite;
- const bool solidTriangle = state.isDrawSolidTriangle;
-
- const int V0 = OFFSET(Triangle,v0);
- const int V1 = (triangle || line) ? OFFSET(Triangle,v1) : OFFSET(Triangle,v0);
- const int V2 = triangle ? OFFSET(Triangle,v2) : (line ? OFFSET(Triangle,v1) : OFFSET(Triangle,v0));
-
- int pos = state.positionRegister;
-
- Pointer<Byte> v0 = tri + V0;
- Pointer<Byte> v1 = tri + V1;
- Pointer<Byte> v2 = tri + V2;
-
- Array<Int> X(16);
- Array<Int> Y(16);
-
- X[0] = *Pointer<Int>(v0 + OFFSET(Vertex,X));
- X[1] = *Pointer<Int>(v1 + OFFSET(Vertex,X));
- X[2] = *Pointer<Int>(v2 + OFFSET(Vertex,X));
-
- Y[0] = *Pointer<Int>(v0 + OFFSET(Vertex,Y));
- Y[1] = *Pointer<Int>(v1 + OFFSET(Vertex,Y));
- Y[2] = *Pointer<Int>(v2 + OFFSET(Vertex,Y));
-
- Int d = 1; // Winding direction
-
- // Culling
- if(solidTriangle)
- {
- Float x0 = Float(X[0]);
- Float x1 = Float(X[1]);
- Float x2 = Float(X[2]);
-
- Float y0 = Float(Y[0]);
- Float y1 = Float(Y[1]);
- Float y2 = Float(Y[2]);
-
- Float A = (y2 - y0) * x1 + (y1 - y2) * x0 + (y0 - y1) * x2; // Area
-
- If(A == 0.0f)
- {
- Return(0);
- }
-
- Int w0w1w2 = *Pointer<Int>(v0 + pos * 16 + 12) ^
- *Pointer<Int>(v1 + pos * 16 + 12) ^
- *Pointer<Int>(v2 + pos * 16 + 12);
-
- A = IfThenElse(w0w1w2 < 0, -A, A);
-
- if(state.cullMode == CULL_CLOCKWISE)
- {
- If(A >= 0.0f) Return(0);
- }
- else if(state.cullMode == CULL_COUNTERCLOCKWISE)
- {
- If(A <= 0.0f) Return(0);
- }
-
- d = IfThenElse(A < 0.0f, d, Int(0));
-
- if(state.twoSidedStencil)
- {
- If(A > 0.0f)
- {
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- }
- Else
- {
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- }
- }
-
- if(state.vFace)
- {
- *Pointer<Float>(primitive + OFFSET(Primitive,area)) = 0.5f * A;
- }
- }
- else
- {
- if(state.twoSidedStencil)
- {
- *Pointer<Byte8>(primitive + OFFSET(Primitive,clockwiseMask)) = Byte8(0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
- *Pointer<Byte8>(primitive + OFFSET(Primitive,invClockwiseMask)) = Byte8(0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00);
- }
- }
-
- Int n = *Pointer<Int>(polygon + OFFSET(Polygon,n));
- Int m = *Pointer<Int>(polygon + OFFSET(Polygon,i));
-
- If(m != 0 || Bool(!solidTriangle)) // Clipped triangle; reproject
- {
- Pointer<Byte> V = polygon + OFFSET(Polygon,P) + m * sizeof(void*) * 16;
-
- Int i = 0;
-
- Do
- {
- Pointer<Float4> p = *Pointer<Pointer<Float4> >(V + i * sizeof(void*));
- Float4 v = *Pointer<Float4>(p, 16);
-
- Float w = v.w;
- Float rhw = IfThenElse(w != 0.0f, 1.0f / w, Float(1.0f));
-
- X[i] = RoundInt(*Pointer<Float>(data + OFFSET(DrawData,X0x16)) + v.x * rhw * *Pointer<Float>(data + OFFSET(DrawData,Wx16)));
- Y[i] = RoundInt(*Pointer<Float>(data + OFFSET(DrawData,Y0x16)) + v.y * rhw * *Pointer<Float>(data + OFFSET(DrawData,Hx16)));
-
- i++;
- }
- Until(i >= n);
- }
-
- // Vertical range
- Int yMin = Y[0];
- Int yMax = Y[0];
-
- Int i = 1;
-
- Do
- {
- yMin = Min(Y[i], yMin);
- yMax = Max(Y[i], yMax);
-
- i++;
- }
- Until(i >= n);
-
- if(state.multiSample > 1)
- {
- yMin = (yMin + 0x0A) >> 4;
- yMax = (yMax + 0x14) >> 4;
- }
- else
- {
- yMin = (yMin + 0x0F) >> 4;
- yMax = (yMax + 0x0F) >> 4;
- }
-
- yMin = Max(yMin, *Pointer<Int>(data + OFFSET(DrawData,scissorY0)));
- yMax = Min(yMax, *Pointer<Int>(data + OFFSET(DrawData,scissorY1)));
-
- // If yMin and yMax are initially negative, the scissor clamping above will typically result
- // in yMin == 0 and yMax unchanged. We bail as we don't need to rasterize this primitive, and
- // code below assumes yMin < yMax.
- If(yMin >= yMax)
- {
- Return(0);
- }
-
- For(Int q = 0, q < state.multiSample, q++)
- {
- Array<Int> Xq(16);
- Array<Int> Yq(16);
-
- Int i = 0;
-
- Do
- {
- Xq[i] = X[i];
- Yq[i] = Y[i];
-
- if(state.multiSample > 1)
- {
- Xq[i] = Xq[i] + *Pointer<Int>(constants + OFFSET(Constants,Xf) + q * sizeof(int));
- Yq[i] = Yq[i] + *Pointer<Int>(constants + OFFSET(Constants,Yf) + q * sizeof(int));
- }
-
- i++;
- }
- Until(i >= n);
-
- Pointer<Byte> leftEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->left)) + q * sizeof(Primitive);
- Pointer<Byte> rightEdge = Pointer<Byte>(primitive + OFFSET(Primitive,outline->right)) + q * sizeof(Primitive);
-
- if(state.multiSample > 1)
- {
- Int xMin = *Pointer<Int>(data + OFFSET(DrawData, scissorX0));
- Int xMax = *Pointer<Int>(data + OFFSET(DrawData, scissorX1));
- Short x = Short(Clamp((X[0] + 0xF) >> 4, xMin, xMax));
-
- For(Int y = yMin - 1, y < yMax + 1, y++)
- {
- *Pointer<Short>(leftEdge + y * sizeof(Primitive::Span)) = x;
- *Pointer<Short>(rightEdge + y * sizeof(Primitive::Span)) = x;
- }
- }
-
- Xq[n] = Xq[0];
- Yq[n] = Yq[0];
-
- // Rasterize
- {
- Int i = 0;
-
- Do
- {
- edge(primitive, data, Xq[i + 1 - d], Yq[i + 1 - d], Xq[i + d], Yq[i + d], q);
-
- i++;
- }
- Until(i >= n);
- }
-
- if(state.multiSample == 1)
- {
- For(, yMin < yMax && *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + yMin * sizeof(Primitive::Span)), yMin++)
- {
- // Increments yMin
- }
-
- For(, yMax > yMin && *Pointer<Short>(leftEdge + (yMax - 1) * sizeof(Primitive::Span)) == *Pointer<Short>(rightEdge + (yMax - 1) * sizeof(Primitive::Span)), yMax--)
- {
- // Decrements yMax
- }
-
- If(yMin == yMax)
- {
- Return(0);
- }
-
- *Pointer<Short>(leftEdge + (yMin - 1) * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span));
- *Pointer<Short>(rightEdge + (yMin - 1) * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + yMin * sizeof(Primitive::Span));
- *Pointer<Short>(leftEdge + yMax * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + (yMax - 1) * sizeof(Primitive::Span));
- *Pointer<Short>(rightEdge + yMax * sizeof(Primitive::Span)) = *Pointer<Short>(leftEdge + (yMax - 1) * sizeof(Primitive::Span));
- }
- }
-
- *Pointer<Int>(primitive + OFFSET(Primitive,yMin)) = yMin;
- *Pointer<Int>(primitive + OFFSET(Primitive,yMax)) = yMax;
-
- // Sort by minimum y
- if(solidTriangle && logPrecision >= WHQL)
- {
- Float y0 = *Pointer<Float>(v0 + pos * 16 + 4);
- Float y1 = *Pointer<Float>(v1 + pos * 16 + 4);
- Float y2 = *Pointer<Float>(v2 + pos * 16 + 4);
-
- Float yMin = Min(Min(y0, y1), y2);
-
- conditionalRotate1(yMin == y1, v0, v1, v2);
- conditionalRotate2(yMin == y2, v0, v1, v2);
- }
-
- // Sort by maximum w
- if(solidTriangle)
- {
- Float w0 = *Pointer<Float>(v0 + pos * 16 + 12);
- Float w1 = *Pointer<Float>(v1 + pos * 16 + 12);
- Float w2 = *Pointer<Float>(v2 + pos * 16 + 12);
-
- Float wMax = Max(Max(w0, w1), w2);
-
- conditionalRotate1(wMax == w1, v0, v1, v2);
- conditionalRotate2(wMax == w2, v0, v1, v2);
- }
-
- Float w0 = *Pointer<Float>(v0 + pos * 16 + 12);
- Float w1 = *Pointer<Float>(v1 + pos * 16 + 12);
- Float w2 = *Pointer<Float>(v2 + pos * 16 + 12);
-
- Float4 w012;
-
- w012.x = w0;
- w012.y = w1;
- w012.z = w2;
- w012.w = 1;
-
- Float rhw0 = *Pointer<Float>(v0 + OFFSET(Vertex,W));
-
- Int X0 = *Pointer<Int>(v0 + OFFSET(Vertex,X));
- Int X1 = *Pointer<Int>(v1 + OFFSET(Vertex,X));
- Int X2 = *Pointer<Int>(v2 + OFFSET(Vertex,X));
-
- Int Y0 = *Pointer<Int>(v0 + OFFSET(Vertex,Y));
- Int Y1 = *Pointer<Int>(v1 + OFFSET(Vertex,Y));
- Int Y2 = *Pointer<Int>(v2 + OFFSET(Vertex,Y));
-
- if(line)
- {
- X2 = X1 + Y1 - Y0;
- Y2 = Y1 + X0 - X1;
- }
-
- Float dx = Float(X0) * (1.0f / 16.0f);
- Float dy = Float(Y0) * (1.0f / 16.0f);
-
- X1 -= X0;
- Y1 -= Y0;
-
- X2 -= X0;
- Y2 -= Y0;
-
- Float x1 = w1 * (1.0f / 16.0f) * Float(X1);
- Float y1 = w1 * (1.0f / 16.0f) * Float(Y1);
-
- Float x2 = w2 * (1.0f / 16.0f) * Float(X2);
- Float y2 = w2 * (1.0f / 16.0f) * Float(Y2);
-
- Float a = x1 * y2 - x2 * y1;
-
- Float4 xQuad = Float4(0, 1, 0, 1) - Float4(dx);
- Float4 yQuad = Float4(0, 0, 1, 1) - Float4(dy);
-
- *Pointer<Float4>(primitive + OFFSET(Primitive,xQuad), 16) = xQuad;
- *Pointer<Float4>(primitive + OFFSET(Primitive,yQuad), 16) = yQuad;
-
- Float4 M[3];
-
- M[0] = Float4(0, 0, 0, 0);
- M[1] = Float4(0, 0, 0, 0);
- M[2] = Float4(0, 0, 0, 0);
-
- M[0].z = rhw0;
-
- If(a != 0.0f)
- {
- Float A = 1.0f / a;
- Float D = A * rhw0;
-
- M[0].x = (y1 * w2 - y2 * w1) * D;
- M[0].y = (x2 * w1 - x1 * w2) * D;
- // M[0].z = rhw0;
- // M[0].w = 0;
-
- M[1].x = y2 * A;
- M[1].y = -x2 * A;
- // M[1].z = 0;
- // M[1].w = 0;
-
- M[2].x = -y1 * A;
- M[2].y = x1 * A;
- // M[2].z = 0;
- // M[2].w = 0;
- }
-
- if(state.interpolateW)
- {
- Float4 ABC = M[0] + M[1] + M[2];
-
- Float4 A = ABC.x;
- Float4 B = ABC.y;
- Float4 C = ABC.z;
-
- *Pointer<Float4>(primitive + OFFSET(Primitive,w.A), 16) = A;
- *Pointer<Float4>(primitive + OFFSET(Primitive,w.B), 16) = B;
- *Pointer<Float4>(primitive + OFFSET(Primitive,w.C), 16) = C;
- }
-
- if(state.interpolateZ)
- {
- Float z0 = *Pointer<Float>(v0 + OFFSET(Vertex,Z));
- Float z1 = *Pointer<Float>(v1 + OFFSET(Vertex,Z));
- Float z2 = *Pointer<Float>(v2 + OFFSET(Vertex,Z));
-
- z1 -= z0;
- z2 -= z0;
-
- Float4 A;
- Float4 B;
- Float4 C;
-
- if(!point)
- {
- Float x1 = Float(X1) * (1.0f / 16.0f);
- Float y1 = Float(Y1) * (1.0f / 16.0f);
- Float x2 = Float(X2) * (1.0f / 16.0f);
- Float y2 = Float(Y2) * (1.0f / 16.0f);
-
- Float D = *Pointer<Float>(data + OFFSET(DrawData,depthRange)) / (x1 * y2 - x2 * y1);
-
- Float a = (y2 * z1 - y1 * z2) * D;
- Float b = (x1 * z2 - x2 * z1) * D;
-
- A = Float4(a);
- B = Float4(b);
- }
- else
- {
- A = Float4(0, 0, 0, 0);
- B = Float4(0, 0, 0, 0);
- }
-
- *Pointer<Float4>(primitive + OFFSET(Primitive,z.A), 16) = A;
- *Pointer<Float4>(primitive + OFFSET(Primitive,z.B), 16) = B;
-
- Float c = z0;
-
- if(state.isDrawTriangle && state.slopeDepthBias)
- {
- Float bias = Max(Abs(Float(A.x)), Abs(Float(B.x)));
- bias *= *Pointer<Float>(data + OFFSET(DrawData,slopeDepthBias));
-
- if(complementaryDepthBuffer)
- {
- bias = -bias;
- }
-
- c += bias;
- }
-
- C = Float4(c * *Pointer<Float>(data + OFFSET(DrawData,depthRange)) + *Pointer<Float>(data + OFFSET(DrawData,depthNear)));
-
- *Pointer<Float4>(primitive + OFFSET(Primitive,z.C), 16) = C;
- }
-
- for(int interpolant = 0; interpolant < MAX_FRAGMENT_INPUTS; interpolant++)
- {
- for(int component = 0; component < 4; component++)
- {
- int attribute = state.gradient[interpolant][component].attribute;
- bool flat = state.gradient[interpolant][component].flat;
- bool wrap = state.gradient[interpolant][component].wrap;
-
- if(attribute != Unused)
- {
- setupGradient(primitive, tri, w012, M, v0, v1, v2, OFFSET(Vertex,v[attribute][component]), OFFSET(Primitive,V[interpolant][component]), flat, sprite, state.perspective, wrap, component);
- }
- }
- }
-
- if(state.fog.attribute == Fog)
- {
- setupGradient(primitive, tri, w012, M, v0, v1, v2, OFFSET(Vertex,f), OFFSET(Primitive,f), state.fog.flat, false, state.perspective, false, 0);
- }
-
- Return(1);
- }
-
- routine = function("SetupRoutine");
- }
-
- void SetupRoutine::setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flat, bool sprite, bool perspective, bool wrap, int component)
- {
- Float4 i;
-
- if(!flat)
- {
- if(!sprite)
- {
- i.x = *Pointer<Float>(v0 + attribute);
- i.y = *Pointer<Float>(v1 + attribute);
- i.z = *Pointer<Float>(v2 + attribute);
- i.w = 0;
- }
- else
- {
- if(component == 0) i.x = 0.5f;
- if(component == 1) i.x = 0.5f;
- if(component == 2) i.x = 0.0f;
- if(component == 3) i.x = 1.0f;
-
- if(component == 0) i.y = 1.0f;
- if(component == 1) i.y = 0.5f;
- if(component == 2) i.y = 0.0f;
- if(component == 3) i.y = 1.0f;
-
- if(component == 0) i.z = 0.5f;
- if(component == 1) i.z = 1.0f;
- if(component == 2) i.z = 0.0f;
- if(component == 3) i.z = 1.0f;
-
- i.w = 0;
- }
-
- if(wrap)
- {
- Float m;
-
- m = *Pointer<Float>(v0 + attribute);
- m = Max(m, *Pointer<Float>(v1 + attribute));
- m = Max(m, *Pointer<Float>(v2 + attribute));
- m -= 0.5f;
-
- // FIXME: Vectorize
- If(Float(i.x) < m) i.x = i.x + 1.0f;
- If(Float(i.y) < m) i.y = i.y + 1.0f;
- If(Float(i.z) < m) i.z = i.z + 1.0f;
- }
-
- if(!perspective)
- {
- i *= w012;
- }
-
- Float4 A = i.xxxx * m[0];
- Float4 B = i.yyyy * m[1];
- Float4 C = i.zzzz * m[2];
-
- C = A + B + C;
-
- A = C.xxxx;
- B = C.yyyy;
- C = C.zzzz;
-
- *Pointer<Float4>(primitive + planeEquation + 0, 16) = A;
- *Pointer<Float4>(primitive + planeEquation + 16, 16) = B;
- *Pointer<Float4>(primitive + planeEquation + 32, 16) = C;
- }
- else
- {
- int leadingVertex = leadingVertexFirst ? OFFSET(Triangle,v0) : OFFSET(Triangle,v2);
- Float C = *Pointer<Float>(triangle + leadingVertex + attribute);
-
- *Pointer<Float4>(primitive + planeEquation + 0, 16) = Float4(0, 0, 0, 0);
- *Pointer<Float4>(primitive + planeEquation + 16, 16) = Float4(0, 0, 0, 0);
- *Pointer<Float4>(primitive + planeEquation + 32, 16) = Float4(C);
- }
- }
-
- void SetupRoutine::edge(Pointer<Byte> &primitive, Pointer<Byte> &data, const Int &Xa, const Int &Ya, const Int &Xb, const Int &Yb, Int &q)
- {
- If(Ya != Yb)
- {
- Bool swap = Yb < Ya;
-
- Int X1 = IfThenElse(swap, Xb, Xa);
- Int X2 = IfThenElse(swap, Xa, Xb);
- Int Y1 = IfThenElse(swap, Yb, Ya);
- Int Y2 = IfThenElse(swap, Ya, Yb);
-
- Int y1 = Max((Y1 + 0x0000000F) >> 4, *Pointer<Int>(data + OFFSET(DrawData,scissorY0)));
- Int y2 = Min((Y2 + 0x0000000F) >> 4, *Pointer<Int>(data + OFFSET(DrawData,scissorY1)));
-
- If(y1 < y2)
- {
- Int xMin = *Pointer<Int>(data + OFFSET(DrawData,scissorX0));
- Int xMax = *Pointer<Int>(data + OFFSET(DrawData,scissorX1));
-
- Pointer<Byte> leftEdge = primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->left);
- Pointer<Byte> rightEdge = primitive + q * sizeof(Primitive) + OFFSET(Primitive,outline->right);
- Pointer<Byte> edge = IfThenElse(swap, rightEdge, leftEdge);
-
- // Deltas
- Int DX12 = X2 - X1;
- Int DY12 = Y2 - Y1;
-
- Int FDX12 = DX12 << 4;
- Int FDY12 = DY12 << 4;
-
- Int X = DX12 * ((y1 << 4) - Y1) + (X1 & 0x0000000F) * DY12;
- Int x = (X1 >> 4) + X / FDY12; // Edge
- Int d = X % FDY12; // Error-term
- Int ceil = -d >> 31; // Ceiling division: remainder <= 0
- x -= ceil;
- d -= ceil & FDY12;
-
- Int Q = FDX12 / FDY12; // Edge-step
- Int R = FDX12 % FDY12; // Error-step
- Int floor = R >> 31; // Flooring division: remainder >= 0
- Q += floor;
- R += floor & FDY12;
-
- Int D = FDY12; // Error-overflow
- Int y = y1;
-
- Do
- {
- *Pointer<Short>(edge + y * sizeof(Primitive::Span)) = Short(Clamp(x, xMin, xMax));
-
- x += Q;
- d += R;
-
- Int overflow = -d >> 31;
-
- d -= D & overflow;
- x -= overflow;
-
- y++;
- }
- Until(y >= y2);
- }
- }
- }
-
- void SetupRoutine::conditionalRotate1(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2)
- {
- #if 0 // Rely on LLVM optimization
- If(condition)
- {
- Pointer<Byte> vX;
-
- vX = v0;
- v0 = v1;
- v1 = v2;
- v2 = vX;
- }
- #else
- Pointer<Byte> vX = v0;
- v0 = IfThenElse(condition, v1, v0);
- v1 = IfThenElse(condition, v2, v1);
- v2 = IfThenElse(condition, vX, v2);
- #endif
- }
-
- void SetupRoutine::conditionalRotate2(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2)
- {
- #if 0 // Rely on LLVM optimization
- If(condition)
- {
- Pointer<Byte> vX;
-
- vX = v2;
- v2 = v1;
- v1 = v0;
- v0 = vX;
- }
- #else
- Pointer<Byte> vX = v2;
- v2 = IfThenElse(condition, v1, v2);
- v1 = IfThenElse(condition, v0, v1);
- v0 = IfThenElse(condition, vX, v0);
- #endif
- }
-
- std::shared_ptr<Routine> SetupRoutine::getRoutine()
- {
- return routine;
- }
-}
diff --git a/src/Shader/SetupRoutine.hpp b/src/Shader/SetupRoutine.hpp
deleted file mode 100644
index 0f3424960..000000000
--- a/src/Shader/SetupRoutine.hpp
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_SetupRoutine_hpp
-#define sw_SetupRoutine_hpp
-
-#include "Renderer/SetupProcessor.hpp"
-#include "Reactor/Reactor.hpp"
-
-namespace sw
-{
- class Context;
-
- class SetupRoutine
- {
- public:
- SetupRoutine(const SetupProcessor::State &state);
-
- virtual ~SetupRoutine();
-
- void generate();
- std::shared_ptr<Routine> getRoutine();
-
- private:
- void setupGradient(Pointer<Byte> &primitive, Pointer<Byte> &triangle, Float4 &w012, Float4 (&m)[3], Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2, int attribute, int planeEquation, bool flatShading, bool sprite, bool perspective, bool wrap, int component);
- void edge(Pointer<Byte> &primitive, Pointer<Byte> &data, const Int &Xa, const Int &Ya, const Int &Xb, const Int &Yb, Int &q);
- void conditionalRotate1(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2);
- void conditionalRotate2(Bool condition, Pointer<Byte> &v0, Pointer<Byte> &v1, Pointer<Byte> &v2);
-
- const SetupProcessor::State &state;
-
- std::shared_ptr<Routine> routine;
- };
-}
-
-#endif // sw_SetupRoutine_hpp
diff --git a/src/Shader/Shader.cpp b/src/Shader/Shader.cpp
deleted file mode 100644
index 561ccbd21..000000000
--- a/src/Shader/Shader.cpp
+++ /dev/null
@@ -1,2122 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "Shader.hpp"
-
-#include "VertexShader.hpp"
-#include "PixelShader.hpp"
-#include "Common/Math.hpp"
-#include "Common/Debug.hpp"
-
-#include <algorithm>
-#include <set>
-#include <fstream>
-#include <functional>
-#include <sstream>
-#include <stdarg.h>
-#include <unordered_map>
-#include <unordered_set>
-
-namespace sw
-{
- volatile int Shader::serialCounter = 1;
-
- Shader::Opcode Shader::OPCODE_DP(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_DP1;
- case 2: return OPCODE_DP2;
- case 3: return OPCODE_DP3;
- case 4: return OPCODE_DP4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_LEN(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_ABS;
- case 2: return OPCODE_LEN2;
- case 3: return OPCODE_LEN3;
- case 4: return OPCODE_LEN4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_DIST(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_DIST1;
- case 2: return OPCODE_DIST2;
- case 3: return OPCODE_DIST3;
- case 4: return OPCODE_DIST4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_NRM(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_SGN;
- case 2: return OPCODE_NRM2;
- case 3: return OPCODE_NRM3;
- case 4: return OPCODE_NRM4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_FORWARD(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_FORWARD1;
- case 2: return OPCODE_FORWARD2;
- case 3: return OPCODE_FORWARD3;
- case 4: return OPCODE_FORWARD4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_REFLECT(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_REFLECT1;
- case 2: return OPCODE_REFLECT2;
- case 3: return OPCODE_REFLECT3;
- case 4: return OPCODE_REFLECT4;
- }
- }
-
- Shader::Opcode Shader::OPCODE_REFRACT(int i)
- {
- switch(i)
- {
- default: ASSERT(false);
- case 1: return OPCODE_REFRACT1;
- case 2: return OPCODE_REFRACT2;
- case 3: return OPCODE_REFRACT3;
- case 4: return OPCODE_REFRACT4;
- }
- }
-
- Shader::Instruction::Instruction(Opcode opcode) : opcode(opcode), analysis(0)
- {
- control = CONTROL_RESERVED0;
-
- predicate = false;
- predicateNot = false;
- predicateSwizzle = 0xE4;
-
- coissue = false;
- samplerType = SAMPLER_UNKNOWN;
- usage = USAGE_POSITION;
- usageIndex = 0;
- }
-
- Shader::Instruction::Instruction(const unsigned long *token, int size, unsigned char majorVersion) : analysis(0)
- {
- parseOperationToken(*token++, majorVersion);
-
- samplerType = SAMPLER_UNKNOWN;
- usage = USAGE_POSITION;
- usageIndex = 0;
-
- if(opcode == OPCODE_IF ||
- opcode == OPCODE_IFC ||
- opcode == OPCODE_LOOP ||
- opcode == OPCODE_REP ||
- opcode == OPCODE_BREAKC ||
- opcode == OPCODE_BREAKP) // No destination operand
- {
- if(size > 0) parseSourceToken(0, token++, majorVersion);
- if(size > 1) parseSourceToken(1, token++, majorVersion);
- if(size > 2) parseSourceToken(2, token++, majorVersion);
- if(size > 3) ASSERT(false);
- }
- else if(opcode == OPCODE_DCL)
- {
- parseDeclarationToken(*token++);
- parseDestinationToken(token++, majorVersion);
- }
- else
- {
- if(size > 0)
- {
- parseDestinationToken(token, majorVersion);
-
- if(dst.rel.type != PARAMETER_VOID && majorVersion >= 3)
- {
- token++;
- size--;
- }
-
- token++;
- size--;
- }
-
- if(predicate)
- {
- ASSERT(size != 0);
-
- predicateNot = (Modifier)((*token & 0x0F000000) >> 24) == MODIFIER_NOT;
- predicateSwizzle = (unsigned char)((*token & 0x00FF0000) >> 16);
-
- token++;
- size--;
- }
-
- for(int i = 0; size > 0; i++)
- {
- parseSourceToken(i, token, majorVersion);
-
- token++;
- size--;
-
- if(src[i].rel.type != PARAMETER_VOID && majorVersion >= 2)
- {
- token++;
- size--;
- }
- }
- }
- }
-
- Shader::Instruction::~Instruction()
- {
- }
-
- std::string Shader::Instruction::string(ShaderType shaderType, unsigned short version) const
- {
- std::string instructionString;
-
- if(opcode != OPCODE_DCL)
- {
- instructionString += coissue ? "+ " : "";
-
- if(predicate)
- {
- instructionString += predicateNot ? "(!p0" : "(p0";
- instructionString += swizzleString(PARAMETER_PREDICATE, predicateSwizzle);
- instructionString += ") ";
- }
-
- instructionString += operationString(version) + controlString() + dst.shiftString() + dst.modifierString();
-
- if(dst.type != PARAMETER_VOID)
- {
- instructionString += " " + dst.string(shaderType, version) +
- dst.relativeString() +
- dst.maskString();
- }
-
- for(int i = 0; i < 4; i++)
- {
- if(src[i].type != PARAMETER_VOID)
- {
- instructionString += (dst.type != PARAMETER_VOID || i > 0) ? ", " : " ";
- instructionString += src[i].preModifierString() +
- src[i].string(shaderType, version) +
- src[i].relativeString() +
- src[i].postModifierString() +
- src[i].swizzleString();
- }
- }
- }
- else // DCL
- {
- instructionString += "dcl";
-
- if(dst.type == PARAMETER_SAMPLER)
- {
- switch(samplerType)
- {
- case SAMPLER_UNKNOWN: instructionString += " "; break;
- case SAMPLER_1D: instructionString += "_1d "; break;
- case SAMPLER_2D: instructionString += "_2d "; break;
- case SAMPLER_CUBE: instructionString += "_cube "; break;
- case SAMPLER_VOLUME: instructionString += "_volume "; break;
- default:
- ASSERT(false);
- }
-
- instructionString += dst.string(shaderType, version);
- }
- else if(dst.type == PARAMETER_INPUT ||
- dst.type == PARAMETER_OUTPUT ||
- dst.type == PARAMETER_TEXTURE)
- {
- if(version >= 0x0300)
- {
- switch(usage)
- {
- case USAGE_POSITION: instructionString += "_position"; break;
- case USAGE_BLENDWEIGHT: instructionString += "_blendweight"; break;
- case USAGE_BLENDINDICES: instructionString += "_blendindices"; break;
- case USAGE_NORMAL: instructionString += "_normal"; break;
- case USAGE_PSIZE: instructionString += "_psize"; break;
- case USAGE_TEXCOORD: instructionString += "_texcoord"; break;
- case USAGE_TANGENT: instructionString += "_tangent"; break;
- case USAGE_BINORMAL: instructionString += "_binormal"; break;
- case USAGE_TESSFACTOR: instructionString += "_tessfactor"; break;
- case USAGE_POSITIONT: instructionString += "_positiont"; break;
- case USAGE_COLOR: instructionString += "_color"; break;
- case USAGE_FOG: instructionString += "_fog"; break;
- case USAGE_DEPTH: instructionString += "_depth"; break;
- case USAGE_SAMPLE: instructionString += "_sample"; break;
- default:
- ASSERT(false);
- }
-
- if(usageIndex > 0)
- {
- std::ostringstream buffer;
-
- buffer << (int)usageIndex;
-
- instructionString += buffer.str();
- }
- }
- else ASSERT(dst.type != PARAMETER_OUTPUT);
-
- instructionString += " ";
-
- instructionString += dst.string(shaderType, version);
- instructionString += dst.maskString();
- }
- else if(dst.type == PARAMETER_MISCTYPE) // vPos and vFace
- {
- instructionString += " ";
-
- instructionString += dst.string(shaderType, version);
- }
- else ASSERT(false);
- }
-
- return instructionString;
- }
-
- std::string Shader::DestinationParameter::modifierString() const
- {
- if(type == PARAMETER_VOID || type == PARAMETER_LABEL)
- {
- return "";
- }
-
- std::string modifierString;
-
- if(saturate)
- {
- modifierString += "_sat";
- }
-
- if(partialPrecision)
- {
- modifierString += "_pp";
- }
-
- if(centroid)
- {
- modifierString += "_centroid";
- }
-
- return modifierString;
- }
-
- std::string Shader::DestinationParameter::shiftString() const
- {
- if(type == PARAMETER_VOID || type == PARAMETER_LABEL)
- {
- return "";
- }
-
- switch(shift)
- {
- case 0: return "";
- case 1: return "_x2";
- case 2: return "_x4";
- case 3: return "_x8";
- case -1: return "_d2";
- case -2: return "_d4";
- case -3: return "_d8";
- default:
- return "";
- // ASSERT(false); // FIXME
- }
- }
-
- std::string Shader::DestinationParameter::maskString() const
- {
- if(type == PARAMETER_VOID || type == PARAMETER_LABEL)
- {
- return "";
- }
-
- switch(mask)
- {
- case 0x0: return "";
- case 0x1: return ".x";
- case 0x2: return ".y";
- case 0x3: return ".xy";
- case 0x4: return ".z";
- case 0x5: return ".xz";
- case 0x6: return ".yz";
- case 0x7: return ".xyz";
- case 0x8: return ".w";
- case 0x9: return ".xw";
- case 0xA: return ".yw";
- case 0xB: return ".xyw";
- case 0xC: return ".zw";
- case 0xD: return ".xzw";
- case 0xE: return ".yzw";
- case 0xF: return "";
- default:
- ASSERT(false);
- }
-
- return "";
- }
-
- std::string Shader::SourceParameter::preModifierString() const
- {
- if(type == PARAMETER_VOID)
- {
- return "";
- }
-
- switch(modifier)
- {
- case MODIFIER_NONE: return "";
- case MODIFIER_NEGATE: return "-";
- case MODIFIER_BIAS: return "";
- case MODIFIER_BIAS_NEGATE: return "-";
- case MODIFIER_SIGN: return "";
- case MODIFIER_SIGN_NEGATE: return "-";
- case MODIFIER_COMPLEMENT: return "1-";
- case MODIFIER_X2: return "";
- case MODIFIER_X2_NEGATE: return "-";
- case MODIFIER_DZ: return "";
- case MODIFIER_DW: return "";
- case MODIFIER_ABS: return "";
- case MODIFIER_ABS_NEGATE: return "-";
- case MODIFIER_NOT: return "!";
- default:
- ASSERT(false);
- }
-
- return "";
- }
-
- std::string Shader::Parameter::relativeString() const
- {
- if(type == PARAMETER_CONST || type == PARAMETER_INPUT || type == PARAMETER_OUTPUT || type == PARAMETER_TEMP)
- {
- if(rel.type == PARAMETER_VOID)
- {
- return "";
- }
- else if(rel.type == PARAMETER_ADDR)
- {
- switch(rel.swizzle & 0x03)
- {
- case 0: return "[a0.x]";
- case 1: return "[a0.y]";
- case 2: return "[a0.z]";
- case 3: return "[a0.w]";
- }
- }
- else if(rel.type == PARAMETER_TEMP)
- {
- std::ostringstream buffer;
- buffer << rel.index;
-
- switch(rel.swizzle & 0x03)
- {
- case 0: return "[r" + buffer.str() + ".x]";
- case 1: return "[r" + buffer.str() + ".y]";
- case 2: return "[r" + buffer.str() + ".z]";
- case 3: return "[r" + buffer.str() + ".w]";
- }
- }
- else if(rel.type == PARAMETER_LOOP)
- {
- return "[aL]";
- }
- else if(rel.type == PARAMETER_CONST)
- {
- std::ostringstream buffer;
- buffer << rel.index;
-
- switch(rel.swizzle & 0x03)
- {
- case 0: return "[c" + buffer.str() + ".x]";
- case 1: return "[c" + buffer.str() + ".y]";
- case 2: return "[c" + buffer.str() + ".z]";
- case 3: return "[c" + buffer.str() + ".w]";
- }
- }
- else ASSERT(false);
- }
-
- return "";
- }
-
- std::string Shader::SourceParameter::postModifierString() const
- {
- if(type == PARAMETER_VOID)
- {
- return "";
- }
-
- switch(modifier)
- {
- case MODIFIER_NONE: return "";
- case MODIFIER_NEGATE: return "";
- case MODIFIER_BIAS: return "_bias";
- case MODIFIER_BIAS_NEGATE: return "_bias";
- case MODIFIER_SIGN: return "_bx2";
- case MODIFIER_SIGN_NEGATE: return "_bx2";
- case MODIFIER_COMPLEMENT: return "";
- case MODIFIER_X2: return "_x2";
- case MODIFIER_X2_NEGATE: return "_x2";
- case MODIFIER_DZ: return "_dz";
- case MODIFIER_DW: return "_dw";
- case MODIFIER_ABS: return "_abs";
- case MODIFIER_ABS_NEGATE: return "_abs";
- case MODIFIER_NOT: return "";
- default:
- ASSERT(false);
- }
-
- return "";
- }
-
- std::string Shader::SourceParameter::string(ShaderType shaderType, unsigned short version) const
- {
- if(type == PARAMETER_CONST && bufferIndex >= 0)
- {
- std::ostringstream buffer;
- buffer << bufferIndex;
-
- std::ostringstream offset;
- offset << index;
-
- return "cb" + buffer.str() + "[" + offset.str() + "]";
- }
- else
- {
- return Parameter::string(shaderType, version);
- }
- }
-
- std::string Shader::SourceParameter::swizzleString() const
- {
- return Instruction::swizzleString(type, swizzle);
- }
-
- void Shader::Instruction::parseOperationToken(unsigned long token, unsigned char majorVersion)
- {
- if((token & 0xFFFF0000) == 0xFFFF0000 || (token & 0xFFFF0000) == 0xFFFE0000) // Version token
- {
- opcode = (Opcode)token;
-
- control = CONTROL_RESERVED0;
- predicate = false;
- coissue = false;
- }
- else
- {
- opcode = (Opcode)(token & 0x0000FFFF);
- control = (Control)((token & 0x00FF0000) >> 16);
-
- int size = (token & 0x0F000000) >> 24;
-
- predicate = (token & 0x10000000) != 0x00000000;
- coissue = (token & 0x40000000) != 0x00000000;
-
- if(majorVersion < 2)
- {
- if(size != 0)
- {
- ASSERT(false); // Reserved
- }
- }
-
- if(majorVersion < 2)
- {
- if(predicate)
- {
- ASSERT(false);
- }
- }
-
- if((token & 0x20000000) != 0x00000000)
- {
- ASSERT(false); // Reserved
- }
-
- if(majorVersion >= 2)
- {
- if(coissue)
- {
- ASSERT(false); // Reserved
- }
- }
-
- if((token & 0x80000000) != 0x00000000)
- {
- ASSERT(false);
- }
- }
- }
-
- void Shader::Instruction::parseDeclarationToken(unsigned long token)
- {
- samplerType = (SamplerType)((token & 0x78000000) >> 27);
- usage = (Usage)(token & 0x0000001F);
- usageIndex = (unsigned char)((token & 0x000F0000) >> 16);
- }
-
- void Shader::Instruction::parseDestinationToken(const unsigned long *token, unsigned char majorVersion)
- {
- dst.index = (unsigned short)(token[0] & 0x000007FF);
- dst.type = (ParameterType)(((token[0] & 0x00001800) >> 8) | ((token[0] & 0x70000000) >> 28));
-
- // TODO: Check type and index range
-
- bool relative = (token[0] & 0x00002000) != 0x00000000;
- dst.rel.type = relative ? PARAMETER_ADDR : PARAMETER_VOID;
- dst.rel.swizzle = 0x00;
- dst.rel.scale = 1;
-
- if(relative && majorVersion >= 3)
- {
- dst.rel.type = (ParameterType)(((token[1] & 0x00001800) >> 8) | ((token[1] & 0x70000000) >> 28));
- dst.rel.swizzle = (unsigned char)((token[1] & 0x00FF0000) >> 16);
- }
- else if(relative) ASSERT(false); // Reserved
-
- if((token[0] & 0x0000C000) != 0x00000000)
- {
- ASSERT(false); // Reserved
- }
-
- dst.mask = (unsigned char)((token[0] & 0x000F0000) >> 16);
- dst.saturate = (token[0] & 0x00100000) != 0;
- dst.partialPrecision = (token[0] & 0x00200000) != 0;
- dst.centroid = (token[0] & 0x00400000) != 0;
- dst.shift = (signed char)((token[0] & 0x0F000000) >> 20) >> 4;
-
- if(majorVersion >= 2)
- {
- if(dst.shift)
- {
- ASSERT(false); // Reserved
- }
- }
-
- if((token[0] & 0x80000000) != 0x80000000)
- {
- ASSERT(false);
- }
- }
-
- void Shader::Instruction::parseSourceToken(int i, const unsigned long *token, unsigned char majorVersion)
- {
- // Defaults
- src[i].index = 0;
- src[i].type = PARAMETER_VOID;
- src[i].modifier = MODIFIER_NONE;
- src[i].swizzle = 0xE4;
- src[i].rel.type = PARAMETER_VOID;
- src[i].rel.swizzle = 0x00;
- src[i].rel.scale = 1;
-
- switch(opcode)
- {
- case OPCODE_DEF:
- src[0].type = PARAMETER_FLOAT4LITERAL;
- src[0].value[i] = *(float*)token;
- break;
- case OPCODE_DEFB:
- src[0].type = PARAMETER_BOOL1LITERAL;
- src[0].boolean[0] = *(int*)token;
- break;
- case OPCODE_DEFI:
- src[0].type = PARAMETER_INT4LITERAL;
- src[0].integer[i] = *(int*)token;
- break;
- default:
- src[i].index = (unsigned short)(token[0] & 0x000007FF);
- src[i].type = (ParameterType)(((token[0] & 0x00001800) >> 8) | ((token[0] & 0x70000000) >> 28));
-
- // FIXME: Check type and index range
-
- bool relative = (token[0] & 0x00002000) != 0x00000000;
- src[i].rel.type = relative ? PARAMETER_ADDR : PARAMETER_VOID;
-
- if((token[0] & 0x0000C000) != 0x00000000)
- {
- if(opcode != OPCODE_DEF &&
- opcode != OPCODE_DEFI &&
- opcode != OPCODE_DEFB)
- {
- ASSERT(false);
- }
- }
-
- src[i].swizzle = (unsigned char)((token[0] & 0x00FF0000) >> 16);
- src[i].modifier = (Modifier)((token[0] & 0x0F000000) >> 24);
-
- if((token[0] & 0x80000000) != 0x80000000)
- {
- if(opcode != OPCODE_DEF &&
- opcode != OPCODE_DEFI &&
- opcode != OPCODE_DEFB)
- {
- ASSERT(false);
- }
- }
-
- if(relative && majorVersion >= 2)
- {
- src[i].rel.type = (ParameterType)(((token[1] & 0x00001800) >> 8) | ((token[1] & 0x70000000) >> 28));
- src[i].rel.swizzle = (unsigned char)((token[1] & 0x00FF0000) >> 16);
- }
- }
- }
-
- std::string Shader::Instruction::swizzleString(ParameterType type, unsigned char swizzle)
- {
- if(type == PARAMETER_VOID || type == PARAMETER_LABEL || swizzle == 0xE4)
- {
- return "";
- }
-
- int x = (swizzle & 0x03) >> 0;
- int y = (swizzle & 0x0C) >> 2;
- int z = (swizzle & 0x30) >> 4;
- int w = (swizzle & 0xC0) >> 6;
-
- std::string swizzleString = ".";
-
- switch(x)
- {
- case 0: swizzleString += "x"; break;
- case 1: swizzleString += "y"; break;
- case 2: swizzleString += "z"; break;
- case 3: swizzleString += "w"; break;
- }
-
- if(!(x == y && y == z && z == w))
- {
- switch(y)
- {
- case 0: swizzleString += "x"; break;
- case 1: swizzleString += "y"; break;
- case 2: swizzleString += "z"; break;
- case 3: swizzleString += "w"; break;
- }
-
- if(!(y == z && z == w))
- {
- switch(z)
- {
- case 0: swizzleString += "x"; break;
- case 1: swizzleString += "y"; break;
- case 2: swizzleString += "z"; break;
- case 3: swizzleString += "w"; break;
- }
-
- if(!(z == w))
- {
- switch(w)
- {
- case 0: swizzleString += "x"; break;
- case 1: swizzleString += "y"; break;
- case 2: swizzleString += "z"; break;
- case 3: swizzleString += "w"; break;
- }
- }
- }
- }
-
- return swizzleString;
- }
-
- std::string Shader::Instruction::operationString(unsigned short version) const
- {
- switch(opcode)
- {
- case OPCODE_NULL: return "null";
- case OPCODE_NOP: return "nop";
- case OPCODE_MOV: return "mov";
- case OPCODE_ADD: return "add";
- case OPCODE_IADD: return "iadd";
- case OPCODE_SUB: return "sub";
- case OPCODE_ISUB: return "isub";
- case OPCODE_MAD: return "mad";
- case OPCODE_IMAD: return "imad";
- case OPCODE_MUL: return "mul";
- case OPCODE_IMUL: return "imul";
- case OPCODE_RCPX: return "rcpx";
- case OPCODE_DIV: return "div";
- case OPCODE_IDIV: return "idiv";
- case OPCODE_UDIV: return "udiv";
- case OPCODE_MOD: return "mod";
- case OPCODE_IMOD: return "imod";
- case OPCODE_UMOD: return "umod";
- case OPCODE_SHL: return "shl";
- case OPCODE_ISHR: return "ishr";
- case OPCODE_USHR: return "ushr";
- case OPCODE_RSQX: return "rsqx";
- case OPCODE_SQRT: return "sqrt";
- case OPCODE_RSQ: return "rsq";
- case OPCODE_LEN2: return "len2";
- case OPCODE_LEN3: return "len3";
- case OPCODE_LEN4: return "len4";
- case OPCODE_DIST1: return "dist1";
- case OPCODE_DIST2: return "dist2";
- case OPCODE_DIST3: return "dist3";
- case OPCODE_DIST4: return "dist4";
- case OPCODE_DP3: return "dp3";
- case OPCODE_DP4: return "dp4";
- case OPCODE_DET2: return "det2";
- case OPCODE_DET3: return "det3";
- case OPCODE_DET4: return "det4";
- case OPCODE_MIN: return "min";
- case OPCODE_IMIN: return "imin";
- case OPCODE_UMIN: return "umin";
- case OPCODE_MAX: return "max";
- case OPCODE_IMAX: return "imax";
- case OPCODE_UMAX: return "umax";
- case OPCODE_SLT: return "slt";
- case OPCODE_SGE: return "sge";
- case OPCODE_EXP2X: return "exp2x";
- case OPCODE_LOG2X: return "log2x";
- case OPCODE_LIT: return "lit";
- case OPCODE_ATT: return "att";
- case OPCODE_LRP: return "lrp";
- case OPCODE_STEP: return "step";
- case OPCODE_SMOOTH: return "smooth";
- case OPCODE_FLOATBITSTOINT: return "floatBitsToInt";
- case OPCODE_FLOATBITSTOUINT: return "floatBitsToUInt";
- case OPCODE_INTBITSTOFLOAT: return "intBitsToFloat";
- case OPCODE_UINTBITSTOFLOAT: return "uintBitsToFloat";
- case OPCODE_PACKSNORM2x16: return "packSnorm2x16";
- case OPCODE_PACKUNORM2x16: return "packUnorm2x16";
- case OPCODE_PACKHALF2x16: return "packHalf2x16";
- case OPCODE_UNPACKSNORM2x16: return "unpackSnorm2x16";
- case OPCODE_UNPACKUNORM2x16: return "unpackUnorm2x16";
- case OPCODE_UNPACKHALF2x16: return "unpackHalf2x16";
- case OPCODE_FRC: return "frc";
- case OPCODE_M4X4: return "m4x4";
- case OPCODE_M4X3: return "m4x3";
- case OPCODE_M3X4: return "m3x4";
- case OPCODE_M3X3: return "m3x3";
- case OPCODE_M3X2: return "m3x2";
- case OPCODE_CALL: return "call";
- case OPCODE_CALLNZ: return "callnz";
- case OPCODE_LOOP: return "loop";
- case OPCODE_RET: return "ret";
- case OPCODE_ENDLOOP: return "endloop";
- case OPCODE_LABEL: return "label";
- case OPCODE_DCL: return "dcl";
- case OPCODE_POWX: return "powx";
- case OPCODE_CRS: return "crs";
- case OPCODE_SGN: return "sgn";
- case OPCODE_ISGN: return "isgn";
- case OPCODE_ABS: return "abs";
- case OPCODE_IABS: return "iabs";
- case OPCODE_NRM2: return "nrm2";
- case OPCODE_NRM3: return "nrm3";
- case OPCODE_NRM4: return "nrm4";
- case OPCODE_SINCOS: return "sincos";
- case OPCODE_REP: return "rep";
- case OPCODE_ENDREP: return "endrep";
- case OPCODE_IF: return "if";
- case OPCODE_IFC: return "ifc";
- case OPCODE_ELSE: return "else";
- case OPCODE_ENDIF: return "endif";
- case OPCODE_BREAK: return "break";
- case OPCODE_BREAKC: return "breakc";
- case OPCODE_MOVA: return "mova";
- case OPCODE_DEFB: return "defb";
- case OPCODE_DEFI: return "defi";
- case OPCODE_TEXCOORD: return "texcoord";
- case OPCODE_TEXKILL: return "texkill";
- case OPCODE_DISCARD: return "discard";
- case OPCODE_TEX:
- if(version < 0x0104) return "tex";
- else return "texld";
- case OPCODE_TEXBEM: return "texbem";
- case OPCODE_TEXBEML: return "texbeml";
- case OPCODE_TEXREG2AR: return "texreg2ar";
- case OPCODE_TEXREG2GB: return "texreg2gb";
- case OPCODE_TEXM3X2PAD: return "texm3x2pad";
- case OPCODE_TEXM3X2TEX: return "texm3x2tex";
- case OPCODE_TEXM3X3PAD: return "texm3x3pad";
- case OPCODE_TEXM3X3TEX: return "texm3x3tex";
- case OPCODE_RESERVED0: return "reserved0";
- case OPCODE_TEXM3X3SPEC: return "texm3x3spec";
- case OPCODE_TEXM3X3VSPEC: return "texm3x3vspec";
- case OPCODE_EXPP: return "expp";
- case OPCODE_LOGP: return "logp";
- case OPCODE_CND: return "cnd";
- case OPCODE_DEF: return "def";
- case OPCODE_TEXREG2RGB: return "texreg2rgb";
- case OPCODE_TEXDP3TEX: return "texdp3tex";
- case OPCODE_TEXM3X2DEPTH: return "texm3x2depth";
- case OPCODE_TEXDP3: return "texdp3";
- case OPCODE_TEXM3X3: return "texm3x3";
- case OPCODE_TEXDEPTH: return "texdepth";
- case OPCODE_CMP0: return "cmp0";
- case OPCODE_ICMP: return "icmp";
- case OPCODE_UCMP: return "ucmp";
- case OPCODE_SELECT: return "select";
- case OPCODE_EXTRACT: return "extract";
- case OPCODE_INSERT: return "insert";
- case OPCODE_BEM: return "bem";
- case OPCODE_DP2ADD: return "dp2add";
- case OPCODE_DFDX: return "dFdx";
- case OPCODE_DFDY: return "dFdy";
- case OPCODE_FWIDTH: return "fwidth";
- case OPCODE_TEXLDD: return "texldd";
- case OPCODE_CMP: return "cmp";
- case OPCODE_TEXLDL: return "texldl";
- case OPCODE_TEXBIAS: return "texbias";
- case OPCODE_TEXOFFSET: return "texoffset";
- case OPCODE_TEXOFFSETBIAS: return "texoffsetbias";
- case OPCODE_TEXLOD: return "texlod";
- case OPCODE_TEXLODOFFSET: return "texlodoffset";
- case OPCODE_TEXELFETCH: return "texelfetch";
- case OPCODE_TEXELFETCHOFFSET: return "texelfetchoffset";
- case OPCODE_TEXGRAD: return "texgrad";
- case OPCODE_TEXGRADOFFSET: return "texgradoffset";
- case OPCODE_BREAKP: return "breakp";
- case OPCODE_TEXSIZE: return "texsize";
- case OPCODE_PHASE: return "phase";
- case OPCODE_COMMENT: return "comment";
- case OPCODE_END: return "end";
- case OPCODE_PS_1_0: return "ps_1_0";
- case OPCODE_PS_1_1: return "ps_1_1";
- case OPCODE_PS_1_2: return "ps_1_2";
- case OPCODE_PS_1_3: return "ps_1_3";
- case OPCODE_PS_1_4: return "ps_1_4";
- case OPCODE_PS_2_0: return "ps_2_0";
- case OPCODE_PS_2_x: return "ps_2_x";
- case OPCODE_PS_3_0: return "ps_3_0";
- case OPCODE_VS_1_0: return "vs_1_0";
- case OPCODE_VS_1_1: return "vs_1_1";
- case OPCODE_VS_2_0: return "vs_2_0";
- case OPCODE_VS_2_x: return "vs_2_x";
- case OPCODE_VS_2_sw: return "vs_2_sw";
- case OPCODE_VS_3_0: return "vs_3_0";
- case OPCODE_VS_3_sw: return "vs_3_sw";
- case OPCODE_WHILE: return "while";
- case OPCODE_ENDWHILE: return "endwhile";
- case OPCODE_COS: return "cos";
- case OPCODE_SIN: return "sin";
- case OPCODE_TAN: return "tan";
- case OPCODE_ACOS: return "acos";
- case OPCODE_ASIN: return "asin";
- case OPCODE_ATAN: return "atan";
- case OPCODE_ATAN2: return "atan2";
- case OPCODE_COSH: return "cosh";
- case OPCODE_SINH: return "sinh";
- case OPCODE_TANH: return "tanh";
- case OPCODE_ACOSH: return "acosh";
- case OPCODE_ASINH: return "asinh";
- case OPCODE_ATANH: return "atanh";
- case OPCODE_DP1: return "dp1";
- case OPCODE_DP2: return "dp2";
- case OPCODE_TRUNC: return "trunc";
- case OPCODE_FLOOR: return "floor";
- case OPCODE_ROUND: return "round";
- case OPCODE_ROUNDEVEN: return "roundEven";
- case OPCODE_CEIL: return "ceil";
- case OPCODE_EXP2: return "exp2";
- case OPCODE_LOG2: return "log2";
- case OPCODE_EXP: return "exp";
- case OPCODE_LOG: return "log";
- case OPCODE_POW: return "pow";
- case OPCODE_F2B: return "f2b";
- case OPCODE_B2F: return "b2f";
- case OPCODE_F2I: return "f2i";
- case OPCODE_I2F: return "i2f";
- case OPCODE_F2U: return "f2u";
- case OPCODE_U2F: return "u2f";
- case OPCODE_B2I: return "b2i";
- case OPCODE_I2B: return "i2b";
- case OPCODE_ALL: return "all";
- case OPCODE_ANY: return "any";
- case OPCODE_NEG: return "neg";
- case OPCODE_INEG: return "ineg";
- case OPCODE_ISNAN: return "isnan";
- case OPCODE_ISINF: return "isinf";
- case OPCODE_NOT: return "not";
- case OPCODE_OR: return "or";
- case OPCODE_XOR: return "xor";
- case OPCODE_AND: return "and";
- case OPCODE_EQ: return "eq";
- case OPCODE_NE: return "neq";
- case OPCODE_FORWARD1: return "forward1";
- case OPCODE_FORWARD2: return "forward2";
- case OPCODE_FORWARD3: return "forward3";
- case OPCODE_FORWARD4: return "forward4";
- case OPCODE_REFLECT1: return "reflect1";
- case OPCODE_REFLECT2: return "reflect2";
- case OPCODE_REFLECT3: return "reflect3";
- case OPCODE_REFLECT4: return "reflect4";
- case OPCODE_REFRACT1: return "refract1";
- case OPCODE_REFRACT2: return "refract2";
- case OPCODE_REFRACT3: return "refract3";
- case OPCODE_REFRACT4: return "refract4";
- case OPCODE_LEAVE: return "leave";
- case OPCODE_CONTINUE: return "continue";
- case OPCODE_TEST: return "test";
- case OPCODE_SWITCH: return "switch";
- case OPCODE_ENDSWITCH: return "endswitch";
- case OPCODE_SCALAR: return "scalar";
- }
-
- return "<unknown>";
- }
-
- std::string Shader::Instruction::controlString() const
- {
- if(opcode != OPCODE_LOOP && opcode != OPCODE_BREAKC && opcode != OPCODE_IFC && opcode != OPCODE_CMP)
- {
- if(project) return "p";
-
- if(bias) return "b";
-
- // FIXME: LOD
- }
-
- switch(control)
- {
- case 1: return "_gt";
- case 2: return "_eq";
- case 3: return "_ge";
- case 4: return "_lt";
- case 5: return "_ne";
- case 6: return "_le";
- default:
- return "";
- // ASSERT(false); // FIXME
- }
- }
-
- std::string Shader::Parameter::string(ShaderType shaderType, unsigned short version) const
- {
- std::ostringstream buffer;
-
- if(type == PARAMETER_FLOAT4LITERAL)
- {
- buffer << '{' << value[0] << ", " << value[1] << ", " << value[2] << ", " << value[3] << '}';
-
- return buffer.str();
- }
- else if(type != PARAMETER_RASTOUT && !(type == PARAMETER_ADDR && shaderType == SHADER_VERTEX) && type != PARAMETER_LOOP && type != PARAMETER_PREDICATE && type != PARAMETER_MISCTYPE)
- {
- buffer << index;
-
- return typeString(shaderType, version) + buffer.str();
- }
- else
- {
- return typeString(shaderType, version);
- }
- }
-
- std::string Shader::Parameter::typeString(ShaderType shaderType, unsigned short version) const
- {
- switch(type)
- {
- case PARAMETER_TEMP: return "r";
- case PARAMETER_INPUT: return "v";
- case PARAMETER_CONST: return "c";
- case PARAMETER_TEXTURE:
- // case PARAMETER_ADDR:
- if(shaderType == SHADER_PIXEL) return "t";
- else return "a0";
- case PARAMETER_RASTOUT:
- if(index == 0) return "oPos";
- else if(index == 1) return "oFog";
- else if(index == 2) return "oPts";
- else ASSERT(false);
- case PARAMETER_ATTROUT: return "oD";
- case PARAMETER_TEXCRDOUT:
- // case PARAMETER_OUTPUT: return "";
- if(version < 0x0300) return "oT";
- else return "o";
- case PARAMETER_CONSTINT: return "i";
- case PARAMETER_COLOROUT: return "oC";
- case PARAMETER_DEPTHOUT: return "oDepth";
- case PARAMETER_SAMPLER: return "s";
- // case PARAMETER_CONST2: return "";
- // case PARAMETER_CONST3: return "";
- // case PARAMETER_CONST4: return "";
- case PARAMETER_CONSTBOOL: return "b";
- case PARAMETER_LOOP: return "aL";
- // case PARAMETER_TEMPFLOAT16: return "";
- case PARAMETER_MISCTYPE:
- switch(index)
- {
- case VPosIndex: return "vPos";
- case VFaceIndex: return "vFace";
- case InstanceIDIndex: return "iID";
- case VertexIDIndex: return "vID";
- default: ASSERT(false);
- }
- case PARAMETER_LABEL: return "l";
- case PARAMETER_PREDICATE: return "p0";
- case PARAMETER_FLOAT4LITERAL: return "";
- case PARAMETER_BOOL1LITERAL: return "";
- case PARAMETER_INT4LITERAL: return "";
- // case PARAMETER_VOID: return "";
- default:
- ASSERT(false);
- }
-
- return "";
- }
-
- bool Shader::Instruction::isBranch() const
- {
- return opcode == OPCODE_IF || opcode == OPCODE_IFC;
- }
-
- bool Shader::Instruction::isCall() const
- {
- return opcode == OPCODE_CALL || opcode == OPCODE_CALLNZ;
- }
-
- bool Shader::Instruction::isBreak() const
- {
- return opcode == OPCODE_BREAK || opcode == OPCODE_BREAKC || opcode == OPCODE_BREAKP;
- }
-
- bool Shader::Instruction::isLoop() const
- {
- return opcode == OPCODE_LOOP || opcode == OPCODE_REP || opcode == OPCODE_WHILE;
- }
-
- bool Shader::Instruction::isEndLoop() const
- {
- return opcode == OPCODE_ENDLOOP || opcode == OPCODE_ENDREP || opcode == OPCODE_ENDWHILE;
- }
-
- bool Shader::Instruction::isPredicated() const
- {
- return predicate ||
- analysisBranch ||
- analysisBreak ||
- analysisContinue ||
- analysisLeave;
- }
-
- Shader::Shader() : serialID(serialCounter++)
- {
- usedSamplers = 0;
- }
-
- Shader::~Shader()
- {
- for(auto &inst : instruction)
- {
- delete inst;
- inst = 0;
- }
- }
-
- void Shader::parse(const unsigned long *token)
- {
- minorVersion = (unsigned char)(token[0] & 0x000000FF);
- majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8);
- shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16);
-
- int length = 0;
-
- if(shaderType == SHADER_VERTEX)
- {
- length = VertexShader::validate(token);
- }
- else if(shaderType == SHADER_PIXEL)
- {
- length = PixelShader::validate(token);
- }
- else ASSERT(false);
-
- ASSERT(length != 0);
- instruction.resize(length);
-
- for(int i = 0; i < length; i++)
- {
- while((*token & 0x0000FFFF) == 0x0000FFFE) // Comment token
- {
- int length = (*token & 0x7FFF0000) >> 16;
-
- token += length + 1;
- }
-
- int tokenCount = size(*token);
-
- instruction[i] = new Instruction(token, tokenCount, majorVersion);
-
- token += 1 + tokenCount;
- }
- }
-
- int Shader::size(unsigned long opcode) const
- {
- return size(opcode, shaderModel);
- }
-
- int Shader::size(unsigned long opcode, unsigned short shaderModel)
- {
- if(shaderModel > 0x0300)
- {
- ASSERT(false);
- }
-
- static const signed char size[] =
- {
- 0, // NOP = 0
- 2, // MOV
- 3, // ADD
- 3, // SUB
- 4, // MAD
- 3, // MUL
- 2, // RCP
- 2, // RSQ
- 3, // DP3
- 3, // DP4
- 3, // MIN
- 3, // MAX
- 3, // SLT
- 3, // SGE
- 2, // EXP
- 2, // LOG
- 2, // LIT
- 3, // DST
- 4, // LRP
- 2, // FRC
- 3, // M4x4
- 3, // M4x3
- 3, // M3x4
- 3, // M3x3
- 3, // M3x2
- 1, // CALL
- 2, // CALLNZ
- 2, // LOOP
- 0, // RET
- 0, // ENDLOOP
- 1, // LABEL
- 2, // DCL
- 3, // POW
- 3, // CRS
- 4, // SGN
- 2, // ABS
- 2, // NRM
- 4, // SINCOS
- 1, // REP
- 0, // ENDREP
- 1, // IF
- 2, // IFC
- 0, // ELSE
- 0, // ENDIF
- 0, // BREAK
- 2, // BREAKC
- 2, // MOVA
- 2, // DEFB
- 5, // DEFI
- -1, // 49
- -1, // 50
- -1, // 51
- -1, // 52
- -1, // 53
- -1, // 54
- -1, // 55
- -1, // 56
- -1, // 57
- -1, // 58
- -1, // 59
- -1, // 60
- -1, // 61
- -1, // 62
- -1, // 63
- 1, // TEXCOORD = 64
- 1, // TEXKILL
- 1, // TEX
- 2, // TEXBEM
- 2, // TEXBEML
- 2, // TEXREG2AR
- 2, // TEXREG2GB
- 2, // TEXM3x2PAD
- 2, // TEXM3x2TEX
- 2, // TEXM3x3PAD
- 2, // TEXM3x3TEX
- -1, // RESERVED0
- 3, // TEXM3x3SPEC
- 2, // TEXM3x3VSPEC
- 2, // EXPP
- 2, // LOGP
- 4, // CND
- 5, // DEF
- 2, // TEXREG2RGB
- 2, // TEXDP3TEX
- 2, // TEXM3x2DEPTH
- 2, // TEXDP3
- 2, // TEXM3x3
- 1, // TEXDEPTH
- 4, // CMP
- 3, // BEM
- 4, // DP2ADD
- 2, // DSX
- 2, // DSY
- 5, // TEXLDD
- 3, // SETP
- 3, // TEXLDL
- 2, // BREAKP
- -1, // 97
- -1, // 98
- -1, // 99
- -1, // 100
- -1, // 101
- -1, // 102
- -1, // 103
- -1, // 104
- -1, // 105
- -1, // 106
- -1, // 107
- -1, // 108
- -1, // 109
- -1, // 110
- -1, // 111
- -1, // 112
- };
-
- int length = 0;
-
- if((opcode & 0x0000FFFF) == OPCODE_COMMENT)
- {
- return (opcode & 0x7FFF0000) >> 16;
- }
-
- if(opcode != OPCODE_PS_1_0 &&
- opcode != OPCODE_PS_1_1 &&
- opcode != OPCODE_PS_1_2 &&
- opcode != OPCODE_PS_1_3 &&
- opcode != OPCODE_PS_1_4 &&
- opcode != OPCODE_PS_2_0 &&
- opcode != OPCODE_PS_2_x &&
- opcode != OPCODE_PS_3_0 &&
- opcode != OPCODE_VS_1_0 &&
- opcode != OPCODE_VS_1_1 &&
- opcode != OPCODE_VS_2_0 &&
- opcode != OPCODE_VS_2_x &&
- opcode != OPCODE_VS_2_sw &&
- opcode != OPCODE_VS_3_0 &&
- opcode != OPCODE_VS_3_sw &&
- opcode != OPCODE_PHASE &&
- opcode != OPCODE_END)
- {
- if(shaderModel >= 0x0200)
- {
- length = (opcode & 0x0F000000) >> 24;
- }
- else
- {
- length = size[opcode & 0x0000FFFF];
- }
- }
-
- if(length < 0)
- {
- ASSERT(false);
- }
-
- if(shaderModel == 0x0104)
- {
- switch(opcode & 0x0000FFFF)
- {
- case OPCODE_TEX:
- length += 1;
- break;
- case OPCODE_TEXCOORD:
- length += 1;
- break;
- default:
- break;
- }
- }
-
- return length;
- }
-
- bool Shader::maskContainsComponent(int mask, int component)
- {
- return (mask & (1 << component)) != 0;
- }
-
- bool Shader::swizzleContainsComponent(int swizzle, int component)
- {
- if((swizzle & 0x03) >> 0 == component) return true;
- if((swizzle & 0x0C) >> 2 == component) return true;
- if((swizzle & 0x30) >> 4 == component) return true;
- if((swizzle & 0xC0) >> 6 == component) return true;
-
- return false;
- }
-
- bool Shader::swizzleContainsComponentMasked(int swizzle, int component, int mask)
- {
- if(mask & 0x1) if((swizzle & 0x03) >> 0 == component) return true;
- if(mask & 0x2) if((swizzle & 0x0C) >> 2 == component) return true;
- if(mask & 0x4) if((swizzle & 0x30) >> 4 == component) return true;
- if(mask & 0x8) if((swizzle & 0xC0) >> 6 == component) return true;
-
- return false;
- }
-
- bool Shader::containsDynamicBranching() const
- {
- return dynamicBranching;
- }
-
- bool Shader::containsBreakInstruction() const
- {
- return containsBreak;
- }
-
- bool Shader::containsContinueInstruction() const
- {
- return containsContinue;
- }
-
- bool Shader::containsLeaveInstruction() const
- {
- return containsLeave;
- }
-
- bool Shader::containsDefineInstruction() const
- {
- return containsDefine;
- }
-
- bool Shader::usesSampler(int index) const
- {
- return (usedSamplers & (1 << index)) != 0;
- }
-
- int Shader::getSerialID() const
- {
- return serialID;
- }
-
- size_t Shader::getLength() const
- {
- return instruction.size();
- }
-
- Shader::ShaderType Shader::getShaderType() const
- {
- return shaderType;
- }
-
- unsigned short Shader::getShaderModel() const
- {
- return shaderModel;
- }
-
- void Shader::print(const char *fileName, ...) const
- {
- char fullName[1024 + 1];
-
- va_list vararg;
- va_start(vararg, fileName);
- vsnprintf(fullName, 1024, fileName, vararg);
- va_end(vararg);
-
- std::ofstream file(fullName, std::ofstream::out);
-
- for(const auto &inst : instruction)
- {
- file << inst->string(shaderType, shaderModel) << std::endl;
- }
- }
-
- void Shader::printInstruction(int index, const char *fileName) const
- {
- std::ofstream file(fileName, std::ofstream::out | std::ofstream::app);
-
- file << instruction[index]->string(shaderType, shaderModel) << std::endl;
- }
-
- void Shader::append(Instruction *instruction)
- {
- this->instruction.push_back(instruction);
- }
-
- void Shader::declareSampler(int i)
- {
- if(i >= 0 && i < 16)
- {
- usedSamplers |= 1 << i;
- }
- }
-
- const Shader::Instruction *Shader::getInstruction(size_t i) const
- {
- ASSERT(i < instruction.size());
-
- return instruction[i];
- }
-
- void Shader::optimize()
- {
- optimizeLeave();
- optimizeCall();
- removeNull();
- }
-
- void Shader::optimizeLeave()
- {
- // A return (leave) right before the end of a function or the shader can be removed
- for(unsigned int i = 0; i < instruction.size(); i++)
- {
- if(instruction[i]->opcode == OPCODE_LEAVE)
- {
- if(i == instruction.size() - 1 || instruction[i + 1]->opcode == OPCODE_RET)
- {
- instruction[i]->opcode = OPCODE_NULL;
- }
- }
- }
- }
-
- void Shader::optimizeCall()
- {
- // Eliminate uncalled functions
- std::set<int> calledFunctions;
- bool rescan = true;
-
- while(rescan)
- {
- calledFunctions.clear();
- rescan = false;
-
- for(const auto &inst : instruction)
- {
- if(inst->isCall())
- {
- calledFunctions.insert(inst->dst.label);
- }
- }
-
- if(!calledFunctions.empty())
- {
- for(unsigned int i = 0; i < instruction.size(); i++)
- {
- if(instruction[i]->opcode == OPCODE_LABEL)
- {
- if(calledFunctions.find(instruction[i]->dst.label) == calledFunctions.end())
- {
- for( ; i < instruction.size(); i++)
- {
- Opcode oldOpcode = instruction[i]->opcode;
- instruction[i]->opcode = OPCODE_NULL;
-
- if(oldOpcode == OPCODE_RET)
- {
- rescan = true;
- break;
- }
- }
- }
- }
- }
- }
- }
-
- // Optimize the entry call
- if(instruction.size() >= 2 && instruction[0]->opcode == OPCODE_CALL && instruction[1]->opcode == OPCODE_RET)
- {
- if(calledFunctions.size() == 1)
- {
- instruction[0]->opcode = OPCODE_NULL;
- instruction[1]->opcode = OPCODE_NULL;
-
- for(size_t i = 2; i < instruction.size(); i++)
- {
- if(instruction[i]->opcode == OPCODE_LABEL || instruction[i]->opcode == OPCODE_RET)
- {
- instruction[i]->opcode = OPCODE_NULL;
- }
- }
- }
- }
- }
-
- void Shader::removeNull()
- {
- size_t size = 0;
- for(size_t i = 0; i < instruction.size(); i++)
- {
- if(instruction[i]->opcode != OPCODE_NULL)
- {
- instruction[size] = instruction[i];
- size++;
- }
- else
- {
- delete instruction[i];
- }
- }
-
- instruction.resize(size);
- }
-
- void Shader::analyzeDirtyConstants()
- {
- dirtyConstantsF = 0;
- dirtyConstantsI = 0;
- dirtyConstantsB = 0;
-
- for(const auto &inst : instruction)
- {
- switch(inst->opcode)
- {
- case OPCODE_DEF:
- if(inst->dst.index + 1 > dirtyConstantsF)
- {
- dirtyConstantsF = inst->dst.index + 1;
- }
- break;
- case OPCODE_DEFI:
- if(inst->dst.index + 1 > dirtyConstantsI)
- {
- dirtyConstantsI = inst->dst.index + 1;
- }
- break;
- case OPCODE_DEFB:
- if(inst->dst.index + 1 > dirtyConstantsB)
- {
- dirtyConstantsB = inst->dst.index + 1;
- }
- break;
- default:
- break;
- }
- }
- }
-
- void Shader::analyzeDynamicBranching()
- {
- dynamicBranching = false;
- containsLeave = false;
- containsBreak = false;
- containsContinue = false;
- containsDefine = false;
-
- // Determine global presence of branching instructions
- for(const auto &inst : instruction)
- {
- switch(inst->opcode)
- {
- case OPCODE_CALLNZ:
- case OPCODE_IF:
- case OPCODE_IFC:
- case OPCODE_BREAK:
- case OPCODE_BREAKC:
- case OPCODE_CMP:
- case OPCODE_BREAKP:
- case OPCODE_LEAVE:
- case OPCODE_CONTINUE:
- if(inst->src[0].type != PARAMETER_CONSTBOOL)
- {
- dynamicBranching = true;
- }
-
- if(inst->opcode == OPCODE_LEAVE)
- {
- containsLeave = true;
- }
-
- if(inst->isBreak())
- {
- containsBreak = true;
- }
-
- if(inst->opcode == OPCODE_CONTINUE)
- {
- containsContinue = true;
- }
- case OPCODE_DEF:
- case OPCODE_DEFB:
- case OPCODE_DEFI:
- containsDefine = true;
- default:
- break;
- }
- }
-
- // Conservatively determine which instructions are affected by dynamic branching
- int branchDepth = 0;
- int breakDepth = 0;
- int continueDepth = 0;
- bool leaveReturn = false;
- unsigned int functionBegin = 0;
-
- for(unsigned int i = 0; i < instruction.size(); i++)
- {
- // If statements and loops
- if(instruction[i]->isBranch() || instruction[i]->isLoop())
- {
- branchDepth++;
- }
- else if(instruction[i]->opcode == OPCODE_ENDIF || instruction[i]->isEndLoop())
- {
- branchDepth--;
- }
-
- if(branchDepth > 0)
- {
- instruction[i]->analysisBranch = true;
-
- if(instruction[i]->isCall())
- {
- markFunctionAnalysis(instruction[i]->dst.label, ANALYSIS_BRANCH);
- }
- }
-
- // Break statemement
- if(instruction[i]->isBreak())
- {
- breakDepth++;
- }
-
- if(breakDepth > 0)
- {
- if(instruction[i]->isLoop() || instruction[i]->opcode == OPCODE_SWITCH) // Nested loop or switch, don't make the end of it disable the break execution mask
- {
- breakDepth++;
- }
- else if(instruction[i]->isEndLoop() || instruction[i]->opcode == OPCODE_ENDSWITCH)
- {
- breakDepth--;
- }
-
- instruction[i]->analysisBreak = true;
-
- if(instruction[i]->isCall())
- {
- markFunctionAnalysis(instruction[i]->dst.label, ANALYSIS_BRANCH);
- }
- }
-
- // Continue statement
- if(instruction[i]->opcode == OPCODE_CONTINUE)
- {
- continueDepth++;
- }
-
- if(continueDepth > 0)
- {
- if(instruction[i]->isLoop() || instruction[i]->opcode == OPCODE_SWITCH) // Nested loop or switch, don't make the end of it disable the break execution mask
- {
- continueDepth++;
- }
- else if(instruction[i]->isEndLoop() || instruction[i]->opcode == OPCODE_ENDSWITCH)
- {
- continueDepth--;
- }
-
- instruction[i]->analysisContinue = true;
-
- if(instruction[i]->isCall())
- {
- markFunctionAnalysis(instruction[i]->dst.label, ANALYSIS_CONTINUE);
- }
- }
-
- // Return (leave) statement
- if(instruction[i]->opcode == OPCODE_LEAVE)
- {
- leaveReturn = true;
-
- // Mark loop body instructions prior to the return statement
- for(unsigned int l = functionBegin; l < i; l++)
- {
- if(instruction[l]->isLoop())
- {
- for(unsigned int r = l + 1; r < i; r++)
- {
- instruction[r]->analysisLeave = true;
- }
-
- break;
- }
- }
- }
- else if(instruction[i]->opcode == OPCODE_RET) // End of the function
- {
- leaveReturn = false;
- }
- else if(instruction[i]->opcode == OPCODE_LABEL)
- {
- functionBegin = i;
- }
-
- if(leaveReturn)
- {
- instruction[i]->analysisLeave = true;
-
- if(instruction[i]->isCall())
- {
- markFunctionAnalysis(instruction[i]->dst.label, ANALYSIS_LEAVE);
- }
- }
- }
- }
-
- void Shader::markFunctionAnalysis(unsigned int functionLabel, Analysis flag)
- {
- bool marker = false;
- for(auto &inst : instruction)
- {
- if(!marker)
- {
- if(inst->opcode == OPCODE_LABEL && inst->dst.label == functionLabel)
- {
- marker = true;
- }
- }
- else
- {
- if(inst->opcode == OPCODE_RET)
- {
- break;
- }
- else if(inst->isCall())
- {
- markFunctionAnalysis(inst->dst.label, flag);
- }
-
- inst->analysis |= flag;
- }
- }
- }
-
- void Shader::analyzeSamplers()
- {
- for(const auto &inst : instruction)
- {
- switch(inst->opcode)
- {
- case OPCODE_TEX:
- case OPCODE_TEXBEM:
- case OPCODE_TEXBEML:
- case OPCODE_TEXREG2AR:
- case OPCODE_TEXREG2GB:
- case OPCODE_TEXM3X2TEX:
- case OPCODE_TEXM3X3TEX:
- case OPCODE_TEXM3X3SPEC:
- case OPCODE_TEXM3X3VSPEC:
- case OPCODE_TEXREG2RGB:
- case OPCODE_TEXDP3TEX:
- case OPCODE_TEXM3X2DEPTH:
- case OPCODE_TEXLDD:
- case OPCODE_TEXLDL:
- case OPCODE_TEXLOD:
- case OPCODE_TEXOFFSET:
- case OPCODE_TEXOFFSETBIAS:
- case OPCODE_TEXLODOFFSET:
- case OPCODE_TEXELFETCH:
- case OPCODE_TEXELFETCHOFFSET:
- case OPCODE_TEXGRAD:
- case OPCODE_TEXGRADOFFSET:
- {
- Parameter &dst = inst->dst;
- Parameter &src1 = inst->src[1];
-
- if(majorVersion >= 2)
- {
- if(src1.type == PARAMETER_SAMPLER)
- {
- usedSamplers |= 1 << src1.index;
- }
- }
- else
- {
- usedSamplers |= 1 << dst.index;
- }
- }
- break;
- default:
- break;
- }
- }
- }
-
- // Assigns a unique index to each call instruction, on a per label basis.
- // This is used to know what basic block to return to.
- void Shader::analyzeCallSites()
- {
- std::unordered_map<int, int> callSiteIndices;
-
- for(auto &inst : instruction)
- {
- if(inst->opcode == OPCODE_CALL || inst->opcode == OPCODE_CALLNZ)
- {
- inst->dst.callSite = callSiteIndices[inst->dst.label]++;
- }
- }
- }
-
- void Shader::analyzeIndirectAddressing()
- {
- indirectAddressableTemporaries = false;
- indirectAddressableInput = false;
- indirectAddressableOutput = false;
-
- for(const auto &inst : instruction)
- {
- if(inst->dst.rel.type != PARAMETER_VOID)
- {
- switch(inst->dst.type)
- {
- case PARAMETER_TEMP: indirectAddressableTemporaries = true; break;
- case PARAMETER_INPUT: indirectAddressableInput = true; break;
- case PARAMETER_OUTPUT: indirectAddressableOutput = true; break;
- default: break;
- }
- }
-
- for(int j = 0; j < 3; j++)
- {
- if(inst->src[j].rel.type != PARAMETER_VOID)
- {
- switch(inst->src[j].type)
- {
- case PARAMETER_TEMP: indirectAddressableTemporaries = true; break;
- case PARAMETER_INPUT: indirectAddressableInput = true; break;
- case PARAMETER_OUTPUT: indirectAddressableOutput = true; break;
- default: break;
- }
- }
- }
- }
- }
-
- // analyzeLimits analyzes the whole shader program to determine the deepest
- // nesting of control flow blocks and function calls. These calculations
- // are stored into the limits member, and is used by the programs to
- // allocate stack storage variables.
- void Shader::analyzeLimits()
- {
- typedef unsigned int FunctionID;
-
- // Identifier of the function with the main entry point.
- constexpr FunctionID MAIN_ID = 0xF0000000;
-
- // Invalid function identifier.
- constexpr FunctionID INVALID_ID = ~0U;
-
- // Limits on a single function.
- struct FunctionLimits
- {
- uint32_t loops = 0; // maximum nested loop and reps.
- uint32_t ifs = 0; // maximum nested if statements.
- uint32_t stack = 0; // maximum call depth.
- };
-
- // Information about a single function in the shader.
- struct FunctionInfo
- {
- FunctionLimits limits;
- std::unordered_set<FunctionID> calls; // What this function calls.
- bool reachable; // Is this function reachable?
- };
-
- std::unordered_map<FunctionID, FunctionInfo> functions;
-
- uint32_t maxLabel = 0; // Highest label found
-
- // Add a definition for the main entry point.
- // This starts at the beginning of the instructions and does not have
- // its own label.
- functions[MAIN_ID] = FunctionInfo();
- functions[MAIN_ID].reachable = true;
-
- // Begin by doing a pass over the instructions to identify all the
- // functions. These start with a label and end with a ret. Note that
- // functions can have labels within them.
- FunctionID currentFunc = MAIN_ID;
- for(auto &inst : instruction)
- {
- switch (inst->opcode)
- {
- case OPCODE_LABEL:
- if (currentFunc == INVALID_ID)
- {
- // Start of a function.
- FunctionID id = inst->dst.label;
- ASSERT(id != MAIN_ID); // If this fires, we're going to have to represent main with something else.
- functions[id] = FunctionInfo();
- }
- break;
- case OPCODE_RET:
- currentFunc = INVALID_ID;
- break;
- default:
- break;
- }
- }
-
- // Limits for the currently analyzed function.
- FunctionLimits currentLimits;
-
- // Now loop over the instructions gathering the limits of each of the
- // functions.
- currentFunc = MAIN_ID;
- for(size_t i = 0; i < instruction.size(); i++)
- {
- const auto& inst = instruction[i];
- switch (inst->opcode)
- {
- case OPCODE_LABEL:
- {
- maxLabel = std::max(maxLabel, inst->dst.label);
- if (currentFunc == INVALID_ID)
- {
- // Start of a function.
- FunctionID id = inst->dst.label;
- ASSERT(functions.find(id) != functions.end()); // Sanity check
- currentFunc = id;
- }
- break;
- }
- case OPCODE_CALL:
- case OPCODE_CALLNZ:
- {
- ASSERT(currentFunc != INVALID_ID);
- FunctionID id = inst->dst.label;
- ASSERT(functions.find(id) != functions.end());
- functions[currentFunc].calls.emplace(id);
- functions[id].reachable = true;
- break;
- }
- case OPCODE_LOOP:
- case OPCODE_REP:
- case OPCODE_WHILE:
- case OPCODE_SWITCH: // Not a mistake - switches share loopReps.
- {
- ASSERT(currentFunc != INVALID_ID);
- ++currentLimits.loops;
- auto& func = functions[currentFunc];
- func.limits.loops = std::max(func.limits.loops, currentLimits.loops);
- break;
- }
- case OPCODE_ENDLOOP:
- case OPCODE_ENDREP:
- case OPCODE_ENDWHILE:
- case OPCODE_ENDSWITCH:
- {
- ASSERT(currentLimits.loops > 0);
- --currentLimits.loops;
- break;
- }
- case OPCODE_IF:
- case OPCODE_IFC:
- {
- ASSERT(currentFunc != INVALID_ID);
- ++currentLimits.ifs;
- auto& func = functions[currentFunc];
- func.limits.ifs = std::max(func.limits.ifs, currentLimits.ifs);
- break;
- }
- case OPCODE_ENDIF:
- {
- ASSERT(currentLimits.ifs > 0);
- currentLimits.ifs--;
- break;
- }
- case OPCODE_RET:
- {
- // Must be in a function to return.
- ASSERT(currentFunc != INVALID_ID);
-
- // All stacks should be popped before returning.
- ASSERT(currentLimits.ifs == 0);
- ASSERT(currentLimits.loops == 0);
-
- currentFunc = INVALID_ID;
- currentLimits = FunctionLimits();
- break;
- }
- default:
- break;
- }
- }
-
-#if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
- // Assert that every function is reachable (these should have been
- // stripped in earlier stages). Unreachable functions may be code
- // generated, but their own limits are not considered below, potentially
- // causing OOB indexing in later stages.
- // If we ever find cases where there are unreachable functions, we can
- // replace this assert with NO-OPing or stripping out the dead
- // functions.
- for (const auto &it : functions) { ASSERT(it.second.reachable); }
-#endif
-
- // We have now gathered all the information about each of the functions
- // in the shader. Traverse these functions starting from the main
- // function to calculate the maximum limits across the entire shader.
-
- std::unordered_set<FunctionID> visited;
- std::function<Limits(FunctionID)> traverse;
- traverse = [&](FunctionID id) -> Limits
- {
- const auto& func = functions[id];
- ASSERT(visited.count(id) == 0); // Sanity check: Recursive functions are not allowed.
- visited.insert(id);
- Limits limits;
- limits.stack = 1;
- for (auto callee : func.calls)
- {
- auto calleeLimits = traverse(callee);
- limits.loops = std::max(limits.loops, calleeLimits.loops);
- limits.ifs = std::max(limits.ifs, calleeLimits.ifs);
- limits.stack = std::max(limits.stack, calleeLimits.stack + 1);
- }
- visited.erase(id);
-
- limits.loops += func.limits.loops;
- limits.ifs += func.limits.ifs;
- return limits;
- };
-
- limits = traverse(MAIN_ID);
- limits.maxLabel = maxLabel;
- }
-}
diff --git a/src/Shader/Shader.hpp b/src/Shader/Shader.hpp
deleted file mode 100644
index b9d01887d..000000000
--- a/src/Shader/Shader.hpp
+++ /dev/null
@@ -1,677 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_Shader_hpp
-#define sw_Shader_hpp
-
-#include "Common/Types.hpp"
-
-#include <string>
-#include <vector>
-
-namespace sw
-{
- class Shader
- {
- public:
- enum ShaderType
- {
- SHADER_PIXEL = 0xFFFF,
- SHADER_VERTEX = 0xFFFE,
- SHADER_GEOMETRY = 0xFFFD
- };
-
- enum Opcode
- {
- // Matches order in d3d9types.h
- // See https://docs.microsoft.com/en-us/windows-hardware/drivers/ddi/content/d3d9types/ne-d3d9types-_d3dshader_instruction_opcode_type
- OPCODE_NOP = 0,
- OPCODE_MOV,
- OPCODE_ADD,
- OPCODE_SUB,
- OPCODE_MAD,
- OPCODE_MUL,
- OPCODE_RCPX,
- OPCODE_RSQX,
- OPCODE_DP3,
- OPCODE_DP4,
- OPCODE_MIN,
- OPCODE_MAX,
- OPCODE_SLT,
- OPCODE_SGE,
- OPCODE_EXP2X, // D3DSIO_EXP
- OPCODE_LOG2X, // D3DSIO_LOG
- OPCODE_LIT,
- OPCODE_ATT, // D3DSIO_DST
- OPCODE_LRP,
- OPCODE_FRC,
- OPCODE_M4X4,
- OPCODE_M4X3,
- OPCODE_M3X4,
- OPCODE_M3X3,
- OPCODE_M3X2,
- OPCODE_CALL,
- OPCODE_CALLNZ,
- OPCODE_LOOP,
- OPCODE_RET,
- OPCODE_ENDLOOP,
- OPCODE_LABEL,
- OPCODE_DCL,
- OPCODE_POWX,
- OPCODE_CRS,
- OPCODE_SGN,
- OPCODE_ABS,
- OPCODE_NRM3, // D3DSIO_NRM
- OPCODE_SINCOS,
- OPCODE_REP,
- OPCODE_ENDREP,
- OPCODE_IF,
- OPCODE_IFC,
- OPCODE_ELSE,
- OPCODE_ENDIF,
- OPCODE_BREAK,
- OPCODE_BREAKC,
- OPCODE_MOVA,
- OPCODE_DEFB,
- OPCODE_DEFI,
-
- OPCODE_TEXCOORD = 64,
- OPCODE_TEXKILL,
- OPCODE_TEX,
- OPCODE_TEXBEM,
- OPCODE_TEXBEML,
- OPCODE_TEXREG2AR,
- OPCODE_TEXREG2GB,
- OPCODE_TEXM3X2PAD,
- OPCODE_TEXM3X2TEX,
- OPCODE_TEXM3X3PAD,
- OPCODE_TEXM3X3TEX,
- OPCODE_RESERVED0,
- OPCODE_TEXM3X3SPEC,
- OPCODE_TEXM3X3VSPEC,
- OPCODE_EXPP,
- OPCODE_LOGP,
- OPCODE_CND,
- OPCODE_DEF,
- OPCODE_TEXREG2RGB,
- OPCODE_TEXDP3TEX,
- OPCODE_TEXM3X2DEPTH,
- OPCODE_TEXDP3,
- OPCODE_TEXM3X3,
- OPCODE_TEXDEPTH,
- OPCODE_CMP0, // D3DSIO_CMP
- OPCODE_BEM,
- OPCODE_DP2ADD,
- OPCODE_DFDX, // D3DSIO_DSX
- OPCODE_DFDY, // D3DSIO_DSY
- OPCODE_TEXLDD,
- OPCODE_CMP, // D3DSIO_SETP
- OPCODE_TEXLDL,
- OPCODE_BREAKP,
-
- OPCODE_PHASE = 0xFFFD,
- OPCODE_COMMENT = 0xFFFE,
- OPCODE_END = 0xFFFF,
-
- OPCODE_PS_1_0 = 0xFFFF0100,
- OPCODE_PS_1_1 = 0xFFFF0101,
- OPCODE_PS_1_2 = 0xFFFF0102,
- OPCODE_PS_1_3 = 0xFFFF0103,
- OPCODE_PS_1_4 = 0xFFFF0104,
- OPCODE_PS_2_0 = 0xFFFF0200,
- OPCODE_PS_2_x = 0xFFFF0201,
- OPCODE_PS_3_0 = 0xFFFF0300,
-
- OPCODE_VS_1_0 = 0xFFFE0100,
- OPCODE_VS_1_1 = 0xFFFE0101,
- OPCODE_VS_2_0 = 0xFFFE0200,
- OPCODE_VS_2_x = 0xFFFE0201,
- OPCODE_VS_2_sw = 0xFFFE02FF,
- OPCODE_VS_3_0 = 0xFFFE0300,
- OPCODE_VS_3_sw = 0xFFFE03FF,
-
- OPCODE_NULL = 0x10000000, // Dead instruction, to be eliminated
- OPCODE_WHILE,
- OPCODE_ENDWHILE,
- OPCODE_COS,
- OPCODE_SIN,
- OPCODE_TAN,
- OPCODE_ACOS,
- OPCODE_ASIN,
- OPCODE_ATAN,
- OPCODE_ATAN2,
- OPCODE_COSH,
- OPCODE_SINH,
- OPCODE_TANH,
- OPCODE_ACOSH,
- OPCODE_ASINH,
- OPCODE_ATANH,
- OPCODE_DP1,
- OPCODE_DP2,
- OPCODE_TRUNC,
- OPCODE_FLOOR,
- OPCODE_ROUND,
- OPCODE_ROUNDEVEN,
- OPCODE_CEIL,
- OPCODE_SQRT,
- OPCODE_RSQ,
- OPCODE_LEN2,
- OPCODE_LEN3,
- OPCODE_LEN4,
- OPCODE_DIST1,
- OPCODE_DIST2,
- OPCODE_DIST3,
- OPCODE_DIST4,
- OPCODE_NRM2,
- OPCODE_NRM4,
- OPCODE_DIV,
- OPCODE_MOD,
- OPCODE_EXP2,
- OPCODE_LOG2,
- OPCODE_EXP,
- OPCODE_LOG,
- OPCODE_POW,
- OPCODE_F2B, // Float to bool
- OPCODE_B2F, // Bool to float
- OPCODE_F2I, // Float to int
- OPCODE_I2F, // Int to float
- OPCODE_F2U, // Float to uint
- OPCODE_U2F, // Uint to float
- OPCODE_I2B, // Int to bool
- OPCODE_B2I, // Bool to int
- OPCODE_DET2,
- OPCODE_DET3,
- OPCODE_DET4,
- OPCODE_ALL,
- OPCODE_ANY,
- OPCODE_NEG,
- OPCODE_NOT,
- OPCODE_OR,
- OPCODE_XOR,
- OPCODE_AND,
- OPCODE_EQ,
- OPCODE_NE,
- OPCODE_STEP,
- OPCODE_SMOOTH,
- OPCODE_ISNAN,
- OPCODE_ISINF,
- OPCODE_TEXOFFSET,
- OPCODE_TEXLODOFFSET,
- OPCODE_TEXELFETCH,
- OPCODE_TEXELFETCHOFFSET,
- OPCODE_TEXGRAD,
- OPCODE_TEXGRADOFFSET,
- OPCODE_TEXBIAS,
- OPCODE_TEXLOD,
- OPCODE_TEXOFFSETBIAS,
- OPCODE_TEXSIZE,
- OPCODE_FLOATBITSTOINT,
- OPCODE_FLOATBITSTOUINT,
- OPCODE_INTBITSTOFLOAT,
- OPCODE_UINTBITSTOFLOAT,
- OPCODE_PACKSNORM2x16,
- OPCODE_PACKUNORM2x16,
- OPCODE_PACKHALF2x16,
- OPCODE_UNPACKSNORM2x16,
- OPCODE_UNPACKUNORM2x16,
- OPCODE_UNPACKHALF2x16,
- OPCODE_FORWARD1,
- OPCODE_FORWARD2,
- OPCODE_FORWARD3,
- OPCODE_FORWARD4,
- OPCODE_REFLECT1,
- OPCODE_REFLECT2,
- OPCODE_REFLECT3,
- OPCODE_REFLECT4,
- OPCODE_REFRACT1,
- OPCODE_REFRACT2,
- OPCODE_REFRACT3,
- OPCODE_REFRACT4,
- OPCODE_ICMP,
- OPCODE_UCMP,
- OPCODE_SELECT,
- OPCODE_EXTRACT,
- OPCODE_INSERT,
- OPCODE_DISCARD,
- OPCODE_FWIDTH,
- OPCODE_LEAVE, // Return before the end of the function
- OPCODE_CONTINUE,
- OPCODE_TEST, // Marks the end of the code that can be skipped by 'continue'
- OPCODE_SCALAR, // Marks the start of code not subject to SIMD lane masking. Ends at WHILE and ENDWHILE.
- OPCODE_SWITCH,
- OPCODE_ENDSWITCH,
-
- // Integer opcodes
- OPCODE_INEG,
- OPCODE_IABS,
- OPCODE_ISGN,
- OPCODE_IADD,
- OPCODE_ISUB,
- OPCODE_IMUL,
- OPCODE_IDIV,
- OPCODE_IMAD,
- OPCODE_IMOD,
- OPCODE_SHL,
- OPCODE_ISHR,
- OPCODE_IMIN,
- OPCODE_IMAX,
-
- // Unsigned integer opcodes
- OPCODE_UDIV,
- OPCODE_UMOD,
- OPCODE_USHR,
- OPCODE_UMIN,
- OPCODE_UMAX,
- };
-
- static Opcode OPCODE_DP(int);
- static Opcode OPCODE_LEN(int);
- static Opcode OPCODE_DIST(int);
- static Opcode OPCODE_NRM(int);
- static Opcode OPCODE_FORWARD(int);
- static Opcode OPCODE_REFLECT(int);
- static Opcode OPCODE_REFRACT(int);
-
- enum Control
- {
- CONTROL_RESERVED0,
- CONTROL_GT,
- CONTROL_EQ,
- CONTROL_GE,
- CONTROL_LT,
- CONTROL_NE,
- CONTROL_LE,
- CONTROL_RESERVED1
- };
-
- enum SamplerType
- {
- SAMPLER_UNKNOWN,
- SAMPLER_1D,
- SAMPLER_2D,
- SAMPLER_CUBE,
- SAMPLER_VOLUME
- };
-
- enum Usage // For vertex input/output declarations
- {
- USAGE_POSITION = 0,
- USAGE_BLENDWEIGHT = 1,
- USAGE_BLENDINDICES = 2,
- USAGE_NORMAL = 3,
- USAGE_PSIZE = 4,
- USAGE_TEXCOORD = 5,
- USAGE_TANGENT = 6,
- USAGE_BINORMAL = 7,
- USAGE_TESSFACTOR = 8,
- USAGE_POSITIONT = 9,
- USAGE_COLOR = 10,
- USAGE_FOG = 11,
- USAGE_DEPTH = 12,
- USAGE_SAMPLE = 13
- };
-
- enum ParameterType
- {
- PARAMETER_TEMP = 0,
- PARAMETER_INPUT = 1,
- PARAMETER_CONST = 2,
- PARAMETER_TEXTURE = 3,
- PARAMETER_ADDR = 3,
- PARAMETER_RASTOUT = 4,
- PARAMETER_ATTROUT = 5,
- PARAMETER_TEXCRDOUT = 6,
- PARAMETER_OUTPUT = 6,
- PARAMETER_CONSTINT = 7,
- PARAMETER_COLOROUT = 8,
- PARAMETER_DEPTHOUT = 9,
- PARAMETER_SAMPLER = 10,
- PARAMETER_CONST2 = 11,
- PARAMETER_CONST3 = 12,
- PARAMETER_CONST4 = 13,
- PARAMETER_CONSTBOOL = 14,
- PARAMETER_LOOP = 15,
- PARAMETER_TEMPFLOAT16 = 16,
- PARAMETER_MISCTYPE = 17,
- PARAMETER_LABEL = 18,
- PARAMETER_PREDICATE = 19,
-
- // PARAMETER_FLOAT1LITERAL,
- // PARAMETER_FLOAT2LITERAL,
- // PARAMETER_FLOAT3LITERAL,
- PARAMETER_FLOAT4LITERAL,
- PARAMETER_BOOL1LITERAL,
- // PARAMETER_BOOL2LITERAL,
- // PARAMETER_BOOL3LITERAL,
- // PARAMETER_BOOL4LITERAL,
- // PARAMETER_INT1LITERAL,
- // PARAMETER_INT2LITERAL,
- // PARAMETER_INT3LITERAL,
- PARAMETER_INT4LITERAL,
-
- PARAMETER_VOID
- };
-
- enum MiscParameterIndex
- {
- VPosIndex = 0,
- VFaceIndex = 1,
- InstanceIDIndex = 2,
- VertexIDIndex = 3,
- };
-
- enum Modifier
- {
- MODIFIER_NONE,
- MODIFIER_NEGATE,
- MODIFIER_BIAS,
- MODIFIER_BIAS_NEGATE,
- MODIFIER_SIGN,
- MODIFIER_SIGN_NEGATE,
- MODIFIER_COMPLEMENT,
- MODIFIER_X2,
- MODIFIER_X2_NEGATE,
- MODIFIER_DZ,
- MODIFIER_DW,
- MODIFIER_ABS,
- MODIFIER_ABS_NEGATE,
- MODIFIER_NOT
- };
-
- enum Analysis
- {
- // Flags indicating whether an instruction is affected by an execution enable mask
- ANALYSIS_BRANCH = 0x00000001,
- ANALYSIS_BREAK = 0x00000002,
- ANALYSIS_CONTINUE = 0x00000004,
- ANALYSIS_LEAVE = 0x00000008,
- };
-
- struct Relative
- {
- ParameterType type : 8;
- unsigned int index;
- unsigned int swizzle : 8;
- unsigned int scale;
- bool dynamic; // Varies between concurrent shader instances
- };
-
- struct Parameter
- {
- union
- {
- struct
- {
- unsigned int index; // For registers types
-
- Relative rel;
- };
-
- float value[4]; // For float constants
- int integer[4]; // For integer constants
- int boolean[4]; // For boolean constants
-
- struct
- {
- unsigned int label; // Label index
- unsigned int callSite; // Call index (per label)
- };
- };
-
- Parameter() : index(0), type(PARAMETER_VOID)
- {
- rel.type = PARAMETER_VOID;
- rel.index = 0;
- rel.swizzle = 0;
- rel.scale = 1;
- rel.dynamic = true;
- }
-
- std::string string(ShaderType shaderType, unsigned short version) const;
- std::string typeString(ShaderType shaderType, unsigned short version) const;
- std::string relativeString() const;
-
- ParameterType type : 8;
- };
-
- struct DestinationParameter : Parameter
- {
- union
- {
- unsigned char mask;
-
- struct
- {
- bool x : 1;
- bool y : 1;
- bool z : 1;
- bool w : 1;
- };
- };
-
- DestinationParameter() : mask(0xF), saturate(false), partialPrecision(false), centroid(false), shift(0)
- {
- }
-
- std::string modifierString() const;
- std::string shiftString() const;
- std::string maskString() const;
-
- bool saturate : 1;
- bool partialPrecision : 1;
- bool centroid : 1;
- signed char shift : 4;
- };
-
- struct SourceParameter : Parameter
- {
- SourceParameter() : swizzle(0xE4), modifier(MODIFIER_NONE), bufferIndex(-1)
- {
- }
-
- std::string string(ShaderType shaderType, unsigned short version) const;
- std::string swizzleString() const;
- std::string preModifierString() const;
- std::string postModifierString() const;
-
- unsigned int swizzle : 8;
- Modifier modifier : 8;
- int bufferIndex : 8;
- };
-
- struct Instruction
- {
- explicit Instruction(Opcode opcode);
- Instruction(const unsigned long *token, int size, unsigned char majorVersion);
-
- virtual ~Instruction();
-
- void parseOperationToken(unsigned long token, unsigned char majorVersion);
- void parseDeclarationToken(unsigned long token);
- void parseDestinationToken(const unsigned long *token, unsigned char majorVersion);
- void parseSourceToken(int i, const unsigned long *token, unsigned char majorVersion);
-
- std::string string(ShaderType shaderType, unsigned short version) const;
- static std::string swizzleString(ParameterType type, unsigned char swizzle);
- std::string operationString(unsigned short version) const;
- std::string controlString() const;
-
- bool isBranch() const;
- bool isCall() const;
- bool isBreak() const;
- bool isLoop() const;
- bool isEndLoop() const;
-
- bool isPredicated() const;
-
- Opcode opcode;
-
- union
- {
- Control control;
-
- struct
- {
- unsigned char project : 1; // D3DSI_TEXLD_PROJECT
- unsigned char bias : 1; // D3DSI_TEXLD_BIAS
- };
- };
-
- bool predicate;
- bool predicateNot; // Negative predicate
- unsigned char predicateSwizzle;
-
- bool coissue;
- SamplerType samplerType;
- Usage usage;
- unsigned char usageIndex;
-
- DestinationParameter dst;
- SourceParameter src[5];
-
- union
- {
- unsigned int analysis;
-
- struct
- {
- // Keep in sync with Shader::Analysis flags
- unsigned int analysisBranch : 1;
- unsigned int analysisBreak : 1;
- unsigned int analysisContinue : 1;
- unsigned int analysisLeave : 1;
- };
- };
- };
-
- // Limits holds the maximum nested counts for the shader.
- struct Limits
- {
- uint32_t loops = 0; // maximum nested loop and reps.
- uint32_t ifs = 0; // maximum nested if statements.
- uint32_t stack = 0; // maximum call depth.
- uint32_t maxLabel = 0; // highest label in use.
- };
-
- Shader();
-
- virtual ~Shader();
-
- int getSerialID() const;
- size_t getLength() const;
- ShaderType getShaderType() const;
- unsigned short getShaderModel() const;
- inline const Limits& getLimits() const { return limits; }
-
- void append(Instruction *instruction);
- void declareSampler(int i);
-
- const Instruction *getInstruction(size_t i) const;
- int size(unsigned long opcode) const;
- static int size(unsigned long opcode, unsigned short shaderModel);
-
- void print(const char *fileName, ...) const;
- void printInstruction(int index, const char *fileName) const;
-
- static bool maskContainsComponent(int mask, int component);
- static bool swizzleContainsComponent(int swizzle, int component);
- static bool swizzleContainsComponentMasked(int swizzle, int component, int mask);
-
- bool containsDynamicBranching() const;
- bool containsBreakInstruction() const;
- bool containsContinueInstruction() const;
- bool containsLeaveInstruction() const;
- bool containsDefineInstruction() const;
- bool usesSampler(int i) const;
-
- struct Semantic
- {
- Semantic(unsigned char usage = 0xFF, unsigned char index = 0xFF, bool flat = false) : usage(usage), index(index), centroid(false), flat(flat)
- {
- }
-
- bool operator==(const Semantic &semantic) const
- {
- return usage == semantic.usage && index == semantic.index;
- }
-
- bool active() const
- {
- return usage != 0xFF;
- }
-
- unsigned char usage;
- unsigned char index;
- bool centroid;
- bool flat;
- };
-
- void optimize();
-
- // FIXME: Private
- unsigned int dirtyConstantsF;
- unsigned int dirtyConstantsI;
- unsigned int dirtyConstantsB;
-
- bool indirectAddressableTemporaries;
- bool indirectAddressableInput;
- bool indirectAddressableOutput;
-
- protected:
- void parse(const unsigned long *token);
-
- void optimizeLeave();
- void optimizeCall();
- void removeNull();
-
- void analyzeDirtyConstants();
- void analyzeDynamicBranching();
- void analyzeSamplers();
- void analyzeCallSites();
- void analyzeIndirectAddressing();
- void analyzeLimits();
- void markFunctionAnalysis(unsigned int functionLabel, Analysis flag);
-
- Limits limits; // Calculated in analyzeLimits().
-
- ShaderType shaderType;
-
- union
- {
- unsigned short shaderModel;
-
- struct
- {
- unsigned char minorVersion;
- unsigned char majorVersion;
- };
- };
-
- std::vector<Instruction*> instruction;
-
- unsigned short usedSamplers; // Bit flags
-
- private:
- const int serialID;
- static volatile int serialCounter;
-
- bool dynamicBranching;
- bool containsBreak;
- bool containsContinue;
- bool containsLeave;
- bool containsDefine;
- };
-}
-
-#endif // sw_Shader_hpp
diff --git a/src/Shader/ShaderCore.cpp b/src/Shader/ShaderCore.cpp
deleted file mode 100644
index 90a28bfd4..000000000
--- a/src/Shader/ShaderCore.cpp
+++ /dev/null
@@ -1,2020 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "ShaderCore.hpp"
-
-#include "Renderer/Renderer.hpp"
-#include "Common/Debug.hpp"
-
-#include <limits.h>
-
-namespace sw
-{
- extern TranscendentalPrecision logPrecision;
- extern TranscendentalPrecision expPrecision;
- extern TranscendentalPrecision rcpPrecision;
- extern TranscendentalPrecision rsqPrecision;
-
- Vector4s::Vector4s()
- {
- }
-
- Vector4s::Vector4s(unsigned short x, unsigned short y, unsigned short z, unsigned short w)
- {
- this->x = Short4(x);
- this->y = Short4(y);
- this->z = Short4(z);
- this->w = Short4(w);
- }
-
- Vector4s::Vector4s(const Vector4s &rhs)
- {
- x = rhs.x;
- y = rhs.y;
- z = rhs.z;
- w = rhs.w;
- }
-
- Vector4s &Vector4s::operator=(const Vector4s &rhs)
- {
- x = rhs.x;
- y = rhs.y;
- z = rhs.z;
- w = rhs.w;
-
- return *this;
- }
-
- Short4 &Vector4s::operator[](int i)
- {
- switch(i)
- {
- case 0: return x;
- case 1: return y;
- case 2: return z;
- case 3: return w;
- }
-
- return x;
- }
-
- Vector4f::Vector4f()
- {
- }
-
- Vector4f::Vector4f(float x, float y, float z, float w)
- {
- this->x = Float4(x);
- this->y = Float4(y);
- this->z = Float4(z);
- this->w = Float4(w);
- }
-
- Vector4f::Vector4f(const Vector4f &rhs)
- {
- x = rhs.x;
- y = rhs.y;
- z = rhs.z;
- w = rhs.w;
- }
-
- Vector4f &Vector4f::operator=(const Vector4f &rhs)
- {
- x = rhs.x;
- y = rhs.y;
- z = rhs.z;
- w = rhs.w;
-
- return *this;
- }
-
- Float4 &Vector4f::operator[](int i)
- {
- switch(i)
- {
- case 0: return x;
- case 1: return y;
- case 2: return z;
- case 3: return w;
- }
-
- return x;
- }
-
- Float4 exponential2(RValue<Float4> x, bool pp)
- {
- // This implementation is based on 2^(i + f) = 2^i * 2^f,
- // where i is the integer part of x and f is the fraction.
-
- // For 2^i we can put the integer part directly in the exponent of
- // the IEEE-754 floating-point number. Clamp to prevent overflow
- // past the representation of infinity.
- Float4 x0 = x;
- x0 = Min(x0, As<Float4>(Int4(0x43010000))); // 129.00000e+0f
- x0 = Max(x0, As<Float4>(Int4(0xC2FDFFFF))); // -126.99999e+0f
-
- Int4 i = RoundInt(x0 - Float4(0.5f));
- Float4 ii = As<Float4>((i + Int4(127)) << 23); // Add single-precision bias, and shift into exponent.
-
- // For the fractional part use a polynomial
- // which approximates 2^f in the 0 to 1 range.
- Float4 f = x0 - Float4(i);
- Float4 ff = As<Float4>(Int4(0x3AF61905)); // 1.8775767e-3f
- ff = ff * f + As<Float4>(Int4(0x3C134806)); // 8.9893397e-3f
- ff = ff * f + As<Float4>(Int4(0x3D64AA23)); // 5.5826318e-2f
- ff = ff * f + As<Float4>(Int4(0x3E75EAD4)); // 2.4015361e-1f
- ff = ff * f + As<Float4>(Int4(0x3F31727B)); // 6.9315308e-1f
- ff = ff * f + Float4(1.0f);
-
- return ii * ff;
- }
-
- Float4 logarithm2(RValue<Float4> x, bool absolute, bool pp)
- {
- Float4 x0;
- Float4 x1;
- Float4 x2;
- Float4 x3;
-
- x0 = x;
-
- x1 = As<Float4>(As<Int4>(x0) & Int4(0x7F800000));
- x1 = As<Float4>(As<UInt4>(x1) >> 8);
- x1 = As<Float4>(As<Int4>(x1) | As<Int4>(Float4(1.0f)));
- x1 = (x1 - Float4(1.4960938f)) * Float4(256.0f); // FIXME: (x1 - 1.4960938f) * 256.0f;
- x0 = As<Float4>((As<Int4>(x0) & Int4(0x007FFFFF)) | As<Int4>(Float4(1.0f)));
-
- x2 = (Float4(9.5428179e-2f) * x0 + Float4(4.7779095e-1f)) * x0 + Float4(1.9782813e-1f);
- x3 = ((Float4(1.6618466e-2f) * x0 + Float4(2.0350508e-1f)) * x0 + Float4(2.7382900e-1f)) * x0 + Float4(4.0496687e-2f);
- x2 /= x3;
-
- x1 += (x0 - Float4(1.0f)) * x2;
-
- Int4 pos_inf_x = CmpEQ(As<Int4>(x), Int4(0x7F800000));
- return As<Float4>((pos_inf_x & As<Int4>(x)) | (~pos_inf_x & As<Int4>(x1)));
- }
-
- Float4 exponential(RValue<Float4> x, bool pp)
- {
- // FIXME: Propagate the constant
- return exponential2(Float4(1.44269504f) * x, pp); // 1/ln(2)
- }
-
- Float4 logarithm(RValue<Float4> x, bool absolute, bool pp)
- {
- // FIXME: Propagate the constant
- return Float4(6.93147181e-1f) * logarithm2(x, absolute, pp); // ln(2)
- }
-
- Float4 power(RValue<Float4> x, RValue<Float4> y, bool pp)
- {
- Float4 log = logarithm2(x, true, pp);
- log *= y;
- return exponential2(log, pp);
- }
-
- Float4 reciprocal(RValue<Float4> x, bool pp, bool finite, bool exactAtPow2)
- {
- Float4 rcp;
-
- if(!pp && rcpPrecision >= WHQL)
- {
- rcp = Float4(1.0f) / x;
- }
- else
- {
- rcp = Rcp_pp(x, exactAtPow2);
-
- if(!pp)
- {
- rcp = (rcp + rcp) - (x * rcp * rcp);
- }
- }
-
- if(finite)
- {
- int big = 0x7F7FFFFF;
- rcp = Min(rcp, Float4((float&)big));
- }
-
- return rcp;
- }
-
- Float4 reciprocalSquareRoot(RValue<Float4> x, bool absolute, bool pp)
- {
- Float4 abs = x;
-
- if(absolute)
- {
- abs = Abs(abs);
- }
-
- Float4 rsq;
-
- if(!pp)
- {
- rsq = Float4(1.0f) / Sqrt(abs);
- }
- else
- {
- rsq = RcpSqrt_pp(abs);
-
- if(!pp)
- {
- rsq = rsq * (Float4(3.0f) - rsq * rsq * abs) * Float4(0.5f);
- }
-
- rsq = As<Float4>(CmpNEQ(As<Int4>(abs), Int4(0x7F800000)) & As<Int4>(rsq));
- }
-
- return rsq;
- }
-
- Float4 modulo(RValue<Float4> x, RValue<Float4> y)
- {
- return x - y * Floor(x / y);
- }
-
- Float4 sine_pi(RValue<Float4> x, bool pp)
- {
- const Float4 A = Float4(-4.05284734e-1f); // -4/pi^2
- const Float4 B = Float4(1.27323954e+0f); // 4/pi
- const Float4 C = Float4(7.75160950e-1f);
- const Float4 D = Float4(2.24839049e-1f);
-
- // Parabola approximating sine
- Float4 sin = x * (Abs(x) * A + B);
-
- // Improve precision from 0.06 to 0.001
- if(true)
- {
- sin = sin * (Abs(sin) * D + C);
- }
-
- return sin;
- }
-
- Float4 cosine_pi(RValue<Float4> x, bool pp)
- {
- // cos(x) = sin(x + pi/2)
- Float4 y = x + Float4(1.57079632e+0f);
-
- // Wrap around
- y -= As<Float4>(CmpNLT(y, Float4(3.14159265e+0f)) & As<Int4>(Float4(6.28318530e+0f)));
-
- return sine_pi(y, pp);
- }
-
- // Assumes x is a finite floating point value
- static RValue<Float4> clamp(const Float4 &x, const Float4 &min, const Float4 &max)
- {
- return Min(Max(x, min), max);
- }
-
- Float4 sine(RValue<Float4> x, bool pp)
- {
- // Reduce to [-0.5, 0.5] range
- Float4 y = x * Float4(1.59154943e-1f); // 1/2pi
- y = y - Round(y);
-
- if(!pp)
- {
- // From the paper: "A Fast, Vectorizable Algorithm for Producing Single-Precision Sine-Cosine Pairs"
- // This implementation passes OpenGL ES 3.0 precision requirements, at the cost of more operations:
- // !pp : 17 mul, 7 add, 1 sub, 1 reciprocal
- // pp : 4 mul, 2 add, 2 abs
-
- Float4 y2 = y * y;
- Float4 c1 = y2 * (y2 * (y2 * Float4(-0.0204391631f) + Float4(0.2536086171f)) + Float4(-1.2336977925f)) + Float4(1.0f);
- Float4 s1 = y * (y2 * (y2 * (y2 * Float4(-0.0046075748f) + Float4(0.0796819754f)) + Float4(-0.645963615f)) + Float4(1.5707963235f));
- Float4 c2 = (c1 * c1) - (s1 * s1);
- Float4 s2 = Float4(2.0f) * s1 * c1;
- return Float4(2.0f) * s2 * c2 * reciprocal(s2 * s2 + c2 * c2, pp, true);
- }
-
- const Float4 A = Float4(-16.0f);
- const Float4 B = Float4(8.0f);
- const Float4 C = Float4(7.75160950e-1f);
- const Float4 D = Float4(2.24839049e-1f);
-
- // Parabola approximating sine
- Float4 sin = y * (Abs(y) * A + B);
-
- // Improve precision from 0.06 to 0.001
- if(true)
- {
- sin = sin * (Abs(sin) * D + C);
- }
-
- // TODO(b/151461290): Fix precision loss instead of clamping.
- sin = clamp(sin, Float4(-1.0f), Float4(1.0f));
-
- return sin;
- }
-
- Float4 cosine(RValue<Float4> x, bool pp)
- {
- // cos(x) = sin(x + pi/2)
- Float4 y = x + Float4(1.57079632e+0f);
- auto cos = sine(y, pp);
-
- // TODO(b/151461290): Fix precision loss instead of clamping.
- cos = clamp(cos, Float4(-1.0f), Float4(1.0f));
-
- return cos;
- }
-
- Float4 tangent(RValue<Float4> x, bool pp)
- {
- return sine(x, pp) / cosine(x, pp);
- }
-
- Float4 arccos(RValue<Float4> x, bool pp)
- {
- // pi/2 - arcsin(x)
- return Float4(1.57079632e+0f) - arcsin(x);
- }
-
- Float4 arcsin(RValue<Float4> x, bool pp)
- {
- if(false) // Simpler implementation fails even lowp precision tests
- {
- // x*(pi/2-sqrt(1-x*x)*pi/5)
- return x * (Float4(1.57079632e+0f) - Sqrt(Float4(1.0f) - x*x) * Float4(6.28318531e-1f));
- }
- else
- {
- // From 4.4.45, page 81 of the Handbook of Mathematical Functions, by Milton Abramowitz and Irene Stegun
- const Float4 half_pi(1.57079632f);
- const Float4 a0(1.5707288f);
- const Float4 a1(-0.2121144f);
- const Float4 a2(0.0742610f);
- const Float4 a3(-0.0187293f);
- Float4 absx = Abs(x);
- return As<Float4>(As<Int4>(half_pi - Sqrt(Float4(1.0f) - absx) * (a0 + absx * (a1 + absx * (a2 + absx * a3)))) ^
- (As<Int4>(x) & Int4(0x80000000)));
- }
- }
-
- // Approximation of atan in [0..1]
- Float4 arctan_01(Float4 x, bool pp)
- {
- if(pp)
- {
- return x * (Float4(-0.27f) * x + Float4(1.05539816f));
- }
- else
- {
- // From 4.4.49, page 81 of the Handbook of Mathematical Functions, by Milton Abramowitz and Irene Stegun
- const Float4 a2(-0.3333314528f);
- const Float4 a4(0.1999355085f);
- const Float4 a6(-0.1420889944f);
- const Float4 a8(0.1065626393f);
- const Float4 a10(-0.0752896400f);
- const Float4 a12(0.0429096138f);
- const Float4 a14(-0.0161657367f);
- const Float4 a16(0.0028662257f);
- Float4 x2 = x * x;
- return (x + x * (x2 * (a2 + x2 * (a4 + x2 * (a6 + x2 * (a8 + x2 * (a10 + x2 * (a12 + x2 * (a14 + x2 * a16)))))))));
- }
- }
-
- Float4 arctan(RValue<Float4> x, bool pp)
- {
- Float4 absx = Abs(x);
- Int4 O = CmpNLT(absx, Float4(1.0f));
- Float4 y = As<Float4>((O & As<Int4>(Float4(1.0f) / absx)) | (~O & As<Int4>(absx))); // FIXME: Vector select
-
- const Float4 half_pi(1.57079632f);
- Float4 theta = arctan_01(y, pp);
- return As<Float4>(((O & As<Int4>(half_pi - theta)) | (~O & As<Int4>(theta))) ^ // FIXME: Vector select
- (As<Int4>(x) & Int4(0x80000000)));
- }
-
- Float4 arctan(RValue<Float4> y, RValue<Float4> x, bool pp)
- {
- const Float4 pi(3.14159265f); // pi
- const Float4 minus_pi(-3.14159265f); // -pi
- const Float4 half_pi(1.57079632f); // pi/2
- const Float4 quarter_pi(7.85398163e-1f); // pi/4
-
- // Rotate to upper semicircle when in lower semicircle
- Int4 S = CmpLT(y, Float4(0.0f));
- Float4 theta = As<Float4>(S & As<Int4>(minus_pi));
- Float4 x0 = As<Float4>((As<Int4>(y) & Int4(0x80000000)) ^ As<Int4>(x));
- Float4 y0 = Abs(y);
-
- // Rotate to right quadrant when in left quadrant
- Int4 Q = CmpLT(x0, Float4(0.0f));
- theta += As<Float4>(Q & As<Int4>(half_pi));
- Float4 x1 = As<Float4>((Q & As<Int4>(y0)) | (~Q & As<Int4>(x0))); // FIXME: Vector select
- Float4 y1 = As<Float4>((Q & As<Int4>(-x0)) | (~Q & As<Int4>(y0))); // FIXME: Vector select
-
- // Mirror to first octant when in second octant
- Int4 O = CmpNLT(y1, x1);
- Float4 x2 = As<Float4>((O & As<Int4>(y1)) | (~O & As<Int4>(x1))); // FIXME: Vector select
- Float4 y2 = As<Float4>((O & As<Int4>(x1)) | (~O & As<Int4>(y1))); // FIXME: Vector select
-
- // Approximation of atan in [0..1]
- Int4 zero_x = CmpEQ(x2, Float4(0.0f));
- Int4 inf_y = IsInf(y2); // Since x2 >= y2, this means x2 == y2 == inf, so we use 45 degrees or pi/4
- Float4 atan2_theta = arctan_01(y2 / x2, pp);
- theta += As<Float4>((~zero_x & ~inf_y & ((O & As<Int4>(half_pi - atan2_theta)) | (~O & (As<Int4>(atan2_theta))))) | // FIXME: Vector select
- (inf_y & As<Int4>(quarter_pi)));
-
- // Recover loss of precision for tiny theta angles
- Int4 precision_loss = S & Q & O & ~inf_y; // This combination results in (-pi + half_pi + half_pi - atan2_theta) which is equivalent to -atan2_theta
- return As<Float4>((precision_loss & As<Int4>(-atan2_theta)) | (~precision_loss & As<Int4>(theta))); // FIXME: Vector select
- }
-
- Float4 sineh(RValue<Float4> x, bool pp)
- {
- return (exponential(x, pp) - exponential(-x, pp)) * Float4(0.5f);
- }
-
- Float4 cosineh(RValue<Float4> x, bool pp)
- {
- return (exponential(x, pp) + exponential(-x, pp)) * Float4(0.5f);
- }
-
- Float4 tangenth(RValue<Float4> x, bool pp)
- {
- Float4 e_x = exponential(x, pp);
- Float4 e_minus_x = exponential(-x, pp);
- return (e_x - e_minus_x) / (e_x + e_minus_x);
- }
-
- Float4 arccosh(RValue<Float4> x, bool pp)
- {
- return logarithm(x + Sqrt(x + Float4(1.0f)) * Sqrt(x - Float4(1.0f)), pp);
- }
-
- Float4 arcsinh(RValue<Float4> x, bool pp)
- {
- return logarithm(x + Sqrt(x * x + Float4(1.0f)), pp);
- }
-
- Float4 arctanh(RValue<Float4> x, bool pp)
- {
- return logarithm((Float4(1.0f) + x) / (Float4(1.0f) - x), pp) * Float4(0.5f);
- }
-
- Float4 dot2(const Vector4f &v0, const Vector4f &v1)
- {
- return v0.x * v1.x + v0.y * v1.y;
- }
-
- Float4 dot3(const Vector4f &v0, const Vector4f &v1)
- {
- return v0.x * v1.x + v0.y * v1.y + v0.z * v1.z;
- }
-
- Float4 dot4(const Vector4f &v0, const Vector4f &v1)
- {
- return v0.x * v1.x + v0.y * v1.y + v0.z * v1.z + v0.w * v1.w;
- }
-
- void transpose4x4(Short4 &row0, Short4 &row1, Short4 &row2, Short4 &row3)
- {
- Int2 tmp0 = UnpackHigh(row0, row1);
- Int2 tmp1 = UnpackHigh(row2, row3);
- Int2 tmp2 = UnpackLow(row0, row1);
- Int2 tmp3 = UnpackLow(row2, row3);
-
- row0 = UnpackLow(tmp2, tmp3);
- row1 = UnpackHigh(tmp2, tmp3);
- row2 = UnpackLow(tmp0, tmp1);
- row3 = UnpackHigh(tmp0, tmp1);
- }
-
- void transpose4x3(Short4 &row0, Short4 &row1, Short4 &row2, Short4 &row3)
- {
- Int2 tmp0 = UnpackHigh(row0, row1);
- Int2 tmp1 = UnpackHigh(row2, row3);
- Int2 tmp2 = UnpackLow(row0, row1);
- Int2 tmp3 = UnpackLow(row2, row3);
-
- row0 = UnpackLow(tmp2, tmp3);
- row1 = UnpackHigh(tmp2, tmp3);
- row2 = UnpackLow(tmp0, tmp1);
- }
-
- void transpose4x4(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3)
- {
- Float4 tmp0 = UnpackLow(row0, row1);
- Float4 tmp1 = UnpackLow(row2, row3);
- Float4 tmp2 = UnpackHigh(row0, row1);
- Float4 tmp3 = UnpackHigh(row2, row3);
-
- row0 = Float4(tmp0.xy, tmp1.xy);
- row1 = Float4(tmp0.zw, tmp1.zw);
- row2 = Float4(tmp2.xy, tmp3.xy);
- row3 = Float4(tmp2.zw, tmp3.zw);
- }
-
- void transpose4x3(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3)
- {
- Float4 tmp0 = UnpackLow(row0, row1);
- Float4 tmp1 = UnpackLow(row2, row3);
- Float4 tmp2 = UnpackHigh(row0, row1);
- Float4 tmp3 = UnpackHigh(row2, row3);
-
- row0 = Float4(tmp0.xy, tmp1.xy);
- row1 = Float4(tmp0.zw, tmp1.zw);
- row2 = Float4(tmp2.xy, tmp3.xy);
- }
-
- void transpose4x2(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3)
- {
- Float4 tmp0 = UnpackLow(row0, row1);
- Float4 tmp1 = UnpackLow(row2, row3);
-
- row0 = Float4(tmp0.xy, tmp1.xy);
- row1 = Float4(tmp0.zw, tmp1.zw);
- }
-
- void transpose4x1(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3)
- {
- Float4 tmp0 = UnpackLow(row0, row1);
- Float4 tmp1 = UnpackLow(row2, row3);
-
- row0 = Float4(tmp0.xy, tmp1.xy);
- }
-
- void transpose2x4(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3)
- {
- Float4 tmp01 = UnpackLow(row0, row1);
- Float4 tmp23 = UnpackHigh(row0, row1);
-
- row0 = tmp01;
- row1 = Float4(tmp01.zw, row1.zw);
- row2 = tmp23;
- row3 = Float4(tmp23.zw, row3.zw);
- }
-
- void transpose4xN(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3, int N)
- {
- switch(N)
- {
- case 1: transpose4x1(row0, row1, row2, row3); break;
- case 2: transpose4x2(row0, row1, row2, row3); break;
- case 3: transpose4x3(row0, row1, row2, row3); break;
- case 4: transpose4x4(row0, row1, row2, row3); break;
- }
- }
-
- const Vector4f RegisterFile::operator[](RValue<Int4> index)
- {
- ASSERT(indirectAddressable);
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- Vector4f r;
-
- r.x.x = Extract(x[0][index0], 0);
- r.x.y = Extract(x[0][index1], 1);
- r.x.z = Extract(x[0][index2], 2);
- r.x.w = Extract(x[0][index3], 3);
-
- r.y.x = Extract(y[0][index0], 0);
- r.y.y = Extract(y[0][index1], 1);
- r.y.z = Extract(y[0][index2], 2);
- r.y.w = Extract(y[0][index3], 3);
-
- r.z.x = Extract(z[0][index0], 0);
- r.z.y = Extract(z[0][index1], 1);
- r.z.z = Extract(z[0][index2], 2);
- r.z.w = Extract(z[0][index3], 3);
-
- r.w.x = Extract(w[0][index0], 0);
- r.w.y = Extract(w[0][index1], 1);
- r.w.z = Extract(w[0][index2], 2);
- r.w.w = Extract(w[0][index3], 3);
-
- return r;
- }
-
- void RegisterFile::scatter_x(Int4 index, RValue<Float4> r)
- {
- ASSERT(indirectAddressable);
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- x[0][index0] = Insert(x[0][index0], Extract(r, 0), 0);
- x[0][index1] = Insert(x[0][index1], Extract(r, 1), 1);
- x[0][index2] = Insert(x[0][index2], Extract(r, 2), 2);
- x[0][index3] = Insert(x[0][index3], Extract(r, 3), 3);
- }
-
- void RegisterFile::scatter_y(Int4 index, RValue<Float4> r)
- {
- ASSERT(indirectAddressable);
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- y[0][index0] = Insert(y[0][index0], Extract(r, 0), 0);
- y[0][index1] = Insert(y[0][index1], Extract(r, 1), 1);
- y[0][index2] = Insert(y[0][index2], Extract(r, 2), 2);
- y[0][index3] = Insert(y[0][index3], Extract(r, 3), 3);
- }
-
- void RegisterFile::scatter_z(Int4 index, RValue<Float4> r)
- {
- ASSERT(indirectAddressable);
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- z[0][index0] = Insert(z[0][index0], Extract(r, 0), 0);
- z[0][index1] = Insert(z[0][index1], Extract(r, 1), 1);
- z[0][index2] = Insert(z[0][index2], Extract(r, 2), 2);
- z[0][index3] = Insert(z[0][index3], Extract(r, 3), 3);
- }
-
- void RegisterFile::scatter_w(Int4 index, RValue<Float4> r)
- {
- ASSERT(indirectAddressable);
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- w[0][index0] = Insert(w[0][index0], Extract(r, 0), 0);
- w[0][index1] = Insert(w[0][index1], Extract(r, 1), 1);
- w[0][index2] = Insert(w[0][index2], Extract(r, 2), 2);
- w[0][index3] = Insert(w[0][index3], Extract(r, 3), 3);
- }
-
- void ShaderCore::mov(Vector4f &dst, const Vector4f &src, bool integerDestination)
- {
- if(integerDestination)
- {
- dst.x = As<Float4>(RoundInt(src.x));
- dst.y = As<Float4>(RoundInt(src.y));
- dst.z = As<Float4>(RoundInt(src.z));
- dst.w = As<Float4>(RoundInt(src.w));
- }
- else
- {
- dst = src;
- }
- }
-
- void ShaderCore::neg(Vector4f &dst, const Vector4f &src)
- {
- dst.x = -src.x;
- dst.y = -src.y;
- dst.z = -src.z;
- dst.w = -src.w;
- }
-
- void ShaderCore::ineg(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(-As<Int4>(src.x));
- dst.y = As<Float4>(-As<Int4>(src.y));
- dst.z = As<Float4>(-As<Int4>(src.z));
- dst.w = As<Float4>(-As<Int4>(src.w));
- }
-
- void ShaderCore::f2b(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(CmpNEQ(src.x, Float4(0.0f)));
- dst.y = As<Float4>(CmpNEQ(src.y, Float4(0.0f)));
- dst.z = As<Float4>(CmpNEQ(src.z, Float4(0.0f)));
- dst.w = As<Float4>(CmpNEQ(src.w, Float4(0.0f)));
- }
-
- void ShaderCore::b2f(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(As<Int4>(src.x) & As<Int4>(Float4(1.0f)));
- dst.y = As<Float4>(As<Int4>(src.y) & As<Int4>(Float4(1.0f)));
- dst.z = As<Float4>(As<Int4>(src.z) & As<Int4>(Float4(1.0f)));
- dst.w = As<Float4>(As<Int4>(src.w) & As<Int4>(Float4(1.0f)));
- }
-
- void ShaderCore::f2i(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(Int4(src.x));
- dst.y = As<Float4>(Int4(src.y));
- dst.z = As<Float4>(Int4(src.z));
- dst.w = As<Float4>(Int4(src.w));
- }
-
- void ShaderCore::i2f(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Float4(As<Int4>(src.x));
- dst.y = Float4(As<Int4>(src.y));
- dst.z = Float4(As<Int4>(src.z));
- dst.w = Float4(As<Int4>(src.w));
- }
-
- void ShaderCore::f2u(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(UInt4(src.x));
- dst.y = As<Float4>(UInt4(src.y));
- dst.z = As<Float4>(UInt4(src.z));
- dst.w = As<Float4>(UInt4(src.w));
- }
-
- void ShaderCore::u2f(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Float4(As<UInt4>(src.x));
- dst.y = Float4(As<UInt4>(src.y));
- dst.z = Float4(As<UInt4>(src.z));
- dst.w = Float4(As<UInt4>(src.w));
- }
-
- void ShaderCore::i2b(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(CmpNEQ(As<Int4>(src.x), Int4(0)));
- dst.y = As<Float4>(CmpNEQ(As<Int4>(src.y), Int4(0)));
- dst.z = As<Float4>(CmpNEQ(As<Int4>(src.z), Int4(0)));
- dst.w = As<Float4>(CmpNEQ(As<Int4>(src.w), Int4(0)));
- }
-
- void ShaderCore::b2i(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(As<Int4>(src.x) & Int4(1));
- dst.y = As<Float4>(As<Int4>(src.y) & Int4(1));
- dst.z = As<Float4>(As<Int4>(src.z) & Int4(1));
- dst.w = As<Float4>(As<Int4>(src.w) & Int4(1));
- }
-
- void ShaderCore::add(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.x + src1.x;
- dst.y = src0.y + src1.y;
- dst.z = src0.z + src1.z;
- dst.w = src0.w + src1.w;
- }
-
- void ShaderCore::iadd(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) + As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) + As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) + As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) + As<Int4>(src1.w));
- }
-
- void ShaderCore::sub(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.x - src1.x;
- dst.y = src0.y - src1.y;
- dst.z = src0.z - src1.z;
- dst.w = src0.w - src1.w;
- }
-
- void ShaderCore::isub(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) - As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) - As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) - As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) - As<Int4>(src1.w));
- }
-
- void ShaderCore::mad(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- dst.x = src0.x * src1.x + src2.x;
- dst.y = src0.y * src1.y + src2.y;
- dst.z = src0.z * src1.z + src2.z;
- dst.w = src0.w * src1.w + src2.w;
- }
-
- void ShaderCore::imad(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) * As<Int4>(src1.x) + As<Int4>(src2.x));
- dst.y = As<Float4>(As<Int4>(src0.y) * As<Int4>(src1.y) + As<Int4>(src2.y));
- dst.z = As<Float4>(As<Int4>(src0.z) * As<Int4>(src1.z) + As<Int4>(src2.z));
- dst.w = As<Float4>(As<Int4>(src0.w) * As<Int4>(src1.w) + As<Int4>(src2.w));
- }
-
- void ShaderCore::mul(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.x * src1.x;
- dst.y = src0.y * src1.y;
- dst.z = src0.z * src1.z;
- dst.w = src0.w * src1.w;
- }
-
- void ShaderCore::imul(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) * As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) * As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) * As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) * As<Int4>(src1.w));
- }
-
- void ShaderCore::rcpx(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 rcp = reciprocal(src.x, pp, true, true);
-
- dst.x = rcp;
- dst.y = rcp;
- dst.z = rcp;
- dst.w = rcp;
- }
-
- void ShaderCore::div(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.x / src1.x;
- dst.y = src0.y / src1.y;
- dst.z = src0.z / src1.z;
- dst.w = src0.w / src1.w;
- }
-
- void ShaderCore::idiv(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 intMax(As<Float4>(Int4(INT_MAX)));
- cmp0i(dst.x, src1.x, intMax, src1.x);
- dst.x = As<Float4>(As<Int4>(src0.x) / As<Int4>(dst.x));
- cmp0i(dst.y, src1.y, intMax, src1.y);
- dst.y = As<Float4>(As<Int4>(src0.y) / As<Int4>(dst.y));
- cmp0i(dst.z, src1.z, intMax, src1.z);
- dst.z = As<Float4>(As<Int4>(src0.z) / As<Int4>(dst.z));
- cmp0i(dst.w, src1.w, intMax, src1.w);
- dst.w = As<Float4>(As<Int4>(src0.w) / As<Int4>(dst.w));
- }
-
- void ShaderCore::udiv(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 uintMax(As<Float4>(UInt4(UINT_MAX)));
- cmp0i(dst.x, src1.x, uintMax, src1.x);
- dst.x = As<Float4>(As<UInt4>(src0.x) / As<UInt4>(dst.x));
- cmp0i(dst.y, src1.y, uintMax, src1.y);
- dst.y = As<Float4>(As<UInt4>(src0.y) / As<UInt4>(dst.y));
- cmp0i(dst.z, src1.z, uintMax, src1.z);
- dst.z = As<Float4>(As<UInt4>(src0.z) / As<UInt4>(dst.z));
- cmp0i(dst.w, src1.w, uintMax, src1.w);
- dst.w = As<Float4>(As<UInt4>(src0.w) / As<UInt4>(dst.w));
- }
-
- void ShaderCore::mod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = modulo(src0.x, src1.x);
- dst.y = modulo(src0.y, src1.y);
- dst.z = modulo(src0.z, src1.z);
- dst.w = modulo(src0.w, src1.w);
- }
-
- void ShaderCore::imod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 intMax(As<Float4>(Int4(INT_MAX)));
- cmp0i(dst.x, src1.x, intMax, src1.x);
- dst.x = As<Float4>(As<Int4>(src0.x) % As<Int4>(dst.x));
- cmp0i(dst.y, src1.y, intMax, src1.y);
- dst.y = As<Float4>(As<Int4>(src0.y) % As<Int4>(dst.y));
- cmp0i(dst.z, src1.z, intMax, src1.z);
- dst.z = As<Float4>(As<Int4>(src0.z) % As<Int4>(dst.z));
- cmp0i(dst.w, src1.w, intMax, src1.w);
- dst.w = As<Float4>(As<Int4>(src0.w) % As<Int4>(dst.w));
- }
-
- void ShaderCore::umod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 uintMax(As<Float4>(UInt4(UINT_MAX)));
- cmp0i(dst.x, src1.x, uintMax, src1.x);
- dst.x = As<Float4>(As<UInt4>(src0.x) % As<UInt4>(dst.x));
- cmp0i(dst.y, src1.y, uintMax, src1.y);
- dst.y = As<Float4>(As<UInt4>(src0.y) % As<UInt4>(dst.y));
- cmp0i(dst.z, src1.z, uintMax, src1.z);
- dst.z = As<Float4>(As<UInt4>(src0.z) % As<UInt4>(dst.z));
- cmp0i(dst.w, src1.w, uintMax, src1.w);
- dst.w = As<Float4>(As<UInt4>(src0.w) % As<UInt4>(dst.w));
- }
-
- void ShaderCore::shl(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) << As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) << As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) << As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) << As<Int4>(src1.w));
- }
-
- void ShaderCore::ishr(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) >> As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) >> As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) >> As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) >> As<Int4>(src1.w));
- }
-
- void ShaderCore::ushr(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<UInt4>(src0.x) >> As<UInt4>(src1.x));
- dst.y = As<Float4>(As<UInt4>(src0.y) >> As<UInt4>(src1.y));
- dst.z = As<Float4>(As<UInt4>(src0.z) >> As<UInt4>(src1.z));
- dst.w = As<Float4>(As<UInt4>(src0.w) >> As<UInt4>(src1.w));
- }
-
- void ShaderCore::rsqx(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 rsq = reciprocalSquareRoot(src.x, true, pp);
-
- dst.x = rsq;
- dst.y = rsq;
- dst.z = rsq;
- dst.w = rsq;
- }
-
- void ShaderCore::sqrt(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = Sqrt(src.x);
- dst.y = Sqrt(src.y);
- dst.z = Sqrt(src.z);
- dst.w = Sqrt(src.w);
- }
-
- void ShaderCore::rsq(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = reciprocalSquareRoot(src.x, false, pp);
- dst.y = reciprocalSquareRoot(src.y, false, pp);
- dst.z = reciprocalSquareRoot(src.z, false, pp);
- dst.w = reciprocalSquareRoot(src.w, false, pp);
- }
-
- void ShaderCore::len2(Float4 &dst, const Vector4f &src, bool pp)
- {
- dst = Sqrt(dot2(src, src));
- }
-
- void ShaderCore::len3(Float4 &dst, const Vector4f &src, bool pp)
- {
- dst = Sqrt(dot3(src, src));
- }
-
- void ShaderCore::len4(Float4 &dst, const Vector4f &src, bool pp)
- {
- dst = Sqrt(dot4(src, src));
- }
-
- void ShaderCore::dist1(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- dst = Abs(src0.x - src1.x);
- }
-
- void ShaderCore::dist2(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- Float4 dx = src0.x - src1.x;
- Float4 dy = src0.y - src1.y;
- Float4 dot2 = dx * dx + dy * dy;
- dst = Sqrt(dot2);
- }
-
- void ShaderCore::dist3(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- Float4 dx = src0.x - src1.x;
- Float4 dy = src0.y - src1.y;
- Float4 dz = src0.z - src1.z;
- Float4 dot3 = dx * dx + dy * dy + dz * dz;
- dst = Sqrt(dot3);
- }
-
- void ShaderCore::dist4(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- Float4 dx = src0.x - src1.x;
- Float4 dy = src0.y - src1.y;
- Float4 dz = src0.z - src1.z;
- Float4 dw = src0.w - src1.w;
- Float4 dot4 = dx * dx + dy * dy + dz * dz + dw * dw;
- dst = Sqrt(dot4);
- }
-
- void ShaderCore::dp1(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 t = src0.x * src1.x;
-
- dst.x = t;
- dst.y = t;
- dst.z = t;
- dst.w = t;
- }
-
- void ShaderCore::dp2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 t = dot2(src0, src1);
-
- dst.x = t;
- dst.y = t;
- dst.z = t;
- dst.w = t;
- }
-
- void ShaderCore::dp2add(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- Float4 t = dot2(src0, src1) + src2.x;
-
- dst.x = t;
- dst.y = t;
- dst.z = t;
- dst.w = t;
- }
-
- void ShaderCore::dp3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 dot = dot3(src0, src1);
-
- dst.x = dot;
- dst.y = dot;
- dst.z = dot;
- dst.w = dot;
- }
-
- void ShaderCore::dp4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- Float4 dot = dot4(src0, src1);
-
- dst.x = dot;
- dst.y = dot;
- dst.z = dot;
- dst.w = dot;
- }
-
- void ShaderCore::min(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = Min(src0.x, src1.x);
- dst.y = Min(src0.y, src1.y);
- dst.z = Min(src0.z, src1.z);
- dst.w = Min(src0.w, src1.w);
- }
-
- void ShaderCore::imin(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(Min(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(Min(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(Min(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(Min(As<Int4>(src0.w), As<Int4>(src1.w)));
- }
-
- void ShaderCore::umin(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(Min(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(Min(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(Min(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(Min(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- }
-
- void ShaderCore::max(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = Max(src0.x, src1.x);
- dst.y = Max(src0.y, src1.y);
- dst.z = Max(src0.z, src1.z);
- dst.w = Max(src0.w, src1.w);
- }
-
- void ShaderCore::imax(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(Max(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(Max(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(Max(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(Max(As<Int4>(src0.w), As<Int4>(src1.w)));
- }
-
- void ShaderCore::umax(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(Max(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(Max(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(Max(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(Max(As<Int4>(src0.w), As<Int4>(src1.w)));
- }
-
- void ShaderCore::slt(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(CmpLT(src0.x, src1.x)) & As<Int4>(Float4(1.0f)));
- dst.y = As<Float4>(As<Int4>(CmpLT(src0.y, src1.y)) & As<Int4>(Float4(1.0f)));
- dst.z = As<Float4>(As<Int4>(CmpLT(src0.z, src1.z)) & As<Int4>(Float4(1.0f)));
- dst.w = As<Float4>(As<Int4>(CmpLT(src0.w, src1.w)) & As<Int4>(Float4(1.0f)));
- }
-
- void ShaderCore::step(Vector4f &dst, const Vector4f &edge, const Vector4f &x)
- {
- dst.x = As<Float4>(CmpNLT(x.x, edge.x) & As<Int4>(Float4(1.0f)));
- dst.y = As<Float4>(CmpNLT(x.y, edge.y) & As<Int4>(Float4(1.0f)));
- dst.z = As<Float4>(CmpNLT(x.z, edge.z) & As<Int4>(Float4(1.0f)));
- dst.w = As<Float4>(CmpNLT(x.w, edge.w) & As<Int4>(Float4(1.0f)));
- }
-
- void ShaderCore::exp2x(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 exp = exponential2(src.x, pp);
-
- dst.x = exp;
- dst.y = exp;
- dst.z = exp;
- dst.w = exp;
- }
-
- void ShaderCore::exp2(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = exponential2(src.x, pp);
- dst.y = exponential2(src.y, pp);
- dst.z = exponential2(src.z, pp);
- dst.w = exponential2(src.w, pp);
- }
-
- void ShaderCore::exp(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = exponential(src.x, pp);
- dst.y = exponential(src.y, pp);
- dst.z = exponential(src.z, pp);
- dst.w = exponential(src.w, pp);
- }
-
- void ShaderCore::log2x(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 log = logarithm2(src.x, true, pp);
-
- dst.x = log;
- dst.y = log;
- dst.z = log;
- dst.w = log;
- }
-
- void ShaderCore::log2(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = logarithm2(src.x, false, pp);
- dst.y = logarithm2(src.y, false, pp);
- dst.z = logarithm2(src.z, false, pp);
- dst.w = logarithm2(src.w, false, pp);
- }
-
- void ShaderCore::log(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = logarithm(src.x, false, pp);
- dst.y = logarithm(src.y, false, pp);
- dst.z = logarithm(src.z, false, pp);
- dst.w = logarithm(src.w, false, pp);
- }
-
- void ShaderCore::lit(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Float4(1.0f);
- dst.y = Max(src.x, Float4(0.0f));
-
- Float4 pow;
-
- pow = src.w;
- pow = Min(pow, Float4(127.9961f));
- pow = Max(pow, Float4(-127.9961f));
-
- dst.z = power(src.y, pow);
- dst.z = As<Float4>(As<Int4>(dst.z) & CmpNLT(src.x, Float4(0.0f)));
- dst.z = As<Float4>(As<Int4>(dst.z) & CmpNLT(src.y, Float4(0.0f)));
-
- dst.w = Float4(1.0f);
- }
-
- void ShaderCore::att(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- // Computes attenuation factors (1, d, d^2, 1/d) assuming src0 = d^2, src1 = 1/d
- dst.x = 1;
- dst.y = src0.y * src1.y;
- dst.z = src0.z;
- dst.w = src1.w;
- }
-
- void ShaderCore::lrp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- dst.x = src0.x * (src1.x - src2.x) + src2.x;
- dst.y = src0.y * (src1.y - src2.y) + src2.y;
- dst.z = src0.z * (src1.z - src2.z) + src2.z;
- dst.w = src0.w * (src1.w - src2.w) + src2.w;
- }
-
- void ShaderCore::isinf(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(IsInf(src.x));
- dst.y = As<Float4>(IsInf(src.y));
- dst.z = As<Float4>(IsInf(src.z));
- dst.w = As<Float4>(IsInf(src.w));
- }
-
- void ShaderCore::isnan(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(IsNan(src.x));
- dst.y = As<Float4>(IsNan(src.y));
- dst.z = As<Float4>(IsNan(src.z));
- dst.w = As<Float4>(IsNan(src.w));
- }
-
- void ShaderCore::smooth(Vector4f &dst, const Vector4f &edge0, const Vector4f &edge1, const Vector4f &x)
- {
- Float4 tx = Min(Max((x.x - edge0.x) / (edge1.x - edge0.x), Float4(0.0f)), Float4(1.0f)); dst.x = tx * tx * (Float4(3.0f) - Float4(2.0f) * tx);
- Float4 ty = Min(Max((x.y - edge0.y) / (edge1.y - edge0.y), Float4(0.0f)), Float4(1.0f)); dst.y = ty * ty * (Float4(3.0f) - Float4(2.0f) * ty);
- Float4 tz = Min(Max((x.z - edge0.z) / (edge1.z - edge0.z), Float4(0.0f)), Float4(1.0f)); dst.z = tz * tz * (Float4(3.0f) - Float4(2.0f) * tz);
- Float4 tw = Min(Max((x.w - edge0.w) / (edge1.w - edge0.w), Float4(0.0f)), Float4(1.0f)); dst.w = tw * tw * (Float4(3.0f) - Float4(2.0f) * tw);
- }
-
- void ShaderCore::floatToHalfBits(Float4& dst, const Float4& floatBits, bool storeInUpperBits)
- {
- static const uint32_t mask_sign = 0x80000000u;
- static const uint32_t mask_round = ~0xfffu;
- static const uint32_t c_f32infty = 255 << 23;
- static const uint32_t c_magic = 15 << 23;
- static const uint32_t c_nanbit = 0x200;
- static const uint32_t c_infty_as_fp16 = 0x7c00;
- static const uint32_t c_clamp = (31 << 23) - 0x1000;
-
- UInt4 justsign = UInt4(mask_sign) & As<UInt4>(floatBits);
- UInt4 absf = As<UInt4>(floatBits) ^ justsign;
- UInt4 b_isnormal = CmpNLE(UInt4(c_f32infty), absf);
-
- // Note: this version doesn't round to the nearest even in case of a tie as defined by IEEE 754-2008, it rounds to +inf
- // instead of nearest even, since that's fine for GLSL ES 3.0's needs (see section 2.1.1 Floating-Point Computation)
- UInt4 joined = ((((As<UInt4>(Min(As<Float4>(absf & UInt4(mask_round)) * As<Float4>(UInt4(c_magic)),
- As<Float4>(UInt4(c_clamp))))) - UInt4(mask_round)) >> 13) & b_isnormal) |
- ((b_isnormal ^ UInt4(0xFFFFFFFF)) & ((CmpNLE(absf, UInt4(c_f32infty)) & UInt4(c_nanbit)) |
- UInt4(c_infty_as_fp16)));
-
- dst = As<Float4>(storeInUpperBits ? As<UInt4>(dst) | ((joined << 16) | justsign) : joined | (justsign >> 16));
- }
-
- void ShaderCore::halfToFloatBits(Float4& dst, const Float4& halfBits)
- {
- static const uint32_t mask_nosign = 0x7FFF;
- static const uint32_t magic = (254 - 15) << 23;
- static const uint32_t was_infnan = 0x7BFF;
- static const uint32_t exp_infnan = 255 << 23;
-
- UInt4 expmant = As<UInt4>(halfBits) & UInt4(mask_nosign);
- dst = As<Float4>(As<UInt4>(As<Float4>(expmant << 13) * As<Float4>(UInt4(magic))) |
- ((As<UInt4>(halfBits) ^ UInt4(expmant)) << 16) |
- (CmpNLE(As<UInt4>(expmant), UInt4(was_infnan)) & UInt4(exp_infnan)));
- }
-
- void ShaderCore::packHalf2x16(Vector4f &d, const Vector4f &s0)
- {
- // half2 | half1
- floatToHalfBits(d.x, s0.x, false);
- floatToHalfBits(d.x, s0.y, true);
- }
-
- void ShaderCore::unpackHalf2x16(Vector4f &dst, const Vector4f &s0)
- {
- // half2 | half1
- halfToFloatBits(dst.x, As<Float4>(As<UInt4>(s0.x) & UInt4(0x0000FFFF)));
- halfToFloatBits(dst.y, As<Float4>((As<UInt4>(s0.x) & UInt4(0xFFFF0000)) >> 16));
- }
-
- void ShaderCore::packSnorm2x16(Vector4f &d, const Vector4f &s0)
- {
- // round(clamp(c, -1.0, 1.0) * 32767.0)
- d.x = As<Float4>((Int4(Round(Min(Max(s0.x, Float4(-1.0f)), Float4(1.0f)) * Float4(32767.0f))) & Int4(0xFFFF)) |
- ((Int4(Round(Min(Max(s0.y, Float4(-1.0f)), Float4(1.0f)) * Float4(32767.0f))) & Int4(0xFFFF)) << 16));
- }
-
- void ShaderCore::packUnorm2x16(Vector4f &d, const Vector4f &s0)
- {
- // round(clamp(c, 0.0, 1.0) * 65535.0)
- d.x = As<Float4>((Int4(Round(Min(Max(s0.x, Float4(0.0f)), Float4(1.0f)) * Float4(65535.0f))) & Int4(0xFFFF)) |
- ((Int4(Round(Min(Max(s0.y, Float4(0.0f)), Float4(1.0f)) * Float4(65535.0f))) & Int4(0xFFFF)) << 16));
- }
-
- void ShaderCore::unpackSnorm2x16(Vector4f &dst, const Vector4f &s0)
- {
- // clamp(f / 32727.0, -1.0, 1.0)
- dst.x = Min(Max(Float4(As<Int4>((As<UInt4>(s0.x) & UInt4(0x0000FFFF)) << 16)) * Float4(1.0f / float(0x7FFF0000)), Float4(-1.0f)), Float4(1.0f));
- dst.y = Min(Max(Float4(As<Int4>(As<UInt4>(s0.x) & UInt4(0xFFFF0000))) * Float4(1.0f / float(0x7FFF0000)), Float4(-1.0f)), Float4(1.0f));
- }
-
- void ShaderCore::unpackUnorm2x16(Vector4f &dst, const Vector4f &s0)
- {
- // f / 65535.0
- dst.x = Float4((As<UInt4>(s0.x) & UInt4(0x0000FFFF)) << 16) * Float4(1.0f / float(0xFFFF0000));
- dst.y = Float4(As<UInt4>(s0.x) & UInt4(0xFFFF0000)) * Float4(1.0f / float(0xFFFF0000));
- }
-
- void ShaderCore::det2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.x * src1.y - src0.y * src1.x;
- dst.y = dst.z = dst.w = dst.x;
- }
-
- void ShaderCore::det3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- crs(dst, src1, src2);
- dp3(dst, dst, src0);
- }
-
- void ShaderCore::det4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2, const Vector4f &src3)
- {
- dst.x = src2.z * src3.w - src2.w * src3.z;
- dst.y = src1.w * src3.z - src1.z * src3.w;
- dst.z = src1.z * src2.w - src1.w * src2.z;
- dst.x = src0.x * (src1.y * dst.x + src2.y * dst.y + src3.y * dst.z) -
- src0.y * (src1.x * dst.x + src2.x * dst.y + src3.x * dst.z) +
- src0.z * (src1.x * (src2.y * src3.w - src2.w * src3.y) +
- src2.x * (src1.w * src3.y - src1.y * src3.w) +
- src3.x * (src1.y * src2.w - src1.w * src2.y)) +
- src0.w * (src1.x * (src2.z * src3.y - src2.y * src3.z) +
- src2.x * (src1.y * src3.z - src1.z * src3.y) +
- src3.x * (src1.z * src2.y - src1.y * src2.z));
- dst.y = dst.z = dst.w = dst.x;
- }
-
- void ShaderCore::frc(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Frac(src.x);
- dst.y = Frac(src.y);
- dst.z = Frac(src.z);
- dst.w = Frac(src.w);
- }
-
- void ShaderCore::trunc(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Trunc(src.x);
- dst.y = Trunc(src.y);
- dst.z = Trunc(src.z);
- dst.w = Trunc(src.w);
- }
-
- void ShaderCore::floor(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Floor(src.x);
- dst.y = Floor(src.y);
- dst.z = Floor(src.z);
- dst.w = Floor(src.w);
- }
-
- void ShaderCore::round(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Round(src.x);
- dst.y = Round(src.y);
- dst.z = Round(src.z);
- dst.w = Round(src.w);
- }
-
- void ShaderCore::roundEven(Vector4f &dst, const Vector4f &src)
- {
- // dst = round(src) + ((round(src) < src) * 2 - 1) * (fract(src) == 0.5) * isOdd(round(src));
- // ex.: 1.5: 2 + (0 * 2 - 1) * 1 * 0 = 2
- // 2.5: 3 + (0 * 2 - 1) * 1 * 1 = 2
- // -1.5: -2 + (1 * 2 - 1) * 1 * 0 = -2
- // -2.5: -3 + (1 * 2 - 1) * 1 * 1 = -2
- // Even if the round implementation rounds the other way:
- // 1.5: 1 + (1 * 2 - 1) * 1 * 1 = 2
- // 2.5: 2 + (1 * 2 - 1) * 1 * 0 = 2
- // -1.5: -1 + (0 * 2 - 1) * 1 * 1 = -2
- // -2.5: -2 + (0 * 2 - 1) * 1 * 0 = -2
- round(dst, src);
- dst.x += ((Float4(CmpLT(dst.x, src.x) & Int4(1)) * Float4(2.0f)) - Float4(1.0f)) * Float4(CmpEQ(Frac(src.x), Float4(0.5f)) & Int4(1)) * Float4(Int4(dst.x) & Int4(1));
- dst.y += ((Float4(CmpLT(dst.y, src.y) & Int4(1)) * Float4(2.0f)) - Float4(1.0f)) * Float4(CmpEQ(Frac(src.y), Float4(0.5f)) & Int4(1)) * Float4(Int4(dst.y) & Int4(1));
- dst.z += ((Float4(CmpLT(dst.z, src.z) & Int4(1)) * Float4(2.0f)) - Float4(1.0f)) * Float4(CmpEQ(Frac(src.z), Float4(0.5f)) & Int4(1)) * Float4(Int4(dst.z) & Int4(1));
- dst.w += ((Float4(CmpLT(dst.w, src.w) & Int4(1)) * Float4(2.0f)) - Float4(1.0f)) * Float4(CmpEQ(Frac(src.w), Float4(0.5f)) & Int4(1)) * Float4(Int4(dst.w) & Int4(1));
- }
-
- void ShaderCore::ceil(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Ceil(src.x);
- dst.y = Ceil(src.y);
- dst.z = Ceil(src.z);
- dst.w = Ceil(src.w);
- }
-
- void ShaderCore::powx(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- Float4 pow = power(src0.x, src1.x, pp);
-
- dst.x = pow;
- dst.y = pow;
- dst.z = pow;
- dst.w = pow;
- }
-
- void ShaderCore::pow(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- dst.x = power(src0.x, src1.x, pp);
- dst.y = power(src0.y, src1.y, pp);
- dst.z = power(src0.z, src1.z, pp);
- dst.w = power(src0.w, src1.w, pp);
- }
-
- void ShaderCore::crs(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = src0.y * src1.z - src0.z * src1.y;
- dst.y = src0.z * src1.x - src0.x * src1.z;
- dst.z = src0.x * src1.y - src0.y * src1.x;
- }
-
- void ShaderCore::forward1(Vector4f &dst, const Vector4f &N, const Vector4f &I, const Vector4f &Nref)
- {
- Int4 flip = CmpNLT(Nref.x * I.x, Float4(0.0f)) & Int4(0x80000000);
-
- dst.x = As<Float4>(flip ^ As<Int4>(N.x));
- }
-
- void ShaderCore::forward2(Vector4f &dst, const Vector4f &N, const Vector4f &I, const Vector4f &Nref)
- {
- Int4 flip = CmpNLT(dot2(Nref, I), Float4(0.0f)) & Int4(0x80000000);
-
- dst.x = As<Float4>(flip ^ As<Int4>(N.x));
- dst.y = As<Float4>(flip ^ As<Int4>(N.y));
- }
-
- void ShaderCore::forward3(Vector4f &dst, const Vector4f &N, const Vector4f &I, const Vector4f &Nref)
- {
- Int4 flip = CmpNLT(dot3(Nref, I), Float4(0.0f)) & Int4(0x80000000);
-
- dst.x = As<Float4>(flip ^ As<Int4>(N.x));
- dst.y = As<Float4>(flip ^ As<Int4>(N.y));
- dst.z = As<Float4>(flip ^ As<Int4>(N.z));
- }
-
- void ShaderCore::forward4(Vector4f &dst, const Vector4f &N, const Vector4f &I, const Vector4f &Nref)
- {
- Int4 flip = CmpNLT(dot4(Nref, I), Float4(0.0f)) & Int4(0x80000000);
-
- dst.x = As<Float4>(flip ^ As<Int4>(N.x));
- dst.y = As<Float4>(flip ^ As<Int4>(N.y));
- dst.z = As<Float4>(flip ^ As<Int4>(N.z));
- dst.w = As<Float4>(flip ^ As<Int4>(N.w));
- }
-
- void ShaderCore::reflect1(Vector4f &dst, const Vector4f &I, const Vector4f &N)
- {
- Float4 d = N.x * I.x;
-
- dst.x = I.x - Float4(2.0f) * d * N.x;
- }
-
- void ShaderCore::reflect2(Vector4f &dst, const Vector4f &I, const Vector4f &N)
- {
- Float4 d = dot2(N, I);
-
- dst.x = I.x - Float4(2.0f) * d * N.x;
- dst.y = I.y - Float4(2.0f) * d * N.y;
- }
-
- void ShaderCore::reflect3(Vector4f &dst, const Vector4f &I, const Vector4f &N)
- {
- Float4 d = dot3(N, I);
-
- dst.x = I.x - Float4(2.0f) * d * N.x;
- dst.y = I.y - Float4(2.0f) * d * N.y;
- dst.z = I.z - Float4(2.0f) * d * N.z;
- }
-
- void ShaderCore::reflect4(Vector4f &dst, const Vector4f &I, const Vector4f &N)
- {
- Float4 d = dot4(N, I);
-
- dst.x = I.x - Float4(2.0f) * d * N.x;
- dst.y = I.y - Float4(2.0f) * d * N.y;
- dst.z = I.z - Float4(2.0f) * d * N.z;
- dst.w = I.w - Float4(2.0f) * d * N.w;
- }
-
- void ShaderCore::refract1(Vector4f &dst, const Vector4f &I, const Vector4f &N, const Float4 &eta)
- {
- Float4 d = N.x * I.x;
- Float4 k = Float4(1.0f) - eta * eta * (Float4(1.0f) - d * d);
- Int4 pos = CmpNLT(k, Float4(0.0f));
- Float4 t = (eta * d + Sqrt(k));
-
- dst.x = As<Float4>(pos & As<Int4>(eta * I.x - t * N.x));
- }
-
- void ShaderCore::refract2(Vector4f &dst, const Vector4f &I, const Vector4f &N, const Float4 &eta)
- {
- Float4 d = dot2(N, I);
- Float4 k = Float4(1.0f) - eta * eta * (Float4(1.0f) - d * d);
- Int4 pos = CmpNLT(k, Float4(0.0f));
- Float4 t = (eta * d + Sqrt(k));
-
- dst.x = As<Float4>(pos & As<Int4>(eta * I.x - t * N.x));
- dst.y = As<Float4>(pos & As<Int4>(eta * I.y - t * N.y));
- }
-
- void ShaderCore::refract3(Vector4f &dst, const Vector4f &I, const Vector4f &N, const Float4 &eta)
- {
- Float4 d = dot3(N, I);
- Float4 k = Float4(1.0f) - eta * eta * (Float4(1.0f) - d * d);
- Int4 pos = CmpNLT(k, Float4(0.0f));
- Float4 t = (eta * d + Sqrt(k));
-
- dst.x = As<Float4>(pos & As<Int4>(eta * I.x - t * N.x));
- dst.y = As<Float4>(pos & As<Int4>(eta * I.y - t * N.y));
- dst.z = As<Float4>(pos & As<Int4>(eta * I.z - t * N.z));
- }
-
- void ShaderCore::refract4(Vector4f &dst, const Vector4f &I, const Vector4f &N, const Float4 &eta)
- {
- Float4 d = dot4(N, I);
- Float4 k = Float4(1.0f) - eta * eta * (Float4(1.0f) - d * d);
- Int4 pos = CmpNLT(k, Float4(0.0f));
- Float4 t = (eta * d + Sqrt(k));
-
- dst.x = As<Float4>(pos & As<Int4>(eta * I.x - t * N.x));
- dst.y = As<Float4>(pos & As<Int4>(eta * I.y - t * N.y));
- dst.z = As<Float4>(pos & As<Int4>(eta * I.z - t * N.z));
- dst.w = As<Float4>(pos & As<Int4>(eta * I.w - t * N.w));
- }
-
- void ShaderCore::sgn(Vector4f &dst, const Vector4f &src)
- {
- sgn(dst.x, src.x);
- sgn(dst.y, src.y);
- sgn(dst.z, src.z);
- sgn(dst.w, src.w);
- }
-
- void ShaderCore::isgn(Vector4f &dst, const Vector4f &src)
- {
- isgn(dst.x, src.x);
- isgn(dst.y, src.y);
- isgn(dst.z, src.z);
- isgn(dst.w, src.w);
- }
-
- void ShaderCore::abs(Vector4f &dst, const Vector4f &src)
- {
- dst.x = Abs(src.x);
- dst.y = Abs(src.y);
- dst.z = Abs(src.z);
- dst.w = Abs(src.w);
- }
-
- void ShaderCore::iabs(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(Abs(As<Int4>(src.x)));
- dst.y = As<Float4>(Abs(As<Int4>(src.y)));
- dst.z = As<Float4>(Abs(As<Int4>(src.z)));
- dst.w = As<Float4>(Abs(As<Int4>(src.w)));
- }
-
- void ShaderCore::nrm2(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 dot = dot2(src, src);
- Float4 rsq = reciprocalSquareRoot(dot, false, pp);
-
- dst.x = src.x * rsq;
- dst.y = src.y * rsq;
- dst.z = src.z * rsq;
- dst.w = src.w * rsq;
- }
-
- void ShaderCore::nrm3(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 dot = dot3(src, src);
- Float4 rsq = reciprocalSquareRoot(dot, false, pp);
-
- dst.x = src.x * rsq;
- dst.y = src.y * rsq;
- dst.z = src.z * rsq;
- dst.w = src.w * rsq;
- }
-
- void ShaderCore::nrm4(Vector4f &dst, const Vector4f &src, bool pp)
- {
- Float4 dot = dot4(src, src);
- Float4 rsq = reciprocalSquareRoot(dot, false, pp);
-
- dst.x = src.x * rsq;
- dst.y = src.y * rsq;
- dst.z = src.z * rsq;
- dst.w = src.w * rsq;
- }
-
- void ShaderCore::sincos(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = cosine_pi(src.x, pp);
- dst.y = sine_pi(src.x, pp);
- }
-
- void ShaderCore::cos(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = cosine(src.x, pp);
- dst.y = cosine(src.y, pp);
- dst.z = cosine(src.z, pp);
- dst.w = cosine(src.w, pp);
- }
-
- void ShaderCore::sin(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = sine(src.x, pp);
- dst.y = sine(src.y, pp);
- dst.z = sine(src.z, pp);
- dst.w = sine(src.w, pp);
- }
-
- void ShaderCore::tan(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = tangent(src.x, pp);
- dst.y = tangent(src.y, pp);
- dst.z = tangent(src.z, pp);
- dst.w = tangent(src.w, pp);
- }
-
- void ShaderCore::acos(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arccos(src.x, pp);
- dst.y = arccos(src.y, pp);
- dst.z = arccos(src.z, pp);
- dst.w = arccos(src.w, pp);
- }
-
- void ShaderCore::asin(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arcsin(src.x, pp);
- dst.y = arcsin(src.y, pp);
- dst.z = arcsin(src.z, pp);
- dst.w = arcsin(src.w, pp);
- }
-
- void ShaderCore::atan(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arctan(src.x, pp);
- dst.y = arctan(src.y, pp);
- dst.z = arctan(src.z, pp);
- dst.w = arctan(src.w, pp);
- }
-
- void ShaderCore::atan2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp)
- {
- dst.x = arctan(src0.x, src1.x, pp);
- dst.y = arctan(src0.y, src1.y, pp);
- dst.z = arctan(src0.z, src1.z, pp);
- dst.w = arctan(src0.w, src1.w, pp);
- }
-
- void ShaderCore::cosh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = cosineh(src.x, pp);
- dst.y = cosineh(src.y, pp);
- dst.z = cosineh(src.z, pp);
- dst.w = cosineh(src.w, pp);
- }
-
- void ShaderCore::sinh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = sineh(src.x, pp);
- dst.y = sineh(src.y, pp);
- dst.z = sineh(src.z, pp);
- dst.w = sineh(src.w, pp);
- }
-
- void ShaderCore::tanh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = tangenth(src.x, pp);
- dst.y = tangenth(src.y, pp);
- dst.z = tangenth(src.z, pp);
- dst.w = tangenth(src.w, pp);
- }
-
- void ShaderCore::acosh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arccosh(src.x, pp);
- dst.y = arccosh(src.y, pp);
- dst.z = arccosh(src.z, pp);
- dst.w = arccosh(src.w, pp);
- }
-
- void ShaderCore::asinh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arcsinh(src.x, pp);
- dst.y = arcsinh(src.y, pp);
- dst.z = arcsinh(src.z, pp);
- dst.w = arcsinh(src.w, pp);
- }
-
- void ShaderCore::atanh(Vector4f &dst, const Vector4f &src, bool pp)
- {
- dst.x = arctanh(src.x, pp);
- dst.y = arctanh(src.y, pp);
- dst.z = arctanh(src.z, pp);
- dst.w = arctanh(src.w, pp);
- }
-
- void ShaderCore::expp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel)
- {
- if(shaderModel < 0x0200)
- {
- Float4 frc = Frac(src.x);
- Float4 floor = src.x - frc;
-
- dst.x = exponential2(floor, true);
- dst.y = frc;
- dst.z = exponential2(src.x, true);
- dst.w = Float4(1.0f);
- }
- else // Version >= 2.0
- {
- exp2x(dst, src, true); // FIXME: 10-bit precision suffices
- }
- }
-
- void ShaderCore::logp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel)
- {
- if(shaderModel < 0x0200)
- {
- Float4 tmp0;
- Float4 tmp1;
- Float4 t;
- Int4 r;
-
- tmp0 = Abs(src.x);
- tmp1 = tmp0;
-
- // X component
- r = As<Int4>(As<UInt4>(tmp0) >> 23) - Int4(127);
- dst.x = Float4(r);
-
- // Y component
- dst.y = As<Float4>((As<Int4>(tmp1) & Int4(0x007FFFFF)) | As<Int4>(Float4(1.0f)));
-
- // Z component
- dst.z = logarithm2(src.x, true, true);
-
- // W component
- dst.w = 1.0f;
- }
- else
- {
- log2x(dst, src, true);
- }
- }
-
- void ShaderCore::cmp0(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- cmp0(dst.x, src0.x, src1.x, src2.x);
- cmp0(dst.y, src0.y, src1.y, src2.y);
- cmp0(dst.z, src0.z, src1.z, src2.z);
- cmp0(dst.w, src0.w, src1.w, src2.w);
- }
-
- void ShaderCore::select(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2)
- {
- select(dst.x, As<Int4>(src0.x), src1.x, src2.x);
- select(dst.y, As<Int4>(src0.y), src1.y, src2.y);
- select(dst.z, As<Int4>(src0.z), src1.z, src2.z);
- select(dst.w, As<Int4>(src0.w), src1.w, src2.w);
- }
-
- void ShaderCore::extract(Float4 &dst, const Vector4f &src0, const Float4 &src1)
- {
- select(dst, CmpEQ(As<Int4>(src1), Int4(1)), src0.y, src0.x);
- select(dst, CmpEQ(As<Int4>(src1), Int4(2)), src0.z, dst);
- select(dst, CmpEQ(As<Int4>(src1), Int4(3)), src0.w, dst);
- }
-
- void ShaderCore::insert(Vector4f &dst, const Vector4f &src, const Float4 &element, const Float4 &index)
- {
- select(dst.x, CmpEQ(As<Int4>(index), Int4(0)), element, src.x);
- select(dst.y, CmpEQ(As<Int4>(index), Int4(1)), element, src.y);
- select(dst.z, CmpEQ(As<Int4>(index), Int4(2)), element, src.z);
- select(dst.w, CmpEQ(As<Int4>(index), Int4(3)), element, src.w);
- }
-
- void ShaderCore::sgn(Float4 &dst, const Float4 &src)
- {
- Int4 neg = As<Int4>(CmpLT(src, Float4(-0.0f))) & As<Int4>(Float4(-1.0f));
- Int4 pos = As<Int4>(CmpNLE(src, Float4(+0.0f))) & As<Int4>(Float4(1.0f));
- dst = As<Float4>(neg | pos);
- }
-
- void ShaderCore::isgn(Float4 &dst, const Float4 &src)
- {
- Int4 neg = CmpLT(As<Int4>(src), Int4(0)) & Int4(-1);
- Int4 pos = CmpNLE(As<Int4>(src), Int4(0)) & Int4(1);
- dst = As<Float4>(neg | pos);
- }
-
- void ShaderCore::cmp0(Float4 &dst, const Float4 &src0, const Float4 &src1, const Float4 &src2)
- {
- Int4 pos = CmpLE(Float4(0.0f), src0);
- select(dst, pos, src1, src2);
- }
-
- void ShaderCore::cmp0i(Float4 &dst, const Float4 &src0, const Float4 &src1, const Float4 &src2)
- {
- Int4 pos = CmpEQ(Int4(0), As<Int4>(src0));
- select(dst, pos, src1, src2);
- }
-
- void ShaderCore::select(Float4 &dst, RValue<Int4> src0, const Float4 &src1, const Float4 &src2)
- {
- // FIXME: LLVM vector select
- dst = As<Float4>((src0 & As<Int4>(src1)) | (~src0 & As<Int4>(src2)));
- }
-
- void ShaderCore::cmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control)
- {
- switch(control)
- {
- case Shader::CONTROL_GT:
- dst.x = As<Float4>(CmpNLE(src0.x, src1.x));
- dst.y = As<Float4>(CmpNLE(src0.y, src1.y));
- dst.z = As<Float4>(CmpNLE(src0.z, src1.z));
- dst.w = As<Float4>(CmpNLE(src0.w, src1.w));
- break;
- case Shader::CONTROL_EQ:
- dst.x = As<Float4>(CmpEQ(src0.x, src1.x));
- dst.y = As<Float4>(CmpEQ(src0.y, src1.y));
- dst.z = As<Float4>(CmpEQ(src0.z, src1.z));
- dst.w = As<Float4>(CmpEQ(src0.w, src1.w));
- break;
- case Shader::CONTROL_GE:
- dst.x = As<Float4>(CmpNLT(src0.x, src1.x));
- dst.y = As<Float4>(CmpNLT(src0.y, src1.y));
- dst.z = As<Float4>(CmpNLT(src0.z, src1.z));
- dst.w = As<Float4>(CmpNLT(src0.w, src1.w));
- break;
- case Shader::CONTROL_LT:
- dst.x = As<Float4>(CmpLT(src0.x, src1.x));
- dst.y = As<Float4>(CmpLT(src0.y, src1.y));
- dst.z = As<Float4>(CmpLT(src0.z, src1.z));
- dst.w = As<Float4>(CmpLT(src0.w, src1.w));
- break;
- case Shader::CONTROL_NE:
- dst.x = As<Float4>(CmpNEQ(src0.x, src1.x));
- dst.y = As<Float4>(CmpNEQ(src0.y, src1.y));
- dst.z = As<Float4>(CmpNEQ(src0.z, src1.z));
- dst.w = As<Float4>(CmpNEQ(src0.w, src1.w));
- break;
- case Shader::CONTROL_LE:
- dst.x = As<Float4>(CmpLE(src0.x, src1.x));
- dst.y = As<Float4>(CmpLE(src0.y, src1.y));
- dst.z = As<Float4>(CmpLE(src0.z, src1.z));
- dst.w = As<Float4>(CmpLE(src0.w, src1.w));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void ShaderCore::icmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control)
- {
- switch(control)
- {
- case Shader::CONTROL_GT:
- dst.x = As<Float4>(CmpNLE(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpNLE(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpNLE(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpNLE(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- case Shader::CONTROL_EQ:
- dst.x = As<Float4>(CmpEQ(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpEQ(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpEQ(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpEQ(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- case Shader::CONTROL_GE:
- dst.x = As<Float4>(CmpNLT(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpNLT(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpNLT(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpNLT(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- case Shader::CONTROL_LT:
- dst.x = As<Float4>(CmpLT(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpLT(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpLT(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpLT(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- case Shader::CONTROL_NE:
- dst.x = As<Float4>(CmpNEQ(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpNEQ(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpNEQ(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpNEQ(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- case Shader::CONTROL_LE:
- dst.x = As<Float4>(CmpLE(As<Int4>(src0.x), As<Int4>(src1.x)));
- dst.y = As<Float4>(CmpLE(As<Int4>(src0.y), As<Int4>(src1.y)));
- dst.z = As<Float4>(CmpLE(As<Int4>(src0.z), As<Int4>(src1.z)));
- dst.w = As<Float4>(CmpLE(As<Int4>(src0.w), As<Int4>(src1.w)));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void ShaderCore::ucmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control)
- {
- switch(control)
- {
- case Shader::CONTROL_GT:
- dst.x = As<Float4>(CmpNLE(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpNLE(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpNLE(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpNLE(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- case Shader::CONTROL_EQ:
- dst.x = As<Float4>(CmpEQ(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpEQ(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpEQ(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpEQ(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- case Shader::CONTROL_GE:
- dst.x = As<Float4>(CmpNLT(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpNLT(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpNLT(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpNLT(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- case Shader::CONTROL_LT:
- dst.x = As<Float4>(CmpLT(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpLT(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpLT(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpLT(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- case Shader::CONTROL_NE:
- dst.x = As<Float4>(CmpNEQ(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpNEQ(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpNEQ(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpNEQ(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- case Shader::CONTROL_LE:
- dst.x = As<Float4>(CmpLE(As<UInt4>(src0.x), As<UInt4>(src1.x)));
- dst.y = As<Float4>(CmpLE(As<UInt4>(src0.y), As<UInt4>(src1.y)));
- dst.z = As<Float4>(CmpLE(As<UInt4>(src0.z), As<UInt4>(src1.z)));
- dst.w = As<Float4>(CmpLE(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- break;
- default:
- ASSERT(false);
- }
- }
-
- void ShaderCore::all(Float4 &dst, const Vector4f &src)
- {
- dst = As<Float4>(As<Int4>(src.x) & As<Int4>(src.y) & As<Int4>(src.z) & As<Int4>(src.w));
- }
-
- void ShaderCore::any(Float4 &dst, const Vector4f &src)
- {
- dst = As<Float4>(As<Int4>(src.x) | As<Int4>(src.y) | As<Int4>(src.z) | As<Int4>(src.w));
- }
-
- void ShaderCore::bitwise_not(Vector4f &dst, const Vector4f &src)
- {
- dst.x = As<Float4>(As<Int4>(src.x) ^ Int4(0xFFFFFFFF));
- dst.y = As<Float4>(As<Int4>(src.y) ^ Int4(0xFFFFFFFF));
- dst.z = As<Float4>(As<Int4>(src.z) ^ Int4(0xFFFFFFFF));
- dst.w = As<Float4>(As<Int4>(src.w) ^ Int4(0xFFFFFFFF));
- }
-
- void ShaderCore::bitwise_or(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) | As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) | As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) | As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) | As<Int4>(src1.w));
- }
-
- void ShaderCore::bitwise_xor(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) ^ As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) ^ As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) ^ As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) ^ As<Int4>(src1.w));
- }
-
- void ShaderCore::bitwise_and(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(As<Int4>(src0.x) & As<Int4>(src1.x));
- dst.y = As<Float4>(As<Int4>(src0.y) & As<Int4>(src1.y));
- dst.z = As<Float4>(As<Int4>(src0.z) & As<Int4>(src1.z));
- dst.w = As<Float4>(As<Int4>(src0.w) & As<Int4>(src1.w));
- }
-
- void ShaderCore::equal(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(CmpEQ(As<UInt4>(src0.x), As<UInt4>(src1.x)) &
- CmpEQ(As<UInt4>(src0.y), As<UInt4>(src1.y)) &
- CmpEQ(As<UInt4>(src0.z), As<UInt4>(src1.z)) &
- CmpEQ(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- dst.y = dst.x;
- dst.z = dst.x;
- dst.w = dst.x;
- }
-
- void ShaderCore::notEqual(Vector4f &dst, const Vector4f &src0, const Vector4f &src1)
- {
- dst.x = As<Float4>(CmpNEQ(As<UInt4>(src0.x), As<UInt4>(src1.x)) |
- CmpNEQ(As<UInt4>(src0.y), As<UInt4>(src1.y)) |
- CmpNEQ(As<UInt4>(src0.z), As<UInt4>(src1.z)) |
- CmpNEQ(As<UInt4>(src0.w), As<UInt4>(src1.w)));
- dst.y = dst.x;
- dst.z = dst.x;
- dst.w = dst.x;
- }
-}
diff --git a/src/Shader/ShaderCore.hpp b/src/Shader/ShaderCore.hpp
deleted file mode 100644
index be9e2204f..000000000
--- a/src/Shader/ShaderCore.hpp
+++ /dev/null
@@ -1,415 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_ShaderCore_hpp
-#define sw_ShaderCore_hpp
-
-#include "Shader.hpp"
-#include "Reactor/Reactor.hpp"
-#include "Reactor/Print.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- using namespace rr;
-
- class Vector4s
- {
- public:
- Vector4s();
- Vector4s(unsigned short x, unsigned short y, unsigned short z, unsigned short w);
- Vector4s(const Vector4s &rhs);
-
- Short4 &operator[](int i);
- Vector4s &operator=(const Vector4s &rhs);
-
- Short4 x;
- Short4 y;
- Short4 z;
- Short4 w;
- };
-
- class Vector4f
- {
- public:
- Vector4f();
- Vector4f(float x, float y, float z, float w);
- Vector4f(const Vector4f &rhs);
-
- Float4 &operator[](int i);
- Vector4f &operator=(const Vector4f &rhs);
-
- Float4 x;
- Float4 y;
- Float4 z;
- Float4 w;
- };
-
- Float4 exponential2(RValue<Float4> x, bool pp = false);
- Float4 logarithm2(RValue<Float4> x, bool abs, bool pp = false);
- Float4 exponential(RValue<Float4> x, bool pp = false);
- Float4 logarithm(RValue<Float4> x, bool abs, bool pp = false);
- Float4 power(RValue<Float4> x, RValue<Float4> y, bool pp = false);
- Float4 reciprocal(RValue<Float4> x, bool pp = false, bool finite = false, bool exactAtPow2 = false);
- Float4 reciprocalSquareRoot(RValue<Float4> x, bool abs, bool pp = false);
- Float4 modulo(RValue<Float4> x, RValue<Float4> y);
- Float4 sine_pi(RValue<Float4> x, bool pp = false); // limited to [-pi, pi] range
- Float4 cosine_pi(RValue<Float4> x, bool pp = false); // limited to [-pi, pi] range
- Float4 sine(RValue<Float4> x, bool pp = false);
- Float4 cosine(RValue<Float4> x, bool pp = false);
- Float4 tangent(RValue<Float4> x, bool pp = false);
- Float4 arccos(RValue<Float4> x, bool pp = false);
- Float4 arcsin(RValue<Float4> x, bool pp = false);
- Float4 arctan(RValue<Float4> x, bool pp = false);
- Float4 arctan(RValue<Float4> y, RValue<Float4> x, bool pp = false);
- Float4 sineh(RValue<Float4> x, bool pp = false);
- Float4 cosineh(RValue<Float4> x, bool pp = false);
- Float4 tangenth(RValue<Float4> x, bool pp = false);
- Float4 arccosh(RValue<Float4> x, bool pp = false); // Limited to x >= 1
- Float4 arcsinh(RValue<Float4> x, bool pp = false);
- Float4 arctanh(RValue<Float4> x, bool pp = false); // Limited to ]-1, 1[ range
-
- Float4 dot2(const Vector4f &v0, const Vector4f &v1);
- Float4 dot3(const Vector4f &v0, const Vector4f &v1);
- Float4 dot4(const Vector4f &v0, const Vector4f &v1);
-
- void transpose4x4(Short4 &row0, Short4 &row1, Short4 &row2, Short4 &row3);
- void transpose4x3(Short4 &row0, Short4 &row1, Short4 &row2, Short4 &row3);
- void transpose4x4(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3);
- void transpose4x3(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3);
- void transpose4x2(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3);
- void transpose4x1(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3);
- void transpose2x4(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3);
- void transpose4xN(Float4 &row0, Float4 &row1, Float4 &row2, Float4 &row3, int N);
-
- class Register
- {
- public:
- Register(const Reference<Float4> &x, const Reference<Float4> &y, const Reference<Float4> &z, const Reference<Float4> &w) : x(x), y(y), z(z), w(w)
- {
- }
-
- Register(const Register &rhs) = default;
-
- Reference<Float4> &operator[](int i)
- {
- switch(i)
- {
- default:
- case 0: return x;
- case 1: return y;
- case 2: return z;
- case 3: return w;
- }
- }
-
- Register &operator=(const Register &rhs) = default;
-
- Register &operator=(const Vector4f &rhs)
- {
- x = rhs.x;
- y = rhs.y;
- z = rhs.z;
- w = rhs.w;
-
- return *this;
- }
-
- operator Vector4f()
- {
- Vector4f v;
-
- v.x = x;
- v.y = y;
- v.z = z;
- v.w = w;
-
- return v;
- }
-
- Reference<Float4> x;
- Reference<Float4> y;
- Reference<Float4> z;
- Reference<Float4> w;
- };
-
- class RegisterFile
- {
- public:
- RegisterFile(int size, bool indirectAddressable) : size(size), indirectAddressable(indirectAddressable)
- {
- if(indirectAddressable)
- {
- x = new Array<Float4>(size);
- y = new Array<Float4>(size);
- z = new Array<Float4>(size);
- w = new Array<Float4>(size);
- }
- else
- {
- x = new Array<Float4>[size];
- y = new Array<Float4>[size];
- z = new Array<Float4>[size];
- w = new Array<Float4>[size];
- }
- }
-
- ~RegisterFile()
- {
- if(indirectAddressable)
- {
- delete x;
- delete y;
- delete z;
- delete w;
- }
- else
- {
- delete[] x;
- delete[] y;
- delete[] z;
- delete[] w;
- }
- }
-
- Register operator[](int i)
- {
- ASSERT(i < size);
- if(indirectAddressable)
- {
- return Register(x[0][i], y[0][i], z[0][i], w[0][i]);
- }
- else
- {
- return Register(x[i][0], y[i][0], z[i][0], w[i][0]);
- }
- }
-
- Register operator[](RValue<Int> i)
- {
- ASSERT(indirectAddressable);
-
- return Register(x[0][i], y[0][i], z[0][i], w[0][i]);
- }
-
- const Vector4f operator[](RValue<Int4> i); // Gather operation (read only).
-
- void scatter_x(Int4 i, RValue<Float4> r);
- void scatter_y(Int4 i, RValue<Float4> r);
- void scatter_z(Int4 i, RValue<Float4> r);
- void scatter_w(Int4 i, RValue<Float4> r);
-
- protected:
- const int size;
- const bool indirectAddressable;
- Array<Float4> *x;
- Array<Float4> *y;
- Array<Float4> *z;
- Array<Float4> *w;
- };
-
- template<int S, bool I = false>
- class RegisterArray : public RegisterFile
- {
- public:
- RegisterArray(bool indirectAddressable = I) : RegisterFile(S, indirectAddressable)
- {
- }
- };
-
- class ShaderCore
- {
- typedef Shader::Control Control;
-
- public:
- void mov(Vector4f &dst, const Vector4f &src, bool integerDestination = false);
- void neg(Vector4f &dst, const Vector4f &src);
- void ineg(Vector4f &dst, const Vector4f &src);
- void f2b(Vector4f &dst, const Vector4f &src);
- void b2f(Vector4f &dst, const Vector4f &src);
- void f2i(Vector4f &dst, const Vector4f &src);
- void i2f(Vector4f &dst, const Vector4f &src);
- void f2u(Vector4f &dst, const Vector4f &src);
- void u2f(Vector4f &dst, const Vector4f &src);
- void i2b(Vector4f &dst, const Vector4f &src);
- void b2i(Vector4f &dst, const Vector4f &src);
- void add(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void iadd(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void sub(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void isub(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void mad(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void imad(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void mul(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void imul(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void rcpx(Vector4f &dst, const Vector4f &src, bool pp = false);
- void div(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void idiv(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void udiv(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void mod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void imod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void umod(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void shl(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void ishr(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void ushr(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void rsqx(Vector4f &dst, const Vector4f &src, bool pp = false);
- void sqrt(Vector4f &dst, const Vector4f &src, bool pp = false);
- void rsq(Vector4f &dst, const Vector4f &src, bool pp = false);
- void len2(Float4 &dst, const Vector4f &src, bool pp = false);
- void len3(Float4 &dst, const Vector4f &src, bool pp = false);
- void len4(Float4 &dst, const Vector4f &src, bool pp = false);
- void dist1(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void dist2(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void dist3(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void dist4(Float4 &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void dp1(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void dp2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void dp2add(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void dp3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void dp4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void det2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void det3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void det4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2, const Vector4f &src3);
- void min(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void imin(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void umin(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void max(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void imax(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void umax(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void slt(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void step(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void exp2x(Vector4f &dst, const Vector4f &src, bool pp = false);
- void exp2(Vector4f &dst, const Vector4f &src, bool pp = false);
- void exp(Vector4f &dst, const Vector4f &src, bool pp = false);
- void log2x(Vector4f &dst, const Vector4f &src, bool pp = false);
- void log2(Vector4f &dst, const Vector4f &src, bool pp = false);
- void log(Vector4f &dst, const Vector4f &src, bool pp = false);
- void lit(Vector4f &dst, const Vector4f &src);
- void att(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void lrp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void isinf(Vector4f &dst, const Vector4f &src);
- void isnan(Vector4f &dst, const Vector4f &src);
- void smooth(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void packHalf2x16(Vector4f &dst, const Vector4f &src);
- void unpackHalf2x16(Vector4f &dst, const Vector4f &src);
- void packSnorm2x16(Vector4f &dst, const Vector4f &src);
- void packUnorm2x16(Vector4f &dst, const Vector4f &src);
- void unpackSnorm2x16(Vector4f &dst, const Vector4f &src);
- void unpackUnorm2x16(Vector4f &dst, const Vector4f &src);
- void frc(Vector4f &dst, const Vector4f &src);
- void trunc(Vector4f &dst, const Vector4f &src);
- void floor(Vector4f &dst, const Vector4f &src);
- void round(Vector4f &dst, const Vector4f &src);
- void roundEven(Vector4f &dst, const Vector4f &src);
- void ceil(Vector4f &dst, const Vector4f &src);
- void powx(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void pow(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void crs(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void forward1(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void forward2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void forward3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void forward4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void reflect1(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void reflect2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void reflect3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void reflect4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void refract1(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Float4 &src2);
- void refract2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Float4 &src2);
- void refract3(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Float4 &src2);
- void refract4(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Float4 &src2);
- void sgn(Vector4f &dst, const Vector4f &src);
- void isgn(Vector4f &dst, const Vector4f &src);
- void abs(Vector4f &dst, const Vector4f &src);
- void iabs(Vector4f &dst, const Vector4f &src);
- void nrm2(Vector4f &dst, const Vector4f &src, bool pp = false);
- void nrm3(Vector4f &dst, const Vector4f &src, bool pp = false);
- void nrm4(Vector4f &dst, const Vector4f &src, bool pp = false);
- void sincos(Vector4f &dst, const Vector4f &src, bool pp = false);
- void cos(Vector4f &dst, const Vector4f &src, bool pp = false);
- void sin(Vector4f &dst, const Vector4f &src, bool pp = false);
- void tan(Vector4f &dst, const Vector4f &src, bool pp = false);
- void acos(Vector4f &dst, const Vector4f &src, bool pp = false);
- void asin(Vector4f &dst, const Vector4f &src, bool pp = false);
- void atan(Vector4f &dst, const Vector4f &src, bool pp = false);
- void atan2(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, bool pp = false);
- void cosh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void sinh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void tanh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void acosh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void asinh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void atanh(Vector4f &dst, const Vector4f &src, bool pp = false);
- void expp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel);
- void logp(Vector4f &dst, const Vector4f &src, unsigned short shaderModel);
- void cmp0(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void cmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control);
- void icmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control);
- void ucmp(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, Control control);
- void select(Vector4f &dst, const Vector4f &src0, const Vector4f &src1, const Vector4f &src2);
- void extract(Float4 &dst, const Vector4f &src0, const Float4 &src1);
- void insert(Vector4f &dst, const Vector4f &src, const Float4 &element, const Float4 &index);
- void all(Float4 &dst, const Vector4f &src);
- void any(Float4 &dst, const Vector4f &src);
- void bitwise_not(Vector4f &dst, const Vector4f &src);
- void bitwise_or(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void bitwise_xor(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void bitwise_and(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void equal(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
- void notEqual(Vector4f &dst, const Vector4f &src0, const Vector4f &src1);
-
- private:
- void sgn(Float4 &dst, const Float4 &src);
- void isgn(Float4 &dst, const Float4 &src);
- void cmp0(Float4 &dst, const Float4 &src0, const Float4 &src1, const Float4 &src2);
- void cmp0i(Float4 &dst, const Float4 &src0, const Float4 &src1, const Float4 &src2);
- void select(Float4 &dst, RValue<Int4> src0, const Float4 &src1, const Float4 &src2);
- void floatToHalfBits(Float4& dst, const Float4& floatBits, bool storeInUpperBits);
- void halfToFloatBits(Float4& dst, const Float4& halfBits);
- };
-}
-
-#ifdef ENABLE_RR_PRINT
-namespace rr {
- template <> struct PrintValue::Ty<sw::Vector4f>
- {
- static std::string fmt(const sw::Vector4f& v)
- {
- return "[x: " + PrintValue::fmt(v.x) +
- ", y: " + PrintValue::fmt(v.y) +
- ", z: " + PrintValue::fmt(v.z) +
- ", w: " + PrintValue::fmt(v.w) + "]";
- }
-
- static std::vector<rr::Value*> val(const sw::Vector4f& v)
- {
- return PrintValue::vals(v.x, v.y, v.z, v.w);
- }
- };
- template <> struct PrintValue::Ty<sw::Vector4s>
- {
- static std::string fmt(const sw::Vector4s& v)
- {
- return "[x: " + PrintValue::fmt(v.x) +
- ", y: " + PrintValue::fmt(v.y) +
- ", z: " + PrintValue::fmt(v.z) +
- ", w: " + PrintValue::fmt(v.w) + "]";
- }
-
- static std::vector<rr::Value*> val(const sw::Vector4s& v)
- {
- return PrintValue::vals(v.x, v.y, v.z, v.w);
- }
- };
-}
-#endif // ENABLE_RR_PRINT
-
-#endif // sw_ShaderCore_hpp
diff --git a/src/Shader/VertexPipeline.cpp b/src/Shader/VertexPipeline.cpp
deleted file mode 100644
index 129d8a8d7..000000000
--- a/src/Shader/VertexPipeline.cpp
+++ /dev/null
@@ -1,953 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexPipeline.hpp"
-
-#include "Renderer/Vertex.hpp"
-#include "Renderer/Renderer.hpp"
-#include "Common/Debug.hpp"
-
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#undef max
-#undef min
-
-namespace sw
-{
- extern bool secondaryColor;
-
- VertexPipeline::VertexPipeline(const VertexProcessor::State &state) : VertexRoutine(state, 0)
- {
- }
-
- VertexPipeline::~VertexPipeline()
- {
- }
-
- Vector4f VertexPipeline::transformBlend(const Register &src, const Pointer<Byte> &matrix, bool homogeneous)
- {
- Vector4f dst;
-
- if(state.vertexBlendMatrixCount == 0)
- {
- dst = transform(src, matrix, homogeneous);
- }
- else
- {
- UInt index0[4];
- UInt index1[4];
- UInt index2[4];
- UInt index3[4];
-
- if(state.indexedVertexBlendEnable)
- {
- for(int i = 0; i < 4; i++)
- {
- Float4 B = v[BlendIndices].x;
- UInt indices;
-
- switch(i)
- {
- case 0: indices = As<UInt>(Float(B.x)); break;
- case 1: indices = As<UInt>(Float(B.y)); break;
- case 2: indices = As<UInt>(Float(B.z)); break;
- case 3: indices = As<UInt>(Float(B.w)); break;
- }
-
- index0[i] = (indices & 0x000000FF) << 6;
- index1[i] = (indices & 0x0000FF00) >> 2;
- index2[i] = (indices & 0x00FF0000) >> 10;
- index3[i] = (indices & 0xFF000000) >> 18;
- }
- }
- else
- {
- for(int i = 0; i < 4; i++)
- {
- index0[i] = 0 * 64;
- index1[i] = 1 * 64;
- index2[i] = 2 * 64;
- index3[i] = 3 * 64;
- }
- }
-
- Float4 weight0;
- Float4 weight1;
- Float4 weight2;
- Float4 weight3;
-
- switch(state.vertexBlendMatrixCount)
- {
- case 4: weight2 = v[BlendWeight].z;
- case 3: weight1 = v[BlendWeight].y;
- case 2: weight0 = v[BlendWeight].x;
- case 1:
- break;
- }
-
- if(state.vertexBlendMatrixCount == 1)
- {
- dst = transform(src, matrix, index0, homogeneous);
- }
- else if(state.vertexBlendMatrixCount == 2)
- {
- weight1 = Float4(1.0f) - weight0;
-
- Vector4f pos0;
- Vector4f pos1;
-
- pos0 = transform(src, matrix, index0, homogeneous);
- pos1 = transform(src, matrix, index1, homogeneous);
-
- dst.x = pos0.x * weight0 + pos1.x * weight1; // FIXME: Vector4f operators
- dst.y = pos0.y * weight0 + pos1.y * weight1;
- dst.z = pos0.z * weight0 + pos1.z * weight1;
- dst.w = pos0.w * weight0 + pos1.w * weight1;
- }
- else if(state.vertexBlendMatrixCount == 3)
- {
- weight2 = Float4(1.0f) - (weight0 + weight1);
-
- Vector4f pos0;
- Vector4f pos1;
- Vector4f pos2;
-
- pos0 = transform(src, matrix, index0, homogeneous);
- pos1 = transform(src, matrix, index1, homogeneous);
- pos2 = transform(src, matrix, index2, homogeneous);
-
- dst.x = pos0.x * weight0 + pos1.x * weight1 + pos2.x * weight2;
- dst.y = pos0.y * weight0 + pos1.y * weight1 + pos2.y * weight2;
- dst.z = pos0.z * weight0 + pos1.z * weight1 + pos2.z * weight2;
- dst.w = pos0.w * weight0 + pos1.w * weight1 + pos2.w * weight2;
- }
- else if(state.vertexBlendMatrixCount == 4)
- {
- weight3 = Float4(1.0f) - (weight0 + weight1 + weight2);
-
- Vector4f pos0;
- Vector4f pos1;
- Vector4f pos2;
- Vector4f pos3;
-
- pos0 = transform(src, matrix, index0, homogeneous);
- pos1 = transform(src, matrix, index1, homogeneous);
- pos2 = transform(src, matrix, index2, homogeneous);
- pos3 = transform(src, matrix, index3, homogeneous);
-
- dst.x = pos0.x * weight0 + pos1.x * weight1 + pos2.x * weight2 + pos3.x * weight3;
- dst.y = pos0.y * weight0 + pos1.y * weight1 + pos2.y * weight2 + pos3.y * weight3;
- dst.z = pos0.z * weight0 + pos1.z * weight1 + pos2.z * weight2 + pos3.z * weight3;
- dst.w = pos0.w * weight0 + pos1.w * weight1 + pos2.w * weight2 + pos3.w * weight3;
- }
- }
-
- return dst;
- }
-
- void VertexPipeline::pipeline(UInt &index)
- {
- Vector4f position;
- Vector4f normal;
-
- if(!state.preTransformed)
- {
- position = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.transformT)), true);
- }
- else
- {
- position = v[PositionT];
- }
-
- o[Pos].x = position.x;
- o[Pos].y = position.y;
- o[Pos].z = position.z;
- o[Pos].w = position.w;
-
- Vector4f vertexPosition = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.cameraTransformT)), true);
-
- if(state.vertexNormalActive)
- {
- normal = transformBlend(v[Normal], Pointer<Byte>(data + OFFSET(DrawData,ff.normalTransformT)), false);
-
- if(state.normalizeNormals)
- {
- normal = normalize(normal);
- }
- }
-
- if(!state.vertexLightingActive)
- {
- // FIXME: Don't process if not used at all
- if(state.diffuseActive && state.input[Color0])
- {
- Vector4f diffuse = v[Color0];
-
- o[C0].x = diffuse.x;
- o[C0].y = diffuse.y;
- o[C0].z = diffuse.z;
- o[C0].w = diffuse.w;
- }
- else
- {
- o[C0].x = Float4(1.0f);
- o[C0].y = Float4(1.0f);
- o[C0].z = Float4(1.0f);
- o[C0].w = Float4(1.0f);
- }
-
- // FIXME: Don't process if not used at all
- if(state.specularActive && state.input[Color1])
- {
- Vector4f specular = v[Color1];
-
- o[C1].x = specular.x;
- o[C1].y = specular.y;
- o[C1].z = specular.z;
- o[C1].w = specular.w;
- }
- else
- {
- o[C1].x = Float4(0.0f);
- o[C1].y = Float4(0.0f);
- o[C1].z = Float4(0.0f);
- o[C1].w = Float4(1.0f);
- }
- }
- else
- {
- o[C0].x = Float4(0.0f);
- o[C0].y = Float4(0.0f);
- o[C0].z = Float4(0.0f);
- o[C0].w = Float4(0.0f);
-
- o[C1].x = Float4(0.0f);
- o[C1].y = Float4(0.0f);
- o[C1].z = Float4(0.0f);
- o[C1].w = Float4(0.0f);
-
- Vector4f ambient;
- Float4 globalAmbient = *Pointer<Float4>(data + OFFSET(DrawData,ff.globalAmbient)); // FIXME: Unpack
-
- ambient.x = globalAmbient.x;
- ambient.y = globalAmbient.y;
- ambient.z = globalAmbient.z;
-
- for(int i = 0; i < 8; i++)
- {
- if(!(state.vertexLightActive & (1 << i)))
- {
- continue;
- }
-
- Vector4f L; // Light vector
- Float4 att; // Attenuation
-
- // Attenuation
- {
- Float4 d; // Distance
-
- L.x = L.y = L.z = *Pointer<Float4>(data + OFFSET(DrawData,ff.lightPosition[i])); // FIXME: Unpack
- L.x = L.x.xxxx;
- L.y = L.y.yyyy;
- L.z = L.z.zzzz;
-
- L.x -= vertexPosition.x;
- L.y -= vertexPosition.y;
- L.z -= vertexPosition.z;
- d = dot3(L, L);
- d = RcpSqrt_pp(d); // FIXME: Sufficient precision?
- L.x *= d;
- L.y *= d;
- L.z *= d;
- d = Rcp_pp(d); // FIXME: Sufficient precision?
-
- Float4 q = *Pointer<Float4>(data + OFFSET(DrawData,ff.attenuationQuadratic[i]));
- Float4 l = *Pointer<Float4>(data + OFFSET(DrawData,ff.attenuationLinear[i]));
- Float4 c = *Pointer<Float4>(data + OFFSET(DrawData,ff.attenuationConstant[i]));
-
- att = Rcp_pp((q * d + l) * d + c);
- }
-
- // Ambient per light
- {
- Float4 lightAmbient = *Pointer<Float4>(data + OFFSET(DrawData,ff.lightAmbient[i])); // FIXME: Unpack
-
- ambient.x = ambient.x + lightAmbient.x * att;
- ambient.y = ambient.y + lightAmbient.y * att;
- ambient.z = ambient.z + lightAmbient.z * att;
- }
-
- // Diffuse
- if(state.vertexNormalActive)
- {
- Float4 dot;
-
- dot = dot3(L, normal);
- dot = Max(dot, Float4(0.0f));
- dot *= att;
-
- Vector4f diff;
-
- if(state.vertexDiffuseMaterialSourceActive == MATERIAL_MATERIAL)
- {
- diff.x = diff.y = diff.z = *Pointer<Float4>(data + OFFSET(DrawData,ff.materialDiffuse)); // FIXME: Unpack
- diff.x = diff.x.xxxx;
- diff.y = diff.y.yyyy;
- diff.z = diff.z.zzzz;
- }
- else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR1)
- {
- diff = v[Color0];
- }
- else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR2)
- {
- diff = v[Color1];
- }
- else ASSERT(false);
-
- Float4 lightDiffuse = *Pointer<Float4>(data + OFFSET(DrawData,ff.lightDiffuse[i]));
-
- o[C0].x = o[C0].x + diff.x * dot * lightDiffuse.x; // FIXME: Clamp first?
- o[C0].y = o[C0].y + diff.y * dot * lightDiffuse.y; // FIXME: Clamp first?
- o[C0].z = o[C0].z + diff.z * dot * lightDiffuse.z; // FIXME: Clamp first?
- }
-
- // Specular
- if(state.vertexSpecularActive)
- {
- Vector4f S;
- Vector4f C; // Camera vector
- Float4 pow;
-
- pow = *Pointer<Float>(data + OFFSET(DrawData,ff.materialShininess));
-
- S.x = Float4(0.0f) - vertexPosition.x;
- S.y = Float4(0.0f) - vertexPosition.y;
- S.z = Float4(0.0f) - vertexPosition.z;
- C = normalize(S);
-
- S.x = L.x + C.x;
- S.y = L.y + C.y;
- S.z = L.z + C.z;
- C = normalize(S);
-
- Float4 dot = Max(dot3(C, normal), Float4(0.0f)); // FIXME: max(dot3(C, normal), 0)
-
- Float4 P = power(dot, pow);
- P *= att;
-
- Vector4f spec;
-
- if(state.vertexSpecularMaterialSourceActive == MATERIAL_MATERIAL)
- {
- Float4 materialSpecular = *Pointer<Float4>(data + OFFSET(DrawData,ff.materialSpecular)); // FIXME: Unpack
-
- spec.x = materialSpecular.x;
- spec.y = materialSpecular.y;
- spec.z = materialSpecular.z;
- }
- else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR1)
- {
- spec = v[Color0];
- }
- else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR2)
- {
- spec = v[Color1];
- }
- else ASSERT(false);
-
- Float4 lightSpecular = *Pointer<Float4>(data + OFFSET(DrawData,ff.lightSpecular[i]));
-
- spec.x *= lightSpecular.x;
- spec.y *= lightSpecular.y;
- spec.z *= lightSpecular.z;
-
- spec.x *= P;
- spec.y *= P;
- spec.z *= P;
-
- spec.x = Max(spec.x, Float4(0.0f));
- spec.y = Max(spec.y, Float4(0.0f));
- spec.z = Max(spec.z, Float4(0.0f));
-
- if(secondaryColor)
- {
- o[C1].x = o[C1].x + spec.x;
- o[C1].y = o[C1].y + spec.y;
- o[C1].z = o[C1].z + spec.z;
- }
- else
- {
- o[C0].x = o[C0].x + spec.x;
- o[C0].y = o[C0].y + spec.y;
- o[C0].z = o[C0].z + spec.z;
- }
- }
- }
-
- if(state.vertexAmbientMaterialSourceActive == MATERIAL_MATERIAL)
- {
- Float4 materialAmbient = *Pointer<Float4>(data + OFFSET(DrawData,ff.materialAmbient)); // FIXME: Unpack
-
- ambient.x = ambient.x * materialAmbient.x;
- ambient.y = ambient.y * materialAmbient.y;
- ambient.z = ambient.z * materialAmbient.z;
- }
- else if(state.vertexAmbientMaterialSourceActive == MATERIAL_COLOR1)
- {
- Vector4f materialDiffuse = v[Color0];
-
- ambient.x = ambient.x * materialDiffuse.x;
- ambient.y = ambient.y * materialDiffuse.y;
- ambient.z = ambient.z * materialDiffuse.z;
- }
- else if(state.vertexAmbientMaterialSourceActive == MATERIAL_COLOR2)
- {
- Vector4f materialSpecular = v[Color1];
-
- ambient.x = ambient.x * materialSpecular.x;
- ambient.y = ambient.y * materialSpecular.y;
- ambient.z = ambient.z * materialSpecular.z;
- }
- else ASSERT(false);
-
- o[C0].x = o[C0].x + ambient.x;
- o[C0].y = o[C0].y + ambient.y;
- o[C0].z = o[C0].z + ambient.z;
-
- // Emissive
- if(state.vertexEmissiveMaterialSourceActive == MATERIAL_MATERIAL)
- {
- Float4 materialEmission = *Pointer<Float4>(data + OFFSET(DrawData,ff.materialEmission)); // FIXME: Unpack
-
- o[C0].x = o[C0].x + materialEmission.x;
- o[C0].y = o[C0].y + materialEmission.y;
- o[C0].z = o[C0].z + materialEmission.z;
- }
- else if(state.vertexEmissiveMaterialSourceActive == MATERIAL_COLOR1)
- {
- Vector4f materialSpecular = v[Color0];
-
- o[C0].x = o[C0].x + materialSpecular.x;
- o[C0].y = o[C0].y + materialSpecular.y;
- o[C0].z = o[C0].z + materialSpecular.z;
- }
- else if(state.vertexEmissiveMaterialSourceActive == MATERIAL_COLOR2)
- {
- Vector4f materialSpecular = v[Color1];
-
- o[C0].x = o[C0].x + materialSpecular.x;
- o[C0].y = o[C0].y + materialSpecular.y;
- o[C0].z = o[C0].z + materialSpecular.z;
- }
- else ASSERT(false);
-
- // Diffuse alpha component
- if(state.vertexDiffuseMaterialSourceActive == MATERIAL_MATERIAL)
- {
- o[C0].w = Float4(*Pointer<Float4>(data + OFFSET(DrawData,ff.materialDiffuse[0]))).wwww; // FIXME: Unpack
- }
- else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR1)
- {
- Vector4f alpha = v[Color0];
- o[C0].w = alpha.w;
- }
- else if(state.vertexDiffuseMaterialSourceActive == MATERIAL_COLOR2)
- {
- Vector4f alpha = v[Color1];
- o[C0].w = alpha.w;
- }
- else ASSERT(false);
-
- if(state.vertexSpecularActive)
- {
- // Specular alpha component
- if(state.vertexSpecularMaterialSourceActive == MATERIAL_MATERIAL)
- {
- o[C1].w = Float4(*Pointer<Float4>(data + OFFSET(DrawData,ff.materialSpecular[3]))).wwww; // FIXME: Unpack
- }
- else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR1)
- {
- Vector4f alpha = v[Color0];
- o[C1].w = alpha.w;
- }
- else if(state.vertexSpecularMaterialSourceActive == MATERIAL_COLOR2)
- {
- Vector4f alpha = v[Color1];
- o[C1].w = alpha.w;
- }
- else ASSERT(false);
- }
- }
-
- if(state.fogActive)
- {
- Float4 f;
-
- if(!state.rangeFogActive)
- {
- f = Abs(vertexPosition.z);
- }
- else
- {
- f = Sqrt(dot3(vertexPosition, vertexPosition)); // FIXME: f = length(vertexPosition);
- }
-
- switch(state.vertexFogMode)
- {
- case FOG_NONE:
- if(state.specularActive)
- {
- o[Fog].x = o[C1].w;
- }
- else
- {
- o[Fog].x = Float4(0.0f);
- }
- break;
- case FOG_LINEAR:
- o[Fog].x = f * *Pointer<Float4>(data + OFFSET(DrawData,fog.scale)) + *Pointer<Float4>(data + OFFSET(DrawData,fog.offset));
- break;
- case FOG_EXP:
- o[Fog].x = exponential2(f * *Pointer<Float4>(data + OFFSET(DrawData,fog.densityE)), true);
- break;
- case FOG_EXP2:
- o[Fog].x = exponential2((f * f) * *Pointer<Float4>(data + OFFSET(DrawData,fog.density2E)), true);
- break;
- default:
- ASSERT(false);
- }
- }
-
- for(int stage = 0; stage < 8; stage++)
- {
- processTextureCoordinate(stage, normal, position);
- }
-
- processPointSize();
- }
-
- void VertexPipeline::processTextureCoordinate(int stage, Vector4f &normal, Vector4f &position)
- {
- if(state.output[T0 + stage].write)
- {
- int i = state.textureState[stage].texCoordIndexActive;
-
- switch(state.textureState[stage].texGenActive)
- {
- case TEXGEN_NONE:
- {
- Vector4f &&varying = v[TexCoord0 + i];
-
- o[T0 + stage].x = varying.x;
- o[T0 + stage].y = varying.y;
- o[T0 + stage].z = varying.z;
- o[T0 + stage].w = varying.w;
- }
- break;
- case TEXGEN_PASSTHRU:
- {
- Vector4f &&varying = v[TexCoord0 + i];
-
- o[T0 + stage].x = varying.x;
- o[T0 + stage].y = varying.y;
- o[T0 + stage].z = varying.z;
- o[T0 + stage].w = varying.w;
-
- if(state.input[TexCoord0 + i])
- {
- switch(state.input[TexCoord0 + i].count)
- {
- case 1:
- o[T0 + stage].y = Float4(1.0f);
- o[T0 + stage].z = Float4(0.0f);
- o[T0 + stage].w = Float4(0.0f);
- break;
- case 2:
- o[T0 + stage].z = Float4(1.0f);
- o[T0 + stage].w = Float4(0.0f);
- break;
- case 3:
- o[T0 + stage].w = Float4(1.0f);
- break;
- case 4:
- break;
- default:
- ASSERT(false);
- }
- }
- }
- break;
- case TEXGEN_NORMAL:
- {
- Vector4f Nc; // Normal vector in camera space
-
- if(state.vertexNormalActive)
- {
- Nc = normal;
- }
- else
- {
- Nc.x = Float4(0.0f);
- Nc.y = Float4(0.0f);
- Nc.z = Float4(0.0f);
- }
-
- Nc.w = Float4(1.0f);
-
- o[T0 + stage].x = Nc.x;
- o[T0 + stage].y = Nc.y;
- o[T0 + stage].z = Nc.z;
- o[T0 + stage].w = Nc.w;
- }
- break;
- case TEXGEN_POSITION:
- {
- Vector4f Pn = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.cameraTransformT)), true); // Position in camera space
-
- Pn.w = Float4(1.0f);
-
- o[T0 + stage].x = Pn.x;
- o[T0 + stage].y = Pn.y;
- o[T0 + stage].z = Pn.z;
- o[T0 + stage].w = Pn.w;
- }
- break;
- case TEXGEN_REFLECTION:
- {
- Vector4f R; // Reflection vector
-
- if(state.vertexNormalActive)
- {
- Vector4f Nc; // Normal vector in camera space
-
- Nc = normal;
-
- if(state.localViewerActive)
- {
- Vector4f Ec; // Eye vector in camera space
- Vector4f N2;
-
- Ec = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.cameraTransformT)), true);
- Ec = normalize(Ec);
-
- // R = E - 2 * N * (E . N)
- Float4 dot = Float4(2.0f) * dot3(Ec, Nc);
-
- R.x = Ec.x - Nc.x * dot;
- R.y = Ec.y - Nc.y * dot;
- R.z = Ec.z - Nc.z * dot;
- }
- else
- {
- // u = -2 * Nz * Nx
- // v = -2 * Nz * Ny
- // w = 1 - 2 * Nz * Nz
-
- R.x = -Float4(2.0f) * Nc.z * Nc.x;
- R.y = -Float4(2.0f) * Nc.z * Nc.y;
- R.z = Float4(1.0f) - Float4(2.0f) * Nc.z * Nc.z;
- }
- }
- else
- {
- R.x = Float4(0.0f);
- R.y = Float4(0.0f);
- R.z = Float4(0.0f);
- }
-
- R.w = Float4(1.0f);
-
- o[T0 + stage].x = R.x;
- o[T0 + stage].y = R.y;
- o[T0 + stage].z = R.z;
- o[T0 + stage].w = R.w;
- }
- break;
- case TEXGEN_SPHEREMAP:
- {
- Vector4f R; // Reflection vector
-
- if(state.vertexNormalActive)
- {
- Vector4f Nc; // Normal vector in camera space
-
- Nc = normal;
-
- if(state.localViewerActive)
- {
- Vector4f Ec; // Eye vector in camera space
- Vector4f N2;
-
- Ec = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.cameraTransformT)), true);
- Ec = normalize(Ec);
-
- // R = E - 2 * N * (E . N)
- Float4 dot = Float4(2.0f) * dot3(Ec, Nc);
-
- R.x = Ec.x - Nc.x * dot;
- R.y = Ec.y - Nc.y * dot;
- R.z = Ec.z - Nc.z * dot;
- }
- else
- {
- // u = -2 * Nz * Nx
- // v = -2 * Nz * Ny
- // w = 1 - 2 * Nz * Nz
-
- R.x = -Float4(2.0f) * Nc.z * Nc.x;
- R.y = -Float4(2.0f) * Nc.z * Nc.y;
- R.z = Float4(1.0f) - Float4(2.0f) * Nc.z * Nc.z;
- }
- }
- else
- {
- R.x = Float4(0.0f);
- R.y = Float4(0.0f);
- R.z = Float4(0.0f);
- }
-
- R.z -= Float4(1.0f);
- R = normalize(R);
- R.x = Float4(0.5f) * R.x + Float4(0.5f);
- R.y = Float4(0.5f) * R.y + Float4(0.5f);
-
- R.z = Float4(1.0f);
- R.w = Float4(0.0f);
-
- o[T0 + stage].x = R.x;
- o[T0 + stage].y = R.y;
- o[T0 + stage].z = R.z;
- o[T0 + stage].w = R.w;
- }
- break;
- default:
- ASSERT(false);
- }
-
- Vector4f texTrans0;
- Vector4f texTrans1;
- Vector4f texTrans2;
- Vector4f texTrans3;
-
- Vector4f T;
- Vector4f t;
-
- T.x = o[T0 + stage].x;
- T.y = o[T0 + stage].y;
- T.z = o[T0 + stage].z;
- T.w = o[T0 + stage].w;
-
- switch(state.textureState[stage].textureTransformCountActive)
- {
- case 4:
- texTrans3.x = texTrans3.y = texTrans3.z = texTrans3.w = *Pointer<Float4>(data + OFFSET(DrawData,ff.textureTransform[stage][3])); // FIXME: Unpack
- texTrans3.x = texTrans3.x.xxxx;
- texTrans3.y = texTrans3.y.yyyy;
- texTrans3.z = texTrans3.z.zzzz;
- texTrans3.w = texTrans3.w.wwww;
- t.w = dot4(T, texTrans3);
- case 3:
- texTrans2.x = texTrans2.y = texTrans2.z = texTrans2.w = *Pointer<Float4>(data + OFFSET(DrawData,ff.textureTransform[stage][2])); // FIXME: Unpack
- texTrans2.x = texTrans2.x.xxxx;
- texTrans2.y = texTrans2.y.yyyy;
- texTrans2.z = texTrans2.z.zzzz;
- texTrans2.w = texTrans2.w.wwww;
- t.z = dot4(T, texTrans2);
- case 2:
- texTrans1.x = texTrans1.y = texTrans1.z = texTrans1.w = *Pointer<Float4>(data + OFFSET(DrawData,ff.textureTransform[stage][1])); // FIXME: Unpack
- texTrans1.x = texTrans1.x.xxxx;
- texTrans1.y = texTrans1.y.yyyy;
- texTrans1.z = texTrans1.z.zzzz;
- texTrans1.w = texTrans1.w.wwww;
- t.y = dot4(T, texTrans1);
- case 1:
- texTrans0.x = texTrans0.y = texTrans0.z = texTrans0.w = *Pointer<Float4>(data + OFFSET(DrawData,ff.textureTransform[stage][0])); // FIXME: Unpack
- texTrans0.x = texTrans0.x.xxxx;
- texTrans0.y = texTrans0.y.yyyy;
- texTrans0.z = texTrans0.z.zzzz;
- texTrans0.w = texTrans0.w.wwww;
- t.x = dot4(T, texTrans0);
-
- o[T0 + stage].x = t.x;
- o[T0 + stage].y = t.y;
- o[T0 + stage].z = t.z;
- o[T0 + stage].w = t.w;
- case 0:
- break;
- default:
- ASSERT(false);
- }
- }
- }
-
- void VertexPipeline::processPointSize()
- {
- if(!state.pointSizeActive)
- {
- return; // Use global pointsize
- }
-
- if(state.input[PointSize])
- {
- o[Pts].y = v[PointSize].x;
- }
- else
- {
- o[Pts].y = *Pointer<Float4>(data + OFFSET(DrawData,point.pointSize));
- }
-
- if(state.pointScaleActive && !state.preTransformed)
- {
- Vector4f p = transformBlend(v[Position], Pointer<Byte>(data + OFFSET(DrawData,ff.cameraTransformT)), true);
-
- Float4 d = Sqrt(dot3(p, p)); // FIXME: length(p);
-
- Float4 A = *Pointer<Float>(data + OFFSET(DrawData,point.pointScaleA)); // FIXME: Unpack
- Float4 B = *Pointer<Float>(data + OFFSET(DrawData,point.pointScaleB)); // FIXME: Unpack
- Float4 C = *Pointer<Float>(data + OFFSET(DrawData,point.pointScaleC)); // FIXME: Unpack
-
- A = RcpSqrt_pp(A + d * (B + d * C));
-
- o[Pts].y = o[Pts].y * Float4(*Pointer<Float>(data + OFFSET(DrawData,viewportHeight))) * A; // FIXME: Unpack
- }
- }
-
- Vector4f VertexPipeline::transform(const Register &src, const Pointer<Byte> &matrix, bool homogeneous)
- {
- Vector4f dst;
-
- if(homogeneous)
- {
- Float4 m[4][4];
-
- for(int j = 0; j < 4; j++)
- {
- for(int i = 0; i < 4; i++)
- {
- m[j][i].x = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].y = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].z = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].w = *Pointer<Float>(matrix + 16 * i + 4 * j);
- }
- }
-
- dst.x = src.x * m[0][0] + src.y * m[0][1] + src.z * m[0][2] + src.w * m[0][3];
- dst.y = src.x * m[1][0] + src.y * m[1][1] + src.z * m[1][2] + src.w * m[1][3];
- dst.z = src.x * m[2][0] + src.y * m[2][1] + src.z * m[2][2] + src.w * m[2][3];
- dst.w = src.x * m[3][0] + src.y * m[3][1] + src.z * m[3][2] + src.w * m[3][3];
- }
- else
- {
- Float4 m[3][3];
-
- for(int j = 0; j < 3; j++)
- {
- for(int i = 0; i < 3; i++)
- {
- m[j][i].x = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].y = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].z = *Pointer<Float>(matrix + 16 * i + 4 * j);
- m[j][i].w = *Pointer<Float>(matrix + 16 * i + 4 * j);
- }
- }
-
- dst.x = src.x * m[0][0] + src.y * m[0][1] + src.z * m[0][2];
- dst.y = src.x * m[1][0] + src.y * m[1][1] + src.z * m[1][2];
- dst.z = src.x * m[2][0] + src.y * m[2][1] + src.z * m[2][2];
- }
-
- return dst;
- }
-
- Vector4f VertexPipeline::transform(const Register &src, const Pointer<Byte> &matrix, UInt index[4], bool homogeneous)
- {
- Vector4f dst;
-
- if(homogeneous)
- {
- Float4 m[4][4];
-
- for(int j = 0; j < 4; j++)
- {
- for(int i = 0; i < 4; i++)
- {
- m[j][i].x = *Pointer<Float>(matrix + 16 * i + 4 * j + index[0]);
- m[j][i].y = *Pointer<Float>(matrix + 16 * i + 4 * j + index[1]);
- m[j][i].z = *Pointer<Float>(matrix + 16 * i + 4 * j + index[2]);
- m[j][i].w = *Pointer<Float>(matrix + 16 * i + 4 * j + index[3]);
- }
- }
-
- dst.x = src.x * m[0][0] + src.y * m[0][1] + src.z * m[0][2] + m[0][3];
- dst.y = src.x * m[1][0] + src.y * m[1][1] + src.z * m[1][2] + m[1][3];
- dst.z = src.x * m[2][0] + src.y * m[2][1] + src.z * m[2][2] + m[2][3];
- dst.w = src.x * m[3][0] + src.y * m[3][1] + src.z * m[3][2] + m[3][3];
- }
- else
- {
- Float4 m[3][3];
-
- for(int j = 0; j < 3; j++)
- {
- for(int i = 0; i < 3; i++)
- {
- m[j][i].x = *Pointer<Float>(matrix + 16 * i + 4 * j + index[0]);
- m[j][i].y = *Pointer<Float>(matrix + 16 * i + 4 * j + index[1]);
- m[j][i].z = *Pointer<Float>(matrix + 16 * i + 4 * j + index[2]);
- m[j][i].w = *Pointer<Float>(matrix + 16 * i + 4 * j + index[3]);
- }
- }
-
- dst.x = src.x * m[0][0] + src.y * m[0][1] + src.z * m[0][2];
- dst.y = src.x * m[1][0] + src.y * m[1][1] + src.z * m[1][2];
- dst.z = src.x * m[2][0] + src.y * m[2][1] + src.z * m[2][2];
- }
-
- return dst;
- }
-
- Vector4f VertexPipeline::normalize(Vector4f &src)
- {
- Vector4f dst;
-
- Float4 rcpLength = RcpSqrt_pp(dot3(src, src));
-
- dst.x = src.x * rcpLength;
- dst.y = src.y * rcpLength;
- dst.z = src.z * rcpLength;
-
- return dst;
- }
-
- Float4 VertexPipeline::power(Float4 &src0, Float4 &src1)
- {
- Float4 dst = src0;
-
- dst = dst * dst;
- dst = dst * dst;
- dst = Float4(As<Int4>(dst) - As<Int4>(Float4(1.0f)));
-
- dst *= src1;
-
- dst = As<Float4>(Int4(dst) + As<Int4>(Float4(1.0f)));
- dst = RcpSqrt_pp(dst);
- dst = RcpSqrt_pp(dst);
-
- return dst;
- }
-}
diff --git a/src/Shader/VertexPipeline.hpp b/src/Shader/VertexPipeline.hpp
deleted file mode 100644
index 08fd7e8dd..000000000
--- a/src/Shader/VertexPipeline.hpp
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_VertexPipeline_hpp
-#define sw_VertexPipeline_hpp
-
-#include "VertexRoutine.hpp"
-
-#include "Renderer/Context.hpp"
-#include "Renderer/VertexProcessor.hpp"
-
-namespace sw
-{
- class VertexPipeline : public VertexRoutine
- {
- public:
- VertexPipeline(const VertexProcessor::State &state);
-
- virtual ~VertexPipeline();
-
- private:
- void pipeline(UInt &index) override;
- void processTextureCoordinate(int stage, Vector4f &normal, Vector4f &position);
- void processPointSize();
-
- Vector4f transformBlend(const Register &src, const Pointer<Byte> &matrix, bool homogenous);
- Vector4f transform(const Register &src, const Pointer<Byte> &matrix, bool homogenous);
- Vector4f transform(const Register &src, const Pointer<Byte> &matrix, UInt index[4], bool homogenous);
- Vector4f normalize(Vector4f &src);
- Float4 power(Float4 &src0, Float4 &src1);
- };
-}
-
-#endif // sw_VertexPipeline_hpp
diff --git a/src/Shader/VertexProgram.cpp b/src/Shader/VertexProgram.cpp
deleted file mode 100644
index c3f5de89e..000000000
--- a/src/Shader/VertexProgram.cpp
+++ /dev/null
@@ -1,1671 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexProgram.hpp"
-
-#include "VertexShader.hpp"
-#include "SamplerCore.hpp"
-#include "Renderer/Renderer.hpp"
-#include "Renderer/Vertex.hpp"
-#include "Common/Half.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- VertexProgram::VertexProgram(const VertexProcessor::State &state, const VertexShader *shader)
- : VertexRoutine(state, shader),
- shader(shader),
- r(shader->indirectAddressableTemporaries),
- aL(shader->getLimits().loops),
- increment(shader->getLimits().loops),
- iteration(shader->getLimits().loops),
- callStack(shader->getLimits().stack)
- {
- auto limits = shader->getLimits();
- ifFalseBlock.resize(limits.ifs);
- loopRepTestBlock.resize(limits.loops);
- loopRepEndBlock.resize(limits.loops);
- labelBlock.resize(limits.maxLabel + 1);
- isConditionalIf.resize(limits.ifs);
-
- loopDepth = -1;
- enableStack[0] = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
-
- if(shader->containsBreakInstruction())
- {
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- if(shader->containsContinueInstruction())
- {
- enableContinue = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- if(shader->isInstanceIdDeclared())
- {
- instanceID = *Pointer<Int>(data + OFFSET(DrawData,instanceID));
- }
- }
-
- VertexProgram::~VertexProgram()
- {
- }
-
- void VertexProgram::pipeline(UInt &index)
- {
- if(!state.preTransformed)
- {
- program(index);
- }
- else
- {
- passThrough();
- }
- }
-
- void VertexProgram::program(UInt &index)
- {
- // shader->print("VertexShader-%0.8X.txt", state.shaderID);
-
- unsigned short shaderModel = shader->getShaderModel();
-
- enableIndex = 0;
- stackIndex = 0;
-
- if(shader->containsLeaveInstruction())
- {
- enableLeave = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- if(shader->isVertexIdDeclared())
- {
- if(state.textureSampling)
- {
- vertexID = Int4(Int(index));
- }
- else
- {
- vertexID = Insert(vertexID, As<Int>(index), 0);
- vertexID = Insert(vertexID, As<Int>(index + 1), 1);
- vertexID = Insert(vertexID, As<Int>(index + 2), 2);
- vertexID = Insert(vertexID, As<Int>(index + 3), 3);
- }
- }
-
- // Create all call site return blocks up front
- for(size_t i = 0; i < shader->getLength(); i++)
- {
- const Shader::Instruction *instruction = shader->getInstruction(i);
- Shader::Opcode opcode = instruction->opcode;
-
- if(opcode == Shader::OPCODE_CALL || opcode == Shader::OPCODE_CALLNZ)
- {
- const Dst &dst = instruction->dst;
-
- ASSERT(callRetBlock[dst.label].size() == dst.callSite);
- callRetBlock[dst.label].push_back(Nucleus::createBasicBlock());
- }
- }
-
- for(size_t i = 0; i < shader->getLength(); i++)
- {
- const Shader::Instruction *instruction = shader->getInstruction(i);
- Shader::Opcode opcode = instruction->opcode;
-
- if(opcode == Shader::OPCODE_DCL || opcode == Shader::OPCODE_DEF || opcode == Shader::OPCODE_DEFI || opcode == Shader::OPCODE_DEFB)
- {
- continue;
- }
-
- Dst dst = instruction->dst;
- Src src0 = instruction->src[0];
- Src src1 = instruction->src[1];
- Src src2 = instruction->src[2];
- Src src3 = instruction->src[3];
- Src src4 = instruction->src[4];
-
- bool predicate = instruction->predicate;
- Control control = instruction->control;
- bool integer = dst.type == Shader::PARAMETER_ADDR;
- bool pp = dst.partialPrecision;
-
- Vector4f d;
- Vector4f s0;
- Vector4f s1;
- Vector4f s2;
- Vector4f s3;
- Vector4f s4;
-
- if(src0.type != Shader::PARAMETER_VOID) s0 = fetchRegister(src0);
- if(src1.type != Shader::PARAMETER_VOID) s1 = fetchRegister(src1);
- if(src2.type != Shader::PARAMETER_VOID) s2 = fetchRegister(src2);
- if(src3.type != Shader::PARAMETER_VOID) s3 = fetchRegister(src3);
- if(src4.type != Shader::PARAMETER_VOID) s4 = fetchRegister(src4);
-
- switch(opcode)
- {
- case Shader::OPCODE_VS_1_0: break;
- case Shader::OPCODE_VS_1_1: break;
- case Shader::OPCODE_VS_2_0: break;
- case Shader::OPCODE_VS_2_x: break;
- case Shader::OPCODE_VS_2_sw: break;
- case Shader::OPCODE_VS_3_0: break;
- case Shader::OPCODE_VS_3_sw: break;
- case Shader::OPCODE_DCL: break;
- case Shader::OPCODE_DEF: break;
- case Shader::OPCODE_DEFI: break;
- case Shader::OPCODE_DEFB: break;
- case Shader::OPCODE_NOP: break;
- case Shader::OPCODE_ABS: abs(d, s0); break;
- case Shader::OPCODE_IABS: iabs(d, s0); break;
- case Shader::OPCODE_ADD: add(d, s0, s1); break;
- case Shader::OPCODE_IADD: iadd(d, s0, s1); break;
- case Shader::OPCODE_CRS: crs(d, s0, s1); break;
- case Shader::OPCODE_FORWARD1: forward1(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD2: forward2(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD3: forward3(d, s0, s1, s2); break;
- case Shader::OPCODE_FORWARD4: forward4(d, s0, s1, s2); break;
- case Shader::OPCODE_REFLECT1: reflect1(d, s0, s1); break;
- case Shader::OPCODE_REFLECT2: reflect2(d, s0, s1); break;
- case Shader::OPCODE_REFLECT3: reflect3(d, s0, s1); break;
- case Shader::OPCODE_REFLECT4: reflect4(d, s0, s1); break;
- case Shader::OPCODE_REFRACT1: refract1(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT2: refract2(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT3: refract3(d, s0, s1, s2.x); break;
- case Shader::OPCODE_REFRACT4: refract4(d, s0, s1, s2.x); break;
- case Shader::OPCODE_DP1: dp1(d, s0, s1); break;
- case Shader::OPCODE_DP2: dp2(d, s0, s1); break;
- case Shader::OPCODE_DP3: dp3(d, s0, s1); break;
- case Shader::OPCODE_DP4: dp4(d, s0, s1); break;
- case Shader::OPCODE_DET2: det2(d, s0, s1); break;
- case Shader::OPCODE_DET3: det3(d, s0, s1, s2); break;
- case Shader::OPCODE_DET4: det4(d, s0, s1, s2, s3); break;
- case Shader::OPCODE_ATT: att(d, s0, s1); break;
- case Shader::OPCODE_EXP2X: exp2x(d, s0, pp); break;
- case Shader::OPCODE_EXP2: exp2(d, s0, pp); break;
- case Shader::OPCODE_EXPP: expp(d, s0, shaderModel); break;
- case Shader::OPCODE_EXP: exp(d, s0, pp); break;
- case Shader::OPCODE_FRC: frc(d, s0); break;
- case Shader::OPCODE_TRUNC: trunc(d, s0); break;
- case Shader::OPCODE_FLOOR: floor(d, s0); break;
- case Shader::OPCODE_ROUND: round(d, s0); break;
- case Shader::OPCODE_ROUNDEVEN: roundEven(d, s0); break;
- case Shader::OPCODE_CEIL: ceil(d, s0); break;
- case Shader::OPCODE_LIT: lit(d, s0); break;
- case Shader::OPCODE_LOG2X: log2x(d, s0, pp); break;
- case Shader::OPCODE_LOG2: log2(d, s0, pp); break;
- case Shader::OPCODE_LOGP: logp(d, s0, shaderModel); break;
- case Shader::OPCODE_LOG: log(d, s0, pp); break;
- case Shader::OPCODE_LRP: lrp(d, s0, s1, s2); break;
- case Shader::OPCODE_STEP: step(d, s0, s1); break;
- case Shader::OPCODE_SMOOTH: smooth(d, s0, s1, s2); break;
- case Shader::OPCODE_ISINF: isinf(d, s0); break;
- case Shader::OPCODE_ISNAN: isnan(d, s0); break;
- case Shader::OPCODE_FLOATBITSTOINT:
- case Shader::OPCODE_FLOATBITSTOUINT:
- case Shader::OPCODE_INTBITSTOFLOAT:
- case Shader::OPCODE_UINTBITSTOFLOAT: d = s0; break;
- case Shader::OPCODE_PACKSNORM2x16: packSnorm2x16(d, s0); break;
- case Shader::OPCODE_PACKUNORM2x16: packUnorm2x16(d, s0); break;
- case Shader::OPCODE_PACKHALF2x16: packHalf2x16(d, s0); break;
- case Shader::OPCODE_UNPACKSNORM2x16: unpackSnorm2x16(d, s0); break;
- case Shader::OPCODE_UNPACKUNORM2x16: unpackUnorm2x16(d, s0); break;
- case Shader::OPCODE_UNPACKHALF2x16: unpackHalf2x16(d, s0); break;
- case Shader::OPCODE_M3X2: M3X2(d, s0, src1); break;
- case Shader::OPCODE_M3X3: M3X3(d, s0, src1); break;
- case Shader::OPCODE_M3X4: M3X4(d, s0, src1); break;
- case Shader::OPCODE_M4X3: M4X3(d, s0, src1); break;
- case Shader::OPCODE_M4X4: M4X4(d, s0, src1); break;
- case Shader::OPCODE_MAD: mad(d, s0, s1, s2); break;
- case Shader::OPCODE_IMAD: imad(d, s0, s1, s2); break;
- case Shader::OPCODE_MAX: max(d, s0, s1); break;
- case Shader::OPCODE_IMAX: imax(d, s0, s1); break;
- case Shader::OPCODE_UMAX: umax(d, s0, s1); break;
- case Shader::OPCODE_MIN: min(d, s0, s1); break;
- case Shader::OPCODE_IMIN: imin(d, s0, s1); break;
- case Shader::OPCODE_UMIN: umin(d, s0, s1); break;
- case Shader::OPCODE_MOV: mov(d, s0, integer); break;
- case Shader::OPCODE_MOVA: mov(d, s0, true); break;
- case Shader::OPCODE_NEG: neg(d, s0); break;
- case Shader::OPCODE_INEG: ineg(d, s0); break;
- case Shader::OPCODE_F2B: f2b(d, s0); break;
- case Shader::OPCODE_B2F: b2f(d, s0); break;
- case Shader::OPCODE_F2I: f2i(d, s0); break;
- case Shader::OPCODE_I2F: i2f(d, s0); break;
- case Shader::OPCODE_F2U: f2u(d, s0); break;
- case Shader::OPCODE_U2F: u2f(d, s0); break;
- case Shader::OPCODE_I2B: i2b(d, s0); break;
- case Shader::OPCODE_B2I: b2i(d, s0); break;
- case Shader::OPCODE_MUL: mul(d, s0, s1); break;
- case Shader::OPCODE_IMUL: imul(d, s0, s1); break;
- case Shader::OPCODE_NRM2: nrm2(d, s0, pp); break;
- case Shader::OPCODE_NRM3: nrm3(d, s0, pp); break;
- case Shader::OPCODE_NRM4: nrm4(d, s0, pp); break;
- case Shader::OPCODE_POWX: powx(d, s0, s1, pp); break;
- case Shader::OPCODE_POW: pow(d, s0, s1, pp); break;
- case Shader::OPCODE_RCPX: rcpx(d, s0, pp); break;
- case Shader::OPCODE_DIV: div(d, s0, s1); break;
- case Shader::OPCODE_IDIV: idiv(d, s0, s1); break;
- case Shader::OPCODE_UDIV: udiv(d, s0, s1); break;
- case Shader::OPCODE_MOD: mod(d, s0, s1); break;
- case Shader::OPCODE_IMOD: imod(d, s0, s1); break;
- case Shader::OPCODE_UMOD: umod(d, s0, s1); break;
- case Shader::OPCODE_SHL: shl(d, s0, s1); break;
- case Shader::OPCODE_ISHR: ishr(d, s0, s1); break;
- case Shader::OPCODE_USHR: ushr(d, s0, s1); break;
- case Shader::OPCODE_RSQX: rsqx(d, s0, pp); break;
- case Shader::OPCODE_SQRT: sqrt(d, s0, pp); break;
- case Shader::OPCODE_RSQ: rsq(d, s0, pp); break;
- case Shader::OPCODE_LEN2: len2(d.x, s0, pp); break;
- case Shader::OPCODE_LEN3: len3(d.x, s0, pp); break;
- case Shader::OPCODE_LEN4: len4(d.x, s0, pp); break;
- case Shader::OPCODE_DIST1: dist1(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST2: dist2(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST3: dist3(d.x, s0, s1, pp); break;
- case Shader::OPCODE_DIST4: dist4(d.x, s0, s1, pp); break;
- case Shader::OPCODE_SGE: step(d, s1, s0); break;
- case Shader::OPCODE_SGN: sgn(d, s0); break;
- case Shader::OPCODE_ISGN: isgn(d, s0); break;
- case Shader::OPCODE_SINCOS: sincos(d, s0, pp); break;
- case Shader::OPCODE_COS: cos(d, s0, pp); break;
- case Shader::OPCODE_SIN: sin(d, s0, pp); break;
- case Shader::OPCODE_TAN: tan(d, s0); break;
- case Shader::OPCODE_ACOS: acos(d, s0); break;
- case Shader::OPCODE_ASIN: asin(d, s0); break;
- case Shader::OPCODE_ATAN: atan(d, s0); break;
- case Shader::OPCODE_ATAN2: atan2(d, s0, s1); break;
- case Shader::OPCODE_COSH: cosh(d, s0, pp); break;
- case Shader::OPCODE_SINH: sinh(d, s0, pp); break;
- case Shader::OPCODE_TANH: tanh(d, s0, pp); break;
- case Shader::OPCODE_ACOSH: acosh(d, s0, pp); break;
- case Shader::OPCODE_ASINH: asinh(d, s0, pp); break;
- case Shader::OPCODE_ATANH: atanh(d, s0, pp); break;
- case Shader::OPCODE_SLT: slt(d, s0, s1); break;
- case Shader::OPCODE_SUB: sub(d, s0, s1); break;
- case Shader::OPCODE_ISUB: isub(d, s0, s1); break;
- case Shader::OPCODE_BREAK: BREAK(); break;
- case Shader::OPCODE_BREAKC: BREAKC(s0, s1, control); break;
- case Shader::OPCODE_BREAKP: BREAKP(src0); break;
- case Shader::OPCODE_CONTINUE: CONTINUE(); break;
- case Shader::OPCODE_TEST: TEST(); break;
- case Shader::OPCODE_SCALAR: SCALAR(); break;
- case Shader::OPCODE_CALL: CALL(dst.label, dst.callSite); break;
- case Shader::OPCODE_CALLNZ: CALLNZ(dst.label, dst.callSite, src0); break;
- case Shader::OPCODE_ELSE: ELSE(); break;
- case Shader::OPCODE_ENDIF: ENDIF(); break;
- case Shader::OPCODE_ENDLOOP: ENDLOOP(); break;
- case Shader::OPCODE_ENDREP: ENDREP(); break;
- case Shader::OPCODE_ENDWHILE: ENDWHILE(); break;
- case Shader::OPCODE_ENDSWITCH: ENDSWITCH(); break;
- case Shader::OPCODE_IF: IF(src0); break;
- case Shader::OPCODE_IFC: IFC(s0, s1, control); break;
- case Shader::OPCODE_LABEL: LABEL(dst.index); break;
- case Shader::OPCODE_LOOP: LOOP(src1); break;
- case Shader::OPCODE_REP: REP(src0); break;
- case Shader::OPCODE_WHILE: WHILE(src0); break;
- case Shader::OPCODE_SWITCH: SWITCH(); break;
- case Shader::OPCODE_RET: RET(); break;
- case Shader::OPCODE_LEAVE: LEAVE(); break;
- case Shader::OPCODE_CMP: cmp(d, s0, s1, control); break;
- case Shader::OPCODE_ICMP: icmp(d, s0, s1, control); break;
- case Shader::OPCODE_UCMP: ucmp(d, s0, s1, control); break;
- case Shader::OPCODE_SELECT: select(d, s0, s1, s2); break;
- case Shader::OPCODE_EXTRACT: extract(d.x, s0, s1.x); break;
- case Shader::OPCODE_INSERT: insert(d, s0, s1.x, s2.x); break;
- case Shader::OPCODE_ALL: all(d.x, s0); break;
- case Shader::OPCODE_ANY: any(d.x, s0); break;
- case Shader::OPCODE_NOT: bitwise_not(d, s0); break;
- case Shader::OPCODE_OR: bitwise_or(d, s0, s1); break;
- case Shader::OPCODE_XOR: bitwise_xor(d, s0, s1); break;
- case Shader::OPCODE_AND: bitwise_and(d, s0, s1); break;
- case Shader::OPCODE_EQ: equal(d, s0, s1); break;
- case Shader::OPCODE_NE: notEqual(d, s0, s1); break;
- case Shader::OPCODE_TEXLDL: TEXLOD(d, s0, src1, s0.w); break;
- case Shader::OPCODE_TEXLOD: TEXLOD(d, s0, src1, s2.x); break;
- case Shader::OPCODE_TEX: TEX(d, s0, src1); break;
- case Shader::OPCODE_TEXOFFSET: TEXOFFSET(d, s0, src1, s2); break;
- case Shader::OPCODE_TEXLODOFFSET: TEXLODOFFSET(d, s0, src1, s2, s3.x); break;
- case Shader::OPCODE_TEXELFETCH: TEXELFETCH(d, s0, src1, s2.x); break;
- case Shader::OPCODE_TEXELFETCHOFFSET: TEXELFETCHOFFSET(d, s0, src1, s2, s3.x); break;
- case Shader::OPCODE_TEXGRAD: TEXGRAD(d, s0, src1, s2, s3); break;
- case Shader::OPCODE_TEXGRADOFFSET: TEXGRADOFFSET(d, s0, src1, s2, s3, s4); break;
- case Shader::OPCODE_TEXSIZE: TEXSIZE(d, s0.x, src1); break;
- case Shader::OPCODE_END: break;
- default:
- ASSERT(false);
- }
-
- if(dst.type != Shader::PARAMETER_VOID && dst.type != Shader::PARAMETER_LABEL && opcode != Shader::OPCODE_NOP)
- {
- if(dst.saturate)
- {
- if(dst.x) d.x = Max(d.x, Float4(0.0f));
- if(dst.y) d.y = Max(d.y, Float4(0.0f));
- if(dst.z) d.z = Max(d.z, Float4(0.0f));
- if(dst.w) d.w = Max(d.w, Float4(0.0f));
-
- if(dst.x) d.x = Min(d.x, Float4(1.0f));
- if(dst.y) d.y = Min(d.y, Float4(1.0f));
- if(dst.z) d.z = Min(d.z, Float4(1.0f));
- if(dst.w) d.w = Min(d.w, Float4(1.0f));
- }
-
- if(instruction->isPredicated())
- {
- Vector4f pDst; // FIXME: Rename
-
- switch(dst.type)
- {
- case Shader::PARAMETER_VOID: break;
- case Shader::PARAMETER_TEMP:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- if(dst.x) pDst.x = r[dst.index].x;
- if(dst.y) pDst.y = r[dst.index].y;
- if(dst.z) pDst.z = r[dst.index].z;
- if(dst.w) pDst.w = r[dst.index].w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) pDst.x = r[a].x;
- if(dst.y) pDst.y = r[a].y;
- if(dst.z) pDst.z = r[a].z;
- if(dst.w) pDst.w = r[a].w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) pDst.x = r[a].x;
- if(dst.y) pDst.y = r[a].y;
- if(dst.z) pDst.z = r[a].z;
- if(dst.w) pDst.w = r[a].w;
- }
- break;
- case Shader::PARAMETER_ADDR: pDst = a0; break;
- case Shader::PARAMETER_RASTOUT:
- switch(dst.index)
- {
- case 0:
- if(dst.x) pDst.x = o[Pos].x;
- if(dst.y) pDst.y = o[Pos].y;
- if(dst.z) pDst.z = o[Pos].z;
- if(dst.w) pDst.w = o[Pos].w;
- break;
- case 1:
- pDst.x = o[Fog].x;
- break;
- case 2:
- pDst.x = o[Pts].y;
- break;
- default:
- ASSERT(false);
- }
- break;
- case Shader::PARAMETER_ATTROUT:
- if(dst.x) pDst.x = o[C0 + dst.index].x;
- if(dst.y) pDst.y = o[C0 + dst.index].y;
- if(dst.z) pDst.z = o[C0 + dst.index].z;
- if(dst.w) pDst.w = o[C0 + dst.index].w;
- break;
- case Shader::PARAMETER_TEXCRDOUT:
- // case Shader::PARAMETER_OUTPUT:
- if(shaderModel < 0x0300)
- {
- if(dst.x) pDst.x = o[T0 + dst.index].x;
- if(dst.y) pDst.y = o[T0 + dst.index].y;
- if(dst.z) pDst.z = o[T0 + dst.index].z;
- if(dst.w) pDst.w = o[T0 + dst.index].w;
- }
- else if(dst.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- if(dst.x) pDst.x = o[dst.index].x;
- if(dst.y) pDst.y = o[dst.index].y;
- if(dst.z) pDst.z = o[dst.index].z;
- if(dst.w) pDst.w = o[dst.index].w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) pDst.x = o[a].x;
- if(dst.y) pDst.y = o[a].y;
- if(dst.z) pDst.z = o[a].z;
- if(dst.w) pDst.w = o[a].w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) pDst.x = o[a].x;
- if(dst.y) pDst.y = o[a].y;
- if(dst.z) pDst.z = o[a].z;
- if(dst.w) pDst.w = o[a].w;
- }
- break;
- case Shader::PARAMETER_LABEL: break;
- case Shader::PARAMETER_PREDICATE: pDst = p0; break;
- case Shader::PARAMETER_INPUT: break;
- default:
- ASSERT(false);
- }
-
- Int4 enable = enableMask(instruction);
-
- Int4 xEnable = enable;
- Int4 yEnable = enable;
- Int4 zEnable = enable;
- Int4 wEnable = enable;
-
- if(predicate)
- {
- unsigned char pSwizzle = instruction->predicateSwizzle;
-
- Float4 xPredicate = p0[(pSwizzle >> 0) & 0x03];
- Float4 yPredicate = p0[(pSwizzle >> 2) & 0x03];
- Float4 zPredicate = p0[(pSwizzle >> 4) & 0x03];
- Float4 wPredicate = p0[(pSwizzle >> 6) & 0x03];
-
- if(!instruction->predicateNot)
- {
- if(dst.x) xEnable = xEnable & As<Int4>(xPredicate);
- if(dst.y) yEnable = yEnable & As<Int4>(yPredicate);
- if(dst.z) zEnable = zEnable & As<Int4>(zPredicate);
- if(dst.w) wEnable = wEnable & As<Int4>(wPredicate);
- }
- else
- {
- if(dst.x) xEnable = xEnable & ~As<Int4>(xPredicate);
- if(dst.y) yEnable = yEnable & ~As<Int4>(yPredicate);
- if(dst.z) zEnable = zEnable & ~As<Int4>(zPredicate);
- if(dst.w) wEnable = wEnable & ~As<Int4>(wPredicate);
- }
- }
-
- if(dst.x) d.x = As<Float4>(As<Int4>(d.x) & xEnable);
- if(dst.y) d.y = As<Float4>(As<Int4>(d.y) & yEnable);
- if(dst.z) d.z = As<Float4>(As<Int4>(d.z) & zEnable);
- if(dst.w) d.w = As<Float4>(As<Int4>(d.w) & wEnable);
-
- if(dst.x) d.x = As<Float4>(As<Int4>(d.x) | (As<Int4>(pDst.x) & ~xEnable));
- if(dst.y) d.y = As<Float4>(As<Int4>(d.y) | (As<Int4>(pDst.y) & ~yEnable));
- if(dst.z) d.z = As<Float4>(As<Int4>(d.z) | (As<Int4>(pDst.z) & ~zEnable));
- if(dst.w) d.w = As<Float4>(As<Int4>(d.w) | (As<Int4>(pDst.w) & ~wEnable));
- }
-
- switch(dst.type)
- {
- case Shader::PARAMETER_VOID:
- break;
- case Shader::PARAMETER_TEMP:
- if(dst.rel.type == Shader::PARAMETER_VOID)
- {
- if(dst.x) r[dst.index].x = d.x;
- if(dst.y) r[dst.index].y = d.y;
- if(dst.z) r[dst.index].z = d.z;
- if(dst.w) r[dst.index].w = d.w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) r[a].x = d.x;
- if(dst.y) r[a].y = d.y;
- if(dst.z) r[a].z = d.z;
- if(dst.w) r[a].w = d.w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) r.scatter_x(a, d.x);
- if(dst.y) r.scatter_y(a, d.y);
- if(dst.z) r.scatter_z(a, d.z);
- if(dst.w) r.scatter_w(a, d.w);
- }
- break;
- case Shader::PARAMETER_ADDR:
- if(dst.x) a0.x = d.x;
- if(dst.y) a0.y = d.y;
- if(dst.z) a0.z = d.z;
- if(dst.w) a0.w = d.w;
- break;
- case Shader::PARAMETER_RASTOUT:
- switch(dst.index)
- {
- case 0:
- if(dst.x) o[Pos].x = d.x;
- if(dst.y) o[Pos].y = d.y;
- if(dst.z) o[Pos].z = d.z;
- if(dst.w) o[Pos].w = d.w;
- break;
- case 1:
- o[Fog].x = d.x;
- break;
- case 2:
- o[Pts].y = d.x;
- break;
- default: ASSERT(false);
- }
- break;
- case Shader::PARAMETER_ATTROUT:
- if(dst.x) o[C0 + dst.index].x = d.x;
- if(dst.y) o[C0 + dst.index].y = d.y;
- if(dst.z) o[C0 + dst.index].z = d.z;
- if(dst.w) o[C0 + dst.index].w = d.w;
- break;
- case Shader::PARAMETER_TEXCRDOUT:
- // case Shader::PARAMETER_OUTPUT:
- if(shaderModel < 0x0300)
- {
- if(dst.x) o[T0 + dst.index].x = d.x;
- if(dst.y) o[T0 + dst.index].y = d.y;
- if(dst.z) o[T0 + dst.index].z = d.z;
- if(dst.w) o[T0 + dst.index].w = d.w;
- }
- else if(dst.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- if(dst.x) o[dst.index].x = d.x;
- if(dst.y) o[dst.index].y = d.y;
- if(dst.z) o[dst.index].z = d.z;
- if(dst.w) o[dst.index].w = d.w;
- }
- else if(!dst.rel.dynamic)
- {
- Int a = dst.index + relativeAddress(dst.rel);
-
- if(dst.x) o[a].x = d.x;
- if(dst.y) o[a].y = d.y;
- if(dst.z) o[a].z = d.z;
- if(dst.w) o[a].w = d.w;
- }
- else
- {
- Int4 a = dst.index + dynamicAddress(dst.rel);
-
- if(dst.x) o.scatter_x(a, d.x);
- if(dst.y) o.scatter_y(a, d.y);
- if(dst.z) o.scatter_z(a, d.z);
- if(dst.w) o.scatter_w(a, d.w);
- }
- break;
- case Shader::PARAMETER_LABEL: break;
- case Shader::PARAMETER_PREDICATE: p0 = d; break;
- case Shader::PARAMETER_INPUT: break;
- default:
- ASSERT(false);
- }
- }
- }
-
- if(currentLabel != -1)
- {
- Nucleus::setInsertBlock(returnBlock);
- }
- }
-
- void VertexProgram::passThrough()
- {
- if(shader)
- {
- for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
- {
- unsigned char usage = shader->getOutput(i, 0).usage;
-
- switch(usage)
- {
- case 0xFF:
- continue;
- case Shader::USAGE_PSIZE:
- o[i].y = v[i].x;
- break;
- case Shader::USAGE_TEXCOORD:
- o[i].x = v[i].x;
- o[i].y = v[i].y;
- o[i].z = v[i].z;
- o[i].w = v[i].w;
- break;
- case Shader::USAGE_POSITION:
- o[i].x = v[i].x;
- o[i].y = v[i].y;
- o[i].z = v[i].z;
- o[i].w = v[i].w;
- break;
- case Shader::USAGE_COLOR:
- o[i].x = v[i].x;
- o[i].y = v[i].y;
- o[i].z = v[i].z;
- o[i].w = v[i].w;
- break;
- case Shader::USAGE_FOG:
- o[i].x = v[i].x;
- break;
- default:
- ASSERT(false);
- }
- }
- }
- else
- {
- o[Pos].x = v[PositionT].x;
- o[Pos].y = v[PositionT].y;
- o[Pos].z = v[PositionT].z;
- o[Pos].w = v[PositionT].w;
-
- for(int i = 0; i < 2; i++)
- {
- o[C0 + i].x = v[Color0 + i].x;
- o[C0 + i].y = v[Color0 + i].y;
- o[C0 + i].z = v[Color0 + i].z;
- o[C0 + i].w = v[Color0 + i].w;
- }
-
- for(int i = 0; i < 8; i++)
- {
- o[T0 + i].x = v[TexCoord0 + i].x;
- o[T0 + i].y = v[TexCoord0 + i].y;
- o[T0 + i].z = v[TexCoord0 + i].z;
- o[T0 + i].w = v[TexCoord0 + i].w;
- }
-
- o[Pts].y = v[PointSize].x;
- }
- }
-
- Vector4f VertexProgram::fetchRegister(const Src &src, unsigned int offset)
- {
- Vector4f reg;
- unsigned int i = src.index + offset;
-
- switch(src.type)
- {
- case Shader::PARAMETER_TEMP:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg = r[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = r[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = r[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_CONST:
- reg = readConstant(src, offset);
- break;
- case Shader::PARAMETER_INPUT:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg = v[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = v[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = v[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_VOID: return r[0]; // Dummy
- case Shader::PARAMETER_FLOAT4LITERAL:
- // This is used for all literal types, and since Reactor doesn't guarantee
- // preserving the bit pattern of float constants, we must construct them
- // as integer constants and bitcast.
- reg.x = As<Float4>(Int4(src.integer[0]));
- reg.y = As<Float4>(Int4(src.integer[1]));
- reg.z = As<Float4>(Int4(src.integer[2]));
- reg.w = As<Float4>(Int4(src.integer[3]));
- break;
- case Shader::PARAMETER_ADDR: reg = a0; break;
- case Shader::PARAMETER_CONSTBOOL: return r[0]; // Dummy
- case Shader::PARAMETER_CONSTINT: return r[0]; // Dummy
- case Shader::PARAMETER_LOOP: return r[0]; // Dummy
- case Shader::PARAMETER_PREDICATE: return r[0]; // Dummy
- case Shader::PARAMETER_SAMPLER:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg.x = As<Float4>(Int4(i));
- }
- else if(src.rel.type == Shader::PARAMETER_TEMP)
- {
- reg.x = As<Float4>(Int4(i) + As<Int4>(r[src.rel.index].x));
- }
- return reg;
- case Shader::PARAMETER_OUTPUT:
- if(src.rel.type == Shader::PARAMETER_VOID)
- {
- reg = o[i];
- }
- else if(!src.rel.dynamic)
- {
- reg = o[i + relativeAddress(src.rel, src.bufferIndex)];
- }
- else
- {
- reg = o[i + dynamicAddress(src.rel)];
- }
- break;
- case Shader::PARAMETER_MISCTYPE:
- if(src.index == Shader::InstanceIDIndex)
- {
- reg.x = As<Float>(instanceID);
- }
- else if(src.index == Shader::VertexIDIndex)
- {
- reg.x = As<Float4>(vertexID);
- }
- else ASSERT(false);
- return reg;
- default:
- ASSERT(false);
- }
-
- const Float4 &x = reg[(src.swizzle >> 0) & 0x3];
- const Float4 &y = reg[(src.swizzle >> 2) & 0x3];
- const Float4 &z = reg[(src.swizzle >> 4) & 0x3];
- const Float4 &w = reg[(src.swizzle >> 6) & 0x3];
-
- Vector4f mod;
-
- switch(src.modifier)
- {
- case Shader::MODIFIER_NONE:
- mod.x = x;
- mod.y = y;
- mod.z = z;
- mod.w = w;
- break;
- case Shader::MODIFIER_NEGATE:
- mod.x = -x;
- mod.y = -y;
- mod.z = -z;
- mod.w = -w;
- break;
- case Shader::MODIFIER_ABS:
- mod.x = Abs(x);
- mod.y = Abs(y);
- mod.z = Abs(z);
- mod.w = Abs(w);
- break;
- case Shader::MODIFIER_ABS_NEGATE:
- mod.x = -Abs(x);
- mod.y = -Abs(y);
- mod.z = -Abs(z);
- mod.w = -Abs(w);
- break;
- case Shader::MODIFIER_NOT:
- mod.x = As<Float4>(As<Int4>(x) ^ Int4(0xFFFFFFFF));
- mod.y = As<Float4>(As<Int4>(y) ^ Int4(0xFFFFFFFF));
- mod.z = As<Float4>(As<Int4>(z) ^ Int4(0xFFFFFFFF));
- mod.w = As<Float4>(As<Int4>(w) ^ Int4(0xFFFFFFFF));
- break;
- default:
- ASSERT(false);
- }
-
- return mod;
- }
-
- RValue<Pointer<Byte>> VertexProgram::uniformAddress(int bufferIndex, unsigned int index)
- {
- if(bufferIndex == -1)
- {
- return data + OFFSET(DrawData, vs.c[index]);
- }
- else
- {
- return *Pointer<Pointer<Byte>>(data + OFFSET(DrawData, vs.u[bufferIndex])) + index;
- }
- }
-
- RValue<Pointer<Byte>> VertexProgram::uniformAddress(int bufferIndex, unsigned int index, Int &offset)
- {
- return uniformAddress(bufferIndex, index) + offset * sizeof(float4);
- }
-
- Vector4f VertexProgram::readConstant(const Src &src, unsigned int offset)
- {
- Vector4f c;
- unsigned int i = src.index + offset;
-
- if(src.rel.type == Shader::PARAMETER_VOID) // Not relative
- {
- c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i));
-
- c.x = c.x.xxxx;
- c.y = c.y.yyyy;
- c.z = c.z.zzzz;
- c.w = c.w.wwww;
-
- if(shader->containsDefineInstruction()) // Constant may be known at compile time
- {
- for(size_t j = 0; j < shader->getLength(); j++)
- {
- const Shader::Instruction &instruction = *shader->getInstruction(j);
-
- if(instruction.opcode == Shader::OPCODE_DEF)
- {
- if(instruction.dst.index == i)
- {
- c.x = Float4(instruction.src[0].value[0]);
- c.y = Float4(instruction.src[0].value[1]);
- c.z = Float4(instruction.src[0].value[2]);
- c.w = Float4(instruction.src[0].value[3]);
-
- break;
- }
- }
- }
- }
- }
- else if(!src.rel.dynamic || src.rel.type == Shader::PARAMETER_LOOP)
- {
- Int a = relativeAddress(src.rel, src.bufferIndex);
-
- c.x = c.y = c.z = c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, i, a));
-
- c.x = c.x.xxxx;
- c.y = c.y.yyyy;
- c.z = c.z.zzzz;
- c.w = c.w.wwww;
- }
- else
- {
- int component = src.rel.swizzle & 0x03;
- Float4 a;
-
- switch(src.rel.type)
- {
- case Shader::PARAMETER_ADDR: a = a0[component]; break;
- case Shader::PARAMETER_TEMP: a = r[src.rel.index][component]; break;
- case Shader::PARAMETER_INPUT: a = v[src.rel.index][component]; break;
- case Shader::PARAMETER_OUTPUT: a = o[src.rel.index][component]; break;
- case Shader::PARAMETER_CONST: a = *Pointer<Float>(uniformAddress(src.bufferIndex, src.rel.index) + component * sizeof(float)); break;
- case Shader::PARAMETER_MISCTYPE:
- switch(src.rel.index)
- {
- case Shader::InstanceIDIndex: a = As<Float4>(Int4(instanceID)); break;
- case Shader::VertexIDIndex: a = As<Float4>(vertexID); break;
- default: ASSERT(false);
- }
- break;
- default: ASSERT(false);
- }
-
- Int4 index = Int4(i) + As<Int4>(a) * Int4(src.rel.scale);
-
- if (src.bufferIndex == -1)
- {
- index = Min(As<UInt4>(index), UInt4(VERTEX_UNIFORM_VECTORS)); // Clamp to constant register range, c[VERTEX_UNIFORM_VECTORS] = {0, 0, 0, 0}
- }
-
- Int index0 = Extract(index, 0);
- Int index1 = Extract(index, 1);
- Int index2 = Extract(index, 2);
- Int index3 = Extract(index, 3);
-
- c.x = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index0), 16);
- c.y = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index1), 16);
- c.z = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index2), 16);
- c.w = *Pointer<Float4>(uniformAddress(src.bufferIndex, 0, index3), 16);
-
- transpose4x4(c.x, c.y, c.z, c.w);
- }
-
- return c;
- }
-
- Int VertexProgram::relativeAddress(const Shader::Relative &rel, int bufferIndex)
- {
- ASSERT(!rel.dynamic);
-
- if(rel.type == Shader::PARAMETER_TEMP)
- {
- return As<Int>(Extract(r[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_INPUT)
- {
- return As<Int>(Extract(v[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_OUTPUT)
- {
- return As<Int>(Extract(o[rel.index].x, 0)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_CONST)
- {
- return *Pointer<Int>(uniformAddress(bufferIndex, rel.index)) * rel.scale;
- }
- else if(rel.type == Shader::PARAMETER_LOOP)
- {
- return aL[loopDepth];
- }
- else ASSERT(false);
-
- return 0;
- }
-
- Int4 VertexProgram::dynamicAddress(const Shader::Relative &rel)
- {
- int component = rel.swizzle & 0x03;
- Float4 a;
-
- switch(rel.type)
- {
- case Shader::PARAMETER_ADDR: a = a0[component]; break;
- case Shader::PARAMETER_TEMP: a = r[rel.index][component]; break;
- case Shader::PARAMETER_INPUT: a = v[rel.index][component]; break;
- case Shader::PARAMETER_OUTPUT: a = o[rel.index][component]; break;
- case Shader::PARAMETER_MISCTYPE:
- switch(rel.index)
- {
- case Shader::InstanceIDIndex: a = As<Float>(instanceID); break;
- case Shader::VertexIDIndex: a = As<Float4>(vertexID); break;
- default: ASSERT(false);
- }
- break;
- default: ASSERT(false);
- }
-
- return As<Int4>(a) * Int4(rel.scale);
- }
-
- Int4 VertexProgram::enableMask(const Shader::Instruction *instruction)
- {
- if(scalar)
- {
- return Int4(0xFFFFFFFF);
- }
-
- Int4 enable = instruction->analysisBranch ? Int4(enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))]) : Int4(0xFFFFFFFF);
-
- if(shader->containsBreakInstruction() && instruction->analysisBreak)
- {
- enable &= enableBreak;
- }
-
- if(shader->containsContinueInstruction() && instruction->analysisContinue)
- {
- enable &= enableContinue;
- }
-
- if(shader->containsLeaveInstruction() && instruction->analysisLeave)
- {
- enable &= enableLeave;
- }
-
- return enable;
- }
-
- void VertexProgram::M3X2(Vector4f &dst, Vector4f &src0, Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- }
-
- void VertexProgram::M3X3(Vector4f &dst, Vector4f &src0, Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- dst.z = dot3(src0, row2);
- }
-
- void VertexProgram::M3X4(Vector4f &dst, Vector4f &src0, Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
- Vector4f row3 = fetchRegister(src1, 3);
-
- dst.x = dot3(src0, row0);
- dst.y = dot3(src0, row1);
- dst.z = dot3(src0, row2);
- dst.w = dot3(src0, row3);
- }
-
- void VertexProgram::M4X3(Vector4f &dst, Vector4f &src0, Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
-
- dst.x = dot4(src0, row0);
- dst.y = dot4(src0, row1);
- dst.z = dot4(src0, row2);
- }
-
- void VertexProgram::M4X4(Vector4f &dst, Vector4f &src0, Src &src1)
- {
- Vector4f row0 = fetchRegister(src1, 0);
- Vector4f row1 = fetchRegister(src1, 1);
- Vector4f row2 = fetchRegister(src1, 2);
- Vector4f row3 = fetchRegister(src1, 3);
-
- dst.x = dot4(src0, row0);
- dst.y = dot4(src0, row1);
- dst.z = dot4(src0, row2);
- dst.w = dot4(src0, row3);
- }
-
- void VertexProgram::BREAK()
- {
- enableBreak = enableBreak & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
-
- void VertexProgram::BREAKC(Vector4f &src0, Vector4f &src1, Control control)
- {
- Int4 condition;
-
- switch(control)
- {
- case Shader::CONTROL_GT: condition = CmpNLE(src0.x, src1.x); break;
- case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x); break;
- case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x); break;
- case Shader::CONTROL_LT: condition = CmpLT(src0.x, src1.x); break;
- case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x); break;
- case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x); break;
- default:
- ASSERT(false);
- }
-
- BREAK(condition);
- }
-
- void VertexProgram::BREAKP(const Src &predicateRegister) // FIXME: Factor out parts common with BREAKC
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- BREAK(condition);
- }
-
- void VertexProgram::BREAK(Int4 &condition)
- {
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- enableBreak = enableBreak & ~condition;
- }
-
- void VertexProgram::CONTINUE()
- {
- enableContinue = enableContinue & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
-
- void VertexProgram::TEST()
- {
- enableContinue = restoreContinue.back();
- restoreContinue.pop_back();
- }
-
- void VertexProgram::SCALAR()
- {
- scalar = true;
- }
-
- void VertexProgram::CALL(int labelIndex, int callSiteIndex)
- {
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- Int4 restoreLeave = enableLeave;
-
- Nucleus::createBr(labelBlock[labelIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableLeave = restoreLeave;
- }
-
- void VertexProgram::CALLNZ(int labelIndex, int callSiteIndex, const Src &src)
- {
- if(src.type == Shader::PARAMETER_CONSTBOOL)
- {
- CALLNZb(labelIndex, callSiteIndex, src);
- }
- else if(src.type == Shader::PARAMETER_PREDICATE)
- {
- CALLNZp(labelIndex, callSiteIndex, src);
- }
- else ASSERT(false);
- }
-
- void VertexProgram::CALLNZb(int labelIndex, int callSiteIndex, const Src &boolRegister)
- {
- Bool condition = (*Pointer<Byte>(data + OFFSET(DrawData,vs.b[boolRegister.index])) != Byte(0)); // FIXME
-
- if(boolRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = !condition;
- }
-
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- Int4 restoreLeave = enableLeave;
-
- branch(condition, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableLeave = restoreLeave;
- }
-
- void VertexProgram::CALLNZp(int labelIndex, int callSiteIndex, const Src &predicateRegister)
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- if(callRetBlock[labelIndex].size() > 1)
- {
- callStack[stackIndex++] = UInt(callSiteIndex);
- }
-
- enableIndex++;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
- Int4 restoreLeave = enableLeave;
-
- Bool notAllFalse = SignMask(condition) != 0;
- branch(notAllFalse, labelBlock[labelIndex], callRetBlock[labelIndex][callSiteIndex]);
- Nucleus::setInsertBlock(callRetBlock[labelIndex][callSiteIndex]);
-
- enableIndex--;
- enableLeave = restoreLeave;
- }
-
- void VertexProgram::ELSE()
- {
- ifDepth--;
-
- BasicBlock *falseBlock = ifFalseBlock[ifDepth];
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- if(isConditionalIf[ifDepth])
- {
- Int4 condition = ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] & enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- Bool notAllFalse = SignMask(condition) != 0;
-
- branch(notAllFalse, falseBlock, endBlock);
-
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] & enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- }
- else
- {
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(falseBlock);
- }
-
- ifFalseBlock[ifDepth] = endBlock;
-
- ifDepth++;
- }
-
- void VertexProgram::ENDIF()
- {
- ifDepth--;
-
- BasicBlock *endBlock = ifFalseBlock[ifDepth];
-
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(endBlock);
-
- if(isConditionalIf[ifDepth])
- {
- enableIndex--;
- }
- }
-
- void VertexProgram::ENDLOOP()
- {
- loopRepDepth--;
-
- aL[loopDepth] = aL[loopDepth] + increment[loopDepth]; // FIXME: +=
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- loopDepth--;
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- void VertexProgram::ENDREP()
- {
- loopRepDepth--;
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- loopDepth--;
- enableBreak = Int4(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF);
- }
-
- void VertexProgram::ENDWHILE()
- {
- loopRepDepth--;
-
- BasicBlock *testBlock = loopRepTestBlock[loopRepDepth];
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(endBlock);
-
- enableIndex--;
- scalar = false;
- }
-
- void VertexProgram::ENDSWITCH()
- {
- loopRepDepth--;
-
- BasicBlock *endBlock = loopRepEndBlock[loopRepDepth];
-
- Nucleus::createBr(endBlock);
- Nucleus::setInsertBlock(endBlock);
- }
-
- void VertexProgram::IF(const Src &src)
- {
- if(src.type == Shader::PARAMETER_CONSTBOOL)
- {
- IFb(src);
- }
- else if(src.type == Shader::PARAMETER_PREDICATE)
- {
- IFp(src);
- }
- else
- {
- Int4 condition = As<Int4>(fetchRegister(src).x);
- IF(condition);
- }
- }
-
- void VertexProgram::IFb(const Src &boolRegister)
- {
- ASSERT(ifDepth < 24 + 4);
-
- Bool condition = (*Pointer<Byte>(data + OFFSET(DrawData,vs.b[boolRegister.index])) != Byte(0)); // FIXME
-
- if(boolRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = !condition;
- }
-
- BasicBlock *trueBlock = Nucleus::createBasicBlock();
- BasicBlock *falseBlock = Nucleus::createBasicBlock();
-
- branch(condition, trueBlock, falseBlock);
-
- isConditionalIf[ifDepth] = false;
- ifFalseBlock[ifDepth] = falseBlock;
-
- ifDepth++;
- }
-
- void VertexProgram::IFp(const Src &predicateRegister)
- {
- Int4 condition = As<Int4>(p0[predicateRegister.swizzle & 0x3]);
-
- if(predicateRegister.modifier == Shader::MODIFIER_NOT)
- {
- condition = ~condition;
- }
-
- IF(condition);
- }
-
- void VertexProgram::IFC(Vector4f &src0, Vector4f &src1, Control control)
- {
- Int4 condition;
-
- switch(control)
- {
- case Shader::CONTROL_GT: condition = CmpNLE(src0.x, src1.x); break;
- case Shader::CONTROL_EQ: condition = CmpEQ(src0.x, src1.x); break;
- case Shader::CONTROL_GE: condition = CmpNLT(src0.x, src1.x); break;
- case Shader::CONTROL_LT: condition = CmpLT(src0.x, src1.x); break;
- case Shader::CONTROL_NE: condition = CmpNEQ(src0.x, src1.x); break;
- case Shader::CONTROL_LE: condition = CmpLE(src0.x, src1.x); break;
- default:
- ASSERT(false);
- }
-
- IF(condition);
- }
-
- void VertexProgram::IF(Int4 &condition)
- {
- condition &= enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- enableIndex++;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
-
- BasicBlock *trueBlock = Nucleus::createBasicBlock();
- BasicBlock *falseBlock = Nucleus::createBasicBlock();
-
- Bool notAllFalse = SignMask(condition) != 0;
-
- branch(notAllFalse, trueBlock, falseBlock);
-
- isConditionalIf[ifDepth] = true;
- ifFalseBlock[ifDepth] = falseBlock;
-
- ifDepth++;
- }
-
- void VertexProgram::LABEL(int labelIndex)
- {
- if(!labelBlock[labelIndex])
- {
- labelBlock[labelIndex] = Nucleus::createBasicBlock();
- }
-
- Nucleus::setInsertBlock(labelBlock[labelIndex]);
- currentLabel = labelIndex;
- }
-
- void VertexProgram::LOOP(const Src &integerRegister)
- {
- loopDepth++;
-
- iteration[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData,vs.i[integerRegister.index][0]));
- aL[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData,vs.i[integerRegister.index][1]));
- increment[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData,vs.i[integerRegister.index][2]));
-
- // FIXME: Compiles to two instructions?
- If(increment[loopDepth] == 0)
- {
- increment[loopDepth] = 1;
- }
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- // FIXME: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- branch(iteration[loopDepth] > 0, loopBlock, endBlock);
- Nucleus::setInsertBlock(loopBlock);
-
- iteration[loopDepth] = iteration[loopDepth] - 1; // FIXME: --
-
- loopRepDepth++;
- }
-
- void VertexProgram::REP(const Src &integerRegister)
- {
- loopDepth++;
-
- iteration[loopDepth] = *Pointer<Int>(data + OFFSET(DrawData,vs.i[integerRegister.index][0]));
- aL[loopDepth] = aL[loopDepth - 1];
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- // FIXME: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- branch(iteration[loopDepth] > 0, loopBlock, endBlock);
- Nucleus::setInsertBlock(loopBlock);
-
- iteration[loopDepth] = iteration[loopDepth] - 1; // FIXME: --
-
- loopRepDepth++;
- }
-
- void VertexProgram::WHILE(const Src &temporaryRegister)
- {
- enableIndex++;
-
- BasicBlock *loopBlock = Nucleus::createBasicBlock();
- BasicBlock *testBlock = Nucleus::createBasicBlock();
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = testBlock;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- Int4 restoreBreak = enableBreak;
- restoreContinue.push_back(enableContinue);
-
- // TODO: jump(testBlock)
- Nucleus::createBr(testBlock);
- Nucleus::setInsertBlock(testBlock);
-
- const Vector4f &src = fetchRegister(temporaryRegister);
- Int4 condition = As<Int4>(src.x);
- condition &= enableStack[Min(enableIndex - 1, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
- if(shader->containsLeaveInstruction()) condition &= enableLeave;
- if(shader->containsBreakInstruction()) condition &= enableBreak;
- enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))] = condition;
-
- Bool notAllFalse = SignMask(condition) != 0;
- branch(notAllFalse, loopBlock, endBlock);
-
- Nucleus::setInsertBlock(endBlock);
- enableBreak = restoreBreak;
-
- Nucleus::setInsertBlock(loopBlock);
-
- loopRepDepth++;
- scalar = false;
- }
-
- void VertexProgram::SWITCH()
- {
- BasicBlock *endBlock = Nucleus::createBasicBlock();
-
- loopRepTestBlock[loopRepDepth] = nullptr;
- loopRepEndBlock[loopRepDepth] = endBlock;
-
- Int4 restoreBreak = enableBreak;
-
- BasicBlock *currentBlock = Nucleus::getInsertBlock();
-
- Nucleus::setInsertBlock(endBlock);
- enableBreak = restoreBreak;
-
- Nucleus::setInsertBlock(currentBlock);
-
- loopRepDepth++;
- }
-
- void VertexProgram::RET()
- {
- if(currentLabel == -1)
- {
- returnBlock = Nucleus::createBasicBlock();
- Nucleus::createBr(returnBlock);
- }
- else
- {
- BasicBlock *unreachableBlock = Nucleus::createBasicBlock();
-
- if(callRetBlock[currentLabel].size() > 1) // Pop the return destination from the call stack
- {
- // FIXME: Encapsulate
- UInt index = callStack[--stackIndex];
-
- Value *value = index.loadValue();
- SwitchCases *switchCases = Nucleus::createSwitch(value, unreachableBlock, (int)callRetBlock[currentLabel].size());
-
- for(unsigned int i = 0; i < callRetBlock[currentLabel].size(); i++)
- {
- Nucleus::addSwitchCase(switchCases, i, callRetBlock[currentLabel][i]);
- }
- }
- else if(callRetBlock[currentLabel].size() == 1) // Jump directly to the unique return destination
- {
- Nucleus::createBr(callRetBlock[currentLabel][0]);
- }
- else // Function isn't called
- {
- Nucleus::createBr(unreachableBlock);
- }
-
- Nucleus::setInsertBlock(unreachableBlock);
- Nucleus::createUnreachable();
- }
- }
-
- void VertexProgram::LEAVE()
- {
- enableLeave = enableLeave & ~enableStack[Min(enableIndex, Int(MAX_SHADER_ENABLE_STACK_SIZE))];
-
- // FIXME: Return from function if all instances left
- // FIXME: Use enableLeave in other control-flow constructs
- }
-
- void VertexProgram::TEX(Vector4f &dst, Vector4f &src0, const Src &src1)
- {
- dst = sampleTexture(src1, src0, (src0.x), (src0), (src0), (src0), Base);
- }
-
- void VertexProgram::TEXOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &offset)
- {
- dst = sampleTexture(src1, src0, (src0.x), (src0), (src0), offset, {Base, Offset});
- }
-
- void VertexProgram::TEXLOD(Vector4f &dst, Vector4f &src0, const Src& src1, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), (src0), Lod);
- }
-
- void VertexProgram::TEXLODOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &offset, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), offset, {Lod, Offset});
- }
-
- void VertexProgram::TEXELFETCH(Vector4f &dst, Vector4f &src0, const Src& src1, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), (src0), Fetch);
- }
-
- void VertexProgram::TEXELFETCHOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &offset, Float4 &lod)
- {
- dst = sampleTexture(src1, src0, lod, (src0), (src0), offset, {Fetch, Offset});
- }
-
- void VertexProgram::TEXGRAD(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &dsx, Vector4f &dsy)
- {
- dst = sampleTexture(src1, src0, (src0.x), dsx, dsy, src0, Grad);
- }
-
- void VertexProgram::TEXGRADOFFSET(Vector4f &dst, Vector4f &src0, const Src& src1, Vector4f &dsx, Vector4f &dsy, Vector4f &offset)
- {
- dst = sampleTexture(src1, src0, (src0.x), dsx, dsy, offset, {Grad, Offset});
- }
-
- void VertexProgram::TEXSIZE(Vector4f &dst, Float4 &lod, const Src &src1)
- {
- bool uniformSampler = (src1.type == Shader::PARAMETER_SAMPLER && src1.rel.type == Shader::PARAMETER_VOID);
- Int offset = uniformSampler ? src1.index * sizeof(Texture) : As<Int>(Float(fetchRegister(src1).x.x)) * sizeof(Texture);
- Pointer<Byte> texture = data + OFFSET(DrawData, mipmap[TEXTURE_IMAGE_UNITS]) + offset;
-
- dst = SamplerCore::textureSize(texture, lod);
- }
-
- Vector4f VertexProgram::sampleTexture(const Src &s, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function)
- {
- Vector4f tmp;
-
- if(s.type == Shader::PARAMETER_SAMPLER && s.rel.type == Shader::PARAMETER_VOID)
- {
- tmp = sampleTexture(s.index, uvwq, lod, dsx, dsy, offset, function);
- }
- else
- {
- Int index = As<Int>(Float(fetchRegister(s).x.x));
-
- for(int i = 0; i < VERTEX_TEXTURE_IMAGE_UNITS; i++)
- {
- if(shader->usesSampler(i))
- {
- If(index == i)
- {
- tmp = sampleTexture(i, uvwq, lod, dsx, dsy, offset, function);
- // FIXME: When the sampler states are the same, we could use one sampler and just index the texture
- }
- }
- }
- }
-
- Vector4f c;
- c.x = tmp[(s.swizzle >> 0) & 0x3];
- c.y = tmp[(s.swizzle >> 2) & 0x3];
- c.z = tmp[(s.swizzle >> 4) & 0x3];
- c.w = tmp[(s.swizzle >> 6) & 0x3];
-
- return c;
- }
-
- Vector4f VertexProgram::sampleTexture(int sampler, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function)
- {
- Pointer<Byte> texture = data + OFFSET(DrawData, mipmap[TEXTURE_IMAGE_UNITS]) + sampler * sizeof(Texture);
- return SamplerCore(constants, state.sampler[sampler]).sampleTexture(texture, uvwq.x, uvwq.y, uvwq.z, uvwq.w, lod, dsx, dsy, offset, function);
- }
-}
diff --git a/src/Shader/VertexProgram.hpp b/src/Shader/VertexProgram.hpp
deleted file mode 100644
index bfccb18fd..000000000
--- a/src/Shader/VertexProgram.hpp
+++ /dev/null
@@ -1,143 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_VertexProgram_hpp
-#define sw_VertexProgram_hpp
-
-#include "VertexRoutine.hpp"
-#include "ShaderCore.hpp"
-
-#include "SamplerCore.hpp"
-#include "Renderer/Stream.hpp"
-#include "Common/Types.hpp"
-
-#include <unordered_map>
-
-namespace sw
-{
- struct Stream;
- class VertexShader;
-
- class VertexProgram : public VertexRoutine, public ShaderCore
- {
- public:
- VertexProgram(const VertexProcessor::State &state, const VertexShader *vertexShader);
-
- virtual ~VertexProgram();
-
- private:
- const VertexShader *const shader;
-
- RegisterArray<NUM_TEMPORARY_REGISTERS> r; // Temporary registers
- Vector4f a0;
- Array<Int> aL; // loop counter register
- Vector4f p0;
-
- Array<Int> increment;
- Array<Int> iteration;
-
- Int loopDepth;
- Int stackIndex; // FIXME: Inc/decrement callStack
- Array<UInt> callStack;
-
- Int enableIndex;
- Array<Int4, MAX_SHADER_ENABLE_STACK_SIZE> enableStack;
- Int4 enableBreak;
- Int4 enableContinue;
- Int4 enableLeave;
-
- Int instanceID;
- Int4 vertexID;
-
- typedef Shader::DestinationParameter Dst;
- typedef Shader::SourceParameter Src;
- typedef Shader::Control Control;
- typedef Shader::Usage Usage;
-
- void pipeline(UInt &index) override;
- void program(UInt &index);
- void passThrough();
-
- Vector4f fetchRegister(const Src &src, unsigned int offset = 0);
- Vector4f readConstant(const Src &src, unsigned int offset = 0);
- RValue<Pointer<Byte>> uniformAddress(int bufferIndex, unsigned int index);
- RValue<Pointer<Byte>> uniformAddress(int bufferIndex, unsigned int index, Int &offset);
- Int relativeAddress(const Shader::Relative &rel, int bufferIndex = -1);
- Int4 dynamicAddress(const Shader::Relative &rel);
- Int4 enableMask(const Shader::Instruction *instruction);
-
- void M3X2(Vector4f &dst, Vector4f &src0, Src &src1);
- void M3X3(Vector4f &dst, Vector4f &src0, Src &src1);
- void M3X4(Vector4f &dst, Vector4f &src0, Src &src1);
- void M4X3(Vector4f &dst, Vector4f &src0, Src &src1);
- void M4X4(Vector4f &dst, Vector4f &src0, Src &src1);
- void BREAK();
- void BREAKC(Vector4f &src0, Vector4f &src1, Control);
- void BREAKP(const Src &predicateRegister);
- void BREAK(Int4 &condition);
- void CONTINUE();
- void TEST();
- void SCALAR();
- void CALL(int labelIndex, int callSiteIndex);
- void CALLNZ(int labelIndex, int callSiteIndex, const Src &src);
- void CALLNZb(int labelIndex, int callSiteIndex, const Src &boolRegister);
- void CALLNZp(int labelIndex, int callSiteIndex, const Src &predicateRegister);
- void ELSE();
- void ENDIF();
- void ENDLOOP();
- void ENDREP();
- void ENDWHILE();
- void ENDSWITCH();
- void IF(const Src &src);
- void IFb(const Src &boolRegister);
- void IFp(const Src &predicateRegister);
- void IFC(Vector4f &src0, Vector4f &src1, Control);
- void IF(Int4 &condition);
- void LABEL(int labelIndex);
- void LOOP(const Src &integerRegister);
- void REP(const Src &integerRegister);
- void WHILE(const Src &temporaryRegister);
- void SWITCH();
- void RET();
- void LEAVE();
- void TEX(Vector4f &dst, Vector4f &src, const Src&);
- void TEXOFFSET(Vector4f &dst, Vector4f &src, const Src&, Vector4f &offset);
- void TEXLOD(Vector4f &dst, Vector4f &src, const Src&, Float4 &lod);
- void TEXLODOFFSET(Vector4f &dst, Vector4f &src, const Src&, Vector4f &offset, Float4 &lod);
- void TEXELFETCH(Vector4f &dst, Vector4f &src, const Src&, Float4 &lod);
- void TEXELFETCHOFFSET(Vector4f &dst, Vector4f &src, const Src&, Vector4f &offset, Float4 &lod);
- void TEXGRAD(Vector4f &dst, Vector4f &src, const Src&, Vector4f &dsx, Vector4f &dsy);
- void TEXGRADOFFSET(Vector4f &dst, Vector4f &src, const Src&, Vector4f &dsx, Vector4f &dsy, Vector4f &offset);
- void TEXSIZE(Vector4f &dst, Float4 &lod, const Src&);
-
- Vector4f sampleTexture(const Src &s, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
- Vector4f sampleTexture(int sampler, Vector4f &uvwq, Float4 &lod, Vector4f &dsx, Vector4f &dsy, Vector4f &offset, SamplerFunction function);
-
- int ifDepth = 0;
- int loopRepDepth = 0;
- int currentLabel = -1;
- bool scalar = false;
-
- std::vector<BasicBlock*> ifFalseBlock;
- std::vector<BasicBlock*> loopRepTestBlock;
- std::vector<BasicBlock*> loopRepEndBlock;
- std::vector<BasicBlock*> labelBlock;
- std::unordered_map<unsigned int, std::vector<BasicBlock*>> callRetBlock; // label -> list of call sites
- BasicBlock *returnBlock;
- std::vector<bool> isConditionalIf;
- std::vector<Int4> restoreContinue;
- };
-}
-
-#endif // sw_VertexProgram_hpp
diff --git a/src/Shader/VertexRoutine.cpp b/src/Shader/VertexRoutine.cpp
deleted file mode 100644
index addaba7fc..000000000
--- a/src/Shader/VertexRoutine.cpp
+++ /dev/null
@@ -1,788 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexRoutine.hpp"
-
-#include "VertexShader.hpp"
-#include "Constants.hpp"
-#include "Renderer/Vertex.hpp"
-#include "Renderer/Renderer.hpp"
-#include "Common/Half.hpp"
-#include "Common/Debug.hpp"
-
-namespace sw
-{
- extern bool halfIntegerCoordinates; // Pixel centers are not at integer coordinates
- extern bool symmetricNormalizedDepth; // [-1, 1] instead of [0, 1]
-
- VertexRoutine::VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader)
- : v(shader && shader->indirectAddressableInput),
- o(shader && shader->indirectAddressableOutput),
- state(state)
- {
- }
-
- VertexRoutine::~VertexRoutine()
- {
- }
-
- void VertexRoutine::generate()
- {
- const bool textureSampling = state.textureSampling;
-
- Pointer<Byte> cache = task + OFFSET(VertexTask,vertexCache);
- Pointer<Byte> vertexCache = cache + OFFSET(VertexCache,vertex);
- Pointer<Byte> tagCache = cache + OFFSET(VertexCache,tag);
-
- UInt vertexCount = *Pointer<UInt>(task + OFFSET(VertexTask,vertexCount));
- UInt primitiveNumber = *Pointer<UInt>(task + OFFSET(VertexTask, primitiveStart));
- UInt indexInPrimitive = 0;
-
- constants = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,constants));
-
- Do
- {
- UInt index = *Pointer<UInt>(batch);
- UInt tagIndex = index & 0x0000003C;
- UInt indexQ = !textureSampling ? UInt(index & 0xFFFFFFFC) : index; // FIXME: TEXLDL hack to have independent LODs, hurts performance.
-
- If(*Pointer<UInt>(tagCache + tagIndex) != indexQ)
- {
- *Pointer<UInt>(tagCache + tagIndex) = indexQ;
-
- readInput(indexQ);
- pipeline(indexQ);
- postTransform();
- computeClipFlags();
-
- Pointer<Byte> cacheLine0 = vertexCache + tagIndex * UInt((int)sizeof(Vertex));
- writeCache(cacheLine0);
- }
-
- UInt cacheIndex = index & 0x0000003F;
- Pointer<Byte> cacheLine = vertexCache + cacheIndex * UInt((int)sizeof(Vertex));
- writeVertex(vertex, cacheLine);
-
- if(state.transformFeedbackEnabled != 0)
- {
- transformFeedback(vertex, primitiveNumber, indexInPrimitive);
-
- indexInPrimitive++;
- If(indexInPrimitive == 3)
- {
- primitiveNumber++;
- indexInPrimitive = 0;
- }
- }
-
- vertex += sizeof(Vertex);
- batch += sizeof(unsigned int);
- vertexCount--;
- }
- Until(vertexCount == 0);
-
- Return();
- }
-
- void VertexRoutine::readInput(UInt &index)
- {
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- Pointer<Byte> input = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData,input) + sizeof(void*) * i);
- UInt stride = *Pointer<UInt>(data + OFFSET(DrawData,stride) + sizeof(unsigned int) * i);
-
- v[i] = readStream(input, stride, state.input[i], index);
- }
- }
-
- void VertexRoutine::computeClipFlags()
- {
- int pos = state.positionRegister;
-
- Int4 maxX = CmpLT(o[pos].w, o[pos].x);
- Int4 maxY = CmpLT(o[pos].w, o[pos].y);
- Int4 maxZ = CmpLT(o[pos].w, o[pos].z);
- Int4 minX = CmpNLE(-o[pos].w, o[pos].x);
- Int4 minY = CmpNLE(-o[pos].w, o[pos].y);
- Int4 minZ = symmetricNormalizedDepth ? CmpNLE(-o[pos].w, o[pos].z) : CmpNLE(Float4(0.0f), o[pos].z);
-
- clipFlags = *Pointer<Int>(constants + OFFSET(Constants,maxX) + SignMask(maxX) * 4); // FIXME: Array indexing
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,maxY) + SignMask(maxY) * 4);
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,maxZ) + SignMask(maxZ) * 4);
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,minX) + SignMask(minX) * 4);
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,minY) + SignMask(minY) * 4);
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,minZ) + SignMask(minZ) * 4);
-
- Int4 finiteX = CmpLE(Abs(o[pos].x), *Pointer<Float4>(constants + OFFSET(Constants,maxPos)));
- Int4 finiteY = CmpLE(Abs(o[pos].y), *Pointer<Float4>(constants + OFFSET(Constants,maxPos)));
- Int4 finiteZ = CmpLE(Abs(o[pos].z), *Pointer<Float4>(constants + OFFSET(Constants,maxPos)));
-
- Int4 finiteXYZ = finiteX & finiteY & finiteZ;
- clipFlags |= *Pointer<Int>(constants + OFFSET(Constants,fini) + SignMask(finiteXYZ) * 4);
-
- if(state.preTransformed)
- {
- clipFlags &= 0xFBFBFBFB; // Don't clip against far clip plane
- }
- }
-
- Vector4f VertexRoutine::readStream(Pointer<Byte> &buffer, UInt &stride, const Stream &stream, const UInt &index)
- {
- const bool textureSampling = state.textureSampling;
-
- Vector4f v;
-
- Pointer<Byte> source0 = buffer + index * stride;
- Pointer<Byte> source1 = source0 + (!textureSampling ? stride : 0);
- Pointer<Byte> source2 = source1 + (!textureSampling ? stride : 0);
- Pointer<Byte> source3 = source2 + (!textureSampling ? stride : 0);
-
- bool isNativeFloatAttrib = (stream.attribType == VertexShader::ATTRIBTYPE_FLOAT) || stream.normalized;
-
- switch(stream.type)
- {
- case STREAMTYPE_FLOAT:
- {
- if(stream.count == 0)
- {
- // Null stream, all default components
- }
- else
- {
- if(stream.count == 1)
- {
- v.x.x = *Pointer<Float>(source0);
- v.x.y = *Pointer<Float>(source1);
- v.x.z = *Pointer<Float>(source2);
- v.x.w = *Pointer<Float>(source3);
- }
- else
- {
- v.x = *Pointer<Float4>(source0);
- v.y = *Pointer<Float4>(source1);
- v.z = *Pointer<Float4>(source2);
- v.w = *Pointer<Float4>(source3);
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
-
- switch(stream.attribType)
- {
- case VertexShader::ATTRIBTYPE_INT:
- if(stream.count >= 1) v.x = As<Float4>(Int4(v.x));
- if(stream.count >= 2) v.x = As<Float4>(Int4(v.y));
- if(stream.count >= 3) v.x = As<Float4>(Int4(v.z));
- if(stream.count >= 4) v.x = As<Float4>(Int4(v.w));
- break;
- case VertexShader::ATTRIBTYPE_UINT:
- if(stream.count >= 1) v.x = As<Float4>(UInt4(v.x));
- if(stream.count >= 2) v.x = As<Float4>(UInt4(v.y));
- if(stream.count >= 3) v.x = As<Float4>(UInt4(v.z));
- if(stream.count >= 4) v.x = As<Float4>(UInt4(v.w));
- break;
- default:
- break;
- }
- }
- }
- break;
- case STREAMTYPE_BYTE:
- if(isNativeFloatAttrib) // Stream: UByte, Shader attrib: Float
- {
- v.x = Float4(*Pointer<Byte4>(source0));
- v.y = Float4(*Pointer<Byte4>(source1));
- v.z = Float4(*Pointer<Byte4>(source2));
- v.w = Float4(*Pointer<Byte4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- }
- }
- else // Stream: UByte, Shader attrib: Int / UInt
- {
- v.x = As<Float4>(Int4(*Pointer<Byte4>(source0)));
- v.y = As<Float4>(Int4(*Pointer<Byte4>(source1)));
- v.z = As<Float4>(Int4(*Pointer<Byte4>(source2)));
- v.w = As<Float4>(Int4(*Pointer<Byte4>(source3)));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_SBYTE:
- if(isNativeFloatAttrib) // Stream: SByte, Shader attrib: Float
- {
- v.x = Float4(*Pointer<SByte4>(source0));
- v.y = Float4(*Pointer<SByte4>(source1));
- v.z = Float4(*Pointer<SByte4>(source2));
- v.w = Float4(*Pointer<SByte4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleSByte));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleSByte));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleSByte));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleSByte));
- }
- }
- else // Stream: SByte, Shader attrib: Int / UInt
- {
- v.x = As<Float4>(Int4(*Pointer<SByte4>(source0)));
- v.y = As<Float4>(Int4(*Pointer<SByte4>(source1)));
- v.z = As<Float4>(Int4(*Pointer<SByte4>(source2)));
- v.w = As<Float4>(Int4(*Pointer<SByte4>(source3)));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_COLOR:
- {
- v.x = Float4(*Pointer<Byte4>(source0)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- v.y = Float4(*Pointer<Byte4>(source1)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- v.z = Float4(*Pointer<Byte4>(source2)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
- v.w = Float4(*Pointer<Byte4>(source3)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleByte));
-
- transpose4x4(v.x, v.y, v.z, v.w);
-
- // Swap red and blue
- Float4 t = v.x;
- v.x = v.z;
- v.z = t;
- }
- break;
- case STREAMTYPE_SHORT:
- if(isNativeFloatAttrib) // Stream: Int, Shader attrib: Float
- {
- v.x = Float4(*Pointer<Short4>(source0));
- v.y = Float4(*Pointer<Short4>(source1));
- v.z = Float4(*Pointer<Short4>(source2));
- v.w = Float4(*Pointer<Short4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleShort));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleShort));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleShort));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleShort));
- }
- }
- else // Stream: Short, Shader attrib: Int/UInt, no type conversion
- {
- v.x = As<Float4>(Int4(*Pointer<Short4>(source0)));
- v.y = As<Float4>(Int4(*Pointer<Short4>(source1)));
- v.z = As<Float4>(Int4(*Pointer<Short4>(source2)));
- v.w = As<Float4>(Int4(*Pointer<Short4>(source3)));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_USHORT:
- if(isNativeFloatAttrib) // Stream: Int, Shader attrib: Float
- {
- v.x = Float4(*Pointer<UShort4>(source0));
- v.y = Float4(*Pointer<UShort4>(source1));
- v.z = Float4(*Pointer<UShort4>(source2));
- v.w = Float4(*Pointer<UShort4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleUShort));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleUShort));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleUShort));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants,unscaleUShort));
- }
- }
- else // Stream: UShort, Shader attrib: Int/UInt, no type conversion
- {
- v.x = As<Float4>(Int4(*Pointer<UShort4>(source0)));
- v.y = As<Float4>(Int4(*Pointer<UShort4>(source1)));
- v.z = As<Float4>(Int4(*Pointer<UShort4>(source2)));
- v.w = As<Float4>(Int4(*Pointer<UShort4>(source3)));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_INT:
- if(isNativeFloatAttrib) // Stream: Int, Shader attrib: Float
- {
- v.x = Float4(*Pointer<Int4>(source0));
- v.y = Float4(*Pointer<Int4>(source1));
- v.z = Float4(*Pointer<Int4>(source2));
- v.w = Float4(*Pointer<Int4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleInt));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleInt));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleInt));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleInt));
- }
- }
- else // Stream: Int, Shader attrib: Int/UInt, no type conversion
- {
- v.x = *Pointer<Float4>(source0);
- v.y = *Pointer<Float4>(source1);
- v.z = *Pointer<Float4>(source2);
- v.w = *Pointer<Float4>(source3);
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_UINT:
- if(isNativeFloatAttrib) // Stream: UInt, Shader attrib: Float
- {
- v.x = Float4(*Pointer<UInt4>(source0));
- v.y = Float4(*Pointer<UInt4>(source1));
- v.z = Float4(*Pointer<UInt4>(source2));
- v.w = Float4(*Pointer<UInt4>(source3));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
-
- if(stream.normalized)
- {
- if(stream.count >= 1) v.x *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleUInt));
- if(stream.count >= 2) v.y *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleUInt));
- if(stream.count >= 3) v.z *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleUInt));
- if(stream.count >= 4) v.w *= *Pointer<Float4>(constants + OFFSET(Constants, unscaleUInt));
- }
- }
- else // Stream: UInt, Shader attrib: Int/UInt, no type conversion
- {
- v.x = *Pointer<Float4>(source0);
- v.y = *Pointer<Float4>(source1);
- v.z = *Pointer<Float4>(source2);
- v.w = *Pointer<Float4>(source3);
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_UDEC3:
- {
- // FIXME: Vectorize
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source0);
-
- v.x.x = Float(x & 0x000003FF);
- v.x.y = Float(y & 0x000FFC00);
- v.x.z = Float(z & 0x3FF00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source1);
-
- v.y.x = Float(x & 0x000003FF);
- v.y.y = Float(y & 0x000FFC00);
- v.y.z = Float(z & 0x3FF00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source2);
-
- v.z.x = Float(x & 0x000003FF);
- v.z.y = Float(y & 0x000FFC00);
- v.z.z = Float(z & 0x3FF00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source3);
-
- v.w.x = Float(x & 0x000003FF);
- v.w.y = Float(y & 0x000FFC00);
- v.w.z = Float(z & 0x3FF00000);
- }
-
- transpose4x3(v.x, v.y, v.z, v.w);
-
- v.y *= Float4(1.0f / 0x00000400);
- v.z *= Float4(1.0f / 0x00100000);
- }
- break;
- case STREAMTYPE_DEC3N:
- {
- // FIXME: Vectorize
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source0);
-
- v.x.x = Float((x << 22) & 0xFFC00000);
- v.x.y = Float((y << 12) & 0xFFC00000);
- v.x.z = Float((z << 2) & 0xFFC00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source1);
-
- v.y.x = Float((x << 22) & 0xFFC00000);
- v.y.y = Float((y << 12) & 0xFFC00000);
- v.y.z = Float((z << 2) & 0xFFC00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source2);
-
- v.z.x = Float((x << 22) & 0xFFC00000);
- v.z.y = Float((y << 12) & 0xFFC00000);
- v.z.z = Float((z << 2) & 0xFFC00000);
- }
-
- {
- Int x, y, z;
-
- x = y = z = *Pointer<Int>(source3);
-
- v.w.x = Float((x << 22) & 0xFFC00000);
- v.w.y = Float((y << 12) & 0xFFC00000);
- v.w.z = Float((z << 2) & 0xFFC00000);
- }
-
- transpose4x3(v.x, v.y, v.z, v.w);
-
- v.x *= Float4(1.0f / 0x00400000 / 511.0f);
- v.y *= Float4(1.0f / 0x00400000 / 511.0f);
- v.z *= Float4(1.0f / 0x00400000 / 511.0f);
- }
- break;
- case STREAMTYPE_FIXED:
- {
- v.x = Float4(*Pointer<Int4>(source0)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleFixed));
- v.y = Float4(*Pointer<Int4>(source1)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleFixed));
- v.z = Float4(*Pointer<Int4>(source2)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleFixed));
- v.w = Float4(*Pointer<Int4>(source3)) * *Pointer<Float4>(constants + OFFSET(Constants,unscaleFixed));
-
- transpose4xN(v.x, v.y, v.z, v.w, stream.count);
- }
- break;
- case STREAMTYPE_HALF:
- {
- if(stream.count >= 1)
- {
- UShort x0 = *Pointer<UShort>(source0 + 0);
- UShort x1 = *Pointer<UShort>(source1 + 0);
- UShort x2 = *Pointer<UShort>(source2 + 0);
- UShort x3 = *Pointer<UShort>(source3 + 0);
-
- v.x.x = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(x0) * 4);
- v.x.y = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(x1) * 4);
- v.x.z = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(x2) * 4);
- v.x.w = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(x3) * 4);
- }
-
- if(stream.count >= 2)
- {
- UShort y0 = *Pointer<UShort>(source0 + 2);
- UShort y1 = *Pointer<UShort>(source1 + 2);
- UShort y2 = *Pointer<UShort>(source2 + 2);
- UShort y3 = *Pointer<UShort>(source3 + 2);
-
- v.y.x = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(y0) * 4);
- v.y.y = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(y1) * 4);
- v.y.z = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(y2) * 4);
- v.y.w = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(y3) * 4);
- }
-
- if(stream.count >= 3)
- {
- UShort z0 = *Pointer<UShort>(source0 + 4);
- UShort z1 = *Pointer<UShort>(source1 + 4);
- UShort z2 = *Pointer<UShort>(source2 + 4);
- UShort z3 = *Pointer<UShort>(source3 + 4);
-
- v.z.x = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(z0) * 4);
- v.z.y = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(z1) * 4);
- v.z.z = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(z2) * 4);
- v.z.w = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(z3) * 4);
- }
-
- if(stream.count >= 4)
- {
- UShort w0 = *Pointer<UShort>(source0 + 6);
- UShort w1 = *Pointer<UShort>(source1 + 6);
- UShort w2 = *Pointer<UShort>(source2 + 6);
- UShort w3 = *Pointer<UShort>(source3 + 6);
-
- v.w.x = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(w0) * 4);
- v.w.y = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(w1) * 4);
- v.w.z = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(w2) * 4);
- v.w.w = *Pointer<Float>(constants + OFFSET(Constants,half2float) + Int(w3) * 4);
- }
- }
- break;
- case STREAMTYPE_INDICES:
- {
- v.x.x = *Pointer<Float>(source0);
- v.x.y = *Pointer<Float>(source1);
- v.x.z = *Pointer<Float>(source2);
- v.x.w = *Pointer<Float>(source3);
- }
- break;
- case STREAMTYPE_2_10_10_10_INT:
- {
- Int4 src;
- src = Insert(src, *Pointer<Int>(source0), 0);
- src = Insert(src, *Pointer<Int>(source1), 1);
- src = Insert(src, *Pointer<Int>(source2), 2);
- src = Insert(src, *Pointer<Int>(source3), 3);
-
- v.x = Float4((src << 22) >> 22);
- v.y = Float4((src << 12) >> 22);
- v.z = Float4((src << 02) >> 22);
- v.w = Float4(src >> 30);
-
- if(stream.normalized)
- {
- v.x = Max(v.x * Float4(1.0f / 0x1FF), Float4(-1.0f));
- v.y = Max(v.y * Float4(1.0f / 0x1FF), Float4(-1.0f));
- v.z = Max(v.z * Float4(1.0f / 0x1FF), Float4(-1.0f));
- v.w = Max(v.w, Float4(-1.0f));
- }
- }
- break;
- case STREAMTYPE_2_10_10_10_UINT:
- {
- Int4 src;
- src = Insert(src, *Pointer<Int>(source0), 0);
- src = Insert(src, *Pointer<Int>(source1), 1);
- src = Insert(src, *Pointer<Int>(source2), 2);
- src = Insert(src, *Pointer<Int>(source3), 3);
-
- v.x = Float4(src & Int4(0x3FF));
- v.y = Float4((src >> 10) & Int4(0x3FF));
- v.z = Float4((src >> 20) & Int4(0x3FF));
- v.w = Float4((src >> 30) & Int4(0x3));
-
- if(stream.normalized)
- {
- v.x *= Float4(1.0f / 0x3FF);
- v.y *= Float4(1.0f / 0x3FF);
- v.z *= Float4(1.0f / 0x3FF);
- v.w *= Float4(1.0f / 0x3);
- }
- }
- break;
- default:
- ASSERT(false);
- }
-
- if(stream.count < 1) v.x = Float4(0.0f);
- if(stream.count < 2) v.y = Float4(0.0f);
- if(stream.count < 3) v.z = Float4(0.0f);
- if(stream.count < 4) v.w = isNativeFloatAttrib ? As<Float4>(Float4(1.0f)) : As<Float4>(Int4(0));
-
- return v;
- }
-
- void VertexRoutine::postTransform()
- {
- int pos = state.positionRegister;
-
- // Backtransform
- if(state.preTransformed)
- {
- Float4 rhw = Float4(1.0f) / o[pos].w;
-
- Float4 W = *Pointer<Float4>(data + OFFSET(DrawData,Wx16)) * Float4(1.0f / 16.0f);
- Float4 H = *Pointer<Float4>(data + OFFSET(DrawData,Hx16)) * Float4(1.0f / 16.0f);
- Float4 L = *Pointer<Float4>(data + OFFSET(DrawData,X0x16)) * Float4(1.0f / 16.0f);
- Float4 T = *Pointer<Float4>(data + OFFSET(DrawData,Y0x16)) * Float4(1.0f / 16.0f);
-
- o[pos].x = (o[pos].x - L) / W * rhw;
- o[pos].y = (o[pos].y - T) / H * rhw;
- o[pos].z = o[pos].z * rhw;
- o[pos].w = rhw;
- }
-
- if(!halfIntegerCoordinates && !state.preTransformed)
- {
- o[pos].x = o[pos].x + *Pointer<Float4>(data + OFFSET(DrawData,halfPixelX)) * o[pos].w;
- o[pos].y = o[pos].y + *Pointer<Float4>(data + OFFSET(DrawData,halfPixelY)) * o[pos].w;
- }
-
- if(state.superSampling)
- {
- o[pos].x = o[pos].x + *Pointer<Float4>(data + OFFSET(DrawData,XXXX)) * o[pos].w;
- o[pos].y = o[pos].y + *Pointer<Float4>(data + OFFSET(DrawData,YYYY)) * o[pos].w;
- }
- }
-
- void VertexRoutine::writeCache(Pointer<Byte> &cacheLine)
- {
- Vector4f v;
-
- for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
- {
- if(state.output[i].write)
- {
- v.x = o[i].x;
- v.y = o[i].y;
- v.z = o[i].z;
- v.w = o[i].w;
-
- if(state.output[i].xClamp)
- {
- v.x = Max(v.x, Float4(0.0f));
- v.x = Min(v.x, Float4(1.0f));
- }
-
- if(state.output[i].yClamp)
- {
- v.y = Max(v.y, Float4(0.0f));
- v.y = Min(v.y, Float4(1.0f));
- }
-
- if(state.output[i].zClamp)
- {
- v.z = Max(v.z, Float4(0.0f));
- v.z = Min(v.z, Float4(1.0f));
- }
-
- if(state.output[i].wClamp)
- {
- v.w = Max(v.w, Float4(0.0f));
- v.w = Min(v.w, Float4(1.0f));
- }
-
- if(state.output[i].write == 0x01)
- {
- *Pointer<Float>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 0) = v.x.x;
- *Pointer<Float>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 1) = v.x.y;
- *Pointer<Float>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 2) = v.x.z;
- *Pointer<Float>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 3) = v.x.w;
- }
- else
- {
- if(state.output[i].write == 0x03)
- {
- transpose2x4(v.x, v.y, v.z, v.w);
- }
- else
- {
- transpose4x4(v.x, v.y, v.z, v.w);
- }
-
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 0, 16) = v.x;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 1, 16) = v.y;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 2, 16) = v.z;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,v[i]) + sizeof(Vertex) * 3, 16) = v.w;
- }
- }
- }
-
- *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 0) = (clipFlags >> 0) & 0x0000000FF;
- *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 1) = (clipFlags >> 8) & 0x0000000FF;
- *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 2) = (clipFlags >> 16) & 0x0000000FF;
- *Pointer<Int>(cacheLine + OFFSET(Vertex,clipFlags) + sizeof(Vertex) * 3) = (clipFlags >> 24) & 0x0000000FF;
-
- // Viewport transform
- int pos = state.positionRegister;
-
- v.x = o[pos].x;
- v.y = o[pos].y;
- v.z = o[pos].z;
- v.w = o[pos].w;
-
- if(symmetricNormalizedDepth)
- {
- v.z = (v.z + v.w) * Float4(0.5f); // [-1, 1] -> [0, 1]
- }
-
- Float4 w = As<Float4>(As<Int4>(v.w) | (As<Int4>(CmpEQ(v.w, Float4(0.0f))) & As<Int4>(Float4(1.0f))));
- Float4 rhw = Float4(1.0f) / w;
-
- v.x = As<Float4>(RoundInt(*Pointer<Float4>(data + OFFSET(DrawData,X0x16)) + v.x * rhw * *Pointer<Float4>(data + OFFSET(DrawData,Wx16))));
- v.y = As<Float4>(RoundInt(*Pointer<Float4>(data + OFFSET(DrawData,Y0x16)) + v.y * rhw * *Pointer<Float4>(data + OFFSET(DrawData,Hx16))));
- v.z = v.z * rhw;
- v.w = rhw;
-
- transpose4x4(v.x, v.y, v.z, v.w);
-
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,X) + sizeof(Vertex) * 0, 16) = v.x;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,X) + sizeof(Vertex) * 1, 16) = v.y;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,X) + sizeof(Vertex) * 2, 16) = v.z;
- *Pointer<Float4>(cacheLine + OFFSET(Vertex,X) + sizeof(Vertex) * 3, 16) = v.w;
- }
-
- void VertexRoutine::writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cache)
- {
- for(int i = 0; i < MAX_VERTEX_OUTPUTS; i++)
- {
- if(state.output[i].write)
- {
- *Pointer<Int4>(vertex + OFFSET(Vertex,v[i]), 16) = *Pointer<Int4>(cache + OFFSET(Vertex,v[i]), 16);
- }
- }
-
- *Pointer<Int4>(vertex + OFFSET(Vertex,X)) = *Pointer<Int4>(cache + OFFSET(Vertex,X));
- *Pointer<Int>(vertex + OFFSET(Vertex,clipFlags)) = *Pointer<Int>(cache + OFFSET(Vertex,clipFlags));
- }
-
- void VertexRoutine::transformFeedback(const Pointer<Byte> &vertex, const UInt &primitiveNumber, const UInt &indexInPrimitive)
- {
- If(indexInPrimitive < state.verticesPerPrimitive)
- {
- UInt tOffset = primitiveNumber * state.verticesPerPrimitive + indexInPrimitive;
-
- for(int i = 0; i < MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS; i++)
- {
- if(state.transformFeedbackEnabled & (1ULL << i))
- {
- UInt reg = *Pointer<UInt>(data + OFFSET(DrawData, vs.reg[i]));
- UInt row = *Pointer<UInt>(data + OFFSET(DrawData, vs.row[i]));
- UInt col = *Pointer<UInt>(data + OFFSET(DrawData, vs.col[i]));
- UInt str = *Pointer<UInt>(data + OFFSET(DrawData, vs.str[i]));
-
- Pointer<Byte> t = *Pointer<Pointer<Byte>>(data + OFFSET(DrawData, vs.t[i])) + (tOffset * str * sizeof(float));
- Pointer<Byte> v = vertex + OFFSET(Vertex, v) + reg * sizeof(float);
-
- For(UInt r = 0, r < row, r++)
- {
- UInt rOffsetX = r * col * sizeof(float);
- UInt rOffset4 = r * sizeof(float4);
-
- For(UInt c = 0, c < col, c++)
- {
- UInt cOffset = c * sizeof(float);
- *Pointer<Float>(t + rOffsetX + cOffset) = *Pointer<Float>(v + rOffset4 + cOffset);
- }
- }
- }
- }
- }
- }
-}
diff --git a/src/Shader/VertexRoutine.hpp b/src/Shader/VertexRoutine.hpp
deleted file mode 100644
index 5bd236e67..000000000
--- a/src/Shader/VertexRoutine.hpp
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_VertexRoutine_hpp
-#define sw_VertexRoutine_hpp
-
-#include "Renderer/Color.hpp"
-#include "Renderer/VertexProcessor.hpp"
-#include "ShaderCore.hpp"
-#include "VertexShader.hpp"
-
-namespace sw
-{
- class VertexRoutinePrototype : public Function<Void(Pointer<Byte>, Pointer<Byte>, Pointer<Byte>, Pointer<Byte>)>
- {
- public:
- VertexRoutinePrototype() : vertex(Arg<0>()), batch(Arg<1>()), task(Arg<2>()), data(Arg<3>()) {}
- virtual ~VertexRoutinePrototype() {}
-
- protected:
- Pointer<Byte> vertex;
- Pointer<Byte> batch;
- Pointer<Byte> task;
- Pointer<Byte> data;
- };
-
- class VertexRoutine : public VertexRoutinePrototype
- {
- public:
- VertexRoutine(const VertexProcessor::State &state, const VertexShader *shader);
- virtual ~VertexRoutine();
-
- void generate();
-
- protected:
- Pointer<Byte> constants;
-
- Int clipFlags;
-
- RegisterArray<MAX_VERTEX_INPUTS> v; // Input registers
- RegisterArray<MAX_VERTEX_OUTPUTS> o; // Output registers
-
- const VertexProcessor::State &state;
-
- private:
- virtual void pipeline(UInt &index) = 0;
-
- typedef VertexProcessor::State::Input Stream;
-
- Vector4f readStream(Pointer<Byte> &buffer, UInt &stride, const Stream &stream, const UInt &index);
- void readInput(UInt &index);
- void computeClipFlags();
- void postTransform();
- void writeCache(Pointer<Byte> &cacheLine);
- void writeVertex(const Pointer<Byte> &vertex, Pointer<Byte> &cacheLine);
- void transformFeedback(const Pointer<Byte> &vertex, const UInt &primitiveNumber, const UInt &indexInPrimitive);
- };
-}
-
-#endif // sw_VertexRoutine_hpp
diff --git a/src/Shader/VertexShader.cpp b/src/Shader/VertexShader.cpp
deleted file mode 100644
index 7b2455c0e..000000000
--- a/src/Shader/VertexShader.cpp
+++ /dev/null
@@ -1,331 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#include "VertexShader.hpp"
-
-#include "Renderer/Vertex.hpp"
-#include "Common/Debug.hpp"
-
-#include <string.h>
-
-namespace sw
-{
- VertexShader::VertexShader(const VertexShader *vs) : Shader()
- {
- shaderModel = 0x0300;
- positionRegister = Pos;
- pointSizeRegister = Unused;
- instanceIdDeclared = false;
- vertexIdDeclared = false;
- textureSampling = false;
-
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- input[i] = Semantic();
- attribType[i] = ATTRIBTYPE_FLOAT;
- }
-
- if(vs) // Make a copy
- {
- for(size_t i = 0; i < vs->getLength(); i++)
- {
- append(new sw::Shader::Instruction(*vs->getInstruction(i)));
- }
-
- memcpy(output, vs->output, sizeof(output));
- memcpy(input, vs->input, sizeof(input));
- memcpy(attribType, vs->attribType, sizeof(attribType));
- positionRegister = vs->positionRegister;
- pointSizeRegister = vs->pointSizeRegister;
- instanceIdDeclared = vs->instanceIdDeclared;
- vertexIdDeclared = vs->vertexIdDeclared;
- usedSamplers = vs->usedSamplers;
-
- optimize();
- analyze();
- }
- }
-
- VertexShader::VertexShader(const unsigned long *token) : Shader()
- {
- parse(token);
-
- positionRegister = Pos;
- pointSizeRegister = Unused;
- instanceIdDeclared = false;
- vertexIdDeclared = false;
- textureSampling = false;
-
- for(int i = 0; i < MAX_VERTEX_INPUTS; i++)
- {
- input[i] = Semantic();
- attribType[i] = ATTRIBTYPE_FLOAT;
- }
-
- optimize();
- analyze();
- }
-
- VertexShader::~VertexShader()
- {
- }
-
- int VertexShader::validate(const unsigned long *const token)
- {
- if(!token)
- {
- return 0;
- }
-
- unsigned short version = (unsigned short)(token[0] & 0x0000FFFF);
- unsigned char majorVersion = (unsigned char)((token[0] & 0x0000FF00) >> 8);
- ShaderType shaderType = (ShaderType)((token[0] & 0xFFFF0000) >> 16);
-
- if(shaderType != SHADER_VERTEX || majorVersion > 3)
- {
- return 0;
- }
-
- int instructionCount = 1;
-
- for(int i = 0; token[i] != 0x0000FFFF; i++)
- {
- if((token[i] & 0x0000FFFF) == 0x0000FFFE) // Comment token
- {
- int length = (token[i] & 0x7FFF0000) >> 16;
-
- i += length;
- }
- else
- {
- Shader::Opcode opcode = (Shader::Opcode)(token[i] & 0x0000FFFF);
-
- switch(opcode)
- {
- case Shader::OPCODE_TEXCOORD:
- case Shader::OPCODE_TEXKILL:
- case Shader::OPCODE_TEX:
- case Shader::OPCODE_TEXBEM:
- case Shader::OPCODE_TEXBEML:
- case Shader::OPCODE_TEXREG2AR:
- case Shader::OPCODE_TEXREG2GB:
- case Shader::OPCODE_TEXM3X2PAD:
- case Shader::OPCODE_TEXM3X2TEX:
- case Shader::OPCODE_TEXM3X3PAD:
- case Shader::OPCODE_TEXM3X3TEX:
- case Shader::OPCODE_RESERVED0:
- case Shader::OPCODE_TEXM3X3SPEC:
- case Shader::OPCODE_TEXM3X3VSPEC:
- case Shader::OPCODE_TEXREG2RGB:
- case Shader::OPCODE_TEXDP3TEX:
- case Shader::OPCODE_TEXM3X2DEPTH:
- case Shader::OPCODE_TEXDP3:
- case Shader::OPCODE_TEXM3X3:
- case Shader::OPCODE_TEXDEPTH:
- case Shader::OPCODE_CMP0:
- case Shader::OPCODE_BEM:
- case Shader::OPCODE_DP2ADD:
- case Shader::OPCODE_DFDX:
- case Shader::OPCODE_DFDY:
- case Shader::OPCODE_TEXLDD:
- return 0; // Unsupported operation
- default:
- instructionCount++;
- break;
- }
-
- i += size(token[i], version);
- }
- }
-
- return instructionCount;
- }
-
- bool VertexShader::containsTextureSampling() const
- {
- return textureSampling;
- }
-
- void VertexShader::setInput(int inputIdx, const sw::Shader::Semantic& semantic, AttribType aType)
- {
- input[inputIdx] = semantic;
- attribType[inputIdx] = aType;
- }
-
- void VertexShader::setOutput(int outputIdx, int nbComponents, const sw::Shader::Semantic& semantic)
- {
- for(int i = 0; i < nbComponents; ++i)
- {
- output[outputIdx][i] = semantic;
- }
- }
-
- void VertexShader::setPositionRegister(int posReg)
- {
- setOutput(posReg, 4, sw::Shader::Semantic(sw::Shader::USAGE_POSITION, 0));
- positionRegister = posReg;
- }
-
- void VertexShader::setPointSizeRegister(int ptSizeReg)
- {
- setOutput(ptSizeReg, 4, sw::Shader::Semantic(sw::Shader::USAGE_PSIZE, 0));
- pointSizeRegister = ptSizeReg;
- }
-
- const sw::Shader::Semantic& VertexShader::getInput(int inputIdx) const
- {
- return input[inputIdx];
- }
-
- VertexShader::AttribType VertexShader::getAttribType(int inputIdx) const
- {
- return attribType[inputIdx];
- }
-
- const sw::Shader::Semantic& VertexShader::getOutput(int outputIdx, int component) const
- {
- return output[outputIdx][component];
- }
-
- void VertexShader::analyze()
- {
- analyzeInput();
- analyzeOutput();
- analyzeDirtyConstants();
- analyzeTextureSampling();
- analyzeDynamicBranching();
- analyzeSamplers();
- analyzeCallSites();
- analyzeIndirectAddressing();
- analyzeLimits();
- }
-
- void VertexShader::analyzeInput()
- {
- for(unsigned int i = 0; i < instruction.size(); i++)
- {
- if(instruction[i]->opcode == Shader::OPCODE_DCL &&
- instruction[i]->dst.type == Shader::PARAMETER_INPUT)
- {
- int index = instruction[i]->dst.index;
-
- input[index] = Semantic(instruction[i]->usage, instruction[i]->usageIndex);
- }
- }
- }
-
- void VertexShader::analyzeOutput()
- {
- if(shaderModel < 0x0300)
- {
- output[Pos][0] = Semantic(Shader::USAGE_POSITION, 0);
- output[Pos][1] = Semantic(Shader::USAGE_POSITION, 0);
- output[Pos][2] = Semantic(Shader::USAGE_POSITION, 0);
- output[Pos][3] = Semantic(Shader::USAGE_POSITION, 0);
-
- for(const auto &inst : instruction)
- {
- const DestinationParameter &dst = inst->dst;
-
- switch(dst.type)
- {
- case Shader::PARAMETER_RASTOUT:
- switch(dst.index)
- {
- case 0:
- // Position already assumed written
- break;
- case 1:
- output[Fog][0] = Semantic(Shader::USAGE_FOG, 0);
- break;
- case 2:
- output[Pts][1] = Semantic(Shader::USAGE_PSIZE, 0);
- pointSizeRegister = Pts;
- break;
- default: ASSERT(false);
- }
- break;
- case Shader::PARAMETER_ATTROUT:
- if(dst.index == 0)
- {
- if(dst.x) output[C0][0] = Semantic(Shader::USAGE_COLOR, 0);
- if(dst.y) output[C0][1] = Semantic(Shader::USAGE_COLOR, 0);
- if(dst.z) output[C0][2] = Semantic(Shader::USAGE_COLOR, 0);
- if(dst.w) output[C0][3] = Semantic(Shader::USAGE_COLOR, 0);
- }
- else if(dst.index == 1)
- {
- if(dst.x) output[C1][0] = Semantic(Shader::USAGE_COLOR, 1);
- if(dst.y) output[C1][1] = Semantic(Shader::USAGE_COLOR, 1);
- if(dst.z) output[C1][2] = Semantic(Shader::USAGE_COLOR, 1);
- if(dst.w) output[C1][3] = Semantic(Shader::USAGE_COLOR, 1);
- }
- else ASSERT(false);
- break;
- case Shader::PARAMETER_TEXCRDOUT:
- if(dst.x) output[T0 + dst.index][0] = Semantic(Shader::USAGE_TEXCOORD, dst.index);
- if(dst.y) output[T0 + dst.index][1] = Semantic(Shader::USAGE_TEXCOORD, dst.index);
- if(dst.z) output[T0 + dst.index][2] = Semantic(Shader::USAGE_TEXCOORD, dst.index);
- if(dst.w) output[T0 + dst.index][3] = Semantic(Shader::USAGE_TEXCOORD, dst.index);
- break;
- default:
- break;
- }
- }
- }
- else // Shader Model 3.0 input declaration
- {
- for(const auto &inst : instruction)
- {
- if(inst->opcode == Shader::OPCODE_DCL &&
- inst->dst.type == Shader::PARAMETER_OUTPUT)
- {
- unsigned char usage = inst->usage;
- unsigned char usageIndex = inst->usageIndex;
-
- const DestinationParameter &dst = inst->dst;
-
- if(dst.x) output[dst.index][0] = Semantic(usage, usageIndex);
- if(dst.y) output[dst.index][1] = Semantic(usage, usageIndex);
- if(dst.z) output[dst.index][2] = Semantic(usage, usageIndex);
- if(dst.w) output[dst.index][3] = Semantic(usage, usageIndex);
-
- if(usage == Shader::USAGE_POSITION && usageIndex == 0)
- {
- positionRegister = dst.index;
- }
-
- if(usage == Shader::USAGE_PSIZE && usageIndex == 0)
- {
- pointSizeRegister = dst.index;
- }
- }
- }
- }
- }
-
- void VertexShader::analyzeTextureSampling()
- {
- textureSampling = false;
-
- for(const auto &inst : instruction)
- {
- if(inst->src[1].type == PARAMETER_SAMPLER)
- {
- textureSampling = true;
- break;
- }
- }
- }
-}
diff --git a/src/Shader/VertexShader.hpp b/src/Shader/VertexShader.hpp
deleted file mode 100644
index 9a9a0a671..000000000
--- a/src/Shader/VertexShader.hpp
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright 2016 The SwiftShader Authors. All Rights Reserved.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#ifndef sw_VertexShader_hpp
-#define sw_VertexShader_hpp
-
-#include "Shader.hpp"
-#include "Main/Config.hpp"
-
-namespace sw
-{
- class VertexShader : public Shader
- {
- public:
- enum AttribType : unsigned char
- {
- ATTRIBTYPE_FLOAT,
- ATTRIBTYPE_INT,
- ATTRIBTYPE_UINT,
-
- ATTRIBTYPE_LAST = ATTRIBTYPE_UINT
- };
-
- explicit VertexShader(const VertexShader *vs = 0);
- explicit VertexShader(const unsigned long *token);
-
- virtual ~VertexShader();
-
- static int validate(const unsigned long *const token); // Returns number of instructions if valid
- bool containsTextureSampling() const;
-
- void setInput(int inputIdx, const Semantic& semantic, AttribType attribType = ATTRIBTYPE_FLOAT);
- void setOutput(int outputIdx, int nbComponents, const Semantic& semantic);
- void setPositionRegister(int posReg);
- void setPointSizeRegister(int ptSizeReg);
- void declareInstanceId() { instanceIdDeclared = true; }
- void declareVertexId() { vertexIdDeclared = true; }
-
- const Semantic& getInput(int inputIdx) const;
- const Semantic& getOutput(int outputIdx, int component) const;
- AttribType getAttribType(int inputIndex) const;
- int getPositionRegister() const { return positionRegister; }
- int getPointSizeRegister() const { return pointSizeRegister; }
- bool isInstanceIdDeclared() const { return instanceIdDeclared; }
- bool isVertexIdDeclared() const { return vertexIdDeclared; }
-
- private:
- void analyze();
- void analyzeInput();
- void analyzeOutput();
- void analyzeTextureSampling();
-
- Semantic input[MAX_VERTEX_INPUTS];
- Semantic output[MAX_VERTEX_OUTPUTS][4];
-
- AttribType attribType[MAX_VERTEX_INPUTS];
-
- int positionRegister;
- int pointSizeRegister;
-
- bool instanceIdDeclared;
- bool vertexIdDeclared;
- bool textureSampling;
- };
-}
-
-#endif // sw_VertexShader_hpp
diff --git a/src/SwiftShader.workspace b/src/SwiftShader.workspace
deleted file mode 100644
index 761edb8a2..000000000
--- a/src/SwiftShader.workspace
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
-<CodeBlocks_workspace_file>
- <Workspace title="SwiftShader">
- <Project filename="OpenGL/libEGL/libEGL.cbp" />
- <Project filename="OpenGL/libGLESv2/libGLESv2.cbp" />
- <Project filename="OpenGL/libGLES_CM/libGLES_CM.cbp" />
- <Project filename="../third_party/PowerVR_SDK/Examples/Beginner/01_HelloAPI/OGLES2/Build/OGLES2HelloAPI.cbp">
- <Depends filename="OpenGL/libEGL/libEGL.cbp" />
- <Depends filename="OpenGL/libGLESv2/libGLESv2.cbp" />
- </Project>
- <Project filename="../third_party/PowerVR_SDK/Examples/Beginner/04_BasicTnL/OGLES/Build/OGLESBasicTnL.cbp">
- <Depends filename="OpenGL/libEGL/libEGL.cbp" />
- <Depends filename="OpenGL/libGLES_CM/libGLES_CM.cbp" />
- </Project>
- </Workspace>
-</CodeBlocks_workspace_file>
diff --git a/tests/regres/cov/import.go b/tests/regres/cov/import.go
index 5240dd275..ec22a2914 100644
--- a/tests/regres/cov/import.go
+++ b/tests/regres/cov/import.go
@@ -59,12 +59,7 @@ func AppendRuntimeEnv(env []string, coverageFile string) []string {
// didn't get compiled.
func (e Env) AllSourceFiles() *Coverage {
var ignorePaths = map[string]bool{
- "src/Common": true,
- "src/Main": true,
- "src/OpenGL": true,
- "src/Renderer": true,
- "src/Shader": true,
- "src/System": true,
+ "src/System": true,
}
// Gather all the source files to include them even if there is no coverage