Update Marl to 9c689c9a8

Changes:
    9c689c9a8 Add MARL_USE_PTHREAD_THREAD_LOCAL option
    abd033696 Explicitly #include <utility> in finally.h
    2e82e6999 Fix build issue with GetModuleHandle when using UNICODE
    40b9a1c47 gcc -Wshadow warning fixes

Commands:
    ./third_party/update-marl.sh

Bug: b/140546382
Change-Id: I0fe71df4ca087650fd1d9cb81c816c2d8d41dcfb
diff --git a/.clang-format b/.clang-format
index 08178fe..5a7a390 100644
--- a/.clang-format
+++ b/.clang-format
@@ -1,5 +1,118 @@
-# http://clang.llvm.org/docs/ClangFormatStyleOptions.html
-BasedOnStyle: Chromium
-
 ---
 Language:        Cpp
+# BasedOnStyle:  Google
+AccessModifierOffset: -4
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands:   true
+AlignTrailingComments: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortBlocksOnASingleLine: true
+AllowShortCaseLabelsOnASingleLine: true
+AllowShortFunctionsOnASingleLine: Inline
+AllowShortIfStatementsOnASingleLine: true
+AllowShortLoopsOnASingleLine: true
+AlwaysBreakAfterDefinitionReturnType: None
+AlwaysBreakAfterReturnType: None
+AlwaysBreakBeforeMultilineStrings: true
+AlwaysBreakTemplateDeclarations: true
+BinPackArguments: true
+BinPackParameters: true
+BraceWrapping:
+  AfterCaseLabel: true
+  AfterClass: true
+  AfterControlStatement: true
+  AfterEnum: true
+  AfterExternBlock: false
+  AfterFunction: true
+  AfterNamespace: false
+  AfterStruct: true
+  AfterUnion: true
+  BeforeCatch: true
+  BeforeElse: true
+  IndentBraces: false
+  SplitEmptyFunction: false
+  SplitEmptyNamespace: false
+  SplitEmptyRecord: false
+BreakBeforeBinaryOperators: None
+BreakBeforeBraces: Custom
+BreakBeforeInheritanceComma: false
+BreakBeforeTernaryOperators: true
+BreakConstructorInitializersBeforeComma: false
+BreakConstructorInitializers: BeforeComma
+BreakAfterJavaFieldAnnotations: false
+BreakStringLiterals: true
+ColumnLimit: 0
+CommentPragmas:  '^ IWYU pragma:'
+CompactNamespaces: false
+ConstructorInitializerAllOnOneLineOrOnePerLine: false
+ConstructorInitializerIndentWidth: 4
+ContinuationIndentWidth: 4
+Cpp11BracedListStyle: false
+DerivePointerAlignment: false
+DisableFormat:   false
+ExperimentalAutoDetectBinPacking: false
+FixNamespaceComments: true
+ForEachMacros:
+  - Q_FOREACH
+  - BOOST_FOREACH
+IncludeBlocks:   Preserve
+IncludeCategories:
+  - Regex:           '^"[^/]*"'
+    Priority:        1
+  - Regex:           '^".*/.*"'
+    Priority:        2
+  - Regex:           '^<.*\..*>'
+    Priority:        3
+  - Regex:           '^<[^.]*>'
+    Priority:        4
+  - Regex:           '.*'
+    Priority:        5
+IncludeIsMainRegex: '([-_](test|unittest))?$'
+IndentCaseBlocks: true
+IndentCaseLabels: false
+IndentPPDirectives: AfterHash
+IndentWidth:     4
+IndentWrappedFunctionNames: false
+JavaScriptQuotes: Leave
+JavaScriptWrapImports: true
+KeepEmptyLinesAtTheStartOfBlocks: true
+MacroBlockBegin: ''
+MacroBlockEnd:   ''
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: None
+ObjCBlockIndentWidth: 2
+ObjCSpaceAfterProperty: false
+ObjCSpaceBeforeProtocolList: false
+PenaltyBreakAssignment: 2
+PenaltyBreakBeforeFirstCallParameter: 1
+PenaltyBreakComment: 300
+PenaltyBreakFirstLessLess: 120
+PenaltyBreakString: 1000
+PenaltyExcessCharacter: 1000000
+PenaltyReturnTypeOnItsOwnLine: 200
+PointerAlignment: Right
+RawStringFormats:
+  - Language:        TextProto
+    BasedOnStyle:    google
+ReflowComments:  true
+SortIncludes:    true
+SortUsingDeclarations: true
+SpaceAfterCStyleCast: false
+SpaceAfterTemplateKeyword: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: Never
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 2
+SpacesInAngles:  false
+SpacesInContainerLiterals: true
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+Standard:        Auto
+TabWidth:        4
+UseTab:          ForIndentation
+...
+
diff --git a/.dir-locals.el b/.dir-locals.el
new file mode 100644
index 0000000..fe208a4
--- /dev/null
+++ b/.dir-locals.el
@@ -0,0 +1,165 @@
+;;; Directory Local Variables
+;;; See Info node `(emacs) Directory Variables' for more information.
+
+((c++-mode
+  (tab-width . 4)
+  (indent-tabs-mode . t)
+  (c-basic-offset . 4)
+  (show-trailing-whitespace . t)
+  (indicate-empty-lines . t)
+  (c-offsets-alist
+   (inexpr-class . +)
+   (inexpr-statement . +)
+   (lambda-intro-cont . +)
+   (inlambda . c-lineup-inexpr-block)
+   (template-args-cont c-lineup-template-args +)
+   (incomposition . +)
+   (inmodule . +)
+   (innamespace . +)
+   (inextern-lang . 0)
+   (composition-close . 0)
+   (module-close . 0)
+   (namespace-close . 0)
+   (extern-lang-close . 0)
+   (composition-open . 0)
+   (module-open . 0)
+   (namespace-open . 0)
+   (extern-lang-open . 0)
+   (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)
+   (objc-method-args-cont . c-lineup-ObjC-method-args)
+   (objc-method-intro .
+                      [0])
+   (friend . 0)
+   (cpp-define-intro c-lineup-cpp-define +)
+   (cpp-macro-cont . +)
+   (cpp-macro .
+              [0])
+   (inclass . +)
+   (stream-op . c-lineup-streamop)
+   (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
+   (arglist-cont c-lineup-gcc-asm-reg 0)
+   (comment-intro . 0)
+   (catch-clause . 0)
+   (else-clause . 0)
+   (do-while-closure . 0)
+   (access-label . -)
+   (case-label . +)
+   (substatement . +)
+   (statement-case-intro . +)
+   (statement . 0)
+   (brace-entry-open . 0)
+   (brace-list-entry . 0)
+   (brace-list-intro . +)
+   (brace-list-close . 0)
+   (block-close . 0)
+   (block-open . 0)
+   (inher-cont . c-lineup-multi-inher)
+   (inher-intro . ++)
+   (member-init-cont . c-lineup-multi-inher)
+   (member-init-intro . ++)
+   (annotation-var-cont . +)
+   (annotation-top-cont . 0)
+   (topmost-intro . 0)
+   (knr-argdecl . 0)
+   (func-decl-cont . ++)
+   (inline-close . 0)
+   (class-close . 0)
+   (class-open . 0)
+   (defun-block-intro . +)
+   (defun-close . 0)
+   (defun-open . 0)
+   (c . c-lineup-C-comments)
+   (string . c-lineup-dont-change)
+   (topmost-intro-cont . c-lineup-topmost-intro-cont)
+   (brace-list-open . 0)
+   (inline-open . 0)
+   (arglist-close . c-lineup-arglist)
+   (arglist-intro google-c-lineup-expression-plus-4)
+   (statement-cont nil nil ++)
+   (statement-case-open . +)
+   (label . /)
+   (substatement-label . 2)
+   (substatement-open . 0)
+   (knr-argdecl-intro . +)
+   (statement-block-intro . +)))
+(c-mode
+  (tab-width . 4)
+  (indent-tabs-mode . t)
+  (c-basic-offset . 4)
+  (show-trailing-whitespace . t)
+  (indicate-empty-lines . t)
+  (c-offsets-alist
+   (inexpr-class . +)
+   (inexpr-statement . +)
+   (lambda-intro-cont . +)
+   (inlambda . c-lineup-inexpr-block)
+   (template-args-cont c-lineup-template-args +)
+   (incomposition . +)
+   (inmodule . +)
+   (innamespace . +)
+   (inextern-lang . 0)
+   (composition-close . 0)
+   (module-close . 0)
+   (namespace-close . 0)
+   (extern-lang-close . 0)
+   (composition-open . 0)
+   (module-open . 0)
+   (namespace-open . 0)
+   (extern-lang-open . 0)
+   (objc-method-call-cont c-lineup-ObjC-method-call-colons c-lineup-ObjC-method-call +)
+   (objc-method-args-cont . c-lineup-ObjC-method-args)
+   (objc-method-intro .
+                      [0])
+   (friend . 0)
+   (cpp-define-intro c-lineup-cpp-define +)
+   (cpp-macro-cont . +)
+   (cpp-macro .
+              [0])
+   (inclass . +)
+   (stream-op . c-lineup-streamop)
+   (arglist-cont-nonempty c-lineup-gcc-asm-reg c-lineup-arglist)
+   (arglist-cont c-lineup-gcc-asm-reg 0)
+   (comment-intro . 0)
+   (catch-clause . 0)
+   (else-clause . 0)
+   (do-while-closure . 0)
+   (access-label . -)
+   (case-label . +)
+   (substatement . +)
+   (statement-case-intro . +)
+   (statement . 0)
+   (brace-entry-open . 0)
+   (brace-list-entry . 0)
+   (brace-list-intro . +)
+   (brace-list-close . 0)
+   (block-close . 0)
+   (block-open . 0)
+   (inher-cont . c-lineup-multi-inher)
+   (inher-intro . ++)
+   (member-init-cont . c-lineup-multi-inher)
+   (member-init-intro . ++)
+   (annotation-var-cont . +)
+   (annotation-top-cont . 0)
+   (topmost-intro . 0)
+   (knr-argdecl . 0)
+   (func-decl-cont . ++)
+   (inline-close . 0)
+   (class-close . 0)
+   (class-open . 0)
+   (defun-block-intro . +)
+   (defun-close . 0)
+   (defun-open . 0)
+   (c . c-lineup-C-comments)
+   (string . c-lineup-dont-change)
+   (topmost-intro-cont . c-lineup-topmost-intro-cont)
+   (brace-list-open . 0)
+   (inline-open . 0)
+   (arglist-close . c-lineup-arglist)
+   (arglist-intro google-c-lineup-expression-plus-4)
+   (statement-cont nil nil ++)
+   (statement-case-open . +)
+   (label . /)
+   (substatement-label . 2)
+   (substatement-open . 0)
+   (knr-argdecl-intro . +)
+   (statement-block-intro . +))))
diff --git a/.gitignore b/.gitignore
index 4c7dc22..065adea 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,47 @@
-/.vs/
-/.vscode/
-/build/
-/cmake-build-*/
+# Ignored folders #
+/cache/
+/lib/
+/obj/
+/bin/
 /out/
-bazel-*
-CMakeSettings.json
-/.idea/
+.vs
+.vscode/ipch
+CMakeFiles/
+.idea/
+cmake-build-debug/
+
+# Per user vscode config files.
+.vscode/launch.json
+.vscode/settings.json
+
+# The /build/ directory is recommended for CMake build output
+!/build
+/build/*
+
+
+# Ignored files #
+*.obj
+*.lib
+*.log
+*.tlog
+*.exe
+*.ilk
+*.pdb
+*.sbr
+*.bsc
+*.dll
+*.res
+*.idb
+*.sdf
+*.suo
+*.o
+*.depend
+*.layout
+*.opensdf
+*.aps
+*.opendb
+*.db
+*~
+.*.sw*
+.sw*
+CMakeCache.txt
diff --git a/.gitmodules b/.gitmodules
index 335eee4..cb86c5c 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,6 +1,27 @@
+[submodule "third_party/cppdap"]
+	path = third_party/cppdap
+	url = https://github.com/google/cppdap
 [submodule "third_party/googletest"]
 	path = third_party/googletest
 	url = https://github.com/google/googletest.git
+[submodule "third_party/json"]
+	path = third_party/json
+	url = https://github.com/nlohmann/json.git
+[submodule "third_party/libbacktrace/src"]
+	path = third_party/libbacktrace/src
+	url = https://github.com/ianlancetaylor/libbacktrace.git
+[submodule "third_party/PowerVR_Examples"]
+	path = third_party/PowerVR_Examples
+	url = https://github.com/powervr-graphics/Native_SDK.git
 [submodule "third_party/benchmark"]
 	path = third_party/benchmark
 	url = https://github.com/google/benchmark.git
+[submodule "third_party/glslang"]
+	path = third_party/glslang
+	url = https://github.com/KhronosGroup/glslang.git
+[submodule "third_party/git-hooks"]
+	path = third_party/git-hooks
+	url = https://swiftshader.googlesource.com/git-hooks
+[submodule "third_party/llvm-project"]
+	path = third_party/llvm-project
+	url = https://github.com/llvm/llvm-project.git
diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json
new file mode 100644
index 0000000..a0faf9e
--- /dev/null
+++ b/.vscode/c_cpp_properties.json
@@ -0,0 +1,73 @@
+{
+    "configurations": [
+        {
+            "name": "Linux",
+            "defines": [
+                "ENABLE_VK_DEBUGGER=1",
+                "ENABLE_RR_DEBUG_INFO=1",
+                "VERIFY_LLVM_IR=1"
+            ],
+            "includePath": [
+                "${workspaceFolder}/build/spirv-tools-ext/include",
+                "${workspaceFolder}/include",
+                "${workspaceFolder}/src",
+                "${workspaceFolder}/third_party/benchmark/include",
+                "${workspaceFolder}/third_party/cppdap/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/common/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/windows/include",
+                "${workspaceFolder}/third_party/llvm-10.0/llvm/include",
+                "${workspaceFolder}/third_party/marl/include",
+                "${workspaceFolder}/third_party/SPIRV-Headers/include",
+                "${workspaceFolder}/third_party/SPIRV-Tools/include"
+            ],
+            "cStandard": "c11",
+            "cppStandard": "c++17"
+        },
+        {
+            "name": "Mac",
+            "defines": [
+                "ENABLE_VK_DEBUGGER=1",
+                "ENABLE_RR_DEBUG_INFO=1",
+                "VERIFY_LLVM_IR=1"
+            ],
+            "includePath": [
+                "${workspaceFolder}/build/spirv-tools-ext/include",
+                "${workspaceFolder}/include",
+                "${workspaceFolder}/src",
+                "${workspaceFolder}/third_party/benchmark/include",
+                "${workspaceFolder}/third_party/cppdap/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/common/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/windows/include",
+                "${workspaceFolder}/third_party/llvm-10.0/llvm/include",
+                "${workspaceFolder}/third_party/marl/include",
+                "${workspaceFolder}/third_party/SPIRV-Headers/include",
+                "${workspaceFolder}/third_party/SPIRV-Tools/include"
+            ],
+            "cStandard": "c11",
+            "cppStandard": "c++17"
+        },
+        {
+            "name": "Win32",
+            "defines": [
+                "ENABLE_VK_DEBUGGER=1",
+                "ENABLE_RR_DEBUG_INFO=1",
+                "VERIFY_LLVM_IR=1"
+            ],
+            "includePath": [
+                "${workspaceFolder}/include",
+                "${workspaceFolder}/src",
+                "${workspaceFolder}/third_party/benchmark/include",
+                "${workspaceFolder}/third_party/cppdap/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/common/include",
+                "${workspaceFolder}/third_party/llvm-10.0/configs/windows/include",
+                "${workspaceFolder}/third_party/llvm-10.0/llvm/include",
+                "${workspaceFolder}/third_party/marl/include",
+                "${workspaceFolder}/third_party/SPIRV-Headers/include",
+                "${workspaceFolder}/third_party/SPIRV-Tools/include"
+            ],
+            "cStandard": "c11",
+            "cppStandard": "c++17"
+        }
+    ],
+    "version": 4
+}
\ No newline at end of file
diff --git a/.vscode/tasks.json b/.vscode/tasks.json
new file mode 100644
index 0000000..11a1dc3
--- /dev/null
+++ b/.vscode/tasks.json
@@ -0,0 +1,109 @@
+{
+    // See https://go.microsoft.com/fwlink/?LinkId=733558
+    // for the documentation about the tasks.json format
+    // Available variables which can be used inside of strings.
+    // ${workspaceRoot}: the root folder of the team
+    // ${file}: the current opened file
+    // ${fileBasename}: the current opened file's basename
+    // ${fileDirname}: the current opened file's dirname
+    // ${fileExtname}: the current opened file's extension
+    // ${cwd}: the current working directory of the spawned process
+    "version": "2.0.0",
+    "tasks": [
+        {
+            "label": "make",
+            "group": {
+                "kind": "build",
+                "isDefault": true
+            },
+            "type": "shell",
+            "command": "sh",
+            "osx": {
+                "args": [
+                    "-c",
+                    "cmake --build . && echo Done"
+                ]
+            },
+            "linux": {
+                "args": [
+                    "-c",
+                    "cmake --build . && echo Done"
+                ]
+            },
+            "windows": {
+                "args": [
+                    "-c",
+                    "cmake --build . && echo Done"
+                ]
+            },
+            "options": {
+                "cwd": "${workspaceRoot}/build",
+            },
+            "presentation": {
+                "echo": false,
+                "reveal": "always",
+                "focus": false,
+                "panel": "shared",
+                "showReuseMessage": false,
+                "clear": true,
+            },
+            "problemMatcher": {
+                "owner": "cpp",
+                "fileLocation": "absolute",
+                "pattern": {
+                    "regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
+                    "file": 1,
+                    "line": 2,
+                    "column": 3,
+                    "severity": 4,
+                    "message": 5
+                }
+            }
+        },
+        {
+            "label": "cmake",
+            "type": "shell",
+            "command": "cmake",
+            "args": [
+                "..",
+                "-GNinja",
+                "-DCMAKE_BUILD_TYPE=${input:buildType}",
+                "-DSWIFTSHADER_WARNINGS_AS_ERRORS=1",
+                "-DSWIFTSHADER_DCHECK_ALWAYS_ON=1",
+                "-DREACTOR_VERIFY_LLVM_IR=1",
+            ],
+            "options": {
+                "cwd": "${workspaceRoot}/build"
+            },
+            "problemMatcher": [],
+        },
+        {
+            "label": "Push branch for review",
+            "type": "shell",
+            "command": "git",
+            "args": [
+                "push",
+                "origin",
+                "HEAD:refs/for/master"
+            ],
+            "options": {
+                "cwd": "${workspaceRoot}"
+            },
+            "problemMatcher": [],
+        }
+    ],
+    "inputs": [
+        {
+            "id": "buildType",
+            "type": "pickString",
+            "options": [
+                "Debug",
+                "Release",
+                "MinSizeRel",
+                "RelWithDebInfo",
+            ],
+            "default": "Debug",
+            "description": "The type of build",
+        },
+    ]
+}
diff --git a/AUTHORS.txt b/AUTHORS.txt
new file mode 100644
index 0000000..faa8822
--- /dev/null
+++ b/AUTHORS.txt
@@ -0,0 +1,9 @@
+# This is the official list of SwiftShader authors for copyright purposes.

+# This file is distinct from the CONTRIBUTORS files.

+# See the latter for an explanation.

+# Names should be added to this file as:

+# Name or Organization <email address>

+# The email address is not required for organizations.

+

+Google Inc.

+The ANGLE Project Authors <angleproject@googlegroups.com>
\ No newline at end of file
diff --git a/Android.bp b/Android.bp
new file mode 100644
index 0000000..6931936
--- /dev/null
+++ b/Android.bp
@@ -0,0 +1,138 @@
+//
+// Copyright (C) 2018 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+package {
+    default_applicable_licenses: ["external_swiftshader_license"],
+}
+
+// Added automatically by a large-scale-change that took the approach of
+// 'apply every license found to every target'. While this makes sure we respect
+// every license restriction, it may not be entirely correct.
+//
+// e.g. GPL in an MIT project might only apply to the contrib/ directory.
+//
+// Please consider splitting the single license below into multiple licenses,
+// taking care not to lose any license_kind information, and overriding the
+// default license using the 'licenses: [...]' property on targets as needed.
+//
+// For unused files, consider creating a 'filegroup' with "//visibility:private"
+// to attach the license to, and including a comment whether the files may be
+// used in the current project.
+//
+// large-scale-change filtered out the below license kinds as false-positives:
+//   SPDX-license-identifier-GPL
+//   SPDX-license-identifier-GPL-3.0
+// http://go/android-license-faq
+license {
+    name: "external_swiftshader_license",
+    visibility: [":__subpackages__"],
+    license_kinds: [
+        "SPDX-license-identifier-Apache-2.0",
+        "SPDX-license-identifier-BSD",
+        "SPDX-license-identifier-MIT",
+        "SPDX-license-identifier-NCSA",
+        "legacy_unencumbered",
+    ],
+    license_text: [
+        "LICENSE.txt",
+    ],
+}
+
+cc_defaults {
+    name: "swiftshader_common",
+
+    gnu_extensions: false,
+
+    cflags: [
+        "-Werror",
+        "-Wwrite-strings",
+    ],
+
+    cppflags: [
+        "-Woverloaded-virtual",
+        "-DVK_USE_PLATFORM_ANDROID_KHR",
+        "-DVK_EXPORT= ",
+    ],
+    cpp_std: "c++17",
+
+    arch: {
+        x86: {
+            cflags: [
+                "-msse2",
+            ],
+        },
+        x86_64: {
+            cflags: [
+                "-msse2",
+            ],
+        },
+    },
+
+    target: {
+        host: {
+            cppflags: [
+                "-fno-rtti",
+                "-fno-exceptions",
+            ],
+            compile_multilib: "64",
+        },
+
+        // We don't need Darwin host-side builds
+        darwin: {
+            enabled: false,
+        },
+    },
+}
+
+cc_defaults {
+    name: "swiftshader_common_release",
+
+    defaults: [ "swiftshader_common" ],
+
+    cflags: [
+        "-Os",
+        "-fomit-frame-pointer",
+        "-ffunction-sections",
+        "-fdata-sections",
+    ],
+}
+
+cc_defaults {
+    name: "swiftshader_common_debug",
+
+    defaults: [ "swiftshader_common" ],
+
+    cflags: [
+        "-O0",
+        "-g",
+        "-UNDEBUG",
+    ],
+}
+
+cc_library_headers {
+    name: "swiftshader_platform_headers",
+    host_supported: true,
+    device_supported: true,
+    vendor_available: true,
+    export_include_dirs: ["include"],
+}
+
+cc_library_headers {
+    name: "swiftshader_host_headers",
+    device_supported: false,
+    host_supported: true,
+    export_include_dirs: ["include/Android"],
+}
diff --git a/BUILD.gn b/BUILD.gn
new file mode 100644
index 0000000..b405f51
--- /dev/null
+++ b/BUILD.gn
@@ -0,0 +1,91 @@
+# Copyright 2016 The SwiftShader Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT 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("src/Reactor/reactor.gni")
+
+config("swiftshader_config") {
+  cflags = []
+  defines = []
+  asmflags = []
+
+  if (is_clang) {
+    cflags += [ "-Wno-shadow" ]
+  }
+
+  if (is_debug) {
+    if (swiftshader_startup_dialog) {
+      defines += [ "DEBUGGER_WAIT_DIALOG" ]
+    }
+  }
+  if (is_win) {
+    # Disable MSVC warnings about std::aligned_storage being broken before
+    # VS 2017 15.8
+    defines += [ "_ENABLE_EXTENDED_ALIGNED_STORAGE" ]
+
+    # Diable some MSVC warnings.
+    if (!is_clang) {
+      cflags += [
+        "/wd4065",  # switch statement contains 'default' but no 'case' labels
+        "/wd4309",  # Truncation of constant value. See PixelRoutine.cpp casts
+                    # of signed shorts.
+      ]
+    }
+  } else if (!is_debug) {
+    cflags += [ "-Os" ]
+  }
+
+  if (build_with_chromium) {
+    if (is_clang) {
+      if (current_cpu == "arm64") {
+        import("//build/config/arm.gni")
+
+        if (arm_control_flow_integrity == "standard") {
+          cflags += [ "-mbranch-protection=standard" ]
+          asmflags += [ "-mbranch-protection=standard" ]
+        } else if (arm_control_flow_integrity == "pac") {
+          cflags += [ "-mbranch-protection=pac-ret" ]
+          asmflags += [ "-mbranch-protection=pac-ret" ]
+        } else {
+          assert(arm_control_flow_integrity == "none",
+                 "Invalid branch protection option!")
+        }
+      }
+    }
+  }
+}
+
+group("swiftshader") {
+  data_deps = [
+    "src/Vulkan:icd_file",
+    "src/Vulkan:swiftshader_libvulkan",
+  ]
+}
+
+if (build_with_chromium) {
+  group("swiftshader_tests") {
+    testonly = true
+
+    data_deps = [ "tests/SystemUnitTests:swiftshader_system_unittests" ]
+
+    if (supports_llvm) {
+      data_deps +=
+          [ "tests/ReactorUnitTests:swiftshader_reactor_llvm_unittests" ]
+    }
+
+    if (supports_subzero) {
+      data_deps +=
+          [ "tests/ReactorUnitTests:swiftshader_reactor_subzero_unittests" ]
+    }
+  }
+}
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5f17ee8..fc252f8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,10 +1,10 @@
-# Copyright 2019 The Marl Authors.
+# 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
 #
-#     https://www.apache.org/licenses/LICENSE-2.0
+#    http://www.apache.org/licenses/LICENSE-2.0
 #
 # Unless required by applicable law or agreed to in writing, software
 # distributed under the License is distributed on an "AS IS" BASIS,
@@ -12,395 +12,956 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-cmake_minimum_required(VERSION 3.0)
+cmake_minimum_required(VERSION 3.13)
 
-include(cmake/parse_version.cmake)
-parse_version("${CMAKE_CURRENT_SOURCE_DIR}/CHANGES.md" MARL)
+project(SwiftShader C CXX ASM)
 
-set(CMAKE_CXX_STANDARD 11)
-
-project(Marl
-    VERSION   "${MARL_VERSION_MAJOR}.${MARL_VERSION_MINOR}.${MARL_VERSION_PATCH}"
-    LANGUAGES C CXX ASM
-)
-
-include(CheckCXXSourceCompiles)
-
-# MARL_IS_SUBPROJECT is 1 if added via add_subdirectory() from another project.
-get_directory_property(MARL_IS_SUBPROJECT PARENT_DIRECTORY)
-if(MARL_IS_SUBPROJECT)
-    set(MARL_IS_SUBPROJECT 1)
+set(CMAKE_CXX_STANDARD 17)
+set(CXX_STANDARD_REQUIRED ON)
+# MSVC doesn't define __cplusplus by default
+if(MSVC)
+    string(APPEND CMAKE_CXX_FLAGS " /Zc:__cplusplus")
 endif()
 
 ###########################################################
+# Detect system
+###########################################################
+
+if(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    set(LINUX TRUE)
+elseif(CMAKE_SYSTEM_NAME MATCHES "Android")
+    set(ANDROID TRUE)
+    set(CMAKE_CXX_FLAGS "-DANDROID_NDK_BUILD")
+elseif(WIN32)
+elseif(APPLE)
+elseif(FUCHSIA)
+    # NOTE: Building for Fuchsia requires a Fuchsia CMake-based SDK.
+    # See https://fuchsia-review.googlesource.com/c/fuchsia/+/379673
+    find_package(FuchsiaLibraries)
+else()
+    message(FATAL_ERROR "Platform is not supported")
+endif()
+
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "aarch")
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(ARCH "aarch64")
+    else()
+        set(ARCH "arm")
+    endif()
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^mips.*")
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(ARCH "mips64el")
+    else()
+        set(ARCH "mipsel")
+    endif()
+elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc.*")
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(ARCH "ppc64le")
+    else()
+        message(FATAL_ERROR "Architecture is not supported")
+    endif()
+else()
+    if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+        set(ARCH "x86_64")
+    else()
+        set(ARCH "x86")
+    endif()
+endif()
+
+# Cross compiling on macOS. The cross compiling architecture should override
+# auto-detected system architecture settings.
+if(CMAKE_OSX_ARCHITECTURES)
+    if(CMAKE_OSX_ARCHITECTURES MATCHES "arm64")
+        set(ARCH "aarch64")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "x86_64")
+        set(ARCH "x86_64")
+    elseif(CMAKE_OSX_ARCHITECTURES MATCHES "i386")
+        set(ARCH "x86")
+    else()
+        message(FATAL_ERROR "Architecture ${CMAKE_OSX_ARCHITECTURES} is not "
+                            "supported. Only one architecture (arm64, x86_64 "
+                            "or i386) could be specified at build time.")
+    endif()
+endif()
+
+set(CMAKE_MACOSX_RPATH TRUE)
+
+if ((CMAKE_GENERATOR MATCHES "Visual Studio") AND (CMAKE_GENERATOR_TOOLSET STREQUAL ""))
+  message(WARNING "Visual Studio generators use the x86 host compiler by "
+                  "default, even for 64-bit targets. This can result in linker "
+                  "instability and out of memory errors. To use the 64-bit "
+                  "host compiler, pass -Thost=x64 on the CMake command line.")
+endif()
+
+# Use CCache if available
+find_program(CCACHE_FOUND ccache)
+if(CCACHE_FOUND)
+    message(STATUS "Using ccache")
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
+    set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
+endif()
+
+###########################################################
+# Install Gerrit commit hook
+###########################################################
+
+if(NOT EXISTS ${CMAKE_SOURCE_DIR}/.git/hooks/commit-msg)
+    message(WARNING "
+        .git/hooks/commit-msg was not found.
+        Downloading from https://gerrit-review.googlesource.com/tools/hooks/commit-msg...
+    ")
+
+    file(DOWNLOAD https://gerrit-review.googlesource.com/tools/hooks/commit-msg ${CMAKE_SOURCE_DIR}/commit-msg)
+
+    file(COPY ${CMAKE_SOURCE_DIR}/commit-msg
+         DESTINATION ${CMAKE_SOURCE_DIR}/.git/hooks/
+         FILE_PERMISSIONS
+           OWNER_READ OWNER_WRITE OWNER_EXECUTE
+           GROUP_READ GROUP_WRITE GROUP_EXECUTE
+           WORLD_READ WORLD_EXECUTE)
+    file(REMOVE ${CMAKE_SOURCE_DIR}/commit-msg)
+endif()
+
+###########################################################
+# Host libraries
+###########################################################
+
+if(LINUX)
+    include(CheckSymbolExists)
+    check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
+    check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2)
+endif()
+
+if(SWIFTSHADER_BUILD_WSI_DIRECTFB)
+    find_library(DIRECTFB directfb)
+    find_path(DIRECTFB_INCLUDE_DIR directfb/directfb.h)
+endif(SWIFTSHADER_BUILD_WSI_DIRECTFB)
+if(SWIFTSHADER_BUILD_WSI_D2D)
+    find_library(D2D drm)
+    find_path(D2D_INCLUDE_DIR libdrm/drm.h)
+endif(SWIFTSHADER_BUILD_WSI_D2D)
+
+###########################################################
 # Options
 ###########################################################
+
+if(NOT CMAKE_BUILD_TYPE)
+    set(CMAKE_BUILD_TYPE "Release" CACHE STRING "The type of build: Debug Release MinSizeRel RelWithDebInfo." FORCE)
+    set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo)
+endif()
+
 function(option_if_not_defined name description default)
     if(NOT DEFINED ${name})
         option(${name} ${description} ${default})
     endif()
 endfunction()
 
-option_if_not_defined(MARL_WARNINGS_AS_ERRORS "Treat warnings as errors" OFF)
-option_if_not_defined(MARL_BUILD_EXAMPLES "Build example applications" OFF)
-option_if_not_defined(MARL_BUILD_TESTS "Build tests" OFF)
-option_if_not_defined(MARL_BUILD_BENCHMARKS "Build benchmarks" OFF)
-option_if_not_defined(MARL_BUILD_SHARED "Build marl as a shared / dynamic library (default static)" OFF)
-option_if_not_defined(MARL_USE_PTHREAD_THREAD_LOCAL "Use pthreads for thread local storage" OFF)
-option_if_not_defined(MARL_ASAN "Build marl with address sanitizer" OFF)
-option_if_not_defined(MARL_MSAN "Build marl with memory sanitizer" OFF)
-option_if_not_defined(MARL_TSAN "Build marl with thread sanitizer" OFF)
-option_if_not_defined(MARL_INSTALL "Create marl install target" OFF)
-option_if_not_defined(MARL_FULL_BENCHMARK "Run benchmarks for [0 .. numLogicalCPUs] with no stepping" OFF)
-option_if_not_defined(MARL_FIBERS_USE_UCONTEXT "Use ucontext instead of assembly for fibers (ignored for platforms that do not support ucontext)" OFF)
-option_if_not_defined(MARL_DEBUG_ENABLED "Enable debug checks even in release builds" OFF)
+if(LINUX)
+    option_if_not_defined(SWIFTSHADER_BUILD_WSI_XCB "Build the XCB WSI support" TRUE)
+    option_if_not_defined(SWIFTSHADER_BUILD_WSI_WAYLAND "Build the Wayland WSI support" TRUE)
+    option_if_not_defined(SWIFTSHADER_BUILD_WSI_DIRECTFB "Build the DirectFB WSI support" FALSE)
+    option_if_not_defined(SWIFTSHADER_BUILD_WSI_D2D "Build the Direct-to-Display WSI support" FALSE)
+endif()
+
+option_if_not_defined(SWIFTSHADER_BUILD_PVR "Build the PowerVR examples" FALSE)
+option_if_not_defined(SWIFTSHADER_BUILD_TESTS "Build unit tests" TRUE)
+option_if_not_defined(SWIFTSHADER_BUILD_BENCHMARKS "Build benchmarks" FALSE)
+
+option_if_not_defined(SWIFTSHADER_USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" TRUE)
+
+option_if_not_defined(SWIFTSHADER_MSAN "Build with memory sanitizer" FALSE)
+option_if_not_defined(SWIFTSHADER_ASAN "Build with address sanitizer" FALSE)
+option_if_not_defined(SWIFTSHADER_TSAN "Build with thread sanitizer" FALSE)
+option_if_not_defined(SWIFTSHADER_UBSAN "Build with undefined behavior sanitizer" FALSE)
+option_if_not_defined(SWIFTSHADER_EMIT_COVERAGE "Emit code coverage information" FALSE)
+option_if_not_defined(SWIFTSHADER_WARNINGS_AS_ERRORS "Treat all warnings as errors" TRUE)
+option_if_not_defined(SWIFTSHADER_DCHECK_ALWAYS_ON "Check validation macros even in release builds" FALSE)
+option_if_not_defined(REACTOR_EMIT_DEBUG_INFO "Emit debug info for JIT functions" FALSE)
+option_if_not_defined(REACTOR_EMIT_PRINT_LOCATION "Emit printing of location info for JIT functions" FALSE)
+option_if_not_defined(REACTOR_EMIT_ASM_FILE "Emit asm files for JIT functions" FALSE)
+option_if_not_defined(REACTOR_ENABLE_PRINT "Enable RR_PRINT macros" FALSE)
+option_if_not_defined(REACTOR_VERIFY_LLVM_IR "Check reactor-generated LLVM IR is valid even in release builds" FALSE)
+option_if_not_defined(SWIFTSHADER_LESS_DEBUG_INFO "Generate less debug info to reduce file size" FALSE)
+# option_if_not_defined(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER "Enable Vulkan debugger support" FALSE)  # TODO(b/251802301)
+option_if_not_defined(SWIFTSHADER_ENABLE_ASTC "Enable ASTC compressed textures support" TRUE)  # TODO(b/150130101)
+
+if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER)
+    set(SWIFTSHADER_BUILD_CPPDAP TRUE)
+endif()
+
+set(DEFAULT_REACTOR_BACKEND "LLVM")
+set(REACTOR_BACKEND ${DEFAULT_REACTOR_BACKEND} CACHE STRING "JIT compiler back-end used by Reactor")
+set_property(CACHE REACTOR_BACKEND PROPERTY STRINGS LLVM LLVM-Submodule Subzero)
+
+set(DEFAULT_SWIFTSHADER_LLVM_VERSION "10.0")
+set(SWIFTSHADER_LLVM_VERSION ${DEFAULT_SWIFTSHADER_LLVM_VERSION} CACHE STRING "LLVM version to use")
+set_property(CACHE SWIFTSHADER_LLVM_VERSION PROPERTY STRINGS "10.0")
+
+# If defined, overrides the default optimization level of the current reactor backend.
+# Set to one of the rr::Optimization::Level enum values.
+set(REACTOR_DEFAULT_OPT_LEVEL "" CACHE STRING "Reactor default optimization level")
+set_property(CACHE REACTOR_DEFAULT_OPT_LEVEL PROPERTY STRINGS "None" "Less" "Default" "Aggressive")
+
+if(NOT DEFINED SWIFTSHADER_LOGGING_LEVEL)
+    set(SWIFTSHADER_LOGGING_LEVEL "Info" CACHE STRING "SwiftShader logging level")
+    set_property(CACHE SWIFTSHADER_LOGGING_LEVEL PROPERTY STRINGS "Verbose" "Debug" "Info" "Warn" "Error" "Fatal" "Disabled")
+endif()
+
+# LLVM disallows calling cmake . from the main LLVM dir, the reason is that
+# it builds header files that could overwrite the orignal ones. Here we
+# want to include LLVM as a subdirectory and even though it wouldn't cause
+# the problem, if cmake . is called from the main dir, the condition that
+# LLVM checkes, "CMAKE_CURRENT_SOURCE_DIR == CMAKE_CURRENT_BINARY_DIR" will be true. So we
+# disallow it ourselves too to. In addition if there are remining CMakeFiles
+# and CMakeCache in the directory, cmake .. from a subdirectory will still
+# try to build from the main directory so we instruct users to delete these
+# files when they get the error.
+if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
+    message(FATAL_ERROR "In source builds are not allowed by LLVM, please create a build/ directory and build from there. You may have to delete the CMakeCache.txt file and CMakeFiles directory that are next to the CMakeLists.txt.")
+endif()
+
+set_property(GLOBAL PROPERTY USE_FOLDERS TRUE)
 
 ###########################################################
 # Directories
 ###########################################################
-function(set_if_not_defined name value)
-    if(NOT DEFINED ${name})
-        set(${name} ${value} PARENT_SCOPE)
+
+set(SWIFTSHADER_DIR ${CMAKE_CURRENT_SOURCE_DIR})
+set(SOURCE_DIR ${SWIFTSHADER_DIR}/src)
+set(THIRD_PARTY_DIR ${SWIFTSHADER_DIR}/third_party)
+set(TESTS_DIR ${SWIFTSHADER_DIR}/tests)
+
+###########################################################
+# Initialize submodules
+###########################################################
+
+function(InitSubmodule target submodule_dir)
+    if (NOT TARGET ${target})
+        if(NOT EXISTS ${submodule_dir}/.git)
+            message(WARNING "
+        Target ${target} from submodule ${submodule_dir} missing.
+        Running 'git submodule update --init' to download it:
+            ")
+
+            execute_process(COMMAND git -C ${SWIFTSHADER_DIR} submodule update --init ${submodule_dir})
+        endif()
     endif()
 endfunction()
 
-set(MARL_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
-set(MARL_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include)
-set_if_not_defined(MARL_THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
-set_if_not_defined(MARL_GOOGLETEST_DIR ${MARL_THIRD_PARTY_DIR}/googletest)
-set_if_not_defined(MARL_BENCHMARK_DIR ${MARL_THIRD_PARTY_DIR}/benchmark)
-
-###########################################################
-# Submodules
-###########################################################
-if(MARL_BUILD_TESTS)
-    if(NOT EXISTS ${MARL_GOOGLETEST_DIR}/.git)
-        message(WARNING "third_party/googletest submodule missing.")
-        message(WARNING "Run: `git submodule update --init` to build tests.")
-        set(MARL_BUILD_TESTS OFF)
-    endif()
-endif(MARL_BUILD_TESTS)
-
-if(MARL_BUILD_BENCHMARKS)
-    if(NOT EXISTS ${MARL_BENCHMARK_DIR}/.git)
-        message(WARNING "third_party/benchmark submodule missing.")
-        message(WARNING "Run: `git submodule update --init` to build benchmarks.")
-        set(MARL_BUILD_BENCHMARKS OFF)
-    endif()
-endif(MARL_BUILD_BENCHMARKS)
-
-if(MARL_BUILD_BENCHMARKS)
-    set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
-    add_subdirectory(${MARL_BENCHMARK_DIR})
-endif(MARL_BUILD_BENCHMARKS)
-
-###########################################################
-# Compiler feature tests
-###########################################################
-# Check that the Clang Thread Safety Analysis' try_acquire_capability behaves
-# correctly. This is broken on some earlier versions of clang.
-# See: https://bugs.llvm.org/show_bug.cgi?id=32954
-set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-set(CMAKE_REQUIRED_FLAGS "-Wthread-safety -Werror")
-check_cxx_source_compiles(
-    "int main() {
-      struct __attribute__((capability(\"mutex\"))) Mutex {
-        void Unlock() __attribute__((release_capability)) {};
-        bool TryLock() __attribute__((try_acquire_capability(true))) { return true; };
-      };
-      Mutex m;
-      if (m.TryLock()) {
-        m.Unlock();  // Should not warn.
-      }
-      return 0;
-    }"
-    MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED)
-set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
-
-# Check whether ucontext is supported.
-set(SAVE_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
-set(CMAKE_REQUIRED_FLAGS "-Werror")
-check_cxx_source_compiles(
-    "#include <ucontext.h>
-    int main() {
-      ucontext_t ctx;
-      getcontext(&ctx);
-      makecontext(&ctx, nullptr, 2, 1, 2);
-      swapcontext(&ctx, &ctx);
-      return 0;
-    }"
-    MARL_UCONTEXT_SUPPORTED)
-set(CMAKE_REQUIRED_FLAGS ${SAVE_CMAKE_REQUIRED_FLAGS})
-if (MARL_FIBERS_USE_UCONTEXT AND NOT MARL_UCONTEXT_SUPPORTED)
-    # Disable MARL_FIBERS_USE_UCONTEXT and warn if MARL_UCONTEXT_SUPPORTED is 0.
-    message(WARNING "MARL_FIBERS_USE_UCONTEXT is enabled, but ucontext is not supported by the target. Disabling")
-    set(MARL_FIBERS_USE_UCONTEXT 0)
+if (SWIFTSHADER_BUILD_TESTS OR SWIFTSHADER_BUILD_BENCHMARKS)
+    set(BUILD_VULKAN_WRAPPER TRUE)
 endif()
 
-if(MARL_IS_SUBPROJECT)
-    # Export supported flags as this may be useful to parent projects
-    set(MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED PARENT_SCOPE ${MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED})
-    set(MARL_UCONTEXT_SUPPORTED               PARENT_SCOPE ${MARL_UCONTEXT_SUPPORTED})
+if (BUILD_VULKAN_WRAPPER)
+    InitSubmodule(glslang ${THIRD_PARTY_DIR}/glslang)
+endif()
+
+if (SWIFTSHADER_BUILD_TESTS)
+    InitSubmodule(gtest ${THIRD_PARTY_DIR}/googletest)
+endif()
+
+if(SWIFTSHADER_BUILD_BENCHMARKS)
+    InitSubmodule(benchmark::benchmark ${THIRD_PARTY_DIR}/benchmark)
+endif()
+
+if(REACTOR_EMIT_DEBUG_INFO)
+    InitSubmodule(libbacktrace ${THIRD_PARTY_DIR}/libbacktrace/src)
+endif()
+
+if(SWIFTSHADER_BUILD_PVR)
+    InitSubmodule(PVRCore ${THIRD_PARTY_DIR}/PowerVR_Examples)
+endif()
+
+if(SWIFTSHADER_BUILD_CPPDAP)
+    InitSubmodule(json ${THIRD_PARTY_DIR}/json)
+    InitSubmodule(cppdap ${THIRD_PARTY_DIR}/cppdap)
+endif()
+
+if(${REACTOR_BACKEND} STREQUAL "LLVM-Submodule")
+    InitSubmodule(llvm-submodule ${THIRD_PARTY_DIR}/llvm-project)
 endif()
 
 ###########################################################
-# File lists
+# Convenience macros
 ###########################################################
-set(MARL_LIST
-    ${MARL_SRC_DIR}/debug.cpp
-    ${MARL_SRC_DIR}/memory.cpp
-    ${MARL_SRC_DIR}/scheduler.cpp
-    ${MARL_SRC_DIR}/thread.cpp
-    ${MARL_SRC_DIR}/trace.cpp
-)
-if(NOT MSVC)
-    list(APPEND MARL_LIST
-        ${MARL_SRC_DIR}/osfiber_aarch64.c
-        ${MARL_SRC_DIR}/osfiber_arm.c
-        ${MARL_SRC_DIR}/osfiber_asm_aarch64.S
-        ${MARL_SRC_DIR}/osfiber_asm_arm.S
-        ${MARL_SRC_DIR}/osfiber_asm_loongarch64.S
-        ${MARL_SRC_DIR}/osfiber_asm_mips64.S
-        ${MARL_SRC_DIR}/osfiber_asm_ppc64.S
-        ${MARL_SRC_DIR}/osfiber_asm_rv64.S
-        ${MARL_SRC_DIR}/osfiber_asm_x64.S
-        ${MARL_SRC_DIR}/osfiber_asm_x86.S
-        ${MARL_SRC_DIR}/osfiber_loongarch64.c
-        ${MARL_SRC_DIR}/osfiber_mips64.c
-        ${MARL_SRC_DIR}/osfiber_ppc64.c
-        ${MARL_SRC_DIR}/osfiber_rv64.c
-        ${MARL_SRC_DIR}/osfiber_x64.c
-        ${MARL_SRC_DIR}/osfiber_x86.c
-    )
-    # CMAKE_OSX_ARCHITECTURES settings aren't propagated to assembly files when
-    # building for Apple platforms (https://gitlab.kitware.com/cmake/cmake/-/issues/20771),
-    # we treat assembly files as C files to work around this bug.
-    set_source_files_properties(
-        ${MARL_SRC_DIR}/osfiber_asm_aarch64.S
-        ${MARL_SRC_DIR}/osfiber_asm_arm.S
-        ${MARL_SRC_DIR}/osfiber_asm_loongarch64.S
-        ${MARL_SRC_DIR}/osfiber_asm_mips64.S
-        ${MARL_SRC_DIR}/osfiber_asm_ppc64.S
-        ${MARL_SRC_DIR}/osfiber_asm_x64.S
-        ${MARL_SRC_DIR}/osfiber_asm_x86.S
-        PROPERTIES LANGUAGE C
-    )
-endif(NOT MSVC)
 
-###########################################################
-# OS libraries
-###########################################################
-find_package(Threads REQUIRED)
-
-###########################################################
-# Functions
-###########################################################
-function(marl_set_target_options target)
-    if(MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED)
-        target_compile_options(${target} PRIVATE "-Wthread-safety")
-    endif()
-
-    # Enable all warnings
-    if(MSVC)
-        target_compile_options(${target} PRIVATE "-W4")
-    else()
-        target_compile_options(${target} PRIVATE "-Wall")
-    endif()
-
-    # Disable specific, pedantic warnings
-    if(MSVC)
-        target_compile_options(${target} PRIVATE
-            "-D_CRT_SECURE_NO_WARNINGS"
-            "/wd4127" # conditional expression is constant
-            "/wd4324" # structure was padded due to alignment specifier
-        )
-    endif()
-
-    # Treat all warnings as errors
-    if(MARL_WARNINGS_AS_ERRORS)
-        if(MSVC)
-            target_compile_options(${target} PRIVATE "/WX")
+# Recursively calls source_group on the files of the directory
+# so that Visual Studio has the files in a folder tree
+macro(group_all_sources directory)
+    file(GLOB files RELATIVE ${SWIFTSHADER_DIR}/${directory} ${SWIFTSHADER_DIR}/${directory}/*)
+    foreach(file ${files})
+        if(IS_DIRECTORY ${SWIFTSHADER_DIR}/${directory}/${file})
+            group_all_sources(${directory}/${file})
         else()
-            target_compile_options(${target} PRIVATE "-Werror")
+            string(REPLACE "/" "\\" groupname ${directory})
+            source_group(${groupname} FILES ${SWIFTSHADER_DIR}/${directory}/${file})
         endif()
-    endif(MARL_WARNINGS_AS_ERRORS)
+    endforeach()
+endmacro()
 
-    if(MARL_USE_PTHREAD_THREAD_LOCAL)
-        target_compile_definitions(${target} PRIVATE "MARL_USE_PTHREAD_THREAD_LOCAL=1")
-        target_link_libraries(${target} PUBLIC pthread)
-    endif()
-
-    if(MARL_ASAN)
-        target_compile_options(${target} PUBLIC "-fsanitize=address")
-        target_link_libraries(${target} PUBLIC "-fsanitize=address")
-    elseif(MARL_MSAN)
-        target_compile_options(${target} PUBLIC "-fsanitize=memory")
-        target_link_libraries(${target} PUBLIC "-fsanitize=memory")
-    elseif(MARL_TSAN)
-        target_compile_options(${target} PUBLIC "-fsanitize=thread")
-        target_link_libraries(${target} PUBLIC "-fsanitize=thread")
-    endif()
-
-    if(MARL_FIBERS_USE_UCONTEXT)
-        target_compile_definitions(${target} PRIVATE "MARL_FIBERS_USE_UCONTEXT=1")
-    endif()
-
-    if(MARL_DEBUG_ENABLED)
-        target_compile_definitions(${target} PRIVATE "MARL_DEBUG_ENABLED=1")
-    endif()
-
-    if(CMAKE_SYSTEM_PROCESSOR MATCHES "^rv.*")
-        target_link_libraries(${target} INTERFACE atomic) #explicitly use -latomic for RISC-V linking
-    endif()
-
-    target_include_directories(${target} PUBLIC $<BUILD_INTERFACE:${MARL_INCLUDE_DIR}>)
-endfunction(marl_set_target_options)
-
-###########################################################
-# Targets
-###########################################################
-
-# marl
-if(MARL_BUILD_SHARED OR BUILD_SHARED_LIBS)
-    add_library(marl SHARED ${MARL_LIST})
+# Takes target library and a directory where the export map is
+# and add the linker options so that only the API symbols are
+# exported.
+macro(set_shared_library_export_map TARGET DIR)
     if(MSVC)
-        target_compile_definitions(marl
-            PRIVATE "MARL_BUILDING_DLL=1"
-            PUBLIC  "MARL_DLL=1"
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " /DEF:\"${DIR}/${TARGET}.def\"")
+    elseif(APPLE)
+        # The exported symbols list only exports the API functions and
+        # hides all the others.
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS "-exported_symbols_list ${DIR}/${TARGET}.exports")
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_DEPENDS "${DIR}/${TARGET}.exports;")
+        # Don't allow undefined symbols, unless it's a Sanitizer build.
+        if(NOT SWIFTSHADER_MSAN AND NOT SWIFTSHADER_ASAN AND NOT SWIFTSHADER_TSAN AND NOT SWIFTSHADER_UBSAN)
+            set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,-undefined,error")
+        endif()
+    elseif(LINUX OR FUCHSIA)
+        # NOTE: The Fuchsia linker script is needed to export the vk_icdInitializeConnectToServiceCallback
+        # entry point (a private implementation detail betwen the Fuchsia Vulkan loader and the ICD).
+        if ((FUCHSIA) AND ("${TARGET}" STREQUAL "vk_swiftshader"))
+          set(LINKER_VERSION_SCRIPT "fuchsia_vk_swiftshader.lds")
+        else()
+          set(LINKER_VERSION_SCRIPT "${TARGET}.lds")
+        endif()
+
+        # The version script only exports the API functions and
+        # hides all the others.
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--version-script=${DIR}/${LINKER_VERSION_SCRIPT}")
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_DEPENDS "${DIR}/${LINKER_VERSION_SCRIPT};")
+
+        # -Bsymbolic binds symbol references to their global definitions within
+        # a shared object, thereby preventing symbol preemption.
+        set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS "  -Wl,-Bsymbolic")
+
+        if(ARCH STREQUAL "mipsel" OR ARCH STREQUAL "mips64el")
+          # MIPS supports sysv hash-style only.
+          set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=sysv")
+        elseif(LINUX)
+          # Both hash-style are needed, because we want both gold and
+          # GNU ld to be able to read our libraries.
+          set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--hash-style=both")
+        endif()
+
+        if(NOT ${SWIFTSHADER_EMIT_COVERAGE})
+            # Gc sections is used in combination with each functions being
+            # in its own section, to reduce the binary size.
+            set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--gc-sections")
+        endif()
+
+        # Don't allow undefined symbols, unless it's a Sanitizer build.
+        if(NOT SWIFTSHADER_MSAN AND NOT SWIFTSHADER_ASAN AND NOT SWIFTSHADER_TSAN AND NOT SWIFTSHADER_UBSAN)
+            set_property(TARGET ${TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Wl,--no-undefined")
+        endif()
+    endif()
+endmacro()
+
+if(SWIFTSHADER_USE_GROUP_SOURCES)
+    group_all_sources(src)
+endif()
+
+###########################################################
+# Compile flags
+###########################################################
+
+# Flags for project code (non 3rd party)
+set(SWIFTSHADER_COMPILE_OPTIONS "")
+set(SWIFTSHADER_LINK_FLAGS "")
+set(SWIFTSHADER_LIBS "")
+
+macro(set_cpp_flag FLAG)
+    if(${ARGC} GREATER 1)
+        set(CMAKE_CXX_FLAGS_${ARGV1} "${CMAKE_CXX_FLAGS_${ARGV1}} ${FLAG}")
+    else()
+        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}")
+    endif()
+endmacro()
+
+macro(set_linker_flag FLAG)
+    if(${ARGC} GREATER 1)
+        set(CMAKE_EXE_LINKER_FLAGS_${ARGV1} "${CMAKE_EXE_LINKER_FLAGS_${ARGV1}} ${FLAG}")
+        set(CMAKE_SHARED_LINKER_FLAGS_${ARGV1} "${CMAKE_EXE_LINKER_FLAGS_${ARGV1}} ${FLAG}")
+    else()
+        set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}")
+        set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FLAG}")
+    endif()
+endmacro()
+
+if(MSVC)
+    set_cpp_flag("/MP")
+    add_definitions(-D_CRT_SECURE_NO_WARNINGS)
+    add_definitions(-D_SCL_SECURE_NO_WARNINGS)
+    add_definitions(-D_SBCS)  # Single Byte Character Set (ASCII)
+    add_definitions(-D_ENABLE_EXTENDED_ALIGNED_STORAGE)  # Disable MSVC warnings about std::aligned_storage being broken before VS 2017 15.8
+
+    set_linker_flag("/DEBUG:FASTLINK" DEBUG)
+    set_linker_flag("/DEBUG:FASTLINK" RELWITHDEBINFO)
+
+    # Disable specific warnings
+    # TODO: Not all of these should be disabled, but for now, we want a warning-free msvc build. Remove these one by one
+    #       and fix the actual warnings in code.
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+        "/wd4005" # 'identifier' : macro redefinition
+        "/wd4018" # 'expression' : signed/unsigned mismatch
+        "/wd4065" # switch statement contains 'default' but no 'case' labels
+        "/wd4141" # 'modifier' : used more than once
+        "/wd4244" # 'conversion' conversion from 'type1' to 'type2', possible loss of data
+        "/wd4267" # 'var' : conversion from 'size_t' to 'type', possible loss of data
+        "/wd4291" # 'void X new(size_t,unsigned int,unsigned int)': no matching operator delete found; memory will not be freed if initialization throws an exception
+        "/wd4309" # 'conversion' : truncation of constant value
+        "/wd4624" # 'derived class' : destructor was implicitly defined as deleted because a base class destructor is inaccessible or deleted
+        "/wd4800" # 'type' : forcing value to bool 'true' or 'false' (performance warning)
+        "/wd4838" # conversion from 'type_1' to 'type_2' requires a narrowing conversion
+        "/wd5030" # attribute 'attribute' is not recognized
+        "/wd5038" # data member 'member1' will be initialized after data member 'member2' data member 'member' will be initialized after base class 'base_class'
+        "/wd4146" # unary minus operator applied to unsigned type, result still unsigned
+    )
+
+    # Treat specific warnings as errors
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+        "/we4018" # 'expression' : signed/unsigned mismatch
+        "/we4062" # enumerator 'identifier' in switch of enum 'enumeration' is not handled
+        "/we4471" # 'enumeration': a forward declaration of an unscoped enumeration must have an underlying type (int assumed)
+        "/we4838" # conversion from 'type_1' to 'type_2' requires a narrowing conversion
+        "/we5038" # data member 'member1' will be initialized after data member 'member2' data member 'member' will be initialized after base class 'base_class'
+        "/we4101" # 'identifier' : unreferenced local variable
+    )
+else()
+    # Explicitly enable these warnings.
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+        "-Wall"
+        "-Wreorder"
+        "-Wsign-compare"
+        "-Wmissing-braces"
+    )
+
+    if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
+            list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+                "-Wdeprecated-copy"  # implicit copy constructor for 'X' is deprecated because of user-declared copy assignment operator.
+            )
+        endif()
+    elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+            "-Wextra"
+            "-Wunreachable-code-loop-increment"
+            "-Wunused-lambda-capture"
+            "-Wstring-conversion"
+            "-Wextra-semi"
+            "-Wignored-qualifiers"
+            "-Wdeprecated-copy"  # implicit copy constructor for 'X' is deprecated because of user-declared copy assignment operator.
+            # TODO(b/208256248): Avoid exit-time destructor.
+            #"-Wexit-time-destructors"  # declaration requires an exit-time destructor
         )
     endif()
-else()
-    add_library(marl ${MARL_LIST})
+
+    if (SWIFTSHADER_EMIT_COVERAGE)
+        if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+            list(APPEND SWIFTSHADER_COMPILE_OPTIONS "--coverage")
+            list(APPEND SWIFTSHADER_LIBS "gcov")
+        elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+            list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-fprofile-instr-generate" "-fcoverage-mapping")
+            list(APPEND SWIFTSHADER_LINK_FLAGS "-fprofile-instr-generate" "-fcoverage-mapping")
+        else()
+            message(FATAL_ERROR "Coverage generation not supported for the ${CMAKE_CXX_COMPILER_ID} toolchain")
+        endif()
+    endif()
+
+    # Disable pedantic warnings
+    if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+        list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+            "-Wno-ignored-attributes"   # ignoring attributes on template argument 'X'
+            "-Wno-attributes"           # 'X' attribute ignored
+            "-Wno-strict-aliasing"      # dereferencing type-punned pointer will break strict-aliasing rules
+            "-Wno-comment"              # multi-line comment
+        )
+        if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 9)
+            list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+                "-Wno-init-list-lifetime"  # assignment from temporary initializer_list does not extend the lifetime of the underlying array
+            )
+        endif()
+    elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        list(APPEND SWIFTSHADER_COMPILE_OPTIONS
+            "-Wno-unneeded-internal-declaration"  # function 'X' is not needed and will not be emitted
+            "-Wno-unused-private-field"           # private field 'offset' is not used - TODO: Consider enabling this once Vulkan is further implemented.
+            "-Wno-comment"                        # multi-line comment
+            "-Wno-extra-semi"                     # extra ';' after member function definition
+            "-Wno-unused-parameter"               # unused parameter 'X'
+
+            # Silence errors caused by unknown warnings when building with older
+            # versions of Clang. This demands checking that warnings added above
+            # are spelled correctly and work as intended!
+            "-Wno-unknown-warning-option"
+        )
+    endif()
+
+    if(ARCH STREQUAL "x86")
+        set_cpp_flag("-m32")
+        set_cpp_flag("-msse2")
+        set_cpp_flag("-mfpmath=sse")
+        set_cpp_flag("-march=pentium4")
+        set_cpp_flag("-mtune=generic")
+    endif()
+    if(ARCH STREQUAL "x86_64")
+        set_cpp_flag("-m64")
+        set_cpp_flag("-fPIC")
+        set_cpp_flag("-march=x86-64")
+        set_cpp_flag("-mtune=generic")
+    endif()
+    if(ARCH STREQUAL "mipsel")
+        set_cpp_flag("-EL")
+        set_cpp_flag("-march=mips32r2")
+        set_cpp_flag("-fPIC")
+        set_cpp_flag("-mhard-float")
+        set_cpp_flag("-mfp32")
+        set_cpp_flag("-mxgot")
+    endif()
+    if(ARCH STREQUAL "mips64el")
+        set_cpp_flag("-EL")
+        set_cpp_flag("-march=mips64r2")
+        set_cpp_flag("-mabi=64")
+        set_cpp_flag("-fPIC")
+        set_cpp_flag("-mxgot")
+    endif()
+
+    if(SWIFTSHADER_LESS_DEBUG_INFO)
+        # Use -g1 to be able to get stack traces
+        set_cpp_flag("-g -g1" DEBUG)
+        set_cpp_flag("-g -g1" RELWITHDEBINFO)
+    else()
+        # Use -g3 to have even more debug info
+        set_cpp_flag("-g -g3" DEBUG)
+        set_cpp_flag("-g -g3" RELWITHDEBINFO)
+    endif()
+
+    if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+        # Treated as an unused argument with clang
+        set_cpp_flag("-s" RELEASE)
+    endif()
+
+    # For distribution it is more important to be slim than super optimized
+    set_cpp_flag("-Os" RELEASE)
+    set_cpp_flag("-Os" RELWITHDEBINFO)
+
+    set_cpp_flag("-DNDEBUG" RELEASE)
+    set_cpp_flag("-DNDEBUG" RELWITHDEBINFO)
+
+    # Put each variable and function in its own section so that when linking
+    # with -gc-sections unused functions and variables are removed.
+    set_cpp_flag("-ffunction-sections" RELEASE)
+    set_cpp_flag("-fdata-sections" RELEASE)
+    set_cpp_flag("-fomit-frame-pointer" RELEASE)
+
+    if(SWIFTSHADER_MSAN)
+        if(NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+            message(FATAL_ERROR " \n"
+                    " MemorySanitizer usage requires compiling with Clang.")
+        endif()
+
+        if(NOT DEFINED ENV{SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH})
+            message(FATAL_ERROR " \n"
+                    " MemorySanitizer usage requires an instrumented build of libc++.\n"
+                    " Set the SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH environment variable to the\n"
+                    " build output path. See\n"
+                    " https://github.com/google/sanitizers/wiki/MemorySanitizerLibcxxHowTo#instrumented-libc\n"
+                    " for details on how to build an MSan instrumented libc++.")
+        endif()
+
+        set_cpp_flag("-fsanitize=memory")
+        set_linker_flag("-fsanitize=memory")
+        set_cpp_flag("-stdlib=libc++")
+        set_linker_flag("-L$ENV{SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH}/lib")
+        set_cpp_flag("-I$ENV{SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH}/include")
+        set_cpp_flag("-I$ENV{SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH}/include/c++/v1")
+        set_linker_flag("-Wl,-rpath,$ENV{SWIFTSHADER_MSAN_INSTRUMENTED_LIBCXX_PATH}/lib")
+    elseif(SWIFTSHADER_ASAN)
+        set_cpp_flag("-fsanitize=address")
+        set_linker_flag("-fsanitize=address")
+    elseif(SWIFTSHADER_TSAN)
+        set_cpp_flag("-fsanitize=thread")
+        set_linker_flag("-fsanitize=thread")
+    elseif(SWIFTSHADER_UBSAN)
+        set_cpp_flag("-fsanitize=undefined")
+        set_linker_flag("-fsanitize=undefined")
+    endif()
 endif()
 
-if(NOT MSVC)
-    # Public API symbols are made visible with the MARL_EXPORT annotation.
-    target_compile_options(marl PRIVATE "-fvisibility=hidden")
+if(SWIFTSHADER_DCHECK_ALWAYS_ON)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DDCHECK_ALWAYS_ON")
 endif()
 
-set_target_properties(marl PROPERTIES
-    POSITION_INDEPENDENT_CODE 1
-    VERSION ${MARL_VERSION}
-    SOVERSION "${MARL_VERSION_MAJOR}"
+if(SWIFTSHADER_WARNINGS_AS_ERRORS)
+    if(MSVC)
+        set(WARNINGS_AS_ERRORS "/WX")  # Treat all warnings as errors
+    else()
+        set(WARNINGS_AS_ERRORS "-Werror")  # Treat all warnings as errors
+    endif()
+endif()
+
+# Enable Reactor Print() functionality in Debug/RelWithDebInfo builds or when explicitly enabled.
+if(CMAKE_BUILD_TYPE MATCHES "Deb")
+    set(REACTOR_ENABLE_PRINT TRUE)
+endif()
+
+if(REACTOR_EMIT_PRINT_LOCATION)
+    # This feature depends on REACTOR_EMIT_DEBUG_INFO and REACTOR_ENABLE_PRINT
+    set(REACTOR_EMIT_DEBUG_INFO TRUE)
+    set(REACTOR_ENABLE_PRINT TRUE)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_RR_EMIT_PRINT_LOCATION")
+endif()
+
+if(REACTOR_EMIT_ASM_FILE)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_RR_EMIT_ASM_FILE")
+endif()
+
+if(REACTOR_EMIT_DEBUG_INFO)
+    message(WARNING "REACTOR_EMIT_DEBUG_INFO is enabled. This will likely affect performance.")
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_RR_DEBUG_INFO")
+endif()
+
+if(REACTOR_ENABLE_PRINT)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_RR_PRINT")
+endif()
+
+if(REACTOR_VERIFY_LLVM_IR)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DENABLE_RR_LLVM_IR_VERIFICATION")
+endif()
+
+if(REACTOR_DEFAULT_OPT_LEVEL)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DREACTOR_DEFAULT_OPT_LEVEL=${REACTOR_DEFAULT_OPT_LEVEL}")
+endif()
+
+if(DEFINED SWIFTSHADER_LOGGING_LEVEL)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-DSWIFTSHADER_LOGGING_LEVEL=${SWIFTSHADER_LOGGING_LEVEL}")
+endif()
+
+if(WIN32)
+    add_definitions(-DWINVER=0x501 -DNOMINMAX -DSTRICT)
+    set(CMAKE_FIND_LIBRARY_PREFIXES ${CMAKE_FIND_LIBRARY_PREFIXES} "" "lib")
+endif()
+
+set(USE_EXCEPTIONS
+    ${REACTOR_EMIT_DEBUG_INFO} # boost::stacktrace uses exceptions
 )
+if(NOT MSVC)
+    if (${USE_EXCEPTIONS})
+        list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-fexceptions")
+    else()
+        list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-fno-exceptions")
+    endif()
+endif()
+unset(USE_EXCEPTIONS)
 
-marl_set_target_options(marl)
+###########################################################
+# libbacktrace and boost
+###########################################################
+if(REACTOR_EMIT_DEBUG_INFO)
+    add_subdirectory(${THIRD_PARTY_DIR}/libbacktrace EXCLUDE_FROM_ALL)
+    add_subdirectory(${THIRD_PARTY_DIR}/boost EXCLUDE_FROM_ALL)
+endif()
 
-target_link_libraries(marl PUBLIC Threads::Threads)
+###########################################################
+# LLVM
+###########################################################
+add_subdirectory(${THIRD_PARTY_DIR}/llvm-${SWIFTSHADER_LLVM_VERSION} EXCLUDE_FROM_ALL)
+set_target_properties(llvm PROPERTIES FOLDER "third_party")
 
-# install
-if(MARL_INSTALL)
-    include(CMakePackageConfigHelpers)
-    include(GNUInstallDirs)
+###########################################################
+# LLVM-Submodule
+###########################################################
+if(${REACTOR_BACKEND} STREQUAL "LLVM-Submodule")
+    set(LLVM_INCLUDE_TESTS FALSE)
+    set(LLVM_ENABLE_RTTI TRUE)
+    add_subdirectory(${THIRD_PARTY_DIR}/llvm-project/llvm EXCLUDE_FROM_ALL)
+    if(ARCH STREQUAL "aarch64")
+        llvm_map_components_to_libnames(llvm_libs orcjit aarch64asmparser aarch64codegen)
+    elseif(ARCH STREQUAL "arm")
+        llvm_map_components_to_libnames(llvm_libs orcjit armasmparser armcodegen)
+    elseif(ARCH MATCHES "^mips.*")
+        llvm_map_components_to_libnames(llvm_libs orcjit mipsasmparser mipscodegen)
+    elseif(ARCH STREQUAL "ppc64le")
+        llvm_map_components_to_libnames(llvm_libs orcjit powerpcasmparser powerpccodegen)
+    elseif(ARCH MATCHES "^x86.*")
+        llvm_map_components_to_libnames(llvm_libs orcjit x86asmparser x86codegen)
+    endif()
+    set_target_properties(${llvm_libs} PROPERTIES FOLDER "third_party")
+endif()
 
-    configure_package_config_file(
-        ${CMAKE_CURRENT_SOURCE_DIR}/cmake/marl-config.cmake.in
-        ${CMAKE_CURRENT_BINARY_DIR}/marl-config.cmake
-        INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/marl
+###########################################################
+# Subzero
+###########################################################
+add_subdirectory(${THIRD_PARTY_DIR}/llvm-subzero EXCLUDE_FROM_ALL)
+add_subdirectory(${THIRD_PARTY_DIR}/subzero EXCLUDE_FROM_ALL)
+set_target_properties(llvm-subzero PROPERTIES FOLDER "third_party")
+set_target_properties(subzero PROPERTIES FOLDER "third_party")
+
+###########################################################
+# marl
+###########################################################
+set(MARL_THIRD_PARTY_DIR ${THIRD_PARTY_DIR})
+add_subdirectory(${THIRD_PARTY_DIR}/marl)
+set_target_properties(marl PROPERTIES FOLDER "third_party")
+
+if(MARL_THREAD_SAFETY_ANALYSIS_SUPPORTED)
+    list(APPEND SWIFTSHADER_COMPILE_OPTIONS "-Wthread-safety")
+endif()
+
+###########################################################
+# cppdap
+###########################################################
+if(SWIFTSHADER_BUILD_CPPDAP)
+    set(CPPDAP_THIRD_PARTY_DIR ${THIRD_PARTY_DIR})
+    add_subdirectory(${THIRD_PARTY_DIR}/cppdap)
+endif()
+
+###########################################################
+# astc-encoder
+###########################################################
+if(SWIFTSHADER_ENABLE_ASTC)
+    add_subdirectory(${THIRD_PARTY_DIR}/astc-encoder)
+    set_target_properties(astc-encoder PROPERTIES FOLDER "third_party")
+endif()
+
+###########################################################
+# gtest and gmock
+###########################################################
+if(SWIFTSHADER_BUILD_TESTS)
+    # For Win32, force gtest to match our CRT (shared)
+    set(gtest_force_shared_crt TRUE CACHE BOOL "" FORCE)
+    set(INSTALL_GTEST FALSE CACHE BOOL "" FORCE)
+    add_subdirectory(${THIRD_PARTY_DIR}/googletest EXCLUDE_FROM_ALL)
+    # gtest finds python, which picks python 2 first, if present.
+    # We need to undo this so that SPIR-V can later find python3.
+    unset(PYTHON_EXECUTABLE CACHE)
+    set_target_properties(gmock PROPERTIES FOLDER "third_party")
+    set_target_properties(gmock_main PROPERTIES FOLDER "third_party")
+    set_target_properties(gtest PROPERTIES FOLDER "third_party")
+    set_target_properties(gtest_main PROPERTIES FOLDER "third_party")
+endif()
+
+###########################################################
+# File Lists
+###########################################################
+
+###########################################################
+# Append OS specific files to lists
+###########################################################
+
+if(WIN32)
+    set(OS_LIBS odbc32 odbccp32 WS2_32 dxguid)
+elseif(LINUX)
+    set(OS_LIBS dl pthread)
+    if(SWIFTSHADER_BUILD_WSI_WAYLAND)
+        include_directories("${SWIFTSHADER_DIR}/include/Wayland")
+    endif()
+    if(SWIFTSHADER_BUILD_WSI_DIRECTFB)
+        list(APPEND OS_LIBS "${DIRECTFB}")
+        include_directories(${DIRECTFB_INCLUDE_DIR}/directfb)
+    endif()
+    if(SWIFTSHADER_BUILD_WSI_D2D)
+        list(APPEND OS_LIBS "${D2D}")
+        include_directories(${D2D_INCLUDE_DIR}/libdrm)
+    endif()
+elseif(FUCHSIA)
+    set(OS_LIBS zircon)
+elseif(APPLE)
+    find_library(COCOA_FRAMEWORK Cocoa)
+    find_library(QUARTZ_FRAMEWORK Quartz)
+    find_library(CORE_FOUNDATION_FRAMEWORK CoreFoundation)
+    find_library(IOSURFACE_FRAMEWORK IOSurface)
+    find_library(METAL_FRAMEWORK Metal)
+    set(OS_LIBS "${COCOA_FRAMEWORK}" "${QUARTZ_FRAMEWORK}" "${CORE_FOUNDATION_FRAMEWORK}" "${IOSURFACE_FRAMEWORK}" "${METAL_FRAMEWORK}")
+endif()
+
+###########################################################
+# SwiftShader Targets
+###########################################################
+
+add_subdirectory(src/Reactor) # Add ReactorSubzero and ReactorLLVM targets
+
+if(${REACTOR_BACKEND} STREQUAL "LLVM")
+    add_library(Reactor ALIAS ReactorLLVM)
+elseif(${REACTOR_BACKEND} STREQUAL "LLVM-Submodule")
+    add_library(Reactor ALIAS ReactorLLVMSubmodule)
+elseif(${REACTOR_BACKEND} STREQUAL "Subzero")
+    add_library(Reactor ALIAS ReactorSubzero)
+else()
+    message(FATAL_ERROR "REACTOR_BACKEND must be 'LLVM', 'LLVM-Submodule' or 'Subzero'")
+endif()
+
+if (NOT TARGET SPIRV-Tools)
+    # This variable is also used by SPIRV-Tools to locate SPIRV-Headers
+    set(SPIRV-Headers_SOURCE_DIR "${THIRD_PARTY_DIR}/SPIRV-Headers")
+    set(SPIRV_SKIP_TESTS TRUE CACHE BOOL "" FORCE)
+    set(SPIRV_SKIP_EXECUTABLES TRUE CACHE BOOL "" FORCE)
+    add_subdirectory(${THIRD_PARTY_DIR}/SPIRV-Tools) # Add SPIRV-Tools target
+endif()
+
+# Add a vk_base interface library for shared vulkan build options.
+# TODO: Create src/Base and make this a lib target, and move stuff from
+# src/Vulkan into it that is needed by vk_pipeline, vk_device, and vk_wsi.
+add_library(vk_base INTERFACE)
+
+if(SWIFTSHADER_ENABLE_VULKAN_DEBUGGER)
+    target_compile_definitions(vk_base INTERFACE "ENABLE_VK_DEBUGGER")
+endif()
+
+if(WIN32)
+    target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_WIN32_KHR")
+elseif(LINUX)
+    if(SWIFTSHADER_BUILD_WSI_XCB)
+        target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_XCB_KHR")
+    endif()
+    if(SWIFTSHADER_BUILD_WSI_WAYLAND)
+        target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_WAYLAND_KHR")
+    endif()
+    if(SWIFTSHADER_BUILD_WSI_DIRECTFB)
+        if(DIRECTFB AND DIRECTFB_INCLUDE_DIR)
+            target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_DIRECTFB_EXT")
+        endif()
+    endif(SWIFTSHADER_BUILD_WSI_DIRECTFB)
+    if(SWIFTSHADER_BUILD_WSI_D2D)
+        if(D2D)
+            target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_DISPLAY_KHR")
+        endif()
+    endif(SWIFTSHADER_BUILD_WSI_D2D)
+elseif(APPLE)
+    target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_MACOS_MVK")
+    target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_METAL_EXT")
+elseif(FUCHSIA)
+    target_compile_definitions(vk_base INTERFACE "VK_USE_PLATFORM_FUCHSIA")
+else()
+    message(FATAL_ERROR "Platform does not support Vulkan yet")
+endif()
+
+add_subdirectory(src/System) # Add vk_system target
+add_subdirectory(src/Pipeline) # Add vk_pipeline target
+add_subdirectory(src/WSI) # Add vk_wsi target
+add_subdirectory(src/Device) # Add vk_device target
+add_subdirectory(src/Vulkan) # Add vk_swiftshader target
+
+if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND # turbo-cov is only useful for clang coverage info
+    SWIFTSHADER_EMIT_COVERAGE)
+    add_subdirectory(${TESTS_DIR}/regres/cov/turbo-cov)
+endif()
+
+###########################################################
+# Sample programs and tests
+###########################################################
+
+# TODO(b/161976310): Add support for building PowerVR on MacOS
+if(APPLE AND SWIFTSHADER_BUILD_PVR)
+    message(WARNING "Building PowerVR examples for SwiftShader is not yet supported on Apple platforms.")
+    set(SWIFTSHADER_BUILD_PVR FALSE)
+endif()
+
+if(SWIFTSHADER_BUILD_PVR)
+    if(UNIX AND NOT APPLE)
+        set(PVR_WINDOW_SYSTEM XCB)
+
+        # Set the RPATH of the next defined build targets to $ORIGIN,
+        # allowing them to load shared libraries from the execution directory.
+        set(CMAKE_BUILD_RPATH "$ORIGIN")
+    endif()
+
+    set(PVR_BUILD_EXAMPLES TRUE CACHE BOOL "Build the PowerVR SDK Examples" FORCE)
+    set(PVR_BUILD_VULKAN_EXAMPLES TRUE CACHE BOOL "Build the Vulkan PowerVR SDK Examples" FORCE)
+    add_subdirectory(${THIRD_PARTY_DIR}/PowerVR_Examples)
+
+    # Samples known to work well
+    set(PVR_VULKAN_TARGET_GOOD
+        VulkanBumpmap
+        VulkanExampleUI
+        VulkanGaussianBlur
+        VulkanGlass
+        VulkanGnomeHorde
+        VulkanHelloAPI
+        VulkanImageBasedLighting
+        VulkanIntroducingPVRUtils
+        VulkanMultiSampling
+        VulkanNavigation2D
+        VulkanParticleSystem
+        VulkanSkinning
     )
 
-    install(DIRECTORY ${MARL_INCLUDE_DIR}/marl
-        DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
-        USE_SOURCE_PERMISSIONS
+    set(PVR_VULKAN_TARGET_OTHER
+        VulkanDeferredShading
+        VulkanDeferredShadingPFX
+        VulkanGameOfLife
+        VulkanIBLMapsGenerator
+        VulkanIMGTextureFilterCubic
+        VulkanIntroducingPVRShell
+        VulkanIntroducingPVRVk
+        VulkanIntroducingUIRenderer
+        VulkanMultithreading
+        VulkanNavigation3D
+        VulkanPostProcessing
+        VulkanPVRScopeExample
+        VulkanPVRScopeRemote
     )
 
-    install(TARGETS marl
-        EXPORT marl-targets
-        ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
-        RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-        INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+    set(PVR_TARGET_OTHER
+        glslang
+        glslangValidator
+        glslang-default-resource-limits
+        OSDependent
+        pugixml
+        PVRAssets
+        PVRCamera
+        PVRCore
+        PVRPfx
+        PVRShell
+        PVRUtilsVk
+        PVRVk
+        SPIRV
+        spirv-remap
+        SPVRemapper
+        uninstall
     )
 
-    install(EXPORT marl-targets
-        FILE marl-targets.cmake
-        NAMESPACE marl::
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/marl
+    set(PVR_VULKAN_TARGET
+        ${PVR_VULKAN_TARGET_GOOD}
+        ${PVR_VULKAN_TARGET_OTHER}
     )
 
-    install(FILES ${CMAKE_CURRENT_BINARY_DIR}/marl-config.cmake
-        DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/marl
-    )
-endif(MARL_INSTALL)
+    foreach(pvr_target ${PVR_VULKAN_TARGET})
+        add_dependencies(${pvr_target} vk_swiftshader)
+    endforeach()
 
-# tests
-if(MARL_BUILD_TESTS)
-    set(MARL_TEST_LIST
-        ${MARL_SRC_DIR}/blockingcall_test.cpp
-        ${MARL_SRC_DIR}/conditionvariable_test.cpp
-        ${MARL_SRC_DIR}/containers_test.cpp
-        ${MARL_SRC_DIR}/dag_test.cpp
-        ${MARL_SRC_DIR}/defer_test.cpp
-        ${MARL_SRC_DIR}/event_test.cpp
-        ${MARL_SRC_DIR}/marl_test.cpp
-        ${MARL_SRC_DIR}/marl_test.h
-        ${MARL_SRC_DIR}/memory_test.cpp
-        ${MARL_SRC_DIR}/osfiber_test.cpp
-        ${MARL_SRC_DIR}/parallelize_test.cpp
-        ${MARL_SRC_DIR}/pool_test.cpp
-        ${MARL_SRC_DIR}/scheduler_test.cpp
-        ${MARL_SRC_DIR}/thread_test.cpp
-        ${MARL_SRC_DIR}/ticket_test.cpp
-        ${MARL_SRC_DIR}/waitgroup_test.cpp
-        ${MARL_GOOGLETEST_DIR}/googletest/src/gtest-all.cc
-        ${MARL_GOOGLETEST_DIR}/googlemock/src/gmock-all.cc
-    )
+    foreach(pvr_target ${PVR_VULKAN_TARGET_GOOD})
+        set_target_properties(${pvr_target} PROPERTIES FOLDER Samples)
+    endforeach()
 
-    set(MARL_TEST_INCLUDE_DIR
-        ${MARL_GOOGLETEST_DIR}/googletest/include/
-        ${MARL_GOOGLETEST_DIR}/googlemock/include/
-        ${MARL_GOOGLETEST_DIR}/googletest/
-        ${MARL_GOOGLETEST_DIR}/googlemock/
-    )
+    foreach(pvr_target ${PVR_TARGET_OTHER} ${PVR_VULKAN_TARGET_OTHER})
+        set_target_properties(${pvr_target} PROPERTIES FOLDER Samples/PowerVR-Build)
+    endforeach()
+endif()
 
-    add_executable(marl-unittests ${MARL_TEST_LIST})
+if(BUILD_VULKAN_WRAPPER)
+    if (NOT TARGET glslang)
+        add_subdirectory(${THIRD_PARTY_DIR}/glslang)
+    endif()
+    add_subdirectory(${TESTS_DIR}/VulkanWrapper) # Add VulkanWrapper target
+endif()
 
-    set_target_properties(marl-unittests PROPERTIES
-        INCLUDE_DIRECTORIES "${MARL_TEST_INCLUDE_DIR}"
-        FOLDER "Tests"
-    )
+if(SWIFTSHADER_BUILD_TESTS)
+    add_subdirectory(${TESTS_DIR}/ReactorUnitTests) # Add ReactorUnitTests target
+    add_subdirectory(${TESTS_DIR}/MathUnitTests) # Add math-unittests target
+    add_subdirectory(${TESTS_DIR}/SystemUnitTests) # Add system-unittests target
+endif()
 
-    marl_set_target_options(marl-unittests)
+if(SWIFTSHADER_BUILD_BENCHMARKS)
+    if (NOT TARGET benchmark::benchmark)
+        set(BENCHMARK_ENABLE_TESTING FALSE CACHE BOOL FALSE FORCE)
+        add_subdirectory(${THIRD_PARTY_DIR}/benchmark)
+        set_target_properties(benchmark PROPERTIES FOLDER "third_party")
+        set_target_properties(benchmark_main PROPERTIES FOLDER "third_party")
+    endif()
 
-    target_link_libraries(marl-unittests PRIVATE marl)
-endif(MARL_BUILD_TESTS)
+    add_subdirectory(${TESTS_DIR}/PipelineBenchmarks) # Add PipelineBenchmarks target
+    add_subdirectory(${TESTS_DIR}/ReactorBenchmarks) # Add ReactorBenchmarks target
+    add_subdirectory(${TESTS_DIR}/SystemBenchmarks) # Add system-benchmarks target
+    add_subdirectory(${TESTS_DIR}/VulkanBenchmarks) # Add VulkanBenchmarks target
+endif()
 
-# benchmarks
-if(MARL_BUILD_BENCHMARKS)
-    set(MARL_BENCHMARK_LIST
-        ${MARL_SRC_DIR}/blockingcall_bench.cpp
-        ${MARL_SRC_DIR}/defer_bench.cpp
-        ${MARL_SRC_DIR}/event_bench.cpp
-        ${MARL_SRC_DIR}/marl_bench.cpp
-        ${MARL_SRC_DIR}/non_marl_bench.cpp
-        ${MARL_SRC_DIR}/scheduler_bench.cpp
-        ${MARL_SRC_DIR}/ticket_bench.cpp
-        ${MARL_SRC_DIR}/waitgroup_bench.cpp
-    )
-
-    add_executable(marl-benchmarks ${MARL_BENCHMARK_LIST})
-    set_target_properties(${target} PROPERTIES FOLDER "Benchmarks")
-
-    marl_set_target_options(marl-benchmarks)
-
-    target_compile_definitions(marl-benchmarks PRIVATE
-        "MARL_FULL_BENCHMARK=${MARL_FULL_BENCHMARK}"
-    )
-
-    target_link_libraries(marl-benchmarks PRIVATE benchmark::benchmark marl)
-endif(MARL_BUILD_BENCHMARKS)
-
-# examples
-if(MARL_BUILD_EXAMPLES)
-    function(build_example target)
-        add_executable(${target} "${CMAKE_CURRENT_SOURCE_DIR}/examples/${target}.cpp")
-        set_target_properties(${target} PROPERTIES FOLDER "Examples")
-        marl_set_target_options(${target})
-        target_link_libraries(${target} PRIVATE marl)
-    endfunction(build_example)
-
-    build_example(fractal)
-    build_example(hello_task)
-    build_example(primes)
-    build_example(tasks_in_tasks)
-endif(MARL_BUILD_EXAMPLES)
+if(SWIFTSHADER_BUILD_TESTS)
+    add_subdirectory(${TESTS_DIR}/VulkanUnitTests) # Add VulkanUnitTests target
+endif()
diff --git a/CMakeSettings.json b/CMakeSettings.json
new file mode 100644
index 0000000..23c622f
--- /dev/null
+++ b/CMakeSettings.json
@@ -0,0 +1,55 @@
+{
+  "configurations": [
+    {
+      "name": "x64-Debug",
+      "generator": "Ninja",
+      "configurationType": "Debug",
+      "inheritEnvironments": [ "msvc_x64_x64" ],
+      "buildRoot": "${projectDir}\\out\\build\\${name}",
+      "installRoot": "${projectDir}\\out\\install\\${name}",
+      "cmakeCommandArgs": "",
+      "buildCommandArgs": "-v",
+      "ctestCommandArgs": "",
+      "variables": [
+        {
+          "name": "REACTOR_BACKEND",
+          "value": "Subzero",
+          "type": "STRING"
+        }
+      ]
+    },
+    {
+      "name": "x86-Debug",
+      "generator": "Ninja",
+      "configurationType": "Debug",
+      "buildRoot": "${projectDir}\\out\\build\\${name}",
+      "installRoot": "${projectDir}\\out\\install\\${name}",
+      "cmakeCommandArgs": "",
+      "buildCommandArgs": "-v",
+      "ctestCommandArgs": "",
+      "inheritEnvironments": [ "msvc_x86" ]
+    },
+    {
+      "name": "x86-Release",
+      "generator": "Ninja",
+      "configurationType": "RelWithDebInfo",
+      "buildRoot": "${projectDir}\\out\\build\\${name}",
+      "installRoot": "${projectDir}\\out\\install\\${name}",
+      "cmakeCommandArgs": "",
+      "buildCommandArgs": "-v",
+      "ctestCommandArgs": "",
+      "inheritEnvironments": [ "msvc_x86" ]
+    },
+    {
+      "name": "x64-Release",
+      "generator": "Ninja",
+      "configurationType": "RelWithDebInfo",
+      "buildRoot": "${projectDir}\\out\\build\\${name}",
+      "installRoot": "${projectDir}\\out\\install\\${name}",
+      "cmakeCommandArgs": "",
+      "buildCommandArgs": "-v",
+      "ctestCommandArgs": "",
+      "inheritEnvironments": [ "msvc_x64_x64" ]
+    }
+  ]
+}
\ No newline at end of file
diff --git a/CONTRIBUTING.txt b/CONTRIBUTING.txt
new file mode 100644
index 0000000..2cedc8e
--- /dev/null
+++ b/CONTRIBUTING.txt
@@ -0,0 +1,28 @@
+Want to contribute? Great! First, read this page (including the small print at the end).

+

+### Before you contribute

+Before we can use your code, you must sign the

+[Google Individual Contributor License Agreement]

+(https://cla.developers.google.com/about/google-individual)

+(CLA), which you can do online. The CLA is necessary mainly because you own the

+copyright to your changes, even after your contribution becomes part of our

+codebase, so we need your permission to use and distribute your code. We also

+need to be sure of various other things—for instance that you'll tell us if you

+know that your code infringes on other people's patents. You don't have to sign

+the CLA until after you've submitted your code for review and a member has

+approved it, but you must do it before we can put your code into our codebase.

+Before you start working on a larger contribution, you should get in touch with

+us first through the issue tracker with your idea so that we can help out and

+possibly guide you. Coordinating up front makes it much easier to avoid

+frustration later on.

+

+### Code reviews

+All submissions, including submissions by project members, require review.

+

+Information on how to sumbit changes for review is provided in README.md.

+

+### The small print

+Contributions made by corporations are covered by a different agreement than

+the one above, the

+[Software Grant and Corporate Contributor License Agreement]

+(https://cla.developers.google.com/about/google-corporate).
\ No newline at end of file
diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt
new file mode 100644
index 0000000..5e930c8
--- /dev/null
+++ b/CONTRIBUTORS.txt
@@ -0,0 +1,42 @@
+# People who have agreed to one of the CLAs and can contribute patches.

+# The AUTHORS file lists the copyright holders; this file

+# lists people.  For example, Google employees are listed here

+# but not in AUTHORS, because Google holds the copyright.

+#

+# https://developers.google.com/open-source/cla/individual

+# https://developers.google.com/open-source/cla/corporate

+#

+# Names should be added to this file as:

+#     Name <email address>

+

+Google Inc.

+ Nicolas Capens <capn@google.com>

+ Alexis Hétu <sugoi@google.com>

+ Shannon Woods <shannonwoods@google.com>

+ Corentin Wallez <cwallez@google.com>

+ Greg Hartman <ghartman@google.com>

+ Ping-Hao Wu <pinghao@google.com>

+ Maxime Grégoire <mgregoire@google.com>

+ Veranika Liaukevich <veranika@google.com>

+ John Bauman <jbauman@google.com>

+ Keun Soo Yim <yim@google.com>

+ John Sheu <sheu@google.com>

+ Philippe Hamel <hamelphi@google.com>

+ Daniel Toyama <kenjitoyama@google.com>

+ Meng-Lin Wu <marleymoo@google.com>

+ Krzysztof Kosiński <krzysio@google.com>

+ Chris Forbes <chrisforbes@google.com>

+ Ben Clayton <bclayton@google.com>

+ Hernan Liatis <hliatis@google.com>

+ Logan (Tzu-hsiang) Chien <loganchien@google.com>

+ Stephen White <senorblanco@google.com>

+ Raymond Chiu <chiur@google.com>

+ Shahbaz Youssefi <syoussefi@google.com>

+

+TransGaming Inc.

+ Nicolas Capens

+ Gavriel State

+ Jim MacArthur

+ Daniel Koch

+ Luther Johnson

+ Rob Stepinski

diff --git a/DIR_METADATA b/DIR_METADATA
new file mode 100644
index 0000000..72bfcd7
--- /dev/null
+++ b/DIR_METADATA
@@ -0,0 +1,3 @@
+monorail {
+  component: "Internals>GPU>SwiftShader"
+}
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 0000000..75b5248
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+

+                                 Apache License

+                           Version 2.0, January 2004

+                        http://www.apache.org/licenses/

+

+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

+

+   1. Definitions.

+

+      "License" shall mean the terms and conditions for use, reproduction,

+      and distribution as defined by Sections 1 through 9 of this document.

+

+      "Licensor" shall mean the copyright owner or entity authorized by

+      the copyright owner that is granting the License.

+

+      "Legal Entity" shall mean the union of the acting entity and all

+      other entities that control, are controlled by, or are under common

+      control with that entity. For the purposes of this definition,

+      "control" means (i) the power, direct or indirect, to cause the

+      direction or management of such entity, whether by contract or

+      otherwise, or (ii) ownership of fifty percent (50%) or more of the

+      outstanding shares, or (iii) beneficial ownership of such entity.

+

+      "You" (or "Your") shall mean an individual or Legal Entity

+      exercising permissions granted by this License.

+

+      "Source" form shall mean the preferred form for making modifications,

+      including but not limited to software source code, documentation

+      source, and configuration files.

+

+      "Object" form shall mean any form resulting from mechanical

+      transformation or translation of a Source form, including but

+      not limited to compiled object code, generated documentation,

+      and conversions to other media types.

+

+      "Work" shall mean the work of authorship, whether in Source or

+      Object form, made available under the License, as indicated by a

+      copyright notice that is included in or attached to the work

+      (an example is provided in the Appendix below).

+

+      "Derivative Works" shall mean any work, whether in Source or Object

+      form, that is based on (or derived from) the Work and for which the

+      editorial revisions, annotations, elaborations, or other modifications

+      represent, as a whole, an original work of authorship. For the purposes

+      of this License, Derivative Works shall not include works that remain

+      separable from, or merely link (or bind by name) to the interfaces of,

+      the Work and Derivative Works thereof.

+

+      "Contribution" shall mean any work of authorship, including

+      the original version of the Work and any modifications or additions

+      to that Work or Derivative Works thereof, that is intentionally

+      submitted to Licensor for inclusion in the Work by the copyright owner

+      or by an individual or Legal Entity authorized to submit on behalf of

+      the copyright owner. For the purposes of this definition, "submitted"

+      means any form of electronic, verbal, or written communication sent

+      to the Licensor or its representatives, including but not limited to

+      communication on electronic mailing lists, source code control systems,

+      and issue tracking systems that are managed by, or on behalf of, the

+      Licensor for the purpose of discussing and improving the Work, but

+      excluding communication that is conspicuously marked or otherwise

+      designated in writing by the copyright owner as "Not a Contribution."

+

+      "Contributor" shall mean Licensor and any individual or Legal Entity

+      on behalf of whom a Contribution has been received by Licensor and

+      subsequently incorporated within the Work.

+

+   2. Grant of Copyright License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      copyright license to reproduce, prepare Derivative Works of,

+      publicly display, publicly perform, sublicense, and distribute the

+      Work and such Derivative Works in Source or Object form.

+

+   3. Grant of Patent License. Subject to the terms and conditions of

+      this License, each Contributor hereby grants to You a perpetual,

+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable

+      (except as stated in this section) patent license to make, have made,

+      use, offer to sell, sell, import, and otherwise transfer the Work,

+      where such license applies only to those patent claims licensable

+      by such Contributor that are necessarily infringed by their

+      Contribution(s) alone or by combination of their Contribution(s)

+      with the Work to which such Contribution(s) was submitted. If You

+      institute patent litigation against any entity (including a

+      cross-claim or counterclaim in a lawsuit) alleging that the Work

+      or a Contribution incorporated within the Work constitutes direct

+      or contributory patent infringement, then any patent licenses

+      granted to You under this License for that Work shall terminate

+      as of the date such litigation is filed.

+

+   4. Redistribution. You may reproduce and distribute copies of the

+      Work or Derivative Works thereof in any medium, with or without

+      modifications, and in Source or Object form, provided that You

+      meet the following conditions:

+

+      (a) You must give any other recipients of the Work or

+          Derivative Works a copy of this License; and

+

+      (b) You must cause any modified files to carry prominent notices

+          stating that You changed the files; and

+

+      (c) You must retain, in the Source form of any Derivative Works

+          that You distribute, all copyright, patent, trademark, and

+          attribution notices from the Source form of the Work,

+          excluding those notices that do not pertain to any part of

+          the Derivative Works; and

+

+      (d) If the Work includes a "NOTICE" text file as part of its

+          distribution, then any Derivative Works that You distribute must

+          include a readable copy of the attribution notices contained

+          within such NOTICE file, excluding those notices that do not

+          pertain to any part of the Derivative Works, in at least one

+          of the following places: within a NOTICE text file distributed

+          as part of the Derivative Works; within the Source form or

+          documentation, if provided along with the Derivative Works; or,

+          within a display generated by the Derivative Works, if and

+          wherever such third-party notices normally appear. The contents

+          of the NOTICE file are for informational purposes only and

+          do not modify the License. You may add Your own attribution

+          notices within Derivative Works that You distribute, alongside

+          or as an addendum to the NOTICE text from the Work, provided

+          that such additional attribution notices cannot be construed

+          as modifying the License.

+

+      You may add Your own copyright statement to Your modifications and

+      may provide additional or different license terms and conditions

+      for use, reproduction, or distribution of Your modifications, or

+      for any such Derivative Works as a whole, provided Your use,

+      reproduction, and distribution of the Work otherwise complies with

+      the conditions stated in this License.

+

+   5. Submission of Contributions. Unless You explicitly state otherwise,

+      any Contribution intentionally submitted for inclusion in the Work

+      by You to the Licensor shall be under the terms and conditions of

+      this License, without any additional terms or conditions.

+      Notwithstanding the above, nothing herein shall supersede or modify

+      the terms of any separate license agreement you may have executed

+      with Licensor regarding such Contributions.

+

+   6. Trademarks. This License does not grant permission to use the trade

+      names, trademarks, service marks, or product names of the Licensor,

+      except as required for reasonable and customary use in describing the

+      origin of the Work and reproducing the content of the NOTICE file.

+

+   7. Disclaimer of Warranty. Unless required by applicable law or

+      agreed to in writing, Licensor provides the Work (and each

+      Contributor provides its Contributions) on an "AS IS" BASIS,

+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or

+      implied, including, without limitation, any warranties or conditions

+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A

+      PARTICULAR PURPOSE. You are solely responsible for determining the

+      appropriateness of using or redistributing the Work and assume any

+      risks associated with Your exercise of permissions under this License.

+

+   8. Limitation of Liability. In no event and under no legal theory,

+      whether in tort (including negligence), contract, or otherwise,

+      unless required by applicable law (such as deliberate and grossly

+      negligent acts) or agreed to in writing, shall any Contributor be

+      liable to You for damages, including any direct, indirect, special,

+      incidental, or consequential damages of any character arising as a

+      result of this License or out of the use or inability to use the

+      Work (including but not limited to damages for loss of goodwill,

+      work stoppage, computer failure or malfunction, or any and all

+      other commercial damages or losses), even if such Contributor

+      has been advised of the possibility of such damages.

+

+   9. Accepting Warranty or Additional Liability. While redistributing

+      the Work or Derivative Works thereof, You may choose to offer,

+      and charge a fee for, acceptance of support, warranty, indemnity,

+      or other liability obligations and/or rights consistent with this

+      License. However, in accepting such obligations, You may act only

+      on Your own behalf and on Your sole responsibility, not on behalf

+      of any other Contributor, and only if You agree to indemnify,

+      defend, and hold each Contributor harmless for any liability

+      incurred by, or claims asserted against, such Contributor by reason

+      of your accepting any such warranty or additional liability.

+

+   END OF TERMS AND CONDITIONS

+

+   APPENDIX: How to apply the Apache License to your work.

+

+      To apply the Apache License to your work, attach the following

+      boilerplate notice, with the fields enclosed by brackets "[]"

+      replaced with your own identifying information. (Don't include

+      the brackets!)  The text should be enclosed in the appropriate

+      comment syntax for the file format. We also recommend that a

+      file or class name and description of purpose be included on the

+      same "printed page" as the copyright notice for easier

+      identification within third-party archives.

+

+   Copyright [yyyy] [name of copyright owner]

+

+   Licensed under the Apache License, Version 2.0 (the "License");

+   you may not use this file except in compliance with the License.

+   You may obtain a copy of the License at

+

+       http://www.apache.org/licenses/LICENSE-2.0

+

+   Unless required by applicable law or agreed to in writing, software

+   distributed under the License is distributed on an "AS IS" BASIS,

+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

+   See the License for the specific language governing permissions and

+   limitations under the License.

diff --git a/OWNERS b/OWNERS
new file mode 100644
index 0000000..60f0d1f
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1,21 @@
+# This is the list of people with commit rights actively working on SwiftShader
+#
+# This list is used by Chromium and Android to make sure that one of the owners
+# in this list has approved a SwiftShader related change before landing it.
+#
+# Note that the upstream source-of-truth git repository at
+# swiftshader.googlesource.com/SwiftShader has ownership and access control
+# seperate from those controlled by this OWNERS file.
+
+jonahr@google.com
+syoussefi@google.com
+geofflang@google.com
+
+sugoi@google.com         #{LAST_RESORT_SUGGESTION}
+shannonwoods@google.com  #{LAST_RESORT_SUGGESTION}
+chrisforbes@google.com   #{LAST_RESORT_SUGGESTION}
+cwallez@google.com       #{LAST_RESORT_SUGGESTION}
+amaiorano@google.com     #{LAST_RESORT_SUGGESTION}
+natsu@google.com         #{LAST_RESORT_SUGGESTION}
+schuffelen@google.com    #{LAST_RESORT_SUGGESTION}
+bclayton@google.com      #{LAST_RESORT_SUGGESTION}
\ No newline at end of file
diff --git a/README.md b/README.md
index 540be90..de5e1ce 100644
--- a/README.md
+++ b/README.md
@@ -1,214 +1,127 @@
-# Marl
-
-Marl is a hybrid thread / fiber task scheduler written in C++ 11.
-
-## About
-
-Marl is a C++ 11 library that provides a fluent interface for running tasks across a number of threads.
-
-Marl uses a combination of fibers and threads to allow efficient execution of tasks that can block, while keeping a fixed number of hardware threads.
-
-Marl supports Windows, macOS, Linux, FreeBSD, Fuchsia, Android and iOS (arm, aarch64, loongarch64, mips64, ppc64, rv64, x86 and x64).
-
-Marl has no dependencies on other libraries (with an exception on googletest for building the optional unit tests).
-
-Example:
-
-```cpp
-#include "marl/defer.h"
-#include "marl/event.h"
-#include "marl/scheduler.h"
-#include "marl/waitgroup.h"
-
-#include <cstdio>
-
-int main() {
-  // Create a marl scheduler using all the logical processors available to the process.
-  // Bind this scheduler to the main thread so we can call marl::schedule()
-  marl::Scheduler scheduler(marl::Scheduler::Config::allCores());
-  scheduler.bind();
-  defer(scheduler.unbind());  // Automatically unbind before returning.
-
-  constexpr int numTasks = 10;
-
-  // Create an event that is manually reset.
-  marl::Event sayHello(marl::Event::Mode::Manual);
-
-  // Create a WaitGroup with an initial count of numTasks.
-  marl::WaitGroup saidHello(numTasks);
-
-  // Schedule some tasks to run asynchronously.
-  for (int i = 0; i < numTasks; i++) {
-    // Each task will run on one of the 4 worker threads.
-    marl::schedule([=] {  // All marl primitives are capture-by-value.
-      // Decrement the WaitGroup counter when the task has finished.
-      defer(saidHello.done());
-
-      printf("Task %d waiting to say hello...\n", i);
-
-      // Blocking in a task?
-      // The scheduler will find something else for this thread to do.
-      sayHello.wait();
-
-      printf("Hello from task %d!\n", i);
-    });
-  }
-
-  sayHello.signal();  // Unblock all the tasks.
-
-  saidHello.wait();  // Wait for all tasks to complete.
-
-  printf("All tasks said hello.\n");
-
-  // All tasks are guaranteed to complete before the scheduler is destructed.
-}
-```
-
-## Benchmarks
-
-Graphs of several microbenchmarks can be found [here](https://google.github.io/marl/benchmarks).
-
-## Building
-
-Marl contains many unit tests and examples that can be built using CMake.
-
-Unit tests require fetching the `googletest` external project, which can be done by typing the following in your terminal:
-
-```bash
-cd <path-to-marl>
-git submodule update --init
-```
-
-### Linux and macOS
-
-To build the unit tests and examples, type the following in your terminal:
-
-```bash
-cd <path-to-marl>
-mkdir build
-cd build
-cmake .. -DMARL_BUILD_EXAMPLES=1 -DMARL_BUILD_TESTS=1
-make
-```
-
-The resulting binaries will be found in `<path-to-marl>/build`
-
-### Installing Marl (vcpkg)
-
-Alternatively, you can build and install Marl using [vcpkg](https://github.com/Microsoft/vcpkg/) dependency manager:
-
-```bash or powershell
-git clone https://github.com/Microsoft/vcpkg.git
-cd vcpkg
-./bootstrap-vcpkg.sh
-./vcpkg integrate install
-./vcpkg install marl
-```
-
-The Marl port in vcpkg is kept up to date by Microsoft team members and community contributors. If the version is out of date, please [create an issue or pull request](https://github.com/Microsoft/vcpkg) on the vcpkg repository.
-
-### Windows
-
-Marl can be built using [Visual Studio 2019's CMake integration](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019).
-
-### Using Marl in your CMake project
-
-You can build and link Marl using `add_subdirectory()` in your project's `CMakeLists.txt` file:
-
-```cmake
-set(MARL_DIR <path-to-marl>) # example <path-to-marl>: "${CMAKE_CURRENT_SOURCE_DIR}/third_party/marl"
-add_subdirectory(${MARL_DIR})
-```
-
-This will define the `marl` library target, which you can pass to `target_link_libraries()`:
-
-```cmake
-target_link_libraries(<target> marl) # replace <target> with the name of your project's target
-```
-
-You may also wish to specify your own paths to the third party libraries used by `marl`.
-You can do this by setting any of the following variables before the call to `add_subdirectory()`:
-
-```cmake
-set(MARL_THIRD_PARTY_DIR <third-party-root-directory>) # defaults to ${MARL_DIR}/third_party
-set(MARL_GOOGLETEST_DIR  <path-to-googletest>)         # defaults to ${MARL_THIRD_PARTY_DIR}/googletest
-add_subdirectory(${MARL_DIR})
-```
-
-### Usage Recommendations
-
-#### Capture marl synchronization primitives by value
-
-All marl synchronization primitives aside from `marl::ConditionVariable` should be lambda-captured by **value**:
-
-```c++
-marl::Event event;
-marl::schedule([=]{ // [=] Good, [&] Bad.
-  event.signal();
-})
-```
-
-Internally, these primitives hold a shared pointer to the primitive state. By capturing by value we avoid common issues where the primitive may be destructed before the last reference is used.
-
-#### Create one instance of `marl::Scheduler`, use it for the lifetime of the process
-
-The `marl::Scheduler` constructor can be expensive as it may spawn a number of hardware threads. \
-Destructing the `marl::Scheduler` requires waiting on all tasks to complete.
-
-Multiple `marl::Scheduler`s may fight each other for hardware thread utilization.
-
-For these reasons, it is recommended to create a single `marl::Scheduler` for the lifetime of your process.
-
-For example:
-
-```c++
-int main() {
-  marl::Scheduler scheduler(marl::Scheduler::Config::allCores());
-  scheduler.bind();
-  defer(scheduler.unbind());
-
-  return do_program_stuff();
-}
-```
-
-#### Bind the scheduler to externally created threads
-
-In order to call `marl::schedule()` the scheduler must be bound to the calling thread. Failure to bind the scheduler to the thread before calling `marl::schedule()` will result in undefined behavior.
-
-`marl::Scheduler` may be simultaneously bound to any number of threads, and the scheduler can be retrieved from a bound thread with `marl::Scheduler::get()`.
-
-A typical way to pass the scheduler from one thread to another would be:
-
-```c++
-std::thread spawn_new_thread() {
-  // Grab the scheduler from the currently running thread.
-  marl::Scheduler* scheduler = marl::Scheduler::get();
-
-  // Spawn the new thread.
-  return std::thread([=] {
-    // Bind the scheduler to the new thread.
-    scheduler->bind();
-    defer(scheduler->unbind());
-
-    // You can now safely call `marl::schedule()`
-    run_thread_logic();
-  });
-}
-
-```
-
-Always remember to unbind the scheduler before terminating the thread. Forgetting to unbind will result in the `marl::Scheduler` destructor blocking indefinitely.
-
-#### Don't use externally blocking calls in marl tasks
-
-The `marl::Scheduler` internally holds a number of worker threads which will execute the scheduled tasks. If a marl task becomes blocked on a marl synchronization primitive, marl can yield from the blocked task and continue execution of other scheduled tasks.
-
-Calling a non-marl blocking function on a marl worker thread will prevent that worker thread from being able to switch to execute other tasks until the blocking function has returned. Examples of these non-marl blocking functions include: [`std::mutex::lock()`](https://en.cppreference.com/w/cpp/thread/mutex/lock), [`std::condition_variable::wait()`](https://en.cppreference.com/w/cpp/thread/condition_variable/wait), [`accept()`](http://man7.org/linux/man-pages/man2/accept.2.html).
-
-Short blocking calls are acceptable, such as a mutex lock to access a data structure. However be careful that you do not use a marl blocking call with a `std::mutex` lock held - the marl task may yield with the lock held, and block other tasks from re-locking the mutex. This sort of situation may end up with a deadlock.
-
-If you need to make a blocking call from a marl worker thread, you may wish to use [`marl::blocking_call()`](https://github.com/google/marl/blob/main/include/marl/blockingcall.h), which will spawn a new thread for performing the call, allowing the marl worker to continue processing other scheduled tasks.
-
----
-
-Note: This is not an officially supported Google product
+# SwiftShader

+

+[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

+

+Introduction

+------------

+

+SwiftShader[^1] is a high-performance CPU-based implementation[^2] of the Vulkan[^3] 1.3 graphics API. Its goal is to provide hardware independence for advanced 3D graphics.

+

+> NOTE: The [ANGLE](http://angleproject.org/) project can be used to achieve a layered implementation[^4] of OpenGL ES 3.1 (aka. "SwANGLE").

+

+Building

+--------

+

+SwiftShader libraries can be built for Windows, Linux, and macOS.\

+Android and Chrome (OS) build environments are also supported.

+

+* **CMake**

+\

+  [Install CMake](https://cmake.org/download/) for Linux, macOS, or Windows and use either [the GUI](https://cmake.org/runningcmake/) or run the following terminal commands:

+  ```

+  cd build

+  cmake ..

+  cmake --build . --parallel

+

+  ./vk-unittests

+  ```

+  Tip: Set the [CMAKE_BUILD_PARALLEL_LEVEL](https://cmake.org/cmake/help/latest/envvar/CMAKE_BUILD_PARALLEL_LEVEL.html) environment variable to control the level of parallelism.

+

+

+* **Visual Studio**

+\

+  To build the Vulkan ICD library, use [Visual Studio 2019](https://visualstudio.microsoft.com/vs/community/) to open the project folder and wait for it to run CMake. Open the [CMake Targets View](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019#ide-integration) in the Solution Explorer and select the vk_swiftshader project to [build](https://docs.microsoft.com/en-us/cpp/build/cmake-projects-in-visual-studio?view=vs-2019#building-cmake-projects) it.

+

+

+Usage

+-----

+

+The SwiftShader libraries act as drop-in replacements for graphics drivers.

+

+On Windows, most applications can be made to use SwiftShader's DLLs by placing them in the same folder as the executable. On Linux, the `LD_LIBRARY_PATH` environment variable or `-rpath` linker option can be used to direct applications to search for shared libraries in the indicated directory first.

+

+In general, Vulkan applications look for a shared library named `vulkan-1.dll` on Windows (`vulkan-1.so` on Linux). This 'loader' library then redirects API calls to the actual Installable Client Driver (ICD). SwiftShader's ICD is named `libvk_swiftshader.dll`, but it can be renamed to `vulkan-1.dll` to be loaded directly by the application. Alternatively, you can set the `VK_ICD_FILENAMES` environment variable to the path to `vk_swiftshader_icd.json` file that is generated under the build directory (e.g. `.\SwiftShader\build\Windows\vk_swiftshader_icd.json`). To learn more about how Vulkan loading works, read the [official documentation here](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md).

+

+Contributing

+------------

+

+See [CONTRIBUTING.txt](CONTRIBUTING.txt) for important contributing requirements.

+

+The canonical repository for SwiftShader is hosted at:

+https://swiftshader.googlesource.com/SwiftShader.

+

+All changes must be reviewed and approved in the [Gerrit](https://www.gerritcodereview.com/) review tool at:

+https://swiftshader-review.googlesource.com. You must sign in to this site with a Google Account before changes can be uploaded.

+

+Next, authenticate your account here:

+https://swiftshader.googlesource.com/new-password (use the same e-mail address as the one configured as the [Git commit author](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup#_your_identity)).

+

+All changes require a [Change-ID](https://gerrit-review.googlesource.com/Documentation/user-changeid.html) tag in the commit message. A [commit hook](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks) may be used to add this tag automatically, and can be found at:

+https://gerrit-review.googlesource.com/tools/hooks/commit-msg. You can execute `git clone https://swiftshader.googlesource.com/SwiftShader` and manually place the commit hook in `SwiftShader/.git/hooks/`, or to clone the repository and install the commit hook in one go:

+

+    git clone https://swiftshader.googlesource.com/SwiftShader && (cd SwiftShader && git submodule update --init --recursive third_party/git-hooks && ./third_party/git-hooks/install_hooks.sh)

+

+On Windows, this command line requires using the [Git Bash Shell](https://www.atlassian.com/git/tutorials/git-bash).

+

+Changes are uploaded to Gerrit by executing:

+

+    git push origin HEAD:refs/for/master

+

+When ready, [add](https://gerrit-review.googlesource.com/Documentation/intro-user.html#adding-reviewers) a project [owner](OWNERS) as a reviewer on your change.

+

+Some tests will automatically be run against the change. Notably, [presubmit.sh](tests/presubmit.sh) verifies the change has been formatted using [clang-format 11.0.1](tests/kokoro/gcp_ubuntu/check_style.sh). Most IDEs come with clang-format support, but may require upgrading/downgrading to the [clang-format version 11.0.0](https://github.com/llvm/llvm-project/releases/tag/llvmorg-11.0.0) *release* version (notably Chromium's buildtools has a clang-format binary which can be an in-between revision which produces different formatting results).

+

+Testing

+-------

+

+SwiftShader's Vulkan implementation can be tested using the [dEQP](https://github.com/KhronosGroup/VK-GL-CTS) test suite.

+

+See [docs/dEQP.md](docs/dEQP.md) for details.

+

+Third-Party Dependencies

+------------------------

+

+The [third_party](third_party/) directory contains projects which originated outside of SwiftShader:

+

+[subzero](third_party/subzero/) contains a fork of the [Subzero](https://chromium.googlesource.com/native_client/pnacl-subzero/) project. It originates from Google Chrome's (Portable) [Native Client](https://developer.chrome.com/native-client) project. The fork was made using [git-subtree](https://github.com/git/git/blob/master/contrib/subtree/git-subtree.txt) to include all of Subzero's history.

+

+[llvm-subzero](third_party/llvm-subzero/) contains a minimized set of LLVM dependencies of the Subzero project.

+

+[PowerVR_SDK](third_party/PowerVR_SDK/) contains a subset of the [PowerVR Graphics Native SDK](https://github.com/powervr-graphics/Native_SDK) for running several sample applications.

+

+[googletest](third_party/googletest/) contains the [Google Test](https://github.com/google/googletest) project, as a Git submodule. It is used for running unit tests for Chromium, and Reactor unit tests. Run `git submodule update --init` to obtain/update the code. Any contributions should be made upstream.

+

+Documentation

+-------------

+

+See [docs/Index.md](docs/Index.md).

+

+Contact

+-------

+

+Public mailing list: [swiftshader@googlegroups.com](https://groups.google.com/forum/#!forum/swiftshader)

+

+General bug tracker:  https://g.co/swiftshaderbugs \

+Chrome specific bugs: https://bugs.chromium.org/p/swiftshader

+

+License

+-------

+

+The SwiftShader project is licensed under the Apache License Version 2.0. You can find a copy of it in [LICENSE.txt](LICENSE.txt).

+

+Files in the third_party folder are subject to their respective license.

+

+Authors and Contributors

+------------------------

+

+The legal authors for copyright purposes are listed in [AUTHORS.txt](AUTHORS.txt).

+

+[CONTRIBUTORS.txt](CONTRIBUTORS.txt) contains a list of names of individuals who have contributed to SwiftShader. If you're not on the list, but you've signed the [Google CLA](https://cla.developers.google.com/clas) and have contributed more than a formatting change, feel free to request to be added.

+

+Notes and Disclaimers

+---------------------

+

+[^1]: This is not an official Google product.  

+[^2]: Vulkan 1.3 conformance: https://www.khronos.org/conformance/adopters/conformant-products#submission_717  

+[^3]: Trademarks are the property of their respective owners.  

+[^4]: OpenGL ES 3.1 conformance: https://www.khronos.org/conformance/adopters/conformant-products/opengles#submission_906  
\ No newline at end of file
diff --git a/build/android.toolchain.cmake b/build/android.toolchain.cmake
new file mode 100644
index 0000000..d9806e3
--- /dev/null
+++ b/build/android.toolchain.cmake
@@ -0,0 +1,13 @@
+set(CMAKE_SYSTEM_NAME Android)
+if(NOT $ENV{ANDROID_HOME} STREQUAL "")
+  set(CMAKE_ANDROID_NDK $ENV{ANDROID_HOME}/ndk-bundle)
+else()
+  set(CMAKE_ANDROID_NDK $ENV{HOME}/Android/Sdk/ndk-bundle)
+endif()
+set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang)
+set(CMAKE_ANDROID_ARCH_ABI arm64-v8a)
+set(CMAKE_ANDROID_STL_TYPE c++_shared)
+if(APPLE)
+  set(CMAKE_RANLIB "${CMAKE_ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ranlib")
+  set(CMAKE_AR "${CMAKE_ANDROID_NDK}/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/aarch64-linux-android/bin/ar")
+endif()
diff --git a/build/strip_cmakelists.sh b/build/strip_cmakelists.sh
new file mode 100755
index 0000000..161fd3d
--- /dev/null
+++ b/build/strip_cmakelists.sh
@@ -0,0 +1,2 @@
+cd $(dirname $0)
+go run strip_unneeded.go --file=../CMakeLists.txt --test="cmake -DREACTOR_BACKEND=LLVM -DREACTOR_EMIT_DEBUG_INFO=1 .. && cmake --build ."
\ No newline at end of file
diff --git a/build/strip_unneeded.go b/build/strip_unneeded.go
new file mode 100644
index 0000000..a4a1bf5
--- /dev/null
+++ b/build/strip_unneeded.go
@@ -0,0 +1,123 @@
+// 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.
+
+// strip_unneeded is a tool that attempts to remove unnecessary lines from a
+// file by running a test script after each marked line is removed.
+//
+// strip_unneeded will scan the file specified by the --file argument for lines
+// that contain the substring specified by the --marker argument. One-by-one
+// those marked lines will be removed from the file, after which the test script
+// specified by --test will be run. If the test passes (the process completes
+// with a 0 return code), then the line will remain removed, otherwise it is
+// restored. This will repeat for every line in the file containing the marker,
+// until all lines are tested.
+package main
+
+import (
+	"flag"
+	"fmt"
+	"io/ioutil"
+	"os"
+	"os/exec"
+	"strings"
+)
+
+var (
+	file   = flag.String("file", "", "file to modify")
+	marker = flag.String("marker", "CHECK_NEEDED", "line token")
+	test   = flag.String("test", "", "test script to run with each change")
+)
+
+func main() {
+	if err := run(); err != nil {
+		fmt.Println(err.Error())
+		os.Exit(1)
+	}
+}
+
+func run() error {
+	flag.Parse()
+	if *file == "" {
+		return fmt.Errorf("Missing --file argument")
+	}
+	if *marker == "" {
+		return fmt.Errorf("Missing --marker argument")
+	}
+	if *test == "" {
+		return fmt.Errorf("Missing --test argument")
+	}
+
+	// make sure the test passes with no modifications
+	if err := runTest(); err != nil {
+		return fmt.Errorf("Test fails with no modifications.\n%v", err)
+	}
+
+	// load the test file
+	body, err := ioutil.ReadFile(*file)
+	if err != nil {
+		return fmt.Errorf("Couldn't load file '%v'", *file)
+	}
+
+	// gather all the lines
+	allLines := strings.Split(string(body), "\n")
+
+	// find all the lines with the marker
+	markerLines := make([]int, 0, len(allLines))
+	for i, l := range allLines {
+		if strings.Contains(l, *marker) {
+			markerLines = append(markerLines, i)
+		}
+	}
+
+	omit := map[int]bool{}
+
+	save := func() error {
+		f, err := os.Create(*file)
+		if err != nil {
+			return err
+		}
+		defer f.Close()
+		for i, l := range allLines {
+			if !omit[i] {
+				f.WriteString(l)
+				f.WriteString("\n")
+			}
+		}
+		return nil
+	}
+
+	for i, l := range markerLines {
+		omit[l] = true
+		if err := save(); err != nil {
+			return err
+		}
+		if err := runTest(); err != nil {
+			omit[l] = false
+			fmt.Printf("%d/%d: Test fails when removing line %v: %v\n", i, len(markerLines), l, allLines[l])
+		} else {
+			fmt.Printf("%d/%d: Test passes when removing line %v: %v\n", i, len(markerLines), l, allLines[l])
+		}
+	}
+
+	return save()
+}
+
+func runTest() error {
+	cmd := exec.Command("sh", "-c", *test)
+	out, err := cmd.CombinedOutput()
+	if err != nil {
+		return fmt.Errorf("Test failed with error: %v\n%v", err, string(out))
+	}
+	return nil
+}
diff --git a/build_overrides/build.gni b/build_overrides/build.gni
new file mode 100644
index 0000000..e2af644
--- /dev/null
+++ b/build_overrides/build.gni
@@ -0,0 +1,15 @@
+# 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.
+
+build_with_chromium = false
diff --git a/build_overrides/spirv_tools.gni b/build_overrides/spirv_tools.gni
new file mode 100644
index 0000000..7364b5c
--- /dev/null
+++ b/build_overrides/spirv_tools.gni
@@ -0,0 +1,20 @@
+# 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.
+
+# We are building inside SwiftShader
+spirv_tools_standalone = false
+
+# Paths to SPIRV-Tools dependencies in SwiftShader
+spirv_tools_googletest_dir = "//third_party/googletest"
+spirv_tools_spirv_headers_dir = "//third_party/SPIRV-Headers"
diff --git a/build_overrides/swiftshader.gni b/build_overrides/swiftshader.gni
new file mode 100644
index 0000000..e2eda47
--- /dev/null
+++ b/build_overrides/swiftshader.gni
@@ -0,0 +1,19 @@
+# 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.
+
+# We are building SwiftShader standalone
+swiftshader_standalone = true
+
+# Path to SwiftShader
+swiftshader_dir = "//"
diff --git a/build_overrides/wayland.gni b/build_overrides/wayland.gni
new file mode 100644
index 0000000..e50b0fd
--- /dev/null
+++ b/build_overrides/wayland.gni
@@ -0,0 +1,18 @@
+# Copyright 2022 The SwiftShader Authors. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#    http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+ozone_platform_wayland = true
+
+# SwiftShader has no wayland third-party dir
+wayland_gn_dir = ""
diff --git a/codereview.settings b/codereview.settings
new file mode 100644
index 0000000..4ff2001
--- /dev/null
+++ b/codereview.settings
@@ -0,0 +1,4 @@
+# This file is used by git cl to get repository specific information.
+PROJECT: swiftshader
+GERRIT_HOST: True
+GERRIT_SQUASH_UPLOADS: False
diff --git a/docs/ArchitectureLayers.png b/docs/ArchitectureLayers.png
new file mode 100644
index 0000000..8049804
--- /dev/null
+++ b/docs/ArchitectureLayers.png
Binary files differ
diff --git a/docs/Exp-Log-Optimization.pdf b/docs/Exp-Log-Optimization.pdf
new file mode 100644
index 0000000..a2424d0
--- /dev/null
+++ b/docs/Exp-Log-Optimization.pdf
Binary files differ
diff --git a/docs/Index.md b/docs/Index.md
new file mode 100644
index 0000000..2ec49f5
--- /dev/null
+++ b/docs/Index.md
@@ -0,0 +1,65 @@
+> :warning: **Out of date**

+

+SwiftShader Documentation

+=========================

+

+SwiftShader provides high-performance graphics rendering on the CPU. It eliminates the dependency on graphics hardware capabilities.

+

+Architecture

+------------

+

+SwiftShader provides shared libraries (DLLs) which implement standardized graphics APIs. Applications already using these APIs thus don't require any changes to use SwiftShader. It can run entirely in user space, or as a driver (for Android), and output to either a frame buffer, a window, or an offscreen buffer.

+

+To achieve exceptional performance, SwiftShader is built around two major optimizations that affect its architecture: dynamic code generation, and parallel processing. Generating code at run-time allows to eliminate code branches and optimizes register usage, specializing the processing routines for exactly the operations required by each draw call. Parallel processing means both utilizing the CPU's multiple cores and processing multiple elements accoss the width of the SIMD vector units.

+

+Structurally there are four major layers:

+

+![API, Renderer, Reactor, JIT](/docs/ArchitectureLayers.png "Architecture Layers")

+

+The API layer is an implementation of a graphics API, such as OpenGL (ES) or Direct3D, on top of the Renderer interface. It is responsible for managing API-level resources and rendering state, as well as compiling high-level shaders to bytecode form. 

+

+The Renderer layer generates specialized processing routines for draw calls and coordinates the execution of rendering tasks. It defines the data structures used and how the processing is performed.

+

+Reactor is an embedded language for C++ to dynamically generate code in a WYSIWYG fashion. It allows to specialize the processing routines for the state and shaders used by each draw call. Its syntax closely resembles C and shading languages, to make the code generation easily readable.

+

+The JIT layer is a run-time compiler, such as [LLVM](http://llvm.org/)'s JIT, or [Subzero](Subzero.md). Reactor records its operations in an in-memory intermediate form which can be materialized by the JIT into a function which can be called directly.

+

+Design

+------

+

+### Reactor

+

+To generate code for an expression such as `float y = 1 - x;` directly with LLVM, we'd need code like `Value *valueY = BinaryOperator::CreateSub(ConstantInt::get(Type::getInt32Ty(Context), 1), valueX, "y", basicBlock);`. This is very verbose and becomes hard to read for longer expressions. Using C++ operator overloading, [Reactor](../src/Reactor/) simplifies this to `Float y = 1 - x;`. Note that Reactor types have the same names as C types, but starting with a capital letter. Likewise `If()`, `Else`, and `For(,,)` implement their C counterparts.

+

+While making Reactor's syntax so similar to the C++ in which it is written might cause some confusion at first, it provides a powerful abstraction for code specialization. For example to produce the code for an addition or a subtraction, one could write `x = addOrSub ? x + y : x - y;`. Note that only one operation ends up in the generated code.

+

+We refer to the functions generated by Reactor code as [Routine](../src/Reactor/Routine.hpp)s.

+

+More details on Reactor can be found in [Reactor.md](Reactor.md).

+

+### Renderer

+

+The [Renderer](../src/Renderer/) layer is implemented in three main parts: the [VertexProcessor](../src/Renderer/VertexProcessor.cpp), [SetupProcessor](../src/Renderer/SetupProcessor.cpp), and [PixelProcessor](../src/Renderer/PixelProcessor.cpp). Each "processor" produces a corresponding Reactor routine, and manages the relevant graphics state. They also keep a cache of already generated routines, so that when a combination of states is encountered again it will reuse the routine that performs the desired processing.

+

+The [VertexRoutine](../src/Shader/VertexRoutine.cpp) produces a function for processing a batch of vertices. The fixed-function T&L pipeline is implemented by [VertexPipeline](../src/Shader/VertexPipeline.cpp), while programmable vertex processing with a shader is implemented by [VertexProgram](../src/Shader/VertexProgram.cpp). Note that the vertex routine also performs vertex attribute reading, vertex caching, viewport transform, and clip flag calculation all in the same function.

+

+The [SetupRoutine](../src/Shader/SetupRoutine.cpp) performs primitive setup. This constitutes back-face culling, computing gradients, and rasterization.

+

+The [PixelRoutine](../src/Shader/PixelRoutine.cpp) takes a batch of primitives and performs per-pixel operations. The fixed-function texture stages and legacy integer shaders are implemented by [PixelPipeline](../src/Shader/PixelPipeline.cpp), while programmable pixel processing with a shader is implemented by [PixelProgram](../src/Shader/PixelProgram.cpp). All other per-pixel operations such as the depth test, alpha test, stenciling, and alpha blending are also performed in the pixel routine. Together with the traversal of the pixels in [QuadRasterizer](../src/Renderer/QuadRasterizer.cpp), it forms one function.

+

+The PixelProgram and VertexProgram share some common functionality in [ShaderCore](../src/Shader/ShaderCore.cpp). Likewise, texture sampling is implemented by [SamplerCore](../src/Shader/SamplerCore.cpp).

+

+Aside from creating and managing the processing routines with the help of the Processor classes, the Renderer also subdivides and schedules rendering tasks onto multiple threads.

+

+### OpenGL

+

+The OpenGL (ES) and EGL APIs are implemented in [src/OpenGL/](../src/OpenGL/).

+

+The GLSL compiler is implemented in [src/OpenGL/compiler/](../src/OpenGL/compiler/). It uses [Flex](http://flex.sourceforge.net/) and [Bison](https://www.gnu.org/software/bison/) to tokenize and parse GLSL shader source. It produces an [abstract syntax tree](https://en.wikipedia.org/wiki/Abstract_syntax_tree) (AST), which is then traversed to output assembly-level instructions in [OutputASM.cpp](../src/OpenGL/compiler/OutputASM.cpp).

+

+The [EGL](https://www.khronos.org/registry/egl/specs/eglspec.1.4.20110406.pdf) API is implemented in [src/OpenGL/libEGL/](../src/OpenGL/libEGL/). Its entry functions are listed in [libEGL.def](../src/OpenGL/libEGL/libEGL.def) (for Windows) and [libEGL.lds](../src/OpenGL/libEGL/libEGL.lds) (for Linux), and defined in [main.cpp](../src/OpenGL/libEGL/main.cpp) and implemented in [libEGL.cpp](../src/OpenGL/libEGL/libEGL.cpp). The [Display](../src/OpenGL/libEGL/Display.h), [Surface](../src/OpenGL/libEGL/Surface.h), and [Config](../src/OpenGL/libEGL/Config.h) classes are respective implementations of the abstract EGLDisplay, EGLSurface, and EGLConfig types.

+

+[OpenGL ES 2.0](https://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf) is implemented in [src/OpenGL/libGLESv2/](../src/OpenGL/libGLESv2/). Note that while [OpenGL ES 3.0](https://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.0.pdf) functions are implemented in [libGLESv3.cpp](../src/OpenGL/libGLESv2/libGLESv3.cpp), it is compiled into the libGLESv2 library as standard among most implementations (some platforms have a libGLESv3 symbolically link to libGLESv2). We'll focus on OpenGL ES 2.0 in this documentation.

+

+When the application calls an OpenGL function, it lands in the C entry functions at [main.cpp](../src/OpenGL/libGLESv2/main.cpp). It then gets dispatched to [libGLESv2.cpp](../src/OpenGL/libGLESv2/libGLESv2.cpp) functions in the es2 namespace. These functions obtain the thread's OpenGL context, and perform validation of the call's parameters. Most functions then call a corresponding [Context](../src/OpenGL/libGLESv2/Context.h) method to perform the call's main operations (changing state or queuing a draw task).

+

diff --git a/docs/LLVM.md b/docs/LLVM.md
new file mode 100644
index 0000000..ce504c2
--- /dev/null
+++ b/docs/LLVM.md
@@ -0,0 +1,114 @@
+LLVM Dependency
+===============
+
+Overview
+--------
+
+SwiftShader's [Reactor](Reactor.md) library uses LLVM
+as one of its JIT-compiler backends. This page contains notes about building and
+upgrading LLVM.
+
+Directory structure
+-------------------
+
+The current version of LLVM we use is 10, and can be found in
+`third_party/llvm-10.0`.
+
+In this folder you will find the following directories:
+
+*   configs : Contains per-platform headers that LLVM sources include to
+    configure the build. These are generated by running `scripts/update.py`
+    (more on that below).
+*   llvm : Contains a subset of the LLVM source code needed to build the JIT
+    support required by SwiftShader.
+*   scripts : Contains `update.py`, which is used to update the files in the
+    `configs` folder. More on that below.
+
+Updating the current version of LLVM to latest
+----------------------------------------------
+
+Updating to the latest version of LLVM can be tricky to do manually, especially
+because the [llvm-project repo](https://github.com/llvm/llvm-project) includes
+much more than just LLVM (e.g. it includes all the Clang source). Furthermore,
+we may have local changes to our copy of LLVM that must be maintained, or at
+least considered across updates.
+
+To ease this pain, run the script `third_party/update-llvm-10.sh` on Linux. This
+script works by updating a separate branch of SwiftShader, `llvm10-clean`, on
+which the latest snapshot of LLVM is fetched and committed, and then this branch
+is merged back into `master`. During the merge, if there are conflicts to
+resolve because of local changes we've made, these can be resolved in the usual
+manner, and the merge can be resumed.
+
+The script is configured to fetch from the branch in `LLVM_REPO_BRANCH`, and
+will automatically grab the latest commit on that branch.
+
+Although not always necessary, if there were new configuration variables added
+or modified, you may need to run `update.py` as described below. Otherwise, if
+all goes well, the update to LLVM can be committed and pushed.
+
+Updating LLVM configuration files
+---------------------------------
+
+The script `third_party/llvm-10.0/scripts/update.py` is used to update the
+config files in `third_party/llvm-10.0/configs`.
+
+Before running this script, you must make sure to update two variables in it
+(and commit this change):
+
+```
+# LLVM_BRANCH must match the value of the same variable in third_party/update-llvm-10.sh
+LLVM_BRANCH = "release/10.x"
+
+# LLVM_COMMIT must be set to the commit hash that we last updated to when running third_party/update-llvm-10.sh.
+# Run 'git show -s origin/llvm10-clean' and look for 'llvm-10-update: <hash>' to retrieve it.
+LLVM_COMMIT = "d32170dbd5b0d54436537b6b75beaf44324e0c28"
+```
+
+The script takes a platform as argument, and extra CMake args. For example, to
+update the Linux configs, run:
+
+```
+python3 update.py linux -j 200
+```
+
+This script does the following:
+
+*   Clones the LLVM repo and checks out `LLVM_COMMIT` from `LLVM_BRANCH`.
+*   Builds LLVM specifically for the target architectures specified in
+    `LLVM_TRIPLES` dictionary.
+*   Copies the specified platform config files to
+    `third_party/llvm-10.0/configs`, applying certain transformations to the
+    files, such as undefining macros listed in `LLVM_UNDEF_MACROS` (see the
+    `copy_platform_file` function).
+
+Note that certain configuration options depend on the host OS, you will need to
+run the script on the right host OS. See the `LLVM_PLATFORM_TO_HOST_SYSTEM`
+dictionary for the mapping, which looks like this at the time of this writing:
+
+```
+# Mapping of target platform to the host it must be built on
+LLVM_PLATFORM_TO_HOST_SYSTEM = {
+    'android': 'Linux',
+    'darwin': 'Darwin',
+    'linux': 'Linux',
+    'windows': 'Windows',
+    'fuchsia': 'Linux'
+}
+```
+
+Generally, Windows to build Window, Darwin to build Darwin (MacOS), and Linux
+for everything else. Also note that for android and fuchsia, the config is
+closest to that of Linux, but you will likely have to manually tweak the configs
+(in particular, `configs/<platform>/include/llvm/Config/config.h`).
+
+Supported platforms, architectures, and build systems
+-----------------------------------------------------
+
+SwiftShader is used by many products on many architectures:
+
+*   OS: Windows, Linux, MacOS, Android, Fuchsia
+*   Architecture: x64, x86, ARM, ARM64, MIPS, MIPS64
+*   Build systems: CMake, GN, Soong, Blaze
+
+Upgrading/updating LLVM usually entails making sure it builds for all of these.
\ No newline at end of file
diff --git a/docs/Reactor.md b/docs/Reactor.md
new file mode 100644
index 0000000..5666851
--- /dev/null
+++ b/docs/Reactor.md
@@ -0,0 +1,311 @@
+Reactor Documentation

+=====================

+

+Reactor is an embedded language for C++ to facilitate dynamic code generation and specialization.

+

+Introduction

+------------

+

+To generate the code for an expression such as

+```C++

+float y = 1 - x;

+```

+using the LLVM compiler framework, one needs to execute

+```C++

+Value *valueY = BinaryOperator::CreateSub(ConstantInt::get(Type::getInt32Ty(Context), 1), valueX, "y", basicBlock);

+```

+

+For large expressions this quickly becomes hard to read, and tedious to write and modify.

+

+With Reactor, it becomes as simple as writing

+```C++

+Float y = 1 - x;

+```

+Note the capital letter for the type. This is not the code to perform the calculation. It's the code that when executed will record the calculation to be performed.

+

+This is possible through the use of C++ operator overloading. Reactor also supports control flow constructs and pointer arithmetic with C-like syntax.

+

+Motivation

+----------

+

+Just-in-time (JIT) compiled code has the potential to be faster than statically compiled code, through [run-time specialization](http://en.wikipedia.org/wiki/Run-time_algorithm_specialisation). However, this is rarely achieved in practice.

+

+Specialization in general is the use of a more optimal routine that is specific for a certain set of conditions. For example when sorting two numbers it is faster to swap them if they are not yet in order, than to call a generic quicksort function. Specialization can be done statically, by explicitly writing each variant or by using metaprogramming to generate multiple variants at static compile time, or dynamically by examining the parameters at run-time and generating a specialized path.

+

+Because specialization can be done statically, sometimes aided by metaprogramming, the ability of a JIT-compiler to do it at run-time is often disregarded. Specialized benchmarks show no advantage of JIT code over static code. However, having a specialized benchmark does not take into account that a typical real-world application deals with many unpredictable conditions. Systems can have one core or several dozen cores, and many different ISA extensions. This alone can make it impractical to write fully specialized routines manually, and with the help of metaprogramming it results in code bloat. Worse yet, any non-trivial application has a layered architecture in which lower layers (e.g. framework APIs) know very little or nothing about the usage by higher layers. Various parameters also depend on user input. Run-time specialization can have access to the full context in which each routine executes, and although the optimization contribution of specialization for a single parameter is small, the combined speedup can be huge. As an extreme example, interpreters can execute any kind of program in any language, but by specializing for a specific program you get a compiled version of that program. But you don't need a full-blown language to observe a huge difference between interpretation and specialization through compilation. Most applications process some form of list of commands in an interpreted fashion, and even the series of calls into a framework API can be compiled into a more efficient whole at run-time.

+

+While the benefit of run-time specialization should now be apparent, JIT-compiled languages lack many of the practical advantages of static compilation. JIT-compilers are very constrained in how much time they can spend on compiling the bytecode into machine code. This limits their ability to even reach parity with static compilation, let alone attempt to exceed it by performing run-time specialization. Also, even if the compilation time was not as constrained, they can't specialize at every opportunity because it would result in an explosive growth of the amount of generated code. There's a need to be very selective in only specializing the hotspots for often recurring conditions, and to manage a cache of the different variants. Even just selecting the size of the set of variables that form the entire condition to specialize for can get immensely complicated.

+

+Clearly we need a manageable way to benefit from run-time specialization where it would help significantly, while still resorting to static compilation for anything else. A crucial observation is that the developer has expectations about the application's behavior, which is valuable information which can be exploited to choose between static or JIT-compilation. One way to do that is to use an API which JIT-compiles the commands provided by the application developer. An example of this is an advanced DBMS which compiles the query into an optimized sequence of routines, each specialized to the data types involved, the sizes of the CPU caches, etc. Another example is a modern graphics API, which takes shaders (a routine executed per pixel or other element) and a set of parameters which affect their execution, and compiles them into GPU-specific code. However, these examples have a very hard divide between what goes on inside the API and outside. You can't exchange data between the statically compiled outside world and the JIT-compiled routines, unless through the API, and they have very different execution models. In other words they are highly domain specific and not generic ways to exploit run-time specialization in arbitrary code.

+

+This is becoming especially problematic for GPUs, as they are now just as programmable as CPUs but you can still only command them through an API. Attempts to disguise this by using a single language, such as C++AMP and SYCL, still have difficulties expressing how data is exchanged, don't actually provide control over the specialization, they have hidden overhead, and they have unpredictable performance characteristics across devices. Meanwhile CPUs gain ever more cores and wider SIMD vector units, but statically compiled languages don't readily exploit this and can't deal with the many code paths required to extract optimal performance. A different language and framework is required.

+

+Concepts and Syntax

+-------------------

+

+### Routine and Function<>

+

+Reactor allows you to create new functions at run-time. Their generation happens in C++, and after materializing them they can be called during the execution of the same C++ program. We call these dynamically generated functions "routines", to discern them from statically compiled functions and methods. Reactor's `Routine` class encapsulates a routine. Deleting a Routine object also frees the memory used to store the routine.

+

+To declare the function signature of a routine, use the `Function<>` template. The template argument is the signature of a function, using Reactor variable types. Here's a complete definition of a routine taking no arguments and returning an integer:

+

+`C++

+Function<Int(Void)> function;

+{

+    Return(1);

+}

+`

+

+The braces are superfluous. They just make the syntax look more like regular C++, and they offer a new scope for Reactor variables.

+

+The Routine is obtained and materialized by "calling" the `Function<>` object to give it a name:

+

+```C++

+auto routine = function("one");

+```

+

+Finally, we can obtain the function pointer to the entry point of the routine, and call it:

+

+```C++

+int (*callable)() = (int(*)())routine->getEntry();

+

+int result = callable();

+assert(result == 1);

+```

+

+Note that `Function<>` objects are relatively heavyweight, since they have the entire JIT-compiler behind them, while `Routine` objects are lightweight and merely provide storage and lifetime management of generated routines. So we typically allow the `Function<>` object to be destroyed (by going out of scope), while the `Routine` object is retained until we no longer need to call the routine. Hence the distinction between them and the need for a couple of lines of boilerplate code.

+

+### Arguments and Expressions

+

+Routines can take various arguments. The following example illustrates the syntax for accessing the arguments of a routine which takes two integer arguments and returns their sum:

+

+```C++

+Function<Int(Int, Int)> function;

+{

+    Int x = function.Arg<0>();

+    Int y = function.Arg<1>();

+

+    Int sum = x + y;

+

+    Return(sum);

+}

+```

+

+Reactor supports various types which correspond to C++ types:

+

+| Class name    | C++ equivalent |

+| ------------- |----------------|

+| Int           | int32_t        |

+| UInt          | uint32_t       |

+| Short         | int16_t        |

+| UShort        | uint16_t       |

+| Byte          | uint8_t        |

+| SByte         | int8_t         |

+| Long          | int64_t        |

+| ULong         | uint64_t       |

+| Float         | float          |

+

+Note that bytes are unsigned unless prefixed with S, while larger integers are signed unless prefixed with U.

+

+These scalar types support all of the C++ arithmetic operations.

+

+Reactor also supports several vector types. For example `Float4` is a vector of four floats. They support a select number of C++ operators, and several "intrinsic" functions such as `Max()` to compute the element-wise maximum and return a bit mask. Check [Reactor.hpp](../src/Reactor/Reactor.hpp) for all the types, operators and intrinsics.

+

+### Casting and Reinterpreting

+

+Types can be cast using the constructor-style syntax:

+

+```C++

+Function<Int(Float)> function;

+{

+    Float x = function.Arg<0>();

+

+    Int cast = Int(x);

+

+    Return(cast);

+}

+```

+

+You can reinterpret-cast a variable using `As<>`:

+

+```C++

+Function<Int(Float)> function;

+{

+    Float x = function.Arg<0>();

+

+    Int reinterpret = As<Int>(x);

+

+    Return(reinterpret);

+}

+```

+

+Note that this is a bitwise cast. Unlike C++'s `reinterpret_cast<>`, it does not allow casting between different sized types. Think of it as storing the value in memory and then loading from that same address into the casted type.

+

+An important exception is that 16-, 8-, and 4-byte vectors can be cast to other vectors of one of these sizes. Casting to a longer vector leaves the upper contents undefined.

+

+### Pointers

+

+Pointers also use a template class:

+

+```C++

+Function<Int(Pointer<Int>)> function;

+{

+    Pointer<Int> x = function.Arg<0>();

+

+    Int dereference = *x;

+

+    Return(dereference);

+}

+```

+

+Pointer arithmetic is only supported on `Pointer<Byte>`, and can be used to access structure fields:

+

+```C++

+struct S

+{

+    int x;

+    int y;

+};

+

+Function<Int(Pointer<Byte>)> function;

+{

+    Pointer<Byte> s = function.Arg<0>();

+

+    Int y = *Pointer<Int>(s + offsetof(S, y));

+

+    Return(y);

+}

+```

+

+Reactor also defines an `OFFSET()` macro, which is a generalization of the `offsetof()` macro defined in `<cstddef>`. It allows e.g. getting the offset of array elements, even when indexed dynamically.

+

+### Conditionals

+

+To generate for example the [unit step](https://en.wikipedia.org/wiki/Heaviside_step_function) function:

+

+```C++

+Function<Float(Float)> function;

+{

+    Pointer<Float> x = function.Arg<0>();

+

+    If(x > 0.0f)

+    {

+        Return(1.0f);

+    }

+    Else If(x < 0.0f)

+    {

+        Return(0.0f);

+    }

+    Else

+    {

+        Return(0.5f);

+    }

+}

+```

+

+There's also an IfThenElse() intrinsic function which corresponds with the C++ ?: operator.

+

+### Loops

+

+Loops also have a syntax similar to C++:

+

+```C++

+Function<Int(Pointer<Int>, Int)> function;

+{

+    Pointer<Int> p = function.Arg<0>();

+    Int n = function.Arg<1>();

+    Int total = 0;

+

+    For(Int i = 0, i < n, i++)

+    {

+        total += p[i];

+    }

+

+    Return(total);

+}

+```

+

+Note the use of commas instead of semicolons to separate the loop expressions.

+

+`While(expr) {}` also works as expected, but there is no `Do {} While(expr)` equivalent because we can't discern between them. Instead, there's a `Do {} Until(expr)` where you can use the inverse expression to exit the loop.

+

+Specialization

+--------------

+

+The above examples don't illustrate anything that can't be written as regular C++ function. The real power of Reactor is to generate routines that are specialized for a certain set of conditions, or "state".

+

+```C++

+Function<Int(Pointer<Int>, Int)> function;

+{

+    Pointer<Int> p = function.Arg<0>();

+    Int n = function.Arg<1>();

+    Int total = 0;

+

+    For(Int i = 0, i < n, i++)

+    {

+        if(state.operation == ADD)

+        {

+            total += p[i];

+        }

+        else if(state.operation == SUBTRACT)

+        {

+            total -= p[i];

+        }

+        else if(state.operation == AND)

+        {

+            total &= p[i];

+        }

+        else if(...)

+        {

+            ...

+        }

+    }

+

+    Return(total);

+}

+```

+

+Note that this example uses regular C++ `if` and `else` constructs. They only determine which code ends up in the generated routine, and don't end up in the generated code themselves. Thus the routine contains a loop with just one arithmetic or logical operation, making it more efficient than if this was written in regular C++.

+

+Of course one could write an equivalent efficient function in regular C++ like this:

+

+```C++

+int function(int *p, int n)

+{

+    int total = 0;

+

+    if(state.operation == ADD)

+    {

+        for(int i = 0; i < n; i++)

+        {

+            total += p[i];

+        }

+    }

+    else if(state.operation == SUBTRACT)

+    {

+        for(int i = 0; i < n; i++)

+        {

+            total -= p[i];

+        }

+    }

+    else if(state.operation == AND)

+    {

+        for(int i = 0; i < n; i++)

+        {

+            total &= p[i];

+        }

+    }

+    else if(...)

+    {

+        ...

+    }

+

+    return total;

+}

+```

+

+But now there's a lot of repeated code. It could be made more manageable using macros or templates, but that doesn't help reduce the binary size of the statically compiled code. That's fine when there are only a handful of state conditions to specialize for, but when you have multiple state variables with many possible values each, the total number of combinations can be prohibitive.

+

+This is especially the case when implementing APIs which offer a broad set of features but developers are likely to only use a select set. The quintessential example is graphics processing, where there are are long pipelines of optional operations and both fixed-function and programmable stages. Applications configure the state of these stages between each draw call.

+

+With Reactor, we can write the code for such pipelines in a syntax that is as easy to read as a naive unoptimized implementation, while at the same time specializing the code for exactly the operations required by the pipeline configuration.

diff --git a/docs/ReactorDebugInfo.md b/docs/ReactorDebugInfo.md
new file mode 100644
index 0000000..3b612d4
--- /dev/null
+++ b/docs/ReactorDebugInfo.md
@@ -0,0 +1,237 @@
+# Reactor Debug Info Generation
+
+## Introduction
+
+Reactor produces Just In Time compiled dynamic executable code and can be used to JIT high performance functions specialized for runtime
+configurations, or to even build a compiler.
+
+In order to debug executable code at a higher level than disassembly, source code files are required.
+
+Reactor has two potential sources of source code:
+
+1. The C++ source code of the program that calls into Reactor.
+2. External source files read by the program and passed to Reactor.
+
+While case (2) is preferable for implementing a compiler, this is currently not
+implemented.
+
+Reactor implements case (1) and this can be used by GDB to single line step and
+inspect variables.
+
+## Supported Platforms
+
+Currently:
+
+* Debug info generation is only supported on Linux with the LLVM 7
+backend.
+* GDB is the only supported debugger.
+* The program must be compiled with debug info iteself.
+
+## Enabling
+
+Debug generation is enabled with `REACTOR_EMIT_DEBUG_INFO` CMake flag (defaults
+to disabled).
+
+## Implementation details
+
+### Source Location
+
+All Reactor functions begin with a call to `RR_DEBUG_INFO_UPDATE_LOC()`, which calls into `rr::DebugInfo::EmitLocation()`.
+
+`rr::DebugInfo::EmitLocation()` calls `rr::DebugInfo::getCallerBacktrace()`,
+which in turn uses [`libbacktrace`](https://github.com/ianlancetaylor/libbacktrace)
+to unwind the stack and find the file, function and line of the caller.
+
+This information is passed to `llvm::IRBuilder<>::SetCurrentDebugLocation`
+to emit source line information for the next LLVM instructions to be built.
+
+### Variables
+
+There are 3 aspects to generating variable debug information:
+
+#### 1. Variable names
+
+Constructing a Reactor `LValue`:
+
+```C++
+rr::Int a = 1;
+```
+
+Will emit an LLVM `alloca` instruction to allocate the storage of the variable,
+and emit another to initialize it to the constant `1`. While fluent, none of the
+Reactor calls see the name of the C++ local variable "`a`", and the LLVM `alloca`
+value gets a meaningless numerical value.
+
+There are two potential ways that Reactor can obtain the variable name:
+
+1. Use the running executable's own debug information to examine the local
+   declaration and extract the local variable's name.
+2. Use the backtrace information to parse the name from the source file.
+
+While (1) is arguably a cleaner and more robust solution, (2) is
+easier to implement and can work for the majority of use cases.
+
+(2) is the current solution implemented.
+
+`rr::DebugInfo::getOrParseFileTokens()` scans a source file line by line, and
+uses a regular expression to look for patterns of `<type> <name>`. Matching is not
+precise, but is adequate to find locals constructed with and without assignment.
+
+#### 2. Variable binding
+
+Given that we can find a variable name for a given source line, we need a way of
+binding the LLVM values to the name.
+
+Given our trivial example:
+
+```C++
+rr::Int a = 1
+```
+
+The `rr::Int` constructor calls `RR_DEBUG_INFO_EMIT_VAR()` passing the storage
+value as single argument. `RR_DEBUG_INFO_EMIT_VAR()` performs the backtrace
+to find the source file and line and uses the token information produced by
+`rr::DebugInfo::getOrParseFileTokens()` to identify the variable name.
+
+However, things get a bit more complicated when there are multiple variables
+being constructed on the same line.
+
+Take for example:
+
+```C++
+rr::Int a = rr::Int(1) + rr::Int(2)
+```
+
+Here we have 3 calls to the `rr::Int` constructor, each calling down
+to `RR_DEBUG_INFO_EMIT_VAR()`.
+
+To disambiguate which of these should be bound to the variable name "`a`",
+`rr::DebugInfo::EmitVariable()` buffers the binding into
+`scope.pending` and the last binding for a given line is used by
+`DebugInfo::emitPending()`. For variable construction and assignment, C++
+guarantees that the LHS is the last value to be constructed.
+
+This solution is not perfect.
+
+Multi-line expressions, multiple assignments on a single line, macro obfuscation
+can all break variable bindings - however the majority of typical cases work.
+
+#### 3. Variable scope
+
+`rr::DebugInfo` maintains a stack of `llvm::DIScope`s and `llvm::DILocation`s
+that mirrors the current backtrace for function being called.
+
+A synthetic call stack is produced by chaining `llvm::DILocation`s with
+`InlinedAt`s.
+
+For example, at the declaration of `i`:
+
+```C++
+void B()
+{
+    rr::Int i; // <- here
+}
+
+void A()
+{
+    B();
+}
+
+int main(int argc, const char* argv[])
+{
+    A();
+}
+```
+
+The `DIScope` hierarchy would be:
+
+```C++
+                              DIFile: "foo.cpp"
+rr::DebugInfo::diScope[0].di: ↳ DISubprogram: "main"
+rr::DebugInfo::diScope[1].di: ↳ DISubprogram: "A"
+rr::DebugInfo::diScope[2].di: ↳ DISubprogram: "B"
+```
+
+The `DILocation` hierarchy would be:
+
+```C++
+rr::DebugInfo::diRootLocation:      DILocation(DISubprogram: "ReactorFunction")
+rr::DebugInfo::diScope[0].location: ↳ DILocation(DISubprogram: "main")
+rr::DebugInfo::diScope[1].location:   ↳ DILocation(DISubprogram: "A")
+rr::DebugInfo::diScope[2].location:     ↳ DILocation(DISubprogram: "B")
+```
+
+Where '↳' represents an `InlinedAt`.
+
+
+`rr::DebugInfo::diScope` is updated by `rr::DebugInfo::syncScope()`.
+
+`llvm::DIScope`s typically do not nest - there is usually a separate
+`llvm::DISubprogram` for each function in the callstack. All local variables
+within a function will typically share the same scope, regardless of whether
+they are declared within a sub-block.
+
+Loops and jumps within a function add complexity. Consider:
+
+```C++
+void B()
+{
+    rr::Int i = 0;
+}
+
+void A()
+{
+    for (int i = 0; i < 3; i++)
+    {
+        rr::Int x = 0;
+    }
+    B();
+}
+
+int main(int argc, const char* argv[])
+{
+    A();
+}
+```
+
+In this particular example Reactor will not be aware of the `for` loop, and will
+attempt to create three variables called "`x`" in the same function scope for `A()`.
+Duplicate symbols in the same `llvm::DIScope` result in undefined behavior.
+
+To solve this, `rr::DebugInfo::syncScope()` observes when a function jumps
+backwards, and forks the current `llvm::DILexicalBlock` for the function. This
+results in a number of `llvm::DILexicalBlock` chains, each declaring variables
+that shadow the previous block.
+
+At the declaration of `i`, the `DIScope` hierarchy would be:
+
+```C++
+                              DIFile: "foo.cpp"
+rr::DebugInfo::diScope[0].di: ↳ DISubprogram: "main"
+                              ↳ DISubprogram: "A"
+                              | ↳ DILexicalBlock: "A".1
+rr::DebugInfo::diScope[1].di: |   ↳ DILexicalBlock: "A".2
+rr::DebugInfo::diScope[2].di: ↳ DISubprogram: "B"
+```
+
+The `DILocation` hierarchy would be:
+
+```C++
+rr::DebugInfo::diRootLocation:      DILocation(DISubprogram: "ReactorFunction")
+rr::DebugInfo::diScope[0].location: ↳ DILocation(DISubprogram: "main")
+rr::DebugInfo::diScope[1].location:   ↳ DILocation(DILexicalBlock: "A".2)
+rr::DebugInfo::diScope[2].location:     ↳ DILocation(DISubprogram: "B")
+```
+
+### Debugger integration
+
+Once the debug information has been generated, it needs to be handed to the
+debugger.
+
+Reactor uses [`llvm::JITEventListener::createGDBRegistrationListener()`](http://llvm.org/doxygen/classllvm_1_1JITEventListener.html#a004abbb5a0d48ac376dfbe3e3c97c306)
+to inform GDB of the JIT'd program and its debugging information.
+More information [can be found here](https://llvm.org/docs/DebuggingJITedCode.html).
+
+LLDB should be able to support this same mechanism, but at the time of writing
+this does not appear to work.
+
diff --git a/docs/Regres.md b/docs/Regres.md
new file mode 100644
index 0000000..c752a72
--- /dev/null
+++ b/docs/Regres.md
@@ -0,0 +1,442 @@
+# Regres - SwiftShader automated testing
+
+## Introduction
+
+Regres is a collection of tools to perform [dEQP](https://github.com/KhronosGroup/VK-GL-CTS)
+presubmit and continuous integration testing and code coverage evaluation for
+SwiftShader.
+
+Regres provides:
+
+* [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 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
+  efficiently running a number of dEQP tests based wildcard or regex name
+  matching.
+
+The Regres source root directory is at [`<swiftshader>/tests/regres/`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/).
+
+## Presubmit testing
+
+Regres monitors changes that have been [put up for review with Gerrit](https://swiftshader-review.googlesource.com/q/status:open).
+
+Once a new [qualifying](#qualifying) patchset has been found, regres will
+checkout, build and test the change against the parent changelist. \
+Any differences in results are reported as a review comment on the change
+[[example]](https://swiftshader-review.googlesource.com/c/SwiftShader/+/46369/5#message-4f09ea3e6d01ed94ae26183c8b6c547c90492c12).
+
+### Qualifying
+
+As Regres may be running externally authored code on Google hardware,
+Regres will only test a change if it is authored by or reviewed by a Googler.
+
+Only the most recent patchset of a change will be tested. If a new patchset is
+pushed while the previous is currently being tested, then testing will continue
+to completion and the previous patchsets will be posted, and the new patchset
+will be queued for testing.
+
+### Prioritization
+
+At the time of writing a Regres presubmit run takes a little over 20 minutes to
+complete, and there is a single Regres machine servicing all changes.
+To keep Regres responsive, changes are prioritized based on their 'readiness to
+land', which is determined by the change's `Kokoro-Presubmit`, `Code-Review` and
+`Presubmit-Ready` Gerrit labels.
+
+### Test Filtering
+
+By default, Regres will run all the test lists declared in the
+[`<swiftshader>/tests/regres/ci-tests.json`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/ci-tests.json) file.\
+As new functionally is being implemented, the test lists in `ci-tests.json` may
+reference known-passing test lists updated by the [daily run](#daily-run-continuous-integration-testing),
+so that failing tests for incomplete functionality are skipped, but tests that
+pass for new functionality *are tested* to ensure they do not regres.
+
+Additional tests names found in the files referenced by
+[`<swiftshader>/tests/regres/full-tests.json`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/full-tests.json)
+can be explicitly included in the change's presubmit run
+by including a line in the change description with the signature:
+
+```text
+Test: <dEQP-test-pattern>
+```
+
+`<dEQP-test-pattern>` can be a single dEQP test name, or you can use wildcards
+[as documented here](https://golang.org/pkg/path/filepath/#Match).
+
+You can repeat `Test:` as many times as you like. `Tests:` is also acccepted.
+
+[For example](https://swiftshader-review.googlesource.com/c/SwiftShader/+/26574):
+
+```text
+Add support for OpLogicalEqual, OpLogicalNotEqual
+
+Test: dEQP-VK.glsl.operator.bool_compare.*
+Test: dEQP-VK.glsl.operator.binary_operator.equal.*
+Test: dEQP-VK.glsl.operator.binary_operator.not_equal.*
+Bug: b/126870789
+Change-Id: I9d33444d67792274d8027b7d1632235533cfc079
+```
+
+## Daily-run continuous integration testing
+
+Once a day, regres will also test another set of tests from [`<swiftshader>/tests/regres/full-tests.json`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/full-tests.json),
+and post the test result lists as a Gerrit changelist
+[[example]](https://swiftshader-review.googlesource.com/c/SwiftShader/+/46448).
+
+The daily run also performs code coverage instrumentation per dEQP test,
+automatically uploading the results of all the dEQP tests to the viewer at
+[swiftshader-regres.github.io/swiftshader-coverage](https://swiftshader-regres.github.io/swiftshader-coverage/).
+
+## Local dEQP test runner
+
+Regres also provides a multi-threaded, [process sandboxed](#process-sandboxing),
+local dEQP test runner with a wild-card / regex based test name matcher.
+
+The local test runner can be run with:
+
+[`<swiftshader>/tests/regres/run_testlist.sh`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/run_testlist.sh) `--deqp-vk=<path to deqp-vk> [--filter=<test name filter>]`
+
+`<test name filter>` can be a single dEQP test name, or you can use wildcards
+[as documented here](https://golang.org/pkg/path/filepath/#Match).
+Alternatively, start with a `/` to use a regex filter.
+
+Other useful flags:
+
+```text
+  -limit int
+        only run a maximum of this number of tests
+  -no-results
+        disable generation of results.json file
+  -output string
+        path to an output JSON results file (default "results.json")
+  -shuffle
+        shuffle tests
+  -test-list string
+        path to a test list file (default "vk-master-PASS.txt")
+```
+
+Run [`<swiftshader>/tests/regres/run_testlist.sh`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/run_testlist.sh) with `--help` to see all available flags.
+
+## Process sandboxing
+
+Regres will run each dEQP test in a separate process to prevent state
+leakage between tests.
+
+Tests are run concurrently, and crashing processes will not take down the test
+runner.
+
+Some dEQP tests are known to perform excessive memory allocations (i.e. keep
+allocating until no more can be claimed from the OS). \
+In order to prevent a single test starving other test processes of memory, each
+process is restricted to a fraction of the system's memory using [linux resource limits](https://man7.org/linux/man-pages/man2/getrlimit.2.html).
+
+Tests may also deadlock, so each test process has a time limit before they are
+automatically killed.
+
+## Implementation details
+
+### Presubmit & daily run process
+
+Regres runs until stopped, and will:
+
+* Download a known compatible version of Clang to a cache directory. This will
+  be used for all compilation stages below.
+* Periodically poll Gerrit for recently opened changes
+* Periodically query Gerrit for details about each tracked change, determining
+  [whether it should be tested](#qualifying), and determine its current
+  [priority](#prioritization).
+* A qualifying change with the highest priority will be picked, and the
+  following is performed for the change:
+  1. The change is `git fetch`ed into a temporary directory.
+  2. If not already cached, the dEQP version described in the
+     change's [`<swiftshader>/tests/regres/deqp.json`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/deqp.json) file is downloaded and built the into a cached directory.
+  3. The source for the change is built into a temporary build directory.
+  4. The built dEQP binaries are used to test the change. The full test results
+     are stored in a cached directory.
+  5. If the parent change's test results aren't already cached, then steps 3 and
+     4 are repeated for the parent change.
+  6. The results of the two changes are diffed, and the results of the diff are
+     posted to the change as a Gerrit review comment.
+* The above is repeated until it is time to perform a daily run, upon which:
+  1. The `HEAD` change of `master` is fetched into a temporary directory.
+  2. If not already cached, the dEQP version described in the
+     change's [`<swiftshader>/tests/regres/deqp.json`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/deqp.json) file is downloaded and built the into a cached directory.
+  3. The `HEAD` change is built into a temporary directory, optionally with code
+     coverage instrumenting.
+  4. The build dEQP binaries are used to test the change.  The full test results
+     are stored in a cached directory, and the each test is binned by status and
+     written to the [`<swiftshader>/tests/regres/testlists`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/testlists) directory.
+  5. A new Gerrit change is created containing the updated test lists and put up
+     for review, along with a summary of test result changes [[example]](https://swiftshader-review.googlesource.com/c/SwiftShader/+/46448).
+     If there's an existing daily test change up for review then this is reused
+     instead of creating another.
+  6. If the build included code coverage instrumentation, then the coverage
+     results are collated from all test runs, processed and compressed, and
+     uploaded to [github.com/swiftshader-regres/swiftshader-coverage](https://github.com/swiftshader-regres/swiftshader-coverage)
+     which is immediately reflected at [swiftshader-regres.github.io/swiftshader-coverage](https://swiftshader-regres.github.io/swiftshader-coverage).
+     This process is [described in more detail below](#code-coverage).
+  7. Stages 3 - 5 are repeated for both the LLVM and Subzero backends.
+
+### Caching
+
+The cache directory is heavily used to avoid duplicated work. For example, it
+is common for patchsets to be repeatedly pushed with the same parent change, so
+the test results of the parent can be calculated once and stored. A tested
+patchset that is merged into master would also be cached when used as a parent
+of another change.
+
+The cache needs to consider more than just the change identifier as the
+cache-key for storing and retrieving data. Both the test lists and version of
+dEQP used are dictated by the change being tested, and so both used as part of
+the cache key.
+
+### Vulkan Loader usage
+
+Applications make use of the Vulkan API by loading the [Vulkan Loader](https://github.com/KhronosGroup/Vulkan-Loader)
+library (`libvulkan.so.1` on Linux), which enumerates available Vulkan
+implementations (typically GPUs and their drivers) before an actual 'instance'
+is created to communicate with a specific Installable Client Driver (ICD).
+
+However, SwiftShader can build into libvulkan.so.1 itself, which implements the
+same API entry functions as the Vulkan Loader. Regres by default will make dEQP
+load this SwiftShader library instead of the system's Vulkan Loader. It ensures
+test results are independent of the system's Vulkan setup.
+
+To override this, one can set LD_LIBRARY_PATH to point to the location of a
+Loader's libvulkan.so.1.
+
+### Code coverage
+
+The [daily run](#daily-run-continuous-integration-testing) produces code
+coverage information that can be examined for each individual dEQP test at
+[swiftshader-regres.github.io/swiftshader-coverage](https://swiftshader-regres.github.io/swiftshader-coverage/).
+
+The process for generating this information is complex, and is described in
+detail below:
+
+#### Per-test generation
+
+Code coverage instrumentation is generated with
+[clang's `--coverage`](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html)
+functionality. This compiler option is enabled by using SwiftShader's
+`SWIFTSHADER_EMIT_COVERAGE` CMake flag.
+
+Each dEQP test process is run with a unique `LLVM_PROFILE_FILE` environment
+variable value which dictates where the process writes its raw coverage profile
+file. Each process gets a different path so that we can emit coverage from
+multiple, concurrent dEQP test processes.
+
+#### Parsing
+
+[Clang provides two tools](https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#creating-coverage-reports) for processing coverage data:
+
+* `llvm-profdata` indexes the raw `.profraw` coverage profile file and emits a
+  `.profdata` file.
+* `llvm-cov` further processes the `.profdata` file into something human
+  readable or machine parsable.
+
+`llvm-cov` provides many options, including emitting an pretty HTML file, but is
+remarkably slow at producing easily machine-parsable data. Fortunately the core
+of `llvm-cov` is [a few hundreds of lines of code](https://github.com/llvm/llvm-project/tree/master/llvm/tools/llvm-cov), as it relies on LLVM libraries to do the heavy lifting. Regres
+replaces `llvm-cov` with ["`turbo-cov`"](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/cov/turbo-cov/) which efficiently converts a `.profdata` into a simple binary stream which can
+be consumed by Regres.
+
+#### Processing
+
+At the time of writing there are over 560,000 individual dEQP tests, and around
+176,000 lines of C++ code in [`<swiftshader>/src`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:src/).
+If you used 1 bit for each source line, per-line source coverage for all dEQP
+tests would require over 11GiB of storage. That's just for one snapshot.
+
+The processing and compression schemes described below reduces this down to
+around 10 MiB (~1100x reduction in size), and supports sub-line coverage scopes.
+
+##### Spans
+
+Code coverage information is described in spans.
+
+A span is a described as an interval of source locations, where a location is a
+line-column pair:
+
+```go
+type Location struct {
+    Line, Column int
+}
+
+type Span struct {
+    Start, End Location
+}
+```
+
+##### Test tree construction
+
+Each dEQP test is uniquely identified by a fully qualified name.
+Each test belongs to a group, and that group may be nested within any number of
+parent groups. The groups are described in the test name, using dots (`.`) to
+delimit the groups and leaf test name.
+
+For example, the fully qualified test name:
+
+`dEQP-VK.fragment_shader_interlock.basic.discard.ssbo.sample_unordered.4xaa.sample_shading.16x16`
+
+Can be broken down into the following groups and test name:
+
+```text
+dEQP-VK                       <-- root group name
+╰ fragment_shader_interlock
+  ╰ basic.discard
+    ╰ ssbo
+      ╰ sample_unordered
+        ╰ 4xaa
+          ╰ sample_shading
+            ╰ 16x16           <-- leaf test name
+```
+
+Breaking down fully qualified test names into groups provide a natural way to
+structure coverage data, as tests of the same group are likely to have similar
+coverage spans.
+
+So, for each source file in the codebase, we create a tree with test groups as
+non-leaf nodes, and tests as leaf nodes.
+
+For example, given the following test list:
+
+```text
+a.b.d.h
+a.b.d.i.n
+a.b.d.i.o
+a.b.e.j
+a.b.e.k.p
+a.b.e.k.q
+a.c.f
+a.c.g.l.r
+a.c.g.m
+```
+
+We would construct the following tree:
+
+```text
+               a
+        ╭──────┴──────╮
+        b             c
+    ╭───┴───╮     ╭───┴───╮
+    d       e     f       g
+  ╭─┴─╮   ╭─┴─╮         ╭─┴─╮
+  h   i   j   k         l   m
+     ╭┴╮     ╭┴╮        │
+     n o     p q        r
+
+```
+
+Each leaf node in this tree (`h`, `n`, `o`, `j`, `p`, `q`, `f`, `r`, `m`)
+represent a test, and non-leaf nodes (`a`, `b`, `c`, `d`, `e`, `g`, `i`, `k`,
+`l`) are a groups.
+
+To begin, we create a test tree structure, and associate the full list of test
+coverage spans with every leaf node (test) in this tree.
+
+This data structure hasn't given us any compression benefits yet, but we can
+now do a few tricks to dramatically reduce number of spans needed to describe
+the graph:
+
+##### Optimization 1: Common span promotion
+
+The first compression scheme is to promote common spans up the tree when they
+are common for all children. This will reduce the number of spans needed to be
+encoded in the final file.
+
+For example, if the test group `a` has 4 children that all share the same span
+`X`:
+
+```text
+          a
+    ╭───┬─┴─┬───╮
+    b   c   d   e
+ [X,Y] [X] [X] [X,Z]
+```
+
+Then span `X` can be promoted up to `a`:
+
+```text
+         [X]
+          a
+    ╭───┬─┴─┬───╮
+    b   c   d   e
+   [Y] []   [] [Z]
+```
+
+##### Optimization 2: Span XOR promotion
+
+This idea can be extended further, by not requiring all the children to share
+the same span before promotion. If **most** child nodes share the same span, we
+can still promote the span, but this time we **remove** the span from the
+children **if they had it**, and **add** the span to children **if they didn't
+have it**.
+
+For example, if the test group `a` has 4 children with 3 that share the span
+`X`:
+
+```text
+          a
+    ╭───┬─┴─┬───╮
+    b   c   d   e
+ [X,Y] [X]  [] [X,Z]
+```
+
+Then span `X` can be promoted up to `a` by flipping the presence of `X` on the
+child nodes:
+
+```text
+         [X]
+          a
+    ╭───┬─┴─┬───╮
+    b   c   d   e
+   [Y] []  [X] [Z]
+```
+
+This process repeats up the tree.
+
+With this optimization applied, we now need to traverse the tree from root to
+leaf in order to know whether a given span is in use for the leaf node (test):
+
+* If the span is encountered an **odd** number of times during traversal, then
+  the span is **covered**.
+* If the span is encountered an **even** number of times during traversal, then
+  the span is **not covered**.
+
+See [`tests/regres/cov/coverage_test.go`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/cov/coverage_test.go) for more examples of this optimization.
+
+##### Optimization 3: Common span grouping
+
+With real world data, we encounter groups of spans that are commonly found
+together. To further reduce coverage data, the whole graph is scanned for common
+span patterns, and are indexed by each tree node.
+The XOR'ing of spans as described above is performed as if the spans were not
+grouped.
+
+##### Optimization 4: Lookup tables
+
+All spans, span-groups and strings are stored in de-duplicated tables, and are
+indexed wherever possible.
+
+The final serialization is performed by [`tests/regres/cov/serialization.go`](https://cs.opensource.google/swiftshader/SwiftShader/+/master:tests/regres/cov/serialization.go).
+
+##### Optimization 5: zlib compression
+
+The coverage data is encoded into JSON for parsing by the web page.
+
+Before writing the JSON file, the text data is zlib compressed.
+
+#### Presentation
+
+The zlib-compressed JSON coverage data is decompressed using
+[`pako`](https://github.com/nodeca/pako), and consumed by some
+[vanilla JavaScript](https://github.com/swiftshader-regres/swiftshader-coverage/blob/gh-pages/index.html).
+
+[`codemirror`](https://codemirror.net/) is used to perform coverage span and C++
+syntax highlighting
diff --git a/docs/RuntimeConfiguration.md b/docs/RuntimeConfiguration.md
new file mode 100644
index 0000000..5083a8a
--- /dev/null
+++ b/docs/RuntimeConfiguration.md
@@ -0,0 +1,34 @@
+Runtime Configuration
+=========================
+
+SwiftShader provides a simple configuration mechanism based on a configuration file to control a variety of runtime options without needing to re-compile from source.
+
+Configuration file
+------------
+
+SwiftShader looks for a file named `SwiftShader.ini` (case-sensitive) in the working directory. At startup, SwiftShader reads this file, if it exists, and sets the options specified in it.
+
+The configuration file syntax is a series of key-value pairs, divided into sections. The following example shows three key-value pairs in two sections (`ThreadCount` and `AffinityMask` in the `[Processor]` section, and `EnableSpirvProfiling` in the `[Profiler]` section):
+```
+[Processor]
+ThreadCount=4
+AffinityMask=0xf
+
+# Comment
+[Profiler]
+EnableSpirvProfiling=true
+```
+
+The syntax rules are as follows:
+* Sections are defined via a name in brackets, e.g. `[Processor]`.
+* Key-value pairs are in the format `Key=Value`.
+* Keys are always strings, while values can be strings, booleans or integers depending on the semantics of the option:
+  * For integer options, both decimal and hexademical values are supported. 
+  * For boolean options, both decimal (`1` and `0`) and alphabetical (`true` and `false`) values are supported.
+* Comments are supported through the use of the `#` character at the beginning of a line.
+
+Options
+------------
+
+Refer to the [SwiftConfig.hpp](../src/System/SwiftConfig.hpp) header for an up-to-date overview of available options.
+
diff --git a/docs/SamplingRoutines.md b/docs/SamplingRoutines.md
new file mode 100644
index 0000000..9c4716a
--- /dev/null
+++ b/docs/SamplingRoutines.md
@@ -0,0 +1,36 @@
+Sampling Routines

+=================

+

+Introduction

+------------

+

+Like other modern real-time graphics APIs, Vulkan has support for [sampler objects](https://www.khronos.org/registry/vulkan/specs/1.2/html/vkspec.html#samplers) which provide the sampling state to be used by image reading and sampling instructions in the shaders. [Sampler descriptors](https://www.khronos.org/registry/vulkan/specs/1.2/html/vkspec.html#descriptorsets-sampler) contain or reference this state. The sampler descriptor is [combined](https://www.khronos.org/registry/spir-v/specs/unified1/SPIRV.html#OpSampledImage) with an image descriptor, and this combination may only be known at shader execution time.

+

+This poses a challenge to SwiftShader's use of [dynamic code generation](Reactor.md), where we wish to specialize the sampling code for both the image's properties (most notably the format) and the sampler state. Historically, sampler state was either part of the texture objects or both the texture and sampler object were bound to a texture unit, ahead of shader execution.

+

+JIT Trampolines

+---------------

+

+The solution is to defer code generation for the sampling instructions until shader execution. For each image sampling operation we generate a call to a C++ function which will provide the specialized routine based on the image and sampler descriptor used at run-time. Then we call the returned routine.

+

+Note that this differs from typical JIT-compilers' use of trampoline functions in that we generate code specific to the combination of state, and adapt it to changes in state dynamically.

+

+3-Level Caching

+---------------

+

+We cache the generated sampling routines, using the descriptors as well as the type of sampling instruction, as the key. This is done at three levels, described in reverse order for easier understanding:

+

+L3: At the third and last level, we use a generic least-recently-used (LRU) cache, just like the caches of the pipeline stages' routines. It is protected by a mutex, which may experience high contention due to all shader worker threads needing the sampling routines.

+

+L2: To mitigate that, there's a second-level cache which contains a 'snapshot' of the last-level cache, which can be queried concurrently without locking. The snapshot is updated at pipeline barriers. While much faster than the last-level cache's critical section, the hash table lookup is still a lot of work per sampling instruction.

+

+L1: Often the descriptors being used don't change between executions of the sampling instruction. Which is where the first-level or '[inline](https://en.wikipedia.org/wiki/Inline_caching)' cache comes in. It is a single-entry cache implemented at the compiled sampling instruction level. Before calling out to the C++ function to retrieve the routine, we check if the sampler and image descriptor haven't changed since the last execution of the instruction. Note that this cache doesn't use the instruction type as part of the lookup key, since each sampling instruction instance gets its own inline cache.

+

+Descriptor Identifiers

+----------------------

+

+To make testing whether the descriptor state remained the same fast, they have unique 32-bit identifiers. Note that sampler object state and image view state that is relevant to sampling routine specialization may not be unique among sampler and image view objects. For image views we're able to compress the state into the 32-bit identifier itself to avoid unnecessary recompiles.

+

+For sampler state, which is considerably larger than 32-bit, we keep a map of it to the unique identifiers. We keep count of how many sampler objects share each identifier, so we know when we can remove the entry.

+

+Both these 32-bit identifiers are the only thing used as the key of the first-level sampling routine cache.
\ No newline at end of file
diff --git a/docs/Sin-Cos-Optimization.pdf b/docs/Sin-Cos-Optimization.pdf
new file mode 100644
index 0000000..56150b8
--- /dev/null
+++ b/docs/Sin-Cos-Optimization.pdf
Binary files differ
diff --git a/docs/Subzero.md b/docs/Subzero.md
new file mode 100644
index 0000000..c66c15a
--- /dev/null
+++ b/docs/Subzero.md
@@ -0,0 +1,19 @@
+Subzero Documentation

+=====================

+

+Subzero is a JIT compiler used as a back-end for [Reactor](Reactor.md). It originates from Chrome's [Portable Native Client](https://developer.chrome.com/native-client) project. Its authoritative repository is at [https://chromium.googlesource.com/native_client/pnacl-subzero/](https://chromium.googlesource.com/native_client/pnacl-subzero/).

+

+Subzero for SwiftShader

+-----------------------

+

+SwiftShader contains a fork of the Subzero source code (at the time of writing they are in sync). It is an alternative JIT compiler back-end, with LLVM still being the default for CMake builds. To build SwiftShader with Subzero instead of LLVM, specify -DREACTOR_BACKEND=Subzero in your CMake command (or change LLVM to Subzero in the CMake GUI). For Chrome builds that use the BUILD.gn files, Subzero is the default as it produces significantly smaller binaries than with LLVM.

+

+Subzero Development

+-------------------

+

+Development on Subzero itself requires setting up the NaCl environment on a Linux system to be able to run its unit tests:

+

+* Install Chrome's [depot_tools](http://dev.chromium.org/developers/how-tos/install-depot-tools).

+* Run `mkdir nacl && cd nacl && fetch nacl` ([ref](http://www.chromium.org/nativeclient/how-tos/how-to-use-git-svn-with-native-client)).

+* Run `native_client/toolchain_build/toolchain_build_pnacl.py --verbose --sync --clobber --install toolchain/linux_x86/pnacl_newlib_raw` ([ref](https://sites.google.com/a/chromium.org/dev/nativeclient/pnacl/developing-pnacl#TOC-TL-DR-for-checking-out-PNaCl-sources-building-and-testing)).

+* Run all unit tests with `make -f Makefile.standalone check` ([ref](https://chromium.googlesource.com/native_client/pnacl-subzero/+/master/docs/README.rst)).

diff --git a/docs/TimelineSemaphores.md b/docs/TimelineSemaphores.md
new file mode 100644
index 0000000..c36bc85
--- /dev/null
+++ b/docs/TimelineSemaphores.md
@@ -0,0 +1,44 @@
+# Vulkan Timeline Semaphores
+
+[Vulkan Timeline
+Semaphores](https://www.khronos.org/blog/vulkan-timeline-semaphores) are a
+synchronization primitive accessible both from the device and the host. A
+timeline semaphore represents a monotonically increasing 64-bit unsigned
+value. Whereas binary Vulkan semaphores are waited on just to become signaled,
+timeline semaphores are waited on to reach a specific value. Once a timeline
+semaphore reaches a certain value, it is considered signaled for every value
+less than or equal to that
+value. [`vkWaitSemaphores`](https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkWaitSemaphores.html)
+is used to wait for semaphores on the host. It can operate in one of two modes:
+"wait for all" and "wait for any".
+
+In SwiftShader, Vulkan Timeline Semaphores are implemented as an unsigned 64-bit
+integer protected by a mutex with changes signaled by a condition
+variable. Waiting for all timeline semaphores in a set is implemented by simply
+waiting for each of the semaphores in turn. Waiting for any semaphore in a set
+is a bit more complex.
+
+## Wait for any semaphore
+
+A "wait for any" of a set of semaphores is represented by a
+`TimelineSemaphore::WaitForAny` object. Additionally, `TimelineSemaphore`
+contains an internal list of all `WaitForAny` objects that wait for it, as well
+as for which values they wait. When signaled, the timeline semaphore looks
+through this list and, in turn, signals any `WaitForAny` objects that are
+waiting for a value less than or equal to the timeline semaphore's new value.
+
+A `WaitForAny` object is created from a `VkSemaphoreWaitInfo`. During
+construction, it checks the value of each timeline semaphore provided against
+the value for which it is waiting. If it has not yet been reached, the wait
+object registers itself with the timeline semaphore. If it _has_ been reached,
+the wait object is immediately signaled and no further timeline semaphores are
+checked.
+
+Once a `WaitForAny` object is signaled, it remains signaled. There is no way to
+change what semaphores or values to wait for after construction. Any subsequent
+calls to `wait()` will return `VK_SUCCESS` immediately.
+
+When a `WaitForAny` object is destroyed, it unregisters itself from every
+`TimelineSemaphore` it was waiting for. It is expected that the number of
+concurrent waits are few, and that the wait objects are short-lived, so there
+should not be a build-up of wait objects in any timeline semaphore.
diff --git a/docs/VulkanShaderDebugging.md b/docs/VulkanShaderDebugging.md
new file mode 100644
index 0000000..c47a56a
--- /dev/null
+++ b/docs/VulkanShaderDebugging.md
@@ -0,0 +1,51 @@
+# Vulkan Shader Debugging
+
+SwiftShader implements a Vulkan shader debugger that uses the [Debug Adapter Protocol](https://microsoft.github.io/debug-adapter-protocol).
+
+This debugger is still actively being developed. Please see the [Known Issues](#Known-Issues).
+
+# Enabling
+
+To enable the debugger functionality, SwiftShader needs to be built using the CMake `SWIFTSHADER_ENABLE_VULKAN_DEBUGGER` flag (`-DSWIFTSHADER_ENABLE_VULKAN_DEBUGGER=1`):
+
+Once SwiftShader is built with the debugger functionality, there are two environment flags that control the runtime behavior:
+
+* `VK_DEBUGGER_PORT` - set to an unused port number that will be used to create the DAP localhost socket. If this environment variable is not set, then the debugger functionality will not be enabled.
+* `VK_WAIT_FOR_DEBUGGER` - if defined, the debugger will block on `vkCreateDevice()` until a debugger connection is established, before allowing `vkCreateDevice()` to return. This allows breakpoints to be set before execution continues.
+
+# Connecting using Visual Studio Code
+
+Once you have built SwiftShader with the debugger functionality enabled, and the `VK_DEBUGGER_PORT` environment variable set, you can connect to the debugger using the following Visual Studio Code `"debugServer"` [Launch Configuration](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations):
+
+```json
+    {
+        "name": "Vulkan Shader Debugger",
+        "type": "node",
+        "request": "launch",
+        "debugServer": 19020,
+    }
+```
+
+Note that the `"type": "node"` field is unused, but is required.
+
+[TODO](https://issuetracker.google.com/issues/148373102): Create a Visual Studio Code extension that provides a pre-built SwiftShader driver and debugger type.
+
+# Shader entry breakpoints
+
+You can use the following function breakpoint names to set a breakpoint on the entry to all shaders of the corresponding shader type:
+* `"VertexShader"`
+* `"FragmentShader"`
+* `"ComputeShader"`
+
+# High-level Shader debugging
+
+The debugger, will by default, automatically disassemble the SPIR-V shader code, and provide this as the source for the shader program.
+
+However, if the shader program contains [`OpenCL.DebugInfo.100`](https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.DebugInfo.100.mobile.html) debug info instructions, then the debugger will allow you to debug the high-level shader source (please see [Known Issues](#Known-Issues)).
+
+
+# Known Issues
+
+* Currently enabling the debugger dramatically affects performance for all shader invocations. We may want to just-in-time recompile shaders that are actively being debugged to keep the invocations of non-debugged shaders performant. [Tracker bug](https://issuetracker.google.com/issues/148372410)
+* Support for [`OpenCL.DebugInfo.100`](https://www.khronos.org/registry/spir-v/specs/unified1/OpenCL.DebugInfo.100.mobile.html) is still in early, but active development. Many features are still incomplete.
+* Shader subgroup invocations are currently presented as a single thread, with each invocation presented as `Lane N` groups in the watch window(s). This approach is still being evaluated, and may be reworked.
\ No newline at end of file
diff --git a/docs/dEQP.md b/docs/dEQP.md
new file mode 100644
index 0000000..537f3c9
--- /dev/null
+++ b/docs/dEQP.md
@@ -0,0 +1,246 @@
+dEQP

+====

+

+These steps are specifically for testing SwiftShader's Vulkan implementation using dEQP on Windows (steps for Linux below the Windows instructions).

+

+Prerequisites

+-------------

+

+1. Install the latest [Python 3](https://www.python.org/downloads/)

+2. Install [Visual Studio](https://visualstudio.microsoft.com/vs/community/)

+3. Install [CMake](https://cmake.org/download/)

+4. Install [Go](https://golang.org/doc/install)

+5. Install [MinGW-W64](http://mingw-w64.org/doku.php/download)

+  * Select 'x86_64' as Architecture during setup

+6. Install [Git](https://git-scm.com/download/win)

+7. Set environment variables: Config Panel -> System and Security -> System -> Advanced system settigns -> Environment Variables

+  * Add `<path to python>` to your PATH environment variable

+  * Add `<path to MinGW-W64>\bin` to your PATH environment variable

+

+8. (Optional) Install [TortoiseGit](https://tortoisegit.org/)

+

+Getting the Code

+----------------

+

+12. Get dEQP (either in 'cmd' or by using TortoiseGit):

+

+    `git clone https://github.com/KhronosGroup/VK-GL-CTS`

+

+    You may wish to check out a stable vulkan-cts-* branch.

+

+13. Get dEQP's dependencies. In your dEQP root directory, open 'cmd' and run:

+

+    `python3 external\fetch_sources.py`

+

+14. Get Cherry (either in 'cmd' or by using TortoiseGit):

+

+    `git clone https://android.googlesource.com/platform/external/cherry`

+

+15. Set environment variable (see point 9):

+

+    Add new variable GOPATH='`<path to cherry>`'

+

+Building the code

+-----------------

+

+16. Build dEQP's Visual Studio files using the CMake GUI, or, in the dEQP root dir, run:

+    ```

+    mkdir build

+    cd build

+    cmake ..

+    ```

+    Note: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.

+

+17. Build dEQP:

+

+    Open `<path to dEQP>\build\dEQP-Core-default.sln` in Visual Studio and Build Solution

+

+    Note: Choose a 'Debug' build.

+

+18. Generate test cases:

+    ```

+    mkdir <path to cherry>\data

+    cd <path to dEQP>

+    python3 scripts\build_caselists.py <path to cherry>\data

+    ```

+

+    Note: you need to run `python3 scripts\build_caselists.py <path to cherry>\data` every time you update dEQP.

+

+Preparing the server

+--------------------

+

+19. Edit `<path to cherry>\cherry\data.go`

+* Search for `../candy-build/deqp-wgl` and replace that by `<path to deqp>/build`

+* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`

+* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.

+

+  Note: If you chose a Release build at step 17, modify the BinaryPath from 'Debug' to 'Release'.

+

+Testing Vulkan

+--------------

+

+20. Assuming you already built SwiftShader, copy and rename this file:

+

+    `<path to SwiftShader>\build\Release_x64\vk_swiftshader.dll` or\

+    `<path to SwiftShader>\build\Debug_x64\vk_swiftshader.dll`

+

+    To:

+

+    `<path to dEQP>\build\external\vulkancts\modules\vulkan\Debug\vulkan-1.dll`

+

+    This will cause dEQP to load SwiftShader's Vulkan implementatin directly, without going through a system-provided [loader](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#the-loader) library or any layers.

+

+     This step can also be automated by setting the `SWIFTSHADER_VULKAN_API_LIBRARY_INSTALL_PATH` environment variable to a path where we'd like the drop-in API library to be installed. For example `<path to dEQP>/build/external/vulkancts/modules/vulkan/Debug/`.

+

+    To use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD) instead:

+    * Edit environment variables:

+      * Define VK_ICD_FILENAMES to `<path to SwiftShader>\src\Vulkan\vk_swiftshader_icd.json`

+    * If the location of `vk_swiftshader.dll` you're using is different than the one specified in `src\Vulkan\vk_swiftshader_icd.json`, modify it to point to the `vk_swiftshader.dll` file you want to use.

+

+Running the tests

+-----------------

+

+21. Start the test server. Go to `<path to cherry>` and run:

+

+    `go run server.go`

+

+22. Open your favorite browser and navigate to `localhost:8080`

+

+    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!

+

+Mustpass sets

+-------------

+

+dEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.

+

+Linux

+-----

+

+The Linux process is similar to Windows. However it doesn't use Release or Debug variants, paths use forward slashes, and it uses shared object files instead of DLLs.

+

+1. Install the latest [Python 3](https://www.python.org/downloads/)

+2. Install GCC and Make. In a terminal, run:

+

+    `sudo apt-get install gcc make`

+

+3. Install [CMake](https://cmake.org/download/)

+4. Install [Go](https://golang.org/doc/install)

+5. Install Git. In a terminal, run:

+

+    `sudo apt-get install git`

+

+6. Download the [Vulkan SDK](https://vulkan.lunarg.com/) and unpack it into a location you like.

+

+Getting the Code

+----------------

+

+7. Get Swiftshader. In a terminal, go to the location you want to keep Swiftshader, and run:

+

+    ```

+    git clone https://swiftshader.googlesource.com/SwiftShader && (cd SwiftShader && curl -Lo `git rev-parse --git-dir`/hooks/commit-msg https://gerrit-review.googlesource.com/tools/hooks/commit-msg ; chmod +x `git rev-parse --git-dir`/hooks/commit-msg)

+    ```

+

+    This will also install the commit hooks you need for committing to SwiftShader.

+

+8. Get dEQP:

+

+   `git clone https://github.com/KhronosGroup/VK-GL-CTS`

+

+9. Get dEQP's dependencies. In your dEQP root directory, run:

+

+    `python3 external/fetch_sources.py`

+

+10. Get Cherry, similar to step 8:

+

+    `git clone https://android.googlesource.com/platform/external/cherry`

+

+11. Set environment variable. Open ~/.bashrc in your preferred editor and add the following line:

+

+    GOPATH='`<path to cherry>`'

+

+Building the code

+-----------------

+

+12. Build Swiftshader. In the Swiftshader root dir, run:

+    ```

+    cd build

+    cmake ..

+    make --jobs=$(nproc)

+    ```

+

+13. Set your environment variables. In the terminal in which you'll be building dEQP, run the following commands:

+

+    ```

+    export LD_LIBRARY_PATH="<Vulkan SDK location>/x86_64/lib:$LD_LIBRARY_PATH"

+    export LD_LIBRARY_PATH="<Swiftshader location>/build:$LD_LIBRARY_PATH"

+    ```

+

+14. Build dEQP. In the dEQP root dir, run:

+    ```

+    mkdir build

+    cd build

+    cmake ..

+    make --jobs=$(nproc)

+    ```

+

+    Also: don't call 'cmake .' directly in the root directory. It will make things fails later on. If you do, simply erase the files created by CMake and follow the steps above.

+

+15. Generate test cases:

+    ```

+    mkdir <path to cherry>/data

+    cd <path to dEQP>

+    python3 scripts/build_caselists.py <path to cherry>/data

+    ```

+

+    Note: you need to run `python3 scripts/build_caselists.py <path to cherry>/data` every time you update dEQP.

+

+Preparing the server

+--------------------

+

+16. Edit `<path to cherry>/cherry/data.go`

+* Search for ".exe" and remove all instances.

+* Search for `../candy-build/deqp-wgl/execserver/Release` and replace that by `<path to deqp>/build/execserver/execserver`

+* Just above, add an option to CommandLine: `--deqp-gl-context-type=egl`

+* Just below, remove 'Debug/' from the BinaryPath.

+* Just one more line below, replace `../candy-build/deqp-wgl/` with `<path to deqp>/build/modules/${TestPackageDir}`.

+* Remove `--deqp-watchdog=enable` to avoid timeouts during debugging.

+

+Testing Vulkan

+--------------

+

+17. Use SwiftShader as an [Installable Client Driver](https://github.com/KhronosGroup/Vulkan-Loader/blob/master/loader/LoaderAndLayerInterface.md#installable-client-drivers) (ICD). Add the following line to your `~/.bashrc`:

+

+      `export VK_ICD_FILENAMES="<path to SwiftShader>/build/Linux/vk_swiftshader_icd.json"`

+

+    Then run `source ~/.bashrc` in the terminal(s) you'll be running tests from.

+

+

+Running the tests

+-----------------

+

+18. Start the test server. Go to `<path to cherry>` and run:

+

+    `go run server.go`

+

+19. Open your favorite browser and navigate to `localhost:8080`

+

+    Get Started -> Choose Device 'localhost' -> Select Tests 'dEQP-VK' -> Execute tests!

+

+20. To make sure that you're running SwiftShader's drivers, select only the dEQP-VK->info->device test. In the next window, click on these tests in the left pane. If you see SwiftShader in the deviceName field, then you've set your suite up properly.

+

+21. If you want to run Vulkan tests in the command line, go to the build directory in dEQP root. Then run the following command:

+

+    `external/vulkanacts/modules/vulkan/deqp-vk`

+

+    You can also run individual tests with:

+

+    `external/vulkanacts/modules/vulkan/deqp-vk --deqp-case=<test name>`

+

+    And you can find a list of the test names in `<Swiftshader root>/tests/regres/testlists/vk-master.txt` However, deqp-vk will cease upon the first failure. It's recommended that you use cherry for your testing needs unless you know what you're doing.

+

+22. To check that you're running SwiftShader in cherry, start the server 

+

+Mustpass sets

+-------------

+

+dEQP contains more tests than what is expected to pass by a conformant implementation (e.g. some tests are considered too strict, or assume certain undefined behavior). The [android/cts/master/vk-master.txt](https://android.googlesource.com/platform/external/deqp/+/master/android/cts/master/vk-master.txt) text file which can be loaded in Cherry's 'Test sets' tab to only run the latest tests expected to pass by certified Android devices.

diff --git a/include/Android/android/api-level.h b/include/Android/android/api-level.h
new file mode 100644
index 0000000..2d2f096
--- /dev/null
+++ b/include/Android/android/api-level.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2008 The Android Open Source Project
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
+ * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef ANDROID_API_LEVEL_H
+#define ANDROID_API_LEVEL_H
+
+/*
+ * Magic version number for a current development build, which has
+ * not yet turned into an official release.
+ */
+#define __ANDROID_API__ 10000
+
+#endif /* ANDROID_API_LEVEL_H */
diff --git a/include/Android/android/sync.h b/include/Android/android/sync.h
new file mode 100644
index 0000000..1ae728a
--- /dev/null
+++ b/include/Android/android/sync.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+extern "C" {
+int sync_wait(int fd, int timeout);
+};
diff --git a/include/Android/cutils/native_handle.h b/include/Android/cutils/native_handle.h
new file mode 100644
index 0000000..b92a663
--- /dev/null
+++ b/include/Android/cutils/native_handle.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+struct native_handle_t;
+
+typedef const struct native_handle_t* buffer_handle_t;
diff --git a/include/Android/hardware/gralloc.h b/include/Android/hardware/gralloc.h
new file mode 100644
index 0000000..013e86a
--- /dev/null
+++ b/include/Android/hardware/gralloc.h
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cutils/native_handle.h>
+
+#include <hardware/hardware.h>
+
+struct android_ycbcr;
+
+enum {
+    GRALLOC_USAGE_SW_READ_OFTEN = 0x00000003U,
+    GRALLOC_USAGE_SW_WRITE_OFTEN = 0x00000030U,
+    GRALLOC_USAGE_HW_TEXTURE = 0x00000100U,
+    GRALLOC_USAGE_HW_RENDER = 0x00000200U,
+};
+
+struct gralloc_module_t {
+    hw_module_t common;
+    int (*registerBuffer)(gralloc_module_t const*, buffer_handle_t);
+    int (*unregisterBuffer)(gralloc_module_t const*, buffer_handle_t);
+    int (*lock)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**);
+    int (*unlock)(gralloc_module_t const*, buffer_handle_t);
+    int (*perform)(gralloc_module_t const*, int, ...);
+    int (*lock_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
+                      android_ycbcr*);
+    int (*lockAsync)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int, void**, int);
+    int (*unlockAsync)(gralloc_module_t const*, buffer_handle_t, int*);
+    int (*lockAsync_ycbcr)(gralloc_module_t const*, buffer_handle_t, int, int, int, int, int,
+                           android_ycbcr*, int);
+    int32_t (*getTransportSize)(gralloc_module_t const*, buffer_handle_t, uint32_t, uint32_t);
+    int32_t (*validateBufferSize)(gralloc_module_t const*, buffer_handle_t, uint32_t, uint32_t, int32_t, int, uint32_t);
+
+    void* reserved_proc[1];
+};
diff --git a/include/Android/hardware/gralloc1.h b/include/Android/hardware/gralloc1.h
new file mode 100644
index 0000000..b02decf
--- /dev/null
+++ b/include/Android/hardware/gralloc1.h
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <hardware/hardware.h>
+
+#include <cutils/native_handle.h>
+
+#define GRALLOC_MODULE_API_VERSION_1_0 HARDWARE_MAKE_API_VERSION(1, 0)
+
+#define GRALLOC_HARDWARE_MODULE_ID "gralloc"
+
+enum {
+    GRALLOC1_ERROR_NONE = 0,
+    GRALLOC1_ERROR_BAD_HANDLE = 2,
+    GRALLOC1_ERROR_BAD_VALUE = 3,
+    GRALLOC1_ERROR_UNDEFINED = 6,
+};
+
+enum {
+    GRALLOC1_FUNCTION_LOCK = 18,
+    GRALLOC1_FUNCTION_UNLOCK = 20,
+};
+
+enum {
+    GRALLOC1_CONSUMER_USAGE_CPU_READ = 1ULL << 1,
+    GRALLOC1_CONSUMER_USAGE_CPU_READ_OFTEN = 1ULL << 2 | GRALLOC1_CONSUMER_USAGE_CPU_READ,
+    GRALLOC1_CONSUMER_USAGE_CPU_WRITE = 1ULL << 5,
+    GRALLOC1_CONSUMER_USAGE_CPU_WRITE_OFTEN = 1ULL << 6 | GRALLOC1_CONSUMER_USAGE_CPU_WRITE,
+    GRALLOC1_CONSUMER_USAGE_GPU_TEXTURE = 1ULL << 8,
+};
+
+enum {
+    GRALLOC1_PRODUCER_USAGE_CPU_READ = 1ULL << 1,
+    GRALLOC1_PRODUCER_USAGE_CPU_READ_OFTEN = 1ULL << 2 | GRALLOC1_PRODUCER_USAGE_CPU_READ,
+    GRALLOC1_PRODUCER_USAGE_CPU_WRITE = 1ULL << 5,
+    GRALLOC1_PRODUCER_USAGE_CPU_WRITE_OFTEN = 1ULL << 6 | GRALLOC1_PRODUCER_USAGE_CPU_WRITE,
+    GRALLOC1_PRODUCER_USAGE_GPU_RENDER_TARGET = 1ULL << 9,
+};
+
+typedef void (*gralloc1_function_pointer_t)();
+
+struct gralloc1_rect_t {
+    int32_t left;
+    int32_t top;
+    int32_t width;
+    int32_t height;
+};
+
+struct gralloc1_device_t {
+    hw_device_t common;
+    void (*getCapabilities)(gralloc1_device_t*, uint32_t*, int32_t*);
+    gralloc1_function_pointer_t (*getFunction)(gralloc1_device_t*, int32_t);
+};
+
+typedef int32_t (*GRALLOC1_PFN_LOCK)(gralloc1_device_t*, buffer_handle_t, uint64_t, uint64_t,
+                                     const gralloc1_rect_t*, void**, int32_t);
+typedef int32_t (*GRALLOC1_PFN_UNLOCK)(gralloc1_device_t*, buffer_handle_t, int32_t*);
+
+static inline int gralloc1_open(const hw_module_t* module, gralloc1_device_t** device) {
+    return module->methods->open(module, GRALLOC_HARDWARE_MODULE_ID,
+                                 reinterpret_cast<hw_device_t**>(device));
+}
diff --git a/include/Android/hardware/hardware.h b/include/Android/hardware/hardware.h
new file mode 100644
index 0000000..21d6dc4
--- /dev/null
+++ b/include/Android/hardware/hardware.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cstdint>
+
+#define MAKE_TAG_CONSTANT(A, B, C, D) (((A) << 24) | ((B) << 16) | ((C) << 8) | (D))
+
+#define HARDWARE_MODULE_TAG MAKE_TAG_CONSTANT('H', 'W', 'M', 'T')
+#define HARDWARE_DEVICE_TAG MAKE_TAG_CONSTANT('H', 'W', 'D', 'T')
+
+#define HARDWARE_MAKE_API_VERSION(maj, min) ((((maj)&0xff) << 8) | ((min)&0xff))
+
+#define HARDWARE_HAL_API_VERSION HARDWARE_MAKE_API_VERSION(1, 0)
+
+struct hw_module_methods_t;
+
+struct hw_module_t {
+    uint32_t tag;
+    uint16_t module_api_version;
+    uint16_t hal_api_version;
+    const char* id;
+    const char* name;
+    const char* author;
+    hw_module_methods_t* methods;
+    void* dso;
+#ifdef __LP64__
+    uint64_t reserved[32 - 7];
+#else
+    uint32_t reserved[32 - 7];
+#endif
+};
+
+struct hw_device_t {
+    uint32_t tag;
+    uint32_t version;
+    struct hw_module_t* module;
+#ifdef __LP64__
+    uint64_t reserved[12];
+#else
+    uint32_t reserved[12];
+#endif
+    int (*close)(hw_device_t* device);
+};
+
+struct hw_module_methods_t {
+    int (*open)(const hw_module_t*, const char*, hw_device_t**);
+};
+
+extern "C" {
+int hw_get_module(const char* id, const hw_module_t** module);
+};
diff --git a/include/Android/nativebase/nativebase.h b/include/Android/nativebase/nativebase.h
new file mode 100644
index 0000000..c2e84d7
--- /dev/null
+++ b/include/Android/nativebase/nativebase.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <cutils/native_handle.h>
+
+#include <cstdint>
+#include <cstring>
+
+// clang-format off
+#define ANDROID_NATIVE_MAKE_CONSTANT(a, b, c, d) \
+    ((static_cast<unsigned int>(a) << 24) | \
+     (static_cast<unsigned int>(b) << 16) | \
+     (static_cast<unsigned int>(c) <<  8) | \
+     (static_cast<unsigned int>(d) <<  0))
+// clang-format on
+
+struct android_native_base_t {
+    int magic;
+    int version;
+    void* reserved[4];
+    void (*incRef)(android_native_base_t*);
+    void (*decRef)(android_native_base_t*);
+};
+
+#define ANDROID_NATIVE_BUFFER_MAGIC ANDROID_NATIVE_MAKE_CONSTANT('_', 'b', 'f', 'r')
+
+struct ANativeWindowBuffer {
+    ANativeWindowBuffer() {
+        common.magic = ANDROID_NATIVE_BUFFER_MAGIC;
+        common.version = sizeof(ANativeWindowBuffer);
+        memset(common.reserved, 0, sizeof(common.reserved));
+    }
+
+    android_native_base_t common;
+
+    int width;
+    int height;
+    int stride;
+    int format;
+    int usage_deprecated;
+    uintptr_t layerCount;
+
+    void* reserved[1];
+
+    const native_handle_t* handle;
+    uint64_t usage;
+
+    void* reserved_proc[8 - (sizeof(uint64_t) / sizeof(void*))];
+};
diff --git a/include/Android/sync/sync.h b/include/Android/sync/sync.h
new file mode 100644
index 0000000..1ae728a
--- /dev/null
+++ b/include/Android/sync/sync.h
@@ -0,0 +1,21 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+extern "C" {
+int sync_wait(int fd, int timeout);
+};
diff --git a/include/Android/system/graphics.h b/include/Android/system/graphics.h
new file mode 100644
index 0000000..563287a
--- /dev/null
+++ b/include/Android/system/graphics.h
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2018 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+enum {
+    HAL_PIXEL_FORMAT_RGBA_8888 = 1,
+    HAL_PIXEL_FORMAT_RGBX_8888 = 2,
+    HAL_PIXEL_FORMAT_RGB_888 = 3,
+    HAL_PIXEL_FORMAT_RGB_565 = 4,
+    HAL_PIXEL_FORMAT_BGRA_8888 = 5,
+    HAL_PIXEL_FORMAT_RGBA_FP16 = 22,
+    HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED = 34,
+    HAL_PIXEL_FORMAT_YV12 = 842094169,
+};
diff --git a/include/Android/vndk/window.h b/include/Android/vndk/window.h
new file mode 100644
index 0000000..8b5965f
--- /dev/null
+++ b/include/Android/vndk/window.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <nativebase/nativebase.h>
+
+struct ANativeWindow;
+typedef struct ANativeWindow ANativeWindow;
+
+void ANativeWindow_acquire(ANativeWindow* window);
+void ANativeWindow_release(ANativeWindow* window);
+int32_t ANativeWindow_getWidth(ANativeWindow* window);
+int32_t ANativeWindow_getHeight(ANativeWindow* window);
+int ANativeWindow_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer, int* fenceFd);
+int ANativeWindow_queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd);
+int ANativeWindow_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd);
+int ANativeWindow_setUsage(ANativeWindow* window, uint64_t usage);
diff --git a/include/Wayland/wayland-client-core.h b/include/Wayland/wayland-client-core.h
new file mode 100644
index 0000000..ce91a6f
--- /dev/null
+++ b/include/Wayland/wayland-client-core.h
@@ -0,0 +1,292 @@
+/*
+ * Copyright © 2008 Kristian Høgsberg
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef WAYLAND_CLIENT_CORE_H
+#define WAYLAND_CLIENT_CORE_H
+
+#include <stdint.h>
+#include "wayland-util.h"
+#include "wayland-version.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/** \class wl_proxy
+ *
+ * \brief Represents a protocol object on the client side.
+ *
+ * A wl_proxy acts as a client side proxy to an object existing in the
+ * compositor. The proxy is responsible for converting requests made by the
+ * clients with \ref wl_proxy_marshal() into Wayland's wire format. Events
+ * coming from the compositor are also handled by the proxy, which will in
+ * turn call the handler set with \ref wl_proxy_add_listener().
+ *
+ * \note With the exception of function \ref wl_proxy_set_queue(), functions
+ * accessing a wl_proxy are not normally used by client code. Clients
+ * should normally use the higher level interface generated by the scanner to
+ * interact with compositor objects.
+ *
+ */
+struct wl_proxy;
+
+/** \class wl_display
+ *
+ * \brief Represents a connection to the compositor and acts as a proxy to
+ * the wl_display singleton object.
+ *
+ * A wl_display object represents a client connection to a Wayland
+ * compositor. It is created with either \ref wl_display_connect() or
+ * \ref wl_display_connect_to_fd(). A connection is terminated using
+ * \ref wl_display_disconnect().
+ *
+ * A wl_display is also used as the \ref wl_proxy for the wl_display
+ * singleton object on the compositor side.
+ *
+ * A wl_display object handles all the data sent from and to the
+ * compositor. When a \ref wl_proxy marshals a request, it will write its wire
+ * representation to the display's write buffer. The data is sent to the
+ * compositor when the client calls \ref wl_display_flush().
+ *
+ * Incoming data is handled in two steps: queueing and dispatching. In the
+ * queue step, the data coming from the display fd is interpreted and
+ * added to a queue. On the dispatch step, the handler for the incoming
+ * event set by the client on the corresponding \ref wl_proxy is called.
+ *
+ * A wl_display has at least one event queue, called the <em>default
+ * queue</em>. Clients can create additional event queues with \ref
+ * wl_display_create_queue() and assign \ref wl_proxy's to it. Events
+ * occurring in a particular proxy are always queued in its assigned queue.
+ * A client can ensure that a certain assumption, such as holding a lock
+ * or running from a given thread, is true when a proxy event handler is
+ * called by assigning that proxy to an event queue and making sure that
+ * this queue is only dispatched when the assumption holds.
+ *
+ * The default queue is dispatched by calling \ref wl_display_dispatch().
+ * This will dispatch any events queued on the default queue and attempt
+ * to read from the display fd if it's empty. Events read are then queued
+ * on the appropriate queues according to the proxy assignment.
+ *
+ * A user created queue is dispatched with \ref wl_display_dispatch_queue().
+ * This function behaves exactly the same as wl_display_dispatch()
+ * but it dispatches given queue instead of the default queue.
+ *
+ * A real world example of event queue usage is Mesa's implementation of
+ * eglSwapBuffers() for the Wayland platform. This function might need
+ * to block until a frame callback is received, but dispatching the default
+ * queue could cause an event handler on the client to start drawing
+ * again. This problem is solved using another event queue, so that only
+ * the events handled by the EGL code are dispatched during the block.
+ *
+ * This creates a problem where a thread dispatches a non-default
+ * queue, reading all the data from the display fd. If the application
+ * would call \em poll(2) after that it would block, even though there
+ * might be events queued on the default queue. Those events should be
+ * dispatched with \ref wl_display_dispatch_pending() or \ref
+ * wl_display_dispatch_queue_pending() before flushing and blocking.
+ */
+struct wl_display;
+
+/** \class wl_event_queue
+ *
+ * \brief A queue for \ref wl_proxy object events.
+ *
+ * Event queues allows the events on a display to be handled in a thread-safe
+ * manner. See \ref wl_display for details.
+ *
+ */
+struct wl_event_queue;
+
+/** Destroy proxy after marshalling
+ * @ingroup wl_proxy
+ */
+#define WL_MARSHAL_FLAG_DESTROY (1 << 0)
+
+void
+wl_event_queue_destroy(struct wl_event_queue *queue);
+
+struct wl_proxy *
+wl_proxy_marshal_flags(struct wl_proxy *proxy, uint32_t opcode,
+		       const struct wl_interface *interface,
+		       uint32_t version,
+		       uint32_t flags, ...);
+
+struct wl_proxy *
+wl_proxy_marshal_array_flags(struct wl_proxy *proxy, uint32_t opcode,
+			     const struct wl_interface *interface,
+			     uint32_t version,
+			     uint32_t flags,
+			     union wl_argument *args);
+
+void
+wl_proxy_marshal(struct wl_proxy *p, uint32_t opcode, ...);
+
+void
+wl_proxy_marshal_array(struct wl_proxy *p, uint32_t opcode,
+		       union wl_argument *args);
+
+struct wl_proxy *
+wl_proxy_create(struct wl_proxy *factory,
+		const struct wl_interface *interface);
+
+void *
+wl_proxy_create_wrapper(void *proxy);
+
+void
+wl_proxy_wrapper_destroy(void *proxy_wrapper);
+
+struct wl_proxy *
+wl_proxy_marshal_constructor(struct wl_proxy *proxy,
+			     uint32_t opcode,
+			     const struct wl_interface *interface,
+			     ...);
+
+struct wl_proxy *
+wl_proxy_marshal_constructor_versioned(struct wl_proxy *proxy,
+				       uint32_t opcode,
+				       const struct wl_interface *interface,
+				       uint32_t version,
+				       ...);
+
+struct wl_proxy *
+wl_proxy_marshal_array_constructor(struct wl_proxy *proxy,
+				   uint32_t opcode, union wl_argument *args,
+				   const struct wl_interface *interface);
+
+struct wl_proxy *
+wl_proxy_marshal_array_constructor_versioned(struct wl_proxy *proxy,
+					     uint32_t opcode,
+					     union wl_argument *args,
+					     const struct wl_interface *interface,
+					     uint32_t version);
+
+void
+wl_proxy_destroy(struct wl_proxy *proxy);
+
+int
+wl_proxy_add_listener(struct wl_proxy *proxy,
+		      void (**implementation)(void), void *data);
+
+const void *
+wl_proxy_get_listener(struct wl_proxy *proxy);
+
+int
+wl_proxy_add_dispatcher(struct wl_proxy *proxy,
+			wl_dispatcher_func_t dispatcher_func,
+			const void * dispatcher_data, void *data);
+
+void
+wl_proxy_set_user_data(struct wl_proxy *proxy, void *user_data);
+
+void *
+wl_proxy_get_user_data(struct wl_proxy *proxy);
+
+uint32_t
+wl_proxy_get_version(struct wl_proxy *proxy);
+
+uint32_t
+wl_proxy_get_id(struct wl_proxy *proxy);
+
+void
+wl_proxy_set_tag(struct wl_proxy *proxy,
+		 const char * const *tag);
+
+const char * const *
+wl_proxy_get_tag(struct wl_proxy *proxy);
+
+const char *
+wl_proxy_get_class(struct wl_proxy *proxy);
+
+void
+wl_proxy_set_queue(struct wl_proxy *proxy, struct wl_event_queue *queue);
+
+struct wl_display *
+wl_display_connect(const char *name);
+
+struct wl_display *
+wl_display_connect_to_fd(int fd);
+
+void
+wl_display_disconnect(struct wl_display *display);
+
+int
+wl_display_get_fd(struct wl_display *display);
+
+int
+wl_display_dispatch(struct wl_display *display);
+
+int
+wl_display_dispatch_queue(struct wl_display *display,
+			  struct wl_event_queue *queue);
+
+int
+wl_display_dispatch_queue_pending(struct wl_display *display,
+				  struct wl_event_queue *queue);
+
+int
+wl_display_dispatch_pending(struct wl_display *display);
+
+int
+wl_display_get_error(struct wl_display *display);
+
+uint32_t
+wl_display_get_protocol_error(struct wl_display *display,
+			      const struct wl_interface **interface,
+			      uint32_t *id);
+
+int
+wl_display_flush(struct wl_display *display);
+
+int
+wl_display_roundtrip_queue(struct wl_display *display,
+			   struct wl_event_queue *queue);
+
+int
+wl_display_roundtrip(struct wl_display *display);
+
+struct wl_event_queue *
+wl_display_create_queue(struct wl_display *display);
+
+int
+wl_display_prepare_read_queue(struct wl_display *display,
+			      struct wl_event_queue *queue);
+
+int
+wl_display_prepare_read(struct wl_display *display);
+
+void
+wl_display_cancel_read(struct wl_display *display);
+
+int
+wl_display_read_events(struct wl_display *display);
+
+void
+wl_log_set_handler_client(wl_log_func_t handler);
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/Wayland/wayland-client-protocol.h b/include/Wayland/wayland-client-protocol.h
new file mode 100644
index 0000000..1f3481c
--- /dev/null
+++ b/include/Wayland/wayland-client-protocol.h
@@ -0,0 +1,6106 @@
+/* Generated by wayland-scanner 1.21.0 */
+
+#ifndef WAYLAND_CLIENT_PROTOCOL_H
+#define WAYLAND_CLIENT_PROTOCOL_H
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-client.h"
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @page page_wayland The wayland protocol
+ * @section page_ifaces_wayland Interfaces
+ * - @subpage page_iface_wl_display - core global object
+ * - @subpage page_iface_wl_registry - global registry object
+ * - @subpage page_iface_wl_callback - callback object
+ * - @subpage page_iface_wl_compositor - the compositor singleton
+ * - @subpage page_iface_wl_shm_pool - a shared memory pool
+ * - @subpage page_iface_wl_shm - shared memory support
+ * - @subpage page_iface_wl_buffer - content for a wl_surface
+ * - @subpage page_iface_wl_data_offer - offer to transfer data
+ * - @subpage page_iface_wl_data_source - offer to transfer data
+ * - @subpage page_iface_wl_data_device - data transfer device
+ * - @subpage page_iface_wl_data_device_manager - data transfer interface
+ * - @subpage page_iface_wl_shell - create desktop-style surfaces
+ * - @subpage page_iface_wl_shell_surface - desktop-style metadata interface
+ * - @subpage page_iface_wl_surface - an onscreen surface
+ * - @subpage page_iface_wl_seat - group of input devices
+ * - @subpage page_iface_wl_pointer - pointer input device
+ * - @subpage page_iface_wl_keyboard - keyboard input device
+ * - @subpage page_iface_wl_touch - touchscreen input device
+ * - @subpage page_iface_wl_output - compositor output region
+ * - @subpage page_iface_wl_region - region interface
+ * - @subpage page_iface_wl_subcompositor - sub-surface compositing
+ * - @subpage page_iface_wl_subsurface - sub-surface interface to a wl_surface
+ * @section page_copyright_wayland Copyright
+ * <pre>
+ *
+ * Copyright © 2008-2011 Kristian Høgsberg
+ * Copyright © 2010-2011 Intel Corporation
+ * Copyright © 2012-2013 Collabora, Ltd.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation files
+ * (the "Software"), to deal in the Software without restriction,
+ * including without limitation the rights to use, copy, modify, merge,
+ * publish, distribute, sublicense, and/or sell copies of the Software,
+ * and to permit persons to whom the Software is furnished to do so,
+ * subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ * </pre>
+ */
+struct wl_buffer;
+struct wl_callback;
+struct wl_compositor;
+struct wl_data_device;
+struct wl_data_device_manager;
+struct wl_data_offer;
+struct wl_data_source;
+struct wl_display;
+struct wl_keyboard;
+struct wl_output;
+struct wl_pointer;
+struct wl_region;
+struct wl_registry;
+struct wl_seat;
+struct wl_shell;
+struct wl_shell_surface;
+struct wl_shm;
+struct wl_shm_pool;
+struct wl_subcompositor;
+struct wl_subsurface;
+struct wl_surface;
+struct wl_touch;
+
+#ifndef WL_DISPLAY_INTERFACE
+#define WL_DISPLAY_INTERFACE
+/**
+ * @page page_iface_wl_display wl_display
+ * @section page_iface_wl_display_desc Description
+ *
+ * The core global object.  This is a special singleton object.  It
+ * is used for internal Wayland protocol features.
+ * @section page_iface_wl_display_api API
+ * See @ref iface_wl_display.
+ */
+/**
+ * @defgroup iface_wl_display The wl_display interface
+ *
+ * The core global object.  This is a special singleton object.  It
+ * is used for internal Wayland protocol features.
+ */
+extern const struct wl_interface wl_display_interface;
+#endif
+#ifndef WL_REGISTRY_INTERFACE
+#define WL_REGISTRY_INTERFACE
+/**
+ * @page page_iface_wl_registry wl_registry
+ * @section page_iface_wl_registry_desc Description
+ *
+ * The singleton global registry object.  The server has a number of
+ * global objects that are available to all clients.  These objects
+ * typically represent an actual object in the server (for example,
+ * an input device) or they are singleton objects that provide
+ * extension functionality.
+ *
+ * When a client creates a registry object, the registry object
+ * will emit a global event for each global currently in the
+ * registry.  Globals come and go as a result of device or
+ * monitor hotplugs, reconfiguration or other events, and the
+ * registry will send out global and global_remove events to
+ * keep the client up to date with the changes.  To mark the end
+ * of the initial burst of events, the client can use the
+ * wl_display.sync request immediately after calling
+ * wl_display.get_registry.
+ *
+ * A client can bind to a global object by using the bind
+ * request.  This creates a client-side handle that lets the object
+ * emit events to the client and lets the client invoke requests on
+ * the object.
+ * @section page_iface_wl_registry_api API
+ * See @ref iface_wl_registry.
+ */
+/**
+ * @defgroup iface_wl_registry The wl_registry interface
+ *
+ * The singleton global registry object.  The server has a number of
+ * global objects that are available to all clients.  These objects
+ * typically represent an actual object in the server (for example,
+ * an input device) or they are singleton objects that provide
+ * extension functionality.
+ *
+ * When a client creates a registry object, the registry object
+ * will emit a global event for each global currently in the
+ * registry.  Globals come and go as a result of device or
+ * monitor hotplugs, reconfiguration or other events, and the
+ * registry will send out global and global_remove events to
+ * keep the client up to date with the changes.  To mark the end
+ * of the initial burst of events, the client can use the
+ * wl_display.sync request immediately after calling
+ * wl_display.get_registry.
+ *
+ * A client can bind to a global object by using the bind
+ * request.  This creates a client-side handle that lets the object
+ * emit events to the client and lets the client invoke requests on
+ * the object.
+ */
+extern const struct wl_interface wl_registry_interface;
+#endif
+#ifndef WL_CALLBACK_INTERFACE
+#define WL_CALLBACK_INTERFACE
+/**
+ * @page page_iface_wl_callback wl_callback
+ * @section page_iface_wl_callback_desc Description
+ *
+ * Clients can handle the 'done' event to get notified when
+ * the related request is done.
+ * @section page_iface_wl_callback_api API
+ * See @ref iface_wl_callback.
+ */
+/**
+ * @defgroup iface_wl_callback The wl_callback interface
+ *
+ * Clients can handle the 'done' event to get notified when
+ * the related request is done.
+ */
+extern const struct wl_interface wl_callback_interface;
+#endif
+#ifndef WL_COMPOSITOR_INTERFACE
+#define WL_COMPOSITOR_INTERFACE
+/**
+ * @page page_iface_wl_compositor wl_compositor
+ * @section page_iface_wl_compositor_desc Description
+ *
+ * A compositor.  This object is a singleton global.  The
+ * compositor is in charge of combining the contents of multiple
+ * surfaces into one displayable output.
+ * @section page_iface_wl_compositor_api API
+ * See @ref iface_wl_compositor.
+ */
+/**
+ * @defgroup iface_wl_compositor The wl_compositor interface
+ *
+ * A compositor.  This object is a singleton global.  The
+ * compositor is in charge of combining the contents of multiple
+ * surfaces into one displayable output.
+ */
+extern const struct wl_interface wl_compositor_interface;
+#endif
+#ifndef WL_SHM_POOL_INTERFACE
+#define WL_SHM_POOL_INTERFACE
+/**
+ * @page page_iface_wl_shm_pool wl_shm_pool
+ * @section page_iface_wl_shm_pool_desc Description
+ *
+ * The wl_shm_pool object encapsulates a piece of memory shared
+ * between the compositor and client.  Through the wl_shm_pool
+ * object, the client can allocate shared memory wl_buffer objects.
+ * All objects created through the same pool share the same
+ * underlying mapped memory. Reusing the mapped memory avoids the
+ * setup/teardown overhead and is useful when interactively resizing
+ * a surface or for many small buffers.
+ * @section page_iface_wl_shm_pool_api API
+ * See @ref iface_wl_shm_pool.
+ */
+/**
+ * @defgroup iface_wl_shm_pool The wl_shm_pool interface
+ *
+ * The wl_shm_pool object encapsulates a piece of memory shared
+ * between the compositor and client.  Through the wl_shm_pool
+ * object, the client can allocate shared memory wl_buffer objects.
+ * All objects created through the same pool share the same
+ * underlying mapped memory. Reusing the mapped memory avoids the
+ * setup/teardown overhead and is useful when interactively resizing
+ * a surface or for many small buffers.
+ */
+extern const struct wl_interface wl_shm_pool_interface;
+#endif
+#ifndef WL_SHM_INTERFACE
+#define WL_SHM_INTERFACE
+/**
+ * @page page_iface_wl_shm wl_shm
+ * @section page_iface_wl_shm_desc Description
+ *
+ * A singleton global object that provides support for shared
+ * memory.
+ *
+ * Clients can create wl_shm_pool objects using the create_pool
+ * request.
+ *
+ * On binding the wl_shm object one or more format events
+ * are emitted to inform clients about the valid pixel formats
+ * that can be used for buffers.
+ * @section page_iface_wl_shm_api API
+ * See @ref iface_wl_shm.
+ */
+/**
+ * @defgroup iface_wl_shm The wl_shm interface
+ *
+ * A singleton global object that provides support for shared
+ * memory.
+ *
+ * Clients can create wl_shm_pool objects using the create_pool
+ * request.
+ *
+ * On binding the wl_shm object one or more format events
+ * are emitted to inform clients about the valid pixel formats
+ * that can be used for buffers.
+ */
+extern const struct wl_interface wl_shm_interface;
+#endif
+#ifndef WL_BUFFER_INTERFACE
+#define WL_BUFFER_INTERFACE
+/**
+ * @page page_iface_wl_buffer wl_buffer
+ * @section page_iface_wl_buffer_desc Description
+ *
+ * A buffer provides the content for a wl_surface. Buffers are
+ * created through factory interfaces such as wl_shm, wp_linux_buffer_params
+ * (from the linux-dmabuf protocol extension) or similar. It has a width and
+ * a height and can be attached to a wl_surface, but the mechanism by which a
+ * client provides and updates the contents is defined by the buffer factory
+ * interface.
+ *
+ * If the buffer uses a format that has an alpha channel, the alpha channel
+ * is assumed to be premultiplied in the color channels unless otherwise
+ * specified.
+ * @section page_iface_wl_buffer_api API
+ * See @ref iface_wl_buffer.
+ */
+/**
+ * @defgroup iface_wl_buffer The wl_buffer interface
+ *
+ * A buffer provides the content for a wl_surface. Buffers are
+ * created through factory interfaces such as wl_shm, wp_linux_buffer_params
+ * (from the linux-dmabuf protocol extension) or similar. It has a width and
+ * a height and can be attached to a wl_surface, but the mechanism by which a
+ * client provides and updates the contents is defined by the buffer factory
+ * interface.
+ *
+ * If the buffer uses a format that has an alpha channel, the alpha channel
+ * is assumed to be premultiplied in the color channels unless otherwise
+ * specified.
+ */
+extern const struct wl_interface wl_buffer_interface;
+#endif
+#ifndef WL_DATA_OFFER_INTERFACE
+#define WL_DATA_OFFER_INTERFACE
+/**
+ * @page page_iface_wl_data_offer wl_data_offer
+ * @section page_iface_wl_data_offer_desc Description
+ *
+ * A wl_data_offer represents a piece of data offered for transfer
+ * by another client (the source client).  It is used by the
+ * copy-and-paste and drag-and-drop mechanisms.  The offer
+ * describes the different mime types that the data can be
+ * converted to and provides the mechanism for transferring the
+ * data directly from the source client.
+ * @section page_iface_wl_data_offer_api API
+ * See @ref iface_wl_data_offer.
+ */
+/**
+ * @defgroup iface_wl_data_offer The wl_data_offer interface
+ *
+ * A wl_data_offer represents a piece of data offered for transfer
+ * by another client (the source client).  It is used by the
+ * copy-and-paste and drag-and-drop mechanisms.  The offer
+ * describes the different mime types that the data can be
+ * converted to and provides the mechanism for transferring the
+ * data directly from the source client.
+ */
+extern const struct wl_interface wl_data_offer_interface;
+#endif
+#ifndef WL_DATA_SOURCE_INTERFACE
+#define WL_DATA_SOURCE_INTERFACE
+/**
+ * @page page_iface_wl_data_source wl_data_source
+ * @section page_iface_wl_data_source_desc Description
+ *
+ * The wl_data_source object is the source side of a wl_data_offer.
+ * It is created by the source client in a data transfer and
+ * provides a way to describe the offered data and a way to respond
+ * to requests to transfer the data.
+ * @section page_iface_wl_data_source_api API
+ * See @ref iface_wl_data_source.
+ */
+/**
+ * @defgroup iface_wl_data_source The wl_data_source interface
+ *
+ * The wl_data_source object is the source side of a wl_data_offer.
+ * It is created by the source client in a data transfer and
+ * provides a way to describe the offered data and a way to respond
+ * to requests to transfer the data.
+ */
+extern const struct wl_interface wl_data_source_interface;
+#endif
+#ifndef WL_DATA_DEVICE_INTERFACE
+#define WL_DATA_DEVICE_INTERFACE
+/**
+ * @page page_iface_wl_data_device wl_data_device
+ * @section page_iface_wl_data_device_desc Description
+ *
+ * There is one wl_data_device per seat which can be obtained
+ * from the global wl_data_device_manager singleton.
+ *
+ * A wl_data_device provides access to inter-client data transfer
+ * mechanisms such as copy-and-paste and drag-and-drop.
+ * @section page_iface_wl_data_device_api API
+ * See @ref iface_wl_data_device.
+ */
+/**
+ * @defgroup iface_wl_data_device The wl_data_device interface
+ *
+ * There is one wl_data_device per seat which can be obtained
+ * from the global wl_data_device_manager singleton.
+ *
+ * A wl_data_device provides access to inter-client data transfer
+ * mechanisms such as copy-and-paste and drag-and-drop.
+ */
+extern const struct wl_interface wl_data_device_interface;
+#endif
+#ifndef WL_DATA_DEVICE_MANAGER_INTERFACE
+#define WL_DATA_DEVICE_MANAGER_INTERFACE
+/**
+ * @page page_iface_wl_data_device_manager wl_data_device_manager
+ * @section page_iface_wl_data_device_manager_desc Description
+ *
+ * The wl_data_device_manager is a singleton global object that
+ * provides access to inter-client data transfer mechanisms such as
+ * copy-and-paste and drag-and-drop.  These mechanisms are tied to
+ * a wl_seat and this interface lets a client get a wl_data_device
+ * corresponding to a wl_seat.
+ *
+ * Depending on the version bound, the objects created from the bound
+ * wl_data_device_manager object will have different requirements for
+ * functioning properly. See wl_data_source.set_actions,
+ * wl_data_offer.accept and wl_data_offer.finish for details.
+ * @section page_iface_wl_data_device_manager_api API
+ * See @ref iface_wl_data_device_manager.
+ */
+/**
+ * @defgroup iface_wl_data_device_manager The wl_data_device_manager interface
+ *
+ * The wl_data_device_manager is a singleton global object that
+ * provides access to inter-client data transfer mechanisms such as
+ * copy-and-paste and drag-and-drop.  These mechanisms are tied to
+ * a wl_seat and this interface lets a client get a wl_data_device
+ * corresponding to a wl_seat.
+ *
+ * Depending on the version bound, the objects created from the bound
+ * wl_data_device_manager object will have different requirements for
+ * functioning properly. See wl_data_source.set_actions,
+ * wl_data_offer.accept and wl_data_offer.finish for details.
+ */
+extern const struct wl_interface wl_data_device_manager_interface;
+#endif
+#ifndef WL_SHELL_INTERFACE
+#define WL_SHELL_INTERFACE
+/**
+ * @page page_iface_wl_shell wl_shell
+ * @section page_iface_wl_shell_desc Description
+ *
+ * This interface is implemented by servers that provide
+ * desktop-style user interfaces.
+ *
+ * It allows clients to associate a wl_shell_surface with
+ * a basic surface.
+ *
+ * Note! This protocol is deprecated and not intended for production use.
+ * For desktop-style user interfaces, use xdg_shell. Compositors and clients
+ * should not implement this interface.
+ * @section page_iface_wl_shell_api API
+ * See @ref iface_wl_shell.
+ */
+/**
+ * @defgroup iface_wl_shell The wl_shell interface
+ *
+ * This interface is implemented by servers that provide
+ * desktop-style user interfaces.
+ *
+ * It allows clients to associate a wl_shell_surface with
+ * a basic surface.
+ *
+ * Note! This protocol is deprecated and not intended for production use.
+ * For desktop-style user interfaces, use xdg_shell. Compositors and clients
+ * should not implement this interface.
+ */
+extern const struct wl_interface wl_shell_interface;
+#endif
+#ifndef WL_SHELL_SURFACE_INTERFACE
+#define WL_SHELL_SURFACE_INTERFACE
+/**
+ * @page page_iface_wl_shell_surface wl_shell_surface
+ * @section page_iface_wl_shell_surface_desc Description
+ *
+ * An interface that may be implemented by a wl_surface, for
+ * implementations that provide a desktop-style user interface.
+ *
+ * It provides requests to treat surfaces like toplevel, fullscreen
+ * or popup windows, move, resize or maximize them, associate
+ * metadata like title and class, etc.
+ *
+ * On the server side the object is automatically destroyed when
+ * the related wl_surface is destroyed. On the client side,
+ * wl_shell_surface_destroy() must be called before destroying
+ * the wl_surface object.
+ * @section page_iface_wl_shell_surface_api API
+ * See @ref iface_wl_shell_surface.
+ */
+/**
+ * @defgroup iface_wl_shell_surface The wl_shell_surface interface
+ *
+ * An interface that may be implemented by a wl_surface, for
+ * implementations that provide a desktop-style user interface.
+ *
+ * It provides requests to treat surfaces like toplevel, fullscreen
+ * or popup windows, move, resize or maximize them, associate
+ * metadata like title and class, etc.
+ *
+ * On the server side the object is automatically destroyed when
+ * the related wl_surface is destroyed. On the client side,
+ * wl_shell_surface_destroy() must be called before destroying
+ * the wl_surface object.
+ */
+extern const struct wl_interface wl_shell_surface_interface;
+#endif
+#ifndef WL_SURFACE_INTERFACE
+#define WL_SURFACE_INTERFACE
+/**
+ * @page page_iface_wl_surface wl_surface
+ * @section page_iface_wl_surface_desc Description
+ *
+ * A surface is a rectangular area that may be displayed on zero
+ * or more outputs, and shown any number of times at the compositor's
+ * discretion. They can present wl_buffers, receive user input, and
+ * define a local coordinate system.
+ *
+ * The size of a surface (and relative positions on it) is described
+ * in surface-local coordinates, which may differ from the buffer
+ * coordinates of the pixel content, in case a buffer_transform
+ * or a buffer_scale is used.
+ *
+ * A surface without a "role" is fairly useless: a compositor does
+ * not know where, when or how to present it. The role is the
+ * purpose of a wl_surface. Examples of roles are a cursor for a
+ * pointer (as set by wl_pointer.set_cursor), a drag icon
+ * (wl_data_device.start_drag), a sub-surface
+ * (wl_subcompositor.get_subsurface), and a window as defined by a
+ * shell protocol (e.g. wl_shell.get_shell_surface).
+ *
+ * A surface can have only one role at a time. Initially a
+ * wl_surface does not have a role. Once a wl_surface is given a
+ * role, it is set permanently for the whole lifetime of the
+ * wl_surface object. Giving the current role again is allowed,
+ * unless explicitly forbidden by the relevant interface
+ * specification.
+ *
+ * Surface roles are given by requests in other interfaces such as
+ * wl_pointer.set_cursor. The request should explicitly mention
+ * that this request gives a role to a wl_surface. Often, this
+ * request also creates a new protocol object that represents the
+ * role and adds additional functionality to wl_surface. When a
+ * client wants to destroy a wl_surface, they must destroy this 'role
+ * object' before the wl_surface.
+ *
+ * Destroying the role object does not remove the role from the
+ * wl_surface, but it may stop the wl_surface from "playing the role".
+ * For instance, if a wl_subsurface object is destroyed, the wl_surface
+ * it was created for will be unmapped and forget its position and
+ * z-order. It is allowed to create a wl_subsurface for the same
+ * wl_surface again, but it is not allowed to use the wl_surface as
+ * a cursor (cursor is a different role than sub-surface, and role
+ * switching is not allowed).
+ * @section page_iface_wl_surface_api API
+ * See @ref iface_wl_surface.
+ */
+/**
+ * @defgroup iface_wl_surface The wl_surface interface
+ *
+ * A surface is a rectangular area that may be displayed on zero
+ * or more outputs, and shown any number of times at the compositor's
+ * discretion. They can present wl_buffers, receive user input, and
+ * define a local coordinate system.
+ *
+ * The size of a surface (and relative positions on it) is described
+ * in surface-local coordinates, which may differ from the buffer
+ * coordinates of the pixel content, in case a buffer_transform
+ * or a buffer_scale is used.
+ *
+ * A surface without a "role" is fairly useless: a compositor does
+ * not know where, when or how to present it. The role is the
+ * purpose of a wl_surface. Examples of roles are a cursor for a
+ * pointer (as set by wl_pointer.set_cursor), a drag icon
+ * (wl_data_device.start_drag), a sub-surface
+ * (wl_subcompositor.get_subsurface), and a window as defined by a
+ * shell protocol (e.g. wl_shell.get_shell_surface).
+ *
+ * A surface can have only one role at a time. Initially a
+ * wl_surface does not have a role. Once a wl_surface is given a
+ * role, it is set permanently for the whole lifetime of the
+ * wl_surface object. Giving the current role again is allowed,
+ * unless explicitly forbidden by the relevant interface
+ * specification.
+ *
+ * Surface roles are given by requests in other interfaces such as
+ * wl_pointer.set_cursor. The request should explicitly mention
+ * that this request gives a role to a wl_surface. Often, this
+ * request also creates a new protocol object that represents the
+ * role and adds additional functionality to wl_surface. When a
+ * client wants to destroy a wl_surface, they must destroy this 'role
+ * object' before the wl_surface.
+ *
+ * Destroying the role object does not remove the role from the
+ * wl_surface, but it may stop the wl_surface from "playing the role".
+ * For instance, if a wl_subsurface object is destroyed, the wl_surface
+ * it was created for will be unmapped and forget its position and
+ * z-order. It is allowed to create a wl_subsurface for the same
+ * wl_surface again, but it is not allowed to use the wl_surface as
+ * a cursor (cursor is a different role than sub-surface, and role
+ * switching is not allowed).
+ */
+extern const struct wl_interface wl_surface_interface;
+#endif
+#ifndef WL_SEAT_INTERFACE
+#define WL_SEAT_INTERFACE
+/**
+ * @page page_iface_wl_seat wl_seat
+ * @section page_iface_wl_seat_desc Description
+ *
+ * A seat is a group of keyboards, pointer and touch devices. This
+ * object is published as a global during start up, or when such a
+ * device is hot plugged.  A seat typically has a pointer and
+ * maintains a keyboard focus and a pointer focus.
+ * @section page_iface_wl_seat_api API
+ * See @ref iface_wl_seat.
+ */
+/**
+ * @defgroup iface_wl_seat The wl_seat interface
+ *
+ * A seat is a group of keyboards, pointer and touch devices. This
+ * object is published as a global during start up, or when such a
+ * device is hot plugged.  A seat typically has a pointer and
+ * maintains a keyboard focus and a pointer focus.
+ */
+extern const struct wl_interface wl_seat_interface;
+#endif
+#ifndef WL_POINTER_INTERFACE
+#define WL_POINTER_INTERFACE
+/**
+ * @page page_iface_wl_pointer wl_pointer
+ * @section page_iface_wl_pointer_desc Description
+ *
+ * The wl_pointer interface represents one or more input devices,
+ * such as mice, which control the pointer location and pointer_focus
+ * of a seat.
+ *
+ * The wl_pointer interface generates motion, enter and leave
+ * events for the surfaces that the pointer is located over,
+ * and button and axis events for button presses, button releases
+ * and scrolling.
+ * @section page_iface_wl_pointer_api API
+ * See @ref iface_wl_pointer.
+ */
+/**
+ * @defgroup iface_wl_pointer The wl_pointer interface
+ *
+ * The wl_pointer interface represents one or more input devices,
+ * such as mice, which control the pointer location and pointer_focus
+ * of a seat.
+ *
+ * The wl_pointer interface generates motion, enter and leave
+ * events for the surfaces that the pointer is located over,
+ * and button and axis events for button presses, button releases
+ * and scrolling.
+ */
+extern const struct wl_interface wl_pointer_interface;
+#endif
+#ifndef WL_KEYBOARD_INTERFACE
+#define WL_KEYBOARD_INTERFACE
+/**
+ * @page page_iface_wl_keyboard wl_keyboard
+ * @section page_iface_wl_keyboard_desc Description
+ *
+ * The wl_keyboard interface represents one or more keyboards
+ * associated with a seat.
+ * @section page_iface_wl_keyboard_api API
+ * See @ref iface_wl_keyboard.
+ */
+/**
+ * @defgroup iface_wl_keyboard The wl_keyboard interface
+ *
+ * The wl_keyboard interface represents one or more keyboards
+ * associated with a seat.
+ */
+extern const struct wl_interface wl_keyboard_interface;
+#endif
+#ifndef WL_TOUCH_INTERFACE
+#define WL_TOUCH_INTERFACE
+/**
+ * @page page_iface_wl_touch wl_touch
+ * @section page_iface_wl_touch_desc Description
+ *
+ * The wl_touch interface represents a touchscreen
+ * associated with a seat.
+ *
+ * Touch interactions can consist of one or more contacts.
+ * For each contact, a series of events is generated, starting
+ * with a down event, followed by zero or more motion events,
+ * and ending with an up event. Events relating to the same
+ * contact point can be identified by the ID of the sequence.
+ * @section page_iface_wl_touch_api API
+ * See @ref iface_wl_touch.
+ */
+/**
+ * @defgroup iface_wl_touch The wl_touch interface
+ *
+ * The wl_touch interface represents a touchscreen
+ * associated with a seat.
+ *
+ * Touch interactions can consist of one or more contacts.
+ * For each contact, a series of events is generated, starting
+ * with a down event, followed by zero or more motion events,
+ * and ending with an up event. Events relating to the same
+ * contact point can be identified by the ID of the sequence.
+ */
+extern const struct wl_interface wl_touch_interface;
+#endif
+#ifndef WL_OUTPUT_INTERFACE
+#define WL_OUTPUT_INTERFACE
+/**
+ * @page page_iface_wl_output wl_output
+ * @section page_iface_wl_output_desc Description
+ *
+ * An output describes part of the compositor geometry.  The
+ * compositor works in the 'compositor coordinate system' and an
+ * output corresponds to a rectangular area in that space that is
+ * actually visible.  This typically corresponds to a monitor that
+ * displays part of the compositor space.  This object is published
+ * as global during start up, or when a monitor is hotplugged.
+ * @section page_iface_wl_output_api API
+ * See @ref iface_wl_output.
+ */
+/**
+ * @defgroup iface_wl_output The wl_output interface
+ *
+ * An output describes part of the compositor geometry.  The
+ * compositor works in the 'compositor coordinate system' and an
+ * output corresponds to a rectangular area in that space that is
+ * actually visible.  This typically corresponds to a monitor that
+ * displays part of the compositor space.  This object is published
+ * as global during start up, or when a monitor is hotplugged.
+ */
+extern const struct wl_interface wl_output_interface;
+#endif
+#ifndef WL_REGION_INTERFACE
+#define WL_REGION_INTERFACE
+/**
+ * @page page_iface_wl_region wl_region
+ * @section page_iface_wl_region_desc Description
+ *
+ * A region object describes an area.
+ *
+ * Region objects are used to describe the opaque and input
+ * regions of a surface.
+ * @section page_iface_wl_region_api API
+ * See @ref iface_wl_region.
+ */
+/**
+ * @defgroup iface_wl_region The wl_region interface
+ *
+ * A region object describes an area.
+ *
+ * Region objects are used to describe the opaque and input
+ * regions of a surface.
+ */
+extern const struct wl_interface wl_region_interface;
+#endif
+#ifndef WL_SUBCOMPOSITOR_INTERFACE
+#define WL_SUBCOMPOSITOR_INTERFACE
+/**
+ * @page page_iface_wl_subcompositor wl_subcompositor
+ * @section page_iface_wl_subcompositor_desc Description
+ *
+ * The global interface exposing sub-surface compositing capabilities.
+ * A wl_surface, that has sub-surfaces associated, is called the
+ * parent surface. Sub-surfaces can be arbitrarily nested and create
+ * a tree of sub-surfaces.
+ *
+ * The root surface in a tree of sub-surfaces is the main
+ * surface. The main surface cannot be a sub-surface, because
+ * sub-surfaces must always have a parent.
+ *
+ * A main surface with its sub-surfaces forms a (compound) window.
+ * For window management purposes, this set of wl_surface objects is
+ * to be considered as a single window, and it should also behave as
+ * such.
+ *
+ * The aim of sub-surfaces is to offload some of the compositing work
+ * within a window from clients to the compositor. A prime example is
+ * a video player with decorations and video in separate wl_surface
+ * objects. This should allow the compositor to pass YUV video buffer
+ * processing to dedicated overlay hardware when possible.
+ * @section page_iface_wl_subcompositor_api API
+ * See @ref iface_wl_subcompositor.
+ */
+/**
+ * @defgroup iface_wl_subcompositor The wl_subcompositor interface
+ *
+ * The global interface exposing sub-surface compositing capabilities.
+ * A wl_surface, that has sub-surfaces associated, is called the
+ * parent surface. Sub-surfaces can be arbitrarily nested and create
+ * a tree of sub-surfaces.
+ *
+ * The root surface in a tree of sub-surfaces is the main
+ * surface. The main surface cannot be a sub-surface, because
+ * sub-surfaces must always have a parent.
+ *
+ * A main surface with its sub-surfaces forms a (compound) window.
+ * For window management purposes, this set of wl_surface objects is
+ * to be considered as a single window, and it should also behave as
+ * such.
+ *
+ * The aim of sub-surfaces is to offload some of the compositing work
+ * within a window from clients to the compositor. A prime example is
+ * a video player with decorations and video in separate wl_surface
+ * objects. This should allow the compositor to pass YUV video buffer
+ * processing to dedicated overlay hardware when possible.
+ */
+extern const struct wl_interface wl_subcompositor_interface;
+#endif
+#ifndef WL_SUBSURFACE_INTERFACE
+#define WL_SUBSURFACE_INTERFACE
+/**
+ * @page page_iface_wl_subsurface wl_subsurface
+ * @section page_iface_wl_subsurface_desc Description
+ *
+ * An additional interface to a wl_surface object, which has been
+ * made a sub-surface. A sub-surface has one parent surface. A
+ * sub-surface's size and position are not limited to that of the parent.
+ * Particularly, a sub-surface is not automatically clipped to its
+ * parent's area.
+ *
+ * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
+ * and the parent surface is mapped. The order of which one happens
+ * first is irrelevant. A sub-surface is hidden if the parent becomes
+ * hidden, or if a NULL wl_buffer is applied. These rules apply
+ * recursively through the tree of surfaces.
+ *
+ * The behaviour of a wl_surface.commit request on a sub-surface
+ * depends on the sub-surface's mode. The possible modes are
+ * synchronized and desynchronized, see methods
+ * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
+ * mode caches the wl_surface state to be applied when the parent's
+ * state gets applied, and desynchronized mode applies the pending
+ * wl_surface state directly. A sub-surface is initially in the
+ * synchronized mode.
+ *
+ * Sub-surfaces also have another kind of state, which is managed by
+ * wl_subsurface requests, as opposed to wl_surface requests. This
+ * state includes the sub-surface position relative to the parent
+ * surface (wl_subsurface.set_position), and the stacking order of
+ * the parent and its sub-surfaces (wl_subsurface.place_above and
+ * .place_below). This state is applied when the parent surface's
+ * wl_surface state is applied, regardless of the sub-surface's mode.
+ * As the exception, set_sync and set_desync are effective immediately.
+ *
+ * The main surface can be thought to be always in desynchronized mode,
+ * since it does not have a parent in the sub-surfaces sense.
+ *
+ * Even if a sub-surface is in desynchronized mode, it will behave as
+ * in synchronized mode, if its parent surface behaves as in
+ * synchronized mode. This rule is applied recursively throughout the
+ * tree of surfaces. This means, that one can set a sub-surface into
+ * synchronized mode, and then assume that all its child and grand-child
+ * sub-surfaces are synchronized, too, without explicitly setting them.
+ *
+ * If the wl_surface associated with the wl_subsurface is destroyed, the
+ * wl_subsurface object becomes inert. Note, that destroying either object
+ * takes effect immediately. If you need to synchronize the removal
+ * of a sub-surface to the parent surface update, unmap the sub-surface
+ * first by attaching a NULL wl_buffer, update parent, and then destroy
+ * the sub-surface.
+ *
+ * If the parent wl_surface object is destroyed, the sub-surface is
+ * unmapped.
+ * @section page_iface_wl_subsurface_api API
+ * See @ref iface_wl_subsurface.
+ */
+/**
+ * @defgroup iface_wl_subsurface The wl_subsurface interface
+ *
+ * An additional interface to a wl_surface object, which has been
+ * made a sub-surface. A sub-surface has one parent surface. A
+ * sub-surface's size and position are not limited to that of the parent.
+ * Particularly, a sub-surface is not automatically clipped to its
+ * parent's area.
+ *
+ * A sub-surface becomes mapped, when a non-NULL wl_buffer is applied
+ * and the parent surface is mapped. The order of which one happens
+ * first is irrelevant. A sub-surface is hidden if the parent becomes
+ * hidden, or if a NULL wl_buffer is applied. These rules apply
+ * recursively through the tree of surfaces.
+ *
+ * The behaviour of a wl_surface.commit request on a sub-surface
+ * depends on the sub-surface's mode. The possible modes are
+ * synchronized and desynchronized, see methods
+ * wl_subsurface.set_sync and wl_subsurface.set_desync. Synchronized
+ * mode caches the wl_surface state to be applied when the parent's
+ * state gets applied, and desynchronized mode applies the pending
+ * wl_surface state directly. A sub-surface is initially in the
+ * synchronized mode.
+ *
+ * Sub-surfaces also have another kind of state, which is managed by
+ * wl_subsurface requests, as opposed to wl_surface requests. This
+ * state includes the sub-surface position relative to the parent
+ * surface (wl_subsurface.set_position), and the stacking order of
+ * the parent and its sub-surfaces (wl_subsurface.place_above and
+ * .place_below). This state is applied when the parent surface's
+ * wl_surface state is applied, regardless of the sub-surface's mode.
+ * As the exception, set_sync and set_desync are effective immediately.
+ *
+ * The main surface can be thought to be always in desynchronized mode,
+ * since it does not have a parent in the sub-surfaces sense.
+ *
+ * Even if a sub-surface is in desynchronized mode, it will behave as
+ * in synchronized mode, if its parent surface behaves as in
+ * synchronized mode. This rule is applied recursively throughout the
+ * tree of surfaces. This means, that one can set a sub-surface into
+ * synchronized mode, and then assume that all its child and grand-child
+ * sub-surfaces are synchronized, too, without explicitly setting them.
+ *
+ * If the wl_surface associated with the wl_subsurface is destroyed, the
+ * wl_subsurface object becomes inert. Note, that destroying either object
+ * takes effect immediately. If you need to synchronize the removal
+ * of a sub-surface to the parent surface update, unmap the sub-surface
+ * first by attaching a NULL wl_buffer, update parent, and then destroy
+ * the sub-surface.
+ *
+ * If the parent wl_surface object is destroyed, the sub-surface is
+ * unmapped.
+ */
+extern const struct wl_interface wl_subsurface_interface;
+#endif
+
+#ifndef WL_DISPLAY_ERROR_ENUM
+#define WL_DISPLAY_ERROR_ENUM
+/**
+ * @ingroup iface_wl_display
+ * global error values
+ *
+ * These errors are global and can be emitted in response to any
+ * server request.
+ */
+enum wl_display_error {
+	/**
+	 * server couldn't find object
+	 */
+	WL_DISPLAY_ERROR_INVALID_OBJECT = 0,
+	/**
+	 * method doesn't exist on the specified interface or malformed request
+	 */
+	WL_DISPLAY_ERROR_INVALID_METHOD = 1,
+	/**
+	 * server is out of memory
+	 */
+	WL_DISPLAY_ERROR_NO_MEMORY = 2,
+	/**
+	 * implementation error in compositor
+	 */
+	WL_DISPLAY_ERROR_IMPLEMENTATION = 3,
+};
+#endif /* WL_DISPLAY_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_display
+ * @struct wl_display_listener
+ */
+struct wl_display_listener {
+	/**
+	 * fatal error event
+	 *
+	 * The error event is sent out when a fatal (non-recoverable)
+	 * error has occurred. The object_id argument is the object where
+	 * the error occurred, most often in response to a request to that
+	 * object. The code identifies the error and is defined by the
+	 * object interface. As such, each interface defines its own set of
+	 * error codes. The message is a brief description of the error,
+	 * for (debugging) convenience.
+	 * @param object_id object where the error occurred
+	 * @param code error code
+	 * @param message error description
+	 */
+	void (*error)(void *data,
+		      struct wl_display *wl_display,
+		      void *object_id,
+		      uint32_t code,
+		      const char *message);
+	/**
+	 * acknowledge object ID deletion
+	 *
+	 * This event is used internally by the object ID management
+	 * logic. When a client deletes an object that it had created, the
+	 * server will send this event to acknowledge that it has seen the
+	 * delete request. When the client receives this event, it will
+	 * know that it can safely reuse the object ID.
+	 * @param id deleted object ID
+	 */
+	void (*delete_id)(void *data,
+			  struct wl_display *wl_display,
+			  uint32_t id);
+};
+
+/**
+ * @ingroup iface_wl_display
+ */
+static inline int
+wl_display_add_listener(struct wl_display *wl_display,
+			const struct wl_display_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_display,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_DISPLAY_SYNC 0
+#define WL_DISPLAY_GET_REGISTRY 1
+
+/**
+ * @ingroup iface_wl_display
+ */
+#define WL_DISPLAY_ERROR_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_display
+ */
+#define WL_DISPLAY_DELETE_ID_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_display
+ */
+#define WL_DISPLAY_SYNC_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_display
+ */
+#define WL_DISPLAY_GET_REGISTRY_SINCE_VERSION 1
+
+/** @ingroup iface_wl_display */
+static inline void
+wl_display_set_user_data(struct wl_display *wl_display, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_display, user_data);
+}
+
+/** @ingroup iface_wl_display */
+static inline void *
+wl_display_get_user_data(struct wl_display *wl_display)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_display);
+}
+
+static inline uint32_t
+wl_display_get_version(struct wl_display *wl_display)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_display);
+}
+
+/**
+ * @ingroup iface_wl_display
+ *
+ * The sync request asks the server to emit the 'done' event
+ * on the returned wl_callback object.  Since requests are
+ * handled in-order and events are delivered in-order, this can
+ * be used as a barrier to ensure all previous requests and the
+ * resulting events have been handled.
+ *
+ * The object returned by this request will be destroyed by the
+ * compositor after the callback is fired and as such the client must not
+ * attempt to use it after that point.
+ *
+ * The callback_data passed in the callback is the event serial.
+ */
+static inline struct wl_callback *
+wl_display_sync(struct wl_display *wl_display)
+{
+	struct wl_proxy *callback;
+
+	callback = wl_proxy_marshal_flags((struct wl_proxy *) wl_display,
+			 WL_DISPLAY_SYNC, &wl_callback_interface, wl_proxy_get_version((struct wl_proxy *) wl_display), 0, NULL);
+
+	return (struct wl_callback *) callback;
+}
+
+/**
+ * @ingroup iface_wl_display
+ *
+ * This request creates a registry object that allows the client
+ * to list and bind the global objects available from the
+ * compositor.
+ *
+ * It should be noted that the server side resources consumed in
+ * response to a get_registry request can only be released when the
+ * client disconnects, not when the client side proxy is destroyed.
+ * Therefore, clients should invoke get_registry as infrequently as
+ * possible to avoid wasting memory.
+ */
+static inline struct wl_registry *
+wl_display_get_registry(struct wl_display *wl_display)
+{
+	struct wl_proxy *registry;
+
+	registry = wl_proxy_marshal_flags((struct wl_proxy *) wl_display,
+			 WL_DISPLAY_GET_REGISTRY, &wl_registry_interface, wl_proxy_get_version((struct wl_proxy *) wl_display), 0, NULL);
+
+	return (struct wl_registry *) registry;
+}
+
+/**
+ * @ingroup iface_wl_registry
+ * @struct wl_registry_listener
+ */
+struct wl_registry_listener {
+	/**
+	 * announce global object
+	 *
+	 * Notify the client of global objects.
+	 *
+	 * The event notifies the client that a global object with the
+	 * given name is now available, and it implements the given version
+	 * of the given interface.
+	 * @param name numeric name of the global object
+	 * @param interface interface implemented by the object
+	 * @param version interface version
+	 */
+	void (*global)(void *data,
+		       struct wl_registry *wl_registry,
+		       uint32_t name,
+		       const char *interface,
+		       uint32_t version);
+	/**
+	 * announce removal of global object
+	 *
+	 * Notify the client of removed global objects.
+	 *
+	 * This event notifies the client that the global identified by
+	 * name is no longer available. If the client bound to the global
+	 * using the bind request, the client should now destroy that
+	 * object.
+	 *
+	 * The object remains valid and requests to the object will be
+	 * ignored until the client destroys it, to avoid races between the
+	 * global going away and a client sending a request to it.
+	 * @param name numeric name of the global object
+	 */
+	void (*global_remove)(void *data,
+			      struct wl_registry *wl_registry,
+			      uint32_t name);
+};
+
+/**
+ * @ingroup iface_wl_registry
+ */
+static inline int
+wl_registry_add_listener(struct wl_registry *wl_registry,
+			 const struct wl_registry_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_registry,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_REGISTRY_BIND 0
+
+/**
+ * @ingroup iface_wl_registry
+ */
+#define WL_REGISTRY_GLOBAL_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_registry
+ */
+#define WL_REGISTRY_GLOBAL_REMOVE_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_registry
+ */
+#define WL_REGISTRY_BIND_SINCE_VERSION 1
+
+/** @ingroup iface_wl_registry */
+static inline void
+wl_registry_set_user_data(struct wl_registry *wl_registry, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_registry, user_data);
+}
+
+/** @ingroup iface_wl_registry */
+static inline void *
+wl_registry_get_user_data(struct wl_registry *wl_registry)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_registry);
+}
+
+static inline uint32_t
+wl_registry_get_version(struct wl_registry *wl_registry)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_registry);
+}
+
+/** @ingroup iface_wl_registry */
+static inline void
+wl_registry_destroy(struct wl_registry *wl_registry)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_registry);
+}
+
+/**
+ * @ingroup iface_wl_registry
+ *
+ * Binds a new, client-created object to the server using the
+ * specified name as the identifier.
+ */
+static inline void *
+wl_registry_bind(struct wl_registry *wl_registry, uint32_t name, const struct wl_interface *interface, uint32_t version)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_registry,
+			 WL_REGISTRY_BIND, interface, version, 0, name, interface->name, version, NULL);
+
+	return (void *) id;
+}
+
+/**
+ * @ingroup iface_wl_callback
+ * @struct wl_callback_listener
+ */
+struct wl_callback_listener {
+	/**
+	 * done event
+	 *
+	 * Notify the client when the related request is done.
+	 * @param callback_data request-specific data for the callback
+	 */
+	void (*done)(void *data,
+		     struct wl_callback *wl_callback,
+		     uint32_t callback_data);
+};
+
+/**
+ * @ingroup iface_wl_callback
+ */
+static inline int
+wl_callback_add_listener(struct wl_callback *wl_callback,
+			 const struct wl_callback_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_callback,
+				     (void (**)(void)) listener, data);
+}
+
+/**
+ * @ingroup iface_wl_callback
+ */
+#define WL_CALLBACK_DONE_SINCE_VERSION 1
+
+
+/** @ingroup iface_wl_callback */
+static inline void
+wl_callback_set_user_data(struct wl_callback *wl_callback, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_callback, user_data);
+}
+
+/** @ingroup iface_wl_callback */
+static inline void *
+wl_callback_get_user_data(struct wl_callback *wl_callback)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_callback);
+}
+
+static inline uint32_t
+wl_callback_get_version(struct wl_callback *wl_callback)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_callback);
+}
+
+/** @ingroup iface_wl_callback */
+static inline void
+wl_callback_destroy(struct wl_callback *wl_callback)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_callback);
+}
+
+#define WL_COMPOSITOR_CREATE_SURFACE 0
+#define WL_COMPOSITOR_CREATE_REGION 1
+
+
+/**
+ * @ingroup iface_wl_compositor
+ */
+#define WL_COMPOSITOR_CREATE_SURFACE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_compositor
+ */
+#define WL_COMPOSITOR_CREATE_REGION_SINCE_VERSION 1
+
+/** @ingroup iface_wl_compositor */
+static inline void
+wl_compositor_set_user_data(struct wl_compositor *wl_compositor, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_compositor, user_data);
+}
+
+/** @ingroup iface_wl_compositor */
+static inline void *
+wl_compositor_get_user_data(struct wl_compositor *wl_compositor)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_compositor);
+}
+
+static inline uint32_t
+wl_compositor_get_version(struct wl_compositor *wl_compositor)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_compositor);
+}
+
+/** @ingroup iface_wl_compositor */
+static inline void
+wl_compositor_destroy(struct wl_compositor *wl_compositor)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_compositor);
+}
+
+/**
+ * @ingroup iface_wl_compositor
+ *
+ * Ask the compositor to create a new surface.
+ */
+static inline struct wl_surface *
+wl_compositor_create_surface(struct wl_compositor *wl_compositor)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_compositor,
+			 WL_COMPOSITOR_CREATE_SURFACE, &wl_surface_interface, wl_proxy_get_version((struct wl_proxy *) wl_compositor), 0, NULL);
+
+	return (struct wl_surface *) id;
+}
+
+/**
+ * @ingroup iface_wl_compositor
+ *
+ * Ask the compositor to create a new region.
+ */
+static inline struct wl_region *
+wl_compositor_create_region(struct wl_compositor *wl_compositor)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_compositor,
+			 WL_COMPOSITOR_CREATE_REGION, &wl_region_interface, wl_proxy_get_version((struct wl_proxy *) wl_compositor), 0, NULL);
+
+	return (struct wl_region *) id;
+}
+
+#define WL_SHM_POOL_CREATE_BUFFER 0
+#define WL_SHM_POOL_DESTROY 1
+#define WL_SHM_POOL_RESIZE 2
+
+
+/**
+ * @ingroup iface_wl_shm_pool
+ */
+#define WL_SHM_POOL_CREATE_BUFFER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shm_pool
+ */
+#define WL_SHM_POOL_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shm_pool
+ */
+#define WL_SHM_POOL_RESIZE_SINCE_VERSION 1
+
+/** @ingroup iface_wl_shm_pool */
+static inline void
+wl_shm_pool_set_user_data(struct wl_shm_pool *wl_shm_pool, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_shm_pool, user_data);
+}
+
+/** @ingroup iface_wl_shm_pool */
+static inline void *
+wl_shm_pool_get_user_data(struct wl_shm_pool *wl_shm_pool)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_shm_pool);
+}
+
+static inline uint32_t
+wl_shm_pool_get_version(struct wl_shm_pool *wl_shm_pool)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_shm_pool);
+}
+
+/**
+ * @ingroup iface_wl_shm_pool
+ *
+ * Create a wl_buffer object from the pool.
+ *
+ * The buffer is created offset bytes into the pool and has
+ * width and height as specified.  The stride argument specifies
+ * the number of bytes from the beginning of one row to the beginning
+ * of the next.  The format is the pixel format of the buffer and
+ * must be one of those advertised through the wl_shm.format event.
+ *
+ * A buffer will keep a reference to the pool it was created from
+ * so it is valid to destroy the pool immediately after creating
+ * a buffer from it.
+ */
+static inline struct wl_buffer *
+wl_shm_pool_create_buffer(struct wl_shm_pool *wl_shm_pool, int32_t offset, int32_t width, int32_t height, int32_t stride, uint32_t format)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
+			 WL_SHM_POOL_CREATE_BUFFER, &wl_buffer_interface, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, NULL, offset, width, height, stride, format);
+
+	return (struct wl_buffer *) id;
+}
+
+/**
+ * @ingroup iface_wl_shm_pool
+ *
+ * Destroy the shared memory pool.
+ *
+ * The mmapped memory will be released when all
+ * buffers that have been created from this pool
+ * are gone.
+ */
+static inline void
+wl_shm_pool_destroy(struct wl_shm_pool *wl_shm_pool)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
+			 WL_SHM_POOL_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_shm_pool
+ *
+ * This request will cause the server to remap the backing memory
+ * for the pool from the file descriptor passed when the pool was
+ * created, but using the new size.  This request can only be
+ * used to make the pool bigger.
+ *
+ * This request only changes the amount of bytes that are mmapped
+ * by the server and does not touch the file corresponding to the
+ * file descriptor passed at creation time. It is the client's
+ * responsibility to ensure that the file is at least as big as
+ * the new pool size.
+ */
+static inline void
+wl_shm_pool_resize(struct wl_shm_pool *wl_shm_pool, int32_t size)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shm_pool,
+			 WL_SHM_POOL_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shm_pool), 0, size);
+}
+
+#ifndef WL_SHM_ERROR_ENUM
+#define WL_SHM_ERROR_ENUM
+/**
+ * @ingroup iface_wl_shm
+ * wl_shm error values
+ *
+ * These errors can be emitted in response to wl_shm requests.
+ */
+enum wl_shm_error {
+	/**
+	 * buffer format is not known
+	 */
+	WL_SHM_ERROR_INVALID_FORMAT = 0,
+	/**
+	 * invalid size or stride during pool or buffer creation
+	 */
+	WL_SHM_ERROR_INVALID_STRIDE = 1,
+	/**
+	 * mmapping the file descriptor failed
+	 */
+	WL_SHM_ERROR_INVALID_FD = 2,
+};
+#endif /* WL_SHM_ERROR_ENUM */
+
+#ifndef WL_SHM_FORMAT_ENUM
+#define WL_SHM_FORMAT_ENUM
+/**
+ * @ingroup iface_wl_shm
+ * pixel formats
+ *
+ * This describes the memory layout of an individual pixel.
+ *
+ * All renderers should support argb8888 and xrgb8888 but any other
+ * formats are optional and may not be supported by the particular
+ * renderer in use.
+ *
+ * The drm format codes match the macros defined in drm_fourcc.h, except
+ * argb8888 and xrgb8888. The formats actually supported by the compositor
+ * will be reported by the format event.
+ *
+ * For all wl_shm formats and unless specified in another protocol
+ * extension, pre-multiplied alpha is used for pixel values.
+ */
+enum wl_shm_format {
+	/**
+	 * 32-bit ARGB format, [31:0] A:R:G:B 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_ARGB8888 = 0,
+	/**
+	 * 32-bit RGB format, [31:0] x:R:G:B 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_XRGB8888 = 1,
+	/**
+	 * 8-bit color index format, [7:0] C
+	 */
+	WL_SHM_FORMAT_C8 = 0x20203843,
+	/**
+	 * 8-bit RGB format, [7:0] R:G:B 3:3:2
+	 */
+	WL_SHM_FORMAT_RGB332 = 0x38424752,
+	/**
+	 * 8-bit BGR format, [7:0] B:G:R 2:3:3
+	 */
+	WL_SHM_FORMAT_BGR233 = 0x38524742,
+	/**
+	 * 16-bit xRGB format, [15:0] x:R:G:B 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_XRGB4444 = 0x32315258,
+	/**
+	 * 16-bit xBGR format, [15:0] x:B:G:R 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_XBGR4444 = 0x32314258,
+	/**
+	 * 16-bit RGBx format, [15:0] R:G:B:x 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_RGBX4444 = 0x32315852,
+	/**
+	 * 16-bit BGRx format, [15:0] B:G:R:x 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_BGRX4444 = 0x32315842,
+	/**
+	 * 16-bit ARGB format, [15:0] A:R:G:B 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_ARGB4444 = 0x32315241,
+	/**
+	 * 16-bit ABGR format, [15:0] A:B:G:R 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_ABGR4444 = 0x32314241,
+	/**
+	 * 16-bit RBGA format, [15:0] R:G:B:A 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_RGBA4444 = 0x32314152,
+	/**
+	 * 16-bit BGRA format, [15:0] B:G:R:A 4:4:4:4 little endian
+	 */
+	WL_SHM_FORMAT_BGRA4444 = 0x32314142,
+	/**
+	 * 16-bit xRGB format, [15:0] x:R:G:B 1:5:5:5 little endian
+	 */
+	WL_SHM_FORMAT_XRGB1555 = 0x35315258,
+	/**
+	 * 16-bit xBGR 1555 format, [15:0] x:B:G:R 1:5:5:5 little endian
+	 */
+	WL_SHM_FORMAT_XBGR1555 = 0x35314258,
+	/**
+	 * 16-bit RGBx 5551 format, [15:0] R:G:B:x 5:5:5:1 little endian
+	 */
+	WL_SHM_FORMAT_RGBX5551 = 0x35315852,
+	/**
+	 * 16-bit BGRx 5551 format, [15:0] B:G:R:x 5:5:5:1 little endian
+	 */
+	WL_SHM_FORMAT_BGRX5551 = 0x35315842,
+	/**
+	 * 16-bit ARGB 1555 format, [15:0] A:R:G:B 1:5:5:5 little endian
+	 */
+	WL_SHM_FORMAT_ARGB1555 = 0x35315241,
+	/**
+	 * 16-bit ABGR 1555 format, [15:0] A:B:G:R 1:5:5:5 little endian
+	 */
+	WL_SHM_FORMAT_ABGR1555 = 0x35314241,
+	/**
+	 * 16-bit RGBA 5551 format, [15:0] R:G:B:A 5:5:5:1 little endian
+	 */
+	WL_SHM_FORMAT_RGBA5551 = 0x35314152,
+	/**
+	 * 16-bit BGRA 5551 format, [15:0] B:G:R:A 5:5:5:1 little endian
+	 */
+	WL_SHM_FORMAT_BGRA5551 = 0x35314142,
+	/**
+	 * 16-bit RGB 565 format, [15:0] R:G:B 5:6:5 little endian
+	 */
+	WL_SHM_FORMAT_RGB565 = 0x36314752,
+	/**
+	 * 16-bit BGR 565 format, [15:0] B:G:R 5:6:5 little endian
+	 */
+	WL_SHM_FORMAT_BGR565 = 0x36314742,
+	/**
+	 * 24-bit RGB format, [23:0] R:G:B little endian
+	 */
+	WL_SHM_FORMAT_RGB888 = 0x34324752,
+	/**
+	 * 24-bit BGR format, [23:0] B:G:R little endian
+	 */
+	WL_SHM_FORMAT_BGR888 = 0x34324742,
+	/**
+	 * 32-bit xBGR format, [31:0] x:B:G:R 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_XBGR8888 = 0x34324258,
+	/**
+	 * 32-bit RGBx format, [31:0] R:G:B:x 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_RGBX8888 = 0x34325852,
+	/**
+	 * 32-bit BGRx format, [31:0] B:G:R:x 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_BGRX8888 = 0x34325842,
+	/**
+	 * 32-bit ABGR format, [31:0] A:B:G:R 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_ABGR8888 = 0x34324241,
+	/**
+	 * 32-bit RGBA format, [31:0] R:G:B:A 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_RGBA8888 = 0x34324152,
+	/**
+	 * 32-bit BGRA format, [31:0] B:G:R:A 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_BGRA8888 = 0x34324142,
+	/**
+	 * 32-bit xRGB format, [31:0] x:R:G:B 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_XRGB2101010 = 0x30335258,
+	/**
+	 * 32-bit xBGR format, [31:0] x:B:G:R 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_XBGR2101010 = 0x30334258,
+	/**
+	 * 32-bit RGBx format, [31:0] R:G:B:x 10:10:10:2 little endian
+	 */
+	WL_SHM_FORMAT_RGBX1010102 = 0x30335852,
+	/**
+	 * 32-bit BGRx format, [31:0] B:G:R:x 10:10:10:2 little endian
+	 */
+	WL_SHM_FORMAT_BGRX1010102 = 0x30335842,
+	/**
+	 * 32-bit ARGB format, [31:0] A:R:G:B 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_ARGB2101010 = 0x30335241,
+	/**
+	 * 32-bit ABGR format, [31:0] A:B:G:R 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_ABGR2101010 = 0x30334241,
+	/**
+	 * 32-bit RGBA format, [31:0] R:G:B:A 10:10:10:2 little endian
+	 */
+	WL_SHM_FORMAT_RGBA1010102 = 0x30334152,
+	/**
+	 * 32-bit BGRA format, [31:0] B:G:R:A 10:10:10:2 little endian
+	 */
+	WL_SHM_FORMAT_BGRA1010102 = 0x30334142,
+	/**
+	 * packed YCbCr format, [31:0] Cr0:Y1:Cb0:Y0 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_YUYV = 0x56595559,
+	/**
+	 * packed YCbCr format, [31:0] Cb0:Y1:Cr0:Y0 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_YVYU = 0x55595659,
+	/**
+	 * packed YCbCr format, [31:0] Y1:Cr0:Y0:Cb0 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_UYVY = 0x59565955,
+	/**
+	 * packed YCbCr format, [31:0] Y1:Cb0:Y0:Cr0 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_VYUY = 0x59555956,
+	/**
+	 * packed AYCbCr format, [31:0] A:Y:Cb:Cr 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_AYUV = 0x56555941,
+	/**
+	 * 2 plane YCbCr Cr:Cb format, 2x2 subsampled Cr:Cb plane
+	 */
+	WL_SHM_FORMAT_NV12 = 0x3231564e,
+	/**
+	 * 2 plane YCbCr Cb:Cr format, 2x2 subsampled Cb:Cr plane
+	 */
+	WL_SHM_FORMAT_NV21 = 0x3132564e,
+	/**
+	 * 2 plane YCbCr Cr:Cb format, 2x1 subsampled Cr:Cb plane
+	 */
+	WL_SHM_FORMAT_NV16 = 0x3631564e,
+	/**
+	 * 2 plane YCbCr Cb:Cr format, 2x1 subsampled Cb:Cr plane
+	 */
+	WL_SHM_FORMAT_NV61 = 0x3136564e,
+	/**
+	 * 3 plane YCbCr format, 4x4 subsampled Cb (1) and Cr (2) planes
+	 */
+	WL_SHM_FORMAT_YUV410 = 0x39565559,
+	/**
+	 * 3 plane YCbCr format, 4x4 subsampled Cr (1) and Cb (2) planes
+	 */
+	WL_SHM_FORMAT_YVU410 = 0x39555659,
+	/**
+	 * 3 plane YCbCr format, 4x1 subsampled Cb (1) and Cr (2) planes
+	 */
+	WL_SHM_FORMAT_YUV411 = 0x31315559,
+	/**
+	 * 3 plane YCbCr format, 4x1 subsampled Cr (1) and Cb (2) planes
+	 */
+	WL_SHM_FORMAT_YVU411 = 0x31315659,
+	/**
+	 * 3 plane YCbCr format, 2x2 subsampled Cb (1) and Cr (2) planes
+	 */
+	WL_SHM_FORMAT_YUV420 = 0x32315559,
+	/**
+	 * 3 plane YCbCr format, 2x2 subsampled Cr (1) and Cb (2) planes
+	 */
+	WL_SHM_FORMAT_YVU420 = 0x32315659,
+	/**
+	 * 3 plane YCbCr format, 2x1 subsampled Cb (1) and Cr (2) planes
+	 */
+	WL_SHM_FORMAT_YUV422 = 0x36315559,
+	/**
+	 * 3 plane YCbCr format, 2x1 subsampled Cr (1) and Cb (2) planes
+	 */
+	WL_SHM_FORMAT_YVU422 = 0x36315659,
+	/**
+	 * 3 plane YCbCr format, non-subsampled Cb (1) and Cr (2) planes
+	 */
+	WL_SHM_FORMAT_YUV444 = 0x34325559,
+	/**
+	 * 3 plane YCbCr format, non-subsampled Cr (1) and Cb (2) planes
+	 */
+	WL_SHM_FORMAT_YVU444 = 0x34325659,
+	/**
+	 * [7:0] R
+	 */
+	WL_SHM_FORMAT_R8 = 0x20203852,
+	/**
+	 * [15:0] R little endian
+	 */
+	WL_SHM_FORMAT_R16 = 0x20363152,
+	/**
+	 * [15:0] R:G 8:8 little endian
+	 */
+	WL_SHM_FORMAT_RG88 = 0x38384752,
+	/**
+	 * [15:0] G:R 8:8 little endian
+	 */
+	WL_SHM_FORMAT_GR88 = 0x38385247,
+	/**
+	 * [31:0] R:G 16:16 little endian
+	 */
+	WL_SHM_FORMAT_RG1616 = 0x32334752,
+	/**
+	 * [31:0] G:R 16:16 little endian
+	 */
+	WL_SHM_FORMAT_GR1616 = 0x32335247,
+	/**
+	 * [63:0] x:R:G:B 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_XRGB16161616F = 0x48345258,
+	/**
+	 * [63:0] x:B:G:R 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_XBGR16161616F = 0x48344258,
+	/**
+	 * [63:0] A:R:G:B 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_ARGB16161616F = 0x48345241,
+	/**
+	 * [63:0] A:B:G:R 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_ABGR16161616F = 0x48344241,
+	/**
+	 * [31:0] X:Y:Cb:Cr 8:8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_XYUV8888 = 0x56555958,
+	/**
+	 * [23:0] Cr:Cb:Y 8:8:8 little endian
+	 */
+	WL_SHM_FORMAT_VUY888 = 0x34325556,
+	/**
+	 * Y followed by U then V, 10:10:10. Non-linear modifier only
+	 */
+	WL_SHM_FORMAT_VUY101010 = 0x30335556,
+	/**
+	 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 10:6:10:6:10:6:10:6 little endian per 2 Y pixels
+	 */
+	WL_SHM_FORMAT_Y210 = 0x30313259,
+	/**
+	 * [63:0] Cr0:0:Y1:0:Cb0:0:Y0:0 12:4:12:4:12:4:12:4 little endian per 2 Y pixels
+	 */
+	WL_SHM_FORMAT_Y212 = 0x32313259,
+	/**
+	 * [63:0] Cr0:Y1:Cb0:Y0 16:16:16:16 little endian per 2 Y pixels
+	 */
+	WL_SHM_FORMAT_Y216 = 0x36313259,
+	/**
+	 * [31:0] A:Cr:Y:Cb 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_Y410 = 0x30313459,
+	/**
+	 * [63:0] A:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
+	 */
+	WL_SHM_FORMAT_Y412 = 0x32313459,
+	/**
+	 * [63:0] A:Cr:Y:Cb 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_Y416 = 0x36313459,
+	/**
+	 * [31:0] X:Cr:Y:Cb 2:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_XVYU2101010 = 0x30335658,
+	/**
+	 * [63:0] X:0:Cr:0:Y:0:Cb:0 12:4:12:4:12:4:12:4 little endian
+	 */
+	WL_SHM_FORMAT_XVYU12_16161616 = 0x36335658,
+	/**
+	 * [63:0] X:Cr:Y:Cb 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_XVYU16161616 = 0x38345658,
+	/**
+	 * [63:0]   A3:A2:Y3:0:Cr0:0:Y2:0:A1:A0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
+	 */
+	WL_SHM_FORMAT_Y0L0 = 0x304c3059,
+	/**
+	 * [63:0]   X3:X2:Y3:0:Cr0:0:Y2:0:X1:X0:Y1:0:Cb0:0:Y0:0  1:1:8:2:8:2:8:2:1:1:8:2:8:2:8:2 little endian
+	 */
+	WL_SHM_FORMAT_X0L0 = 0x304c3058,
+	/**
+	 * [63:0]   A3:A2:Y3:Cr0:Y2:A1:A0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_Y0L2 = 0x324c3059,
+	/**
+	 * [63:0]   X3:X2:Y3:Cr0:Y2:X1:X0:Y1:Cb0:Y0  1:1:10:10:10:1:1:10:10:10 little endian
+	 */
+	WL_SHM_FORMAT_X0L2 = 0x324c3058,
+	WL_SHM_FORMAT_YUV420_8BIT = 0x38305559,
+	WL_SHM_FORMAT_YUV420_10BIT = 0x30315559,
+	WL_SHM_FORMAT_XRGB8888_A8 = 0x38415258,
+	WL_SHM_FORMAT_XBGR8888_A8 = 0x38414258,
+	WL_SHM_FORMAT_RGBX8888_A8 = 0x38415852,
+	WL_SHM_FORMAT_BGRX8888_A8 = 0x38415842,
+	WL_SHM_FORMAT_RGB888_A8 = 0x38413852,
+	WL_SHM_FORMAT_BGR888_A8 = 0x38413842,
+	WL_SHM_FORMAT_RGB565_A8 = 0x38413552,
+	WL_SHM_FORMAT_BGR565_A8 = 0x38413542,
+	/**
+	 * non-subsampled Cr:Cb plane
+	 */
+	WL_SHM_FORMAT_NV24 = 0x3432564e,
+	/**
+	 * non-subsampled Cb:Cr plane
+	 */
+	WL_SHM_FORMAT_NV42 = 0x3234564e,
+	/**
+	 * 2x1 subsampled Cr:Cb plane, 10 bit per channel
+	 */
+	WL_SHM_FORMAT_P210 = 0x30313250,
+	/**
+	 * 2x2 subsampled Cr:Cb plane 10 bits per channel
+	 */
+	WL_SHM_FORMAT_P010 = 0x30313050,
+	/**
+	 * 2x2 subsampled Cr:Cb plane 12 bits per channel
+	 */
+	WL_SHM_FORMAT_P012 = 0x32313050,
+	/**
+	 * 2x2 subsampled Cr:Cb plane 16 bits per channel
+	 */
+	WL_SHM_FORMAT_P016 = 0x36313050,
+	/**
+	 * [63:0] A:x:B:x:G:x:R:x 10:6:10:6:10:6:10:6 little endian
+	 */
+	WL_SHM_FORMAT_AXBXGXRX106106106106 = 0x30314241,
+	/**
+	 * 2x2 subsampled Cr:Cb plane
+	 */
+	WL_SHM_FORMAT_NV15 = 0x3531564e,
+	WL_SHM_FORMAT_Q410 = 0x30313451,
+	WL_SHM_FORMAT_Q401 = 0x31303451,
+	/**
+	 * [63:0] x:R:G:B 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_XRGB16161616 = 0x38345258,
+	/**
+	 * [63:0] x:B:G:R 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_XBGR16161616 = 0x38344258,
+	/**
+	 * [63:0] A:R:G:B 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_ARGB16161616 = 0x38345241,
+	/**
+	 * [63:0] A:B:G:R 16:16:16:16 little endian
+	 */
+	WL_SHM_FORMAT_ABGR16161616 = 0x38344241,
+};
+#endif /* WL_SHM_FORMAT_ENUM */
+
+/**
+ * @ingroup iface_wl_shm
+ * @struct wl_shm_listener
+ */
+struct wl_shm_listener {
+	/**
+	 * pixel format description
+	 *
+	 * Informs the client about a valid pixel format that can be used
+	 * for buffers. Known formats include argb8888 and xrgb8888.
+	 * @param format buffer pixel format
+	 */
+	void (*format)(void *data,
+		       struct wl_shm *wl_shm,
+		       uint32_t format);
+};
+
+/**
+ * @ingroup iface_wl_shm
+ */
+static inline int
+wl_shm_add_listener(struct wl_shm *wl_shm,
+		    const struct wl_shm_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_shm,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_SHM_CREATE_POOL 0
+
+/**
+ * @ingroup iface_wl_shm
+ */
+#define WL_SHM_FORMAT_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_shm
+ */
+#define WL_SHM_CREATE_POOL_SINCE_VERSION 1
+
+/** @ingroup iface_wl_shm */
+static inline void
+wl_shm_set_user_data(struct wl_shm *wl_shm, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_shm, user_data);
+}
+
+/** @ingroup iface_wl_shm */
+static inline void *
+wl_shm_get_user_data(struct wl_shm *wl_shm)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_shm);
+}
+
+static inline uint32_t
+wl_shm_get_version(struct wl_shm *wl_shm)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_shm);
+}
+
+/** @ingroup iface_wl_shm */
+static inline void
+wl_shm_destroy(struct wl_shm *wl_shm)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_shm);
+}
+
+/**
+ * @ingroup iface_wl_shm
+ *
+ * Create a new wl_shm_pool object.
+ *
+ * The pool can be used to create shared memory based buffer
+ * objects.  The server will mmap size bytes of the passed file
+ * descriptor, to use as backing memory for the pool.
+ */
+static inline struct wl_shm_pool *
+wl_shm_create_pool(struct wl_shm *wl_shm, int32_t fd, int32_t size)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shm,
+			 WL_SHM_CREATE_POOL, &wl_shm_pool_interface, wl_proxy_get_version((struct wl_proxy *) wl_shm), 0, NULL, fd, size);
+
+	return (struct wl_shm_pool *) id;
+}
+
+/**
+ * @ingroup iface_wl_buffer
+ * @struct wl_buffer_listener
+ */
+struct wl_buffer_listener {
+	/**
+	 * compositor releases buffer
+	 *
+	 * Sent when this wl_buffer is no longer used by the compositor.
+	 * The client is now free to reuse or destroy this buffer and its
+	 * backing storage.
+	 *
+	 * If a client receives a release event before the frame callback
+	 * requested in the same wl_surface.commit that attaches this
+	 * wl_buffer to a surface, then the client is immediately free to
+	 * reuse the buffer and its backing storage, and does not need a
+	 * second buffer for the next surface content update. Typically
+	 * this is possible, when the compositor maintains a copy of the
+	 * wl_surface contents, e.g. as a GL texture. This is an important
+	 * optimization for GL(ES) compositors with wl_shm clients.
+	 */
+	void (*release)(void *data,
+			struct wl_buffer *wl_buffer);
+};
+
+/**
+ * @ingroup iface_wl_buffer
+ */
+static inline int
+wl_buffer_add_listener(struct wl_buffer *wl_buffer,
+		       const struct wl_buffer_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_buffer,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_BUFFER_DESTROY 0
+
+/**
+ * @ingroup iface_wl_buffer
+ */
+#define WL_BUFFER_RELEASE_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_buffer
+ */
+#define WL_BUFFER_DESTROY_SINCE_VERSION 1
+
+/** @ingroup iface_wl_buffer */
+static inline void
+wl_buffer_set_user_data(struct wl_buffer *wl_buffer, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_buffer, user_data);
+}
+
+/** @ingroup iface_wl_buffer */
+static inline void *
+wl_buffer_get_user_data(struct wl_buffer *wl_buffer)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_buffer);
+}
+
+static inline uint32_t
+wl_buffer_get_version(struct wl_buffer *wl_buffer)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_buffer);
+}
+
+/**
+ * @ingroup iface_wl_buffer
+ *
+ * Destroy a buffer. If and how you need to release the backing
+ * storage is defined by the buffer factory interface.
+ *
+ * For possible side-effects to a surface, see wl_surface.attach.
+ */
+static inline void
+wl_buffer_destroy(struct wl_buffer *wl_buffer)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_buffer,
+			 WL_BUFFER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_buffer), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef WL_DATA_OFFER_ERROR_ENUM
+#define WL_DATA_OFFER_ERROR_ENUM
+enum wl_data_offer_error {
+	/**
+	 * finish request was called untimely
+	 */
+	WL_DATA_OFFER_ERROR_INVALID_FINISH = 0,
+	/**
+	 * action mask contains invalid values
+	 */
+	WL_DATA_OFFER_ERROR_INVALID_ACTION_MASK = 1,
+	/**
+	 * action argument has an invalid value
+	 */
+	WL_DATA_OFFER_ERROR_INVALID_ACTION = 2,
+	/**
+	 * offer doesn't accept this request
+	 */
+	WL_DATA_OFFER_ERROR_INVALID_OFFER = 3,
+};
+#endif /* WL_DATA_OFFER_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_data_offer
+ * @struct wl_data_offer_listener
+ */
+struct wl_data_offer_listener {
+	/**
+	 * advertise offered mime type
+	 *
+	 * Sent immediately after creating the wl_data_offer object. One
+	 * event per offered mime type.
+	 * @param mime_type offered mime type
+	 */
+	void (*offer)(void *data,
+		      struct wl_data_offer *wl_data_offer,
+		      const char *mime_type);
+	/**
+	 * notify the source-side available actions
+	 *
+	 * This event indicates the actions offered by the data source.
+	 * It will be sent right after wl_data_device.enter, or anytime the
+	 * source side changes its offered actions through
+	 * wl_data_source.set_actions.
+	 * @param source_actions actions offered by the data source
+	 * @since 3
+	 */
+	void (*source_actions)(void *data,
+			       struct wl_data_offer *wl_data_offer,
+			       uint32_t source_actions);
+	/**
+	 * notify the selected action
+	 *
+	 * This event indicates the action selected by the compositor
+	 * after matching the source/destination side actions. Only one
+	 * action (or none) will be offered here.
+	 *
+	 * This event can be emitted multiple times during the
+	 * drag-and-drop operation in response to destination side action
+	 * changes through wl_data_offer.set_actions.
+	 *
+	 * This event will no longer be emitted after wl_data_device.drop
+	 * happened on the drag-and-drop destination, the client must honor
+	 * the last action received, or the last preferred one set through
+	 * wl_data_offer.set_actions when handling an "ask" action.
+	 *
+	 * Compositors may also change the selected action on the fly,
+	 * mainly in response to keyboard modifier changes during the
+	 * drag-and-drop operation.
+	 *
+	 * The most recent action received is always the valid one. Prior
+	 * to receiving wl_data_device.drop, the chosen action may change
+	 * (e.g. due to keyboard modifiers being pressed). At the time of
+	 * receiving wl_data_device.drop the drag-and-drop destination must
+	 * honor the last action received.
+	 *
+	 * Action changes may still happen after wl_data_device.drop,
+	 * especially on "ask" actions, where the drag-and-drop destination
+	 * may choose another action afterwards. Action changes happening
+	 * at this stage are always the result of inter-client negotiation,
+	 * the compositor shall no longer be able to induce a different
+	 * action.
+	 *
+	 * Upon "ask" actions, it is expected that the drag-and-drop
+	 * destination may potentially choose a different action and/or
+	 * mime type, based on wl_data_offer.source_actions and finally
+	 * chosen by the user (e.g. popping up a menu with the available
+	 * options). The final wl_data_offer.set_actions and
+	 * wl_data_offer.accept requests must happen before the call to
+	 * wl_data_offer.finish.
+	 * @param dnd_action action selected by the compositor
+	 * @since 3
+	 */
+	void (*action)(void *data,
+		       struct wl_data_offer *wl_data_offer,
+		       uint32_t dnd_action);
+};
+
+/**
+ * @ingroup iface_wl_data_offer
+ */
+static inline int
+wl_data_offer_add_listener(struct wl_data_offer *wl_data_offer,
+			   const struct wl_data_offer_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_data_offer,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_DATA_OFFER_ACCEPT 0
+#define WL_DATA_OFFER_RECEIVE 1
+#define WL_DATA_OFFER_DESTROY 2
+#define WL_DATA_OFFER_FINISH 3
+#define WL_DATA_OFFER_SET_ACTIONS 4
+
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_OFFER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_SOURCE_ACTIONS_SINCE_VERSION 3
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_ACTION_SINCE_VERSION 3
+
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_ACCEPT_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_RECEIVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_FINISH_SINCE_VERSION 3
+/**
+ * @ingroup iface_wl_data_offer
+ */
+#define WL_DATA_OFFER_SET_ACTIONS_SINCE_VERSION 3
+
+/** @ingroup iface_wl_data_offer */
+static inline void
+wl_data_offer_set_user_data(struct wl_data_offer *wl_data_offer, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_data_offer, user_data);
+}
+
+/** @ingroup iface_wl_data_offer */
+static inline void *
+wl_data_offer_get_user_data(struct wl_data_offer *wl_data_offer)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_data_offer);
+}
+
+static inline uint32_t
+wl_data_offer_get_version(struct wl_data_offer *wl_data_offer)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_data_offer);
+}
+
+/**
+ * @ingroup iface_wl_data_offer
+ *
+ * Indicate that the client can accept the given mime type, or
+ * NULL for not accepted.
+ *
+ * For objects of version 2 or older, this request is used by the
+ * client to give feedback whether the client can receive the given
+ * mime type, or NULL if none is accepted; the feedback does not
+ * determine whether the drag-and-drop operation succeeds or not.
+ *
+ * For objects of version 3 or newer, this request determines the
+ * final result of the drag-and-drop operation. If the end result
+ * is that no mime types were accepted, the drag-and-drop operation
+ * will be cancelled and the corresponding drag source will receive
+ * wl_data_source.cancelled. Clients may still use this event in
+ * conjunction with wl_data_source.action for feedback.
+ */
+static inline void
+wl_data_offer_accept(struct wl_data_offer *wl_data_offer, uint32_t serial, const char *mime_type)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
+			 WL_DATA_OFFER_ACCEPT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, serial, mime_type);
+}
+
+/**
+ * @ingroup iface_wl_data_offer
+ *
+ * To transfer the offered data, the client issues this request
+ * and indicates the mime type it wants to receive.  The transfer
+ * happens through the passed file descriptor (typically created
+ * with the pipe system call).  The source client writes the data
+ * in the mime type representation requested and then closes the
+ * file descriptor.
+ *
+ * The receiving client reads from the read end of the pipe until
+ * EOF and then closes its end, at which point the transfer is
+ * complete.
+ *
+ * This request may happen multiple times for different mime types,
+ * both before and after wl_data_device.drop. Drag-and-drop destination
+ * clients may preemptively fetch data or examine it more closely to
+ * determine acceptance.
+ */
+static inline void
+wl_data_offer_receive(struct wl_data_offer *wl_data_offer, const char *mime_type, int32_t fd)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
+			 WL_DATA_OFFER_RECEIVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, mime_type, fd);
+}
+
+/**
+ * @ingroup iface_wl_data_offer
+ *
+ * Destroy the data offer.
+ */
+static inline void
+wl_data_offer_destroy(struct wl_data_offer *wl_data_offer)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
+			 WL_DATA_OFFER_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_data_offer
+ *
+ * Notifies the compositor that the drag destination successfully
+ * finished the drag-and-drop operation.
+ *
+ * Upon receiving this request, the compositor will emit
+ * wl_data_source.dnd_finished on the drag source client.
+ *
+ * It is a client error to perform other requests than
+ * wl_data_offer.destroy after this one. It is also an error to perform
+ * this request after a NULL mime type has been set in
+ * wl_data_offer.accept or no action was received through
+ * wl_data_offer.action.
+ *
+ * If wl_data_offer.finish request is received for a non drag and drop
+ * operation, the invalid_finish protocol error is raised.
+ */
+static inline void
+wl_data_offer_finish(struct wl_data_offer *wl_data_offer)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
+			 WL_DATA_OFFER_FINISH, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0);
+}
+
+/**
+ * @ingroup iface_wl_data_offer
+ *
+ * Sets the actions that the destination side client supports for
+ * this operation. This request may trigger the emission of
+ * wl_data_source.action and wl_data_offer.action events if the compositor
+ * needs to change the selected action.
+ *
+ * This request can be called multiple times throughout the
+ * drag-and-drop operation, typically in response to wl_data_device.enter
+ * or wl_data_device.motion events.
+ *
+ * This request determines the final result of the drag-and-drop
+ * operation. If the end result is that no action is accepted,
+ * the drag source will receive wl_data_source.cancelled.
+ *
+ * The dnd_actions argument must contain only values expressed in the
+ * wl_data_device_manager.dnd_actions enum, and the preferred_action
+ * argument must only contain one of those values set, otherwise it
+ * will result in a protocol error.
+ *
+ * While managing an "ask" action, the destination drag-and-drop client
+ * may perform further wl_data_offer.receive requests, and is expected
+ * to perform one last wl_data_offer.set_actions request with a preferred
+ * action other than "ask" (and optionally wl_data_offer.accept) before
+ * requesting wl_data_offer.finish, in order to convey the action selected
+ * by the user. If the preferred action is not in the
+ * wl_data_offer.source_actions mask, an error will be raised.
+ *
+ * If the "ask" action is dismissed (e.g. user cancellation), the client
+ * is expected to perform wl_data_offer.destroy right away.
+ *
+ * This request can only be made on drag-and-drop offers, a protocol error
+ * will be raised otherwise.
+ */
+static inline void
+wl_data_offer_set_actions(struct wl_data_offer *wl_data_offer, uint32_t dnd_actions, uint32_t preferred_action)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_offer,
+			 WL_DATA_OFFER_SET_ACTIONS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_offer), 0, dnd_actions, preferred_action);
+}
+
+#ifndef WL_DATA_SOURCE_ERROR_ENUM
+#define WL_DATA_SOURCE_ERROR_ENUM
+enum wl_data_source_error {
+	/**
+	 * action mask contains invalid values
+	 */
+	WL_DATA_SOURCE_ERROR_INVALID_ACTION_MASK = 0,
+	/**
+	 * source doesn't accept this request
+	 */
+	WL_DATA_SOURCE_ERROR_INVALID_SOURCE = 1,
+};
+#endif /* WL_DATA_SOURCE_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_data_source
+ * @struct wl_data_source_listener
+ */
+struct wl_data_source_listener {
+	/**
+	 * a target accepts an offered mime type
+	 *
+	 * Sent when a target accepts pointer_focus or motion events. If
+	 * a target does not accept any of the offered types, type is NULL.
+	 *
+	 * Used for feedback during drag-and-drop.
+	 * @param mime_type mime type accepted by the target
+	 */
+	void (*target)(void *data,
+		       struct wl_data_source *wl_data_source,
+		       const char *mime_type);
+	/**
+	 * send the data
+	 *
+	 * Request for data from the client. Send the data as the
+	 * specified mime type over the passed file descriptor, then close
+	 * it.
+	 * @param mime_type mime type for the data
+	 * @param fd file descriptor for the data
+	 */
+	void (*send)(void *data,
+		     struct wl_data_source *wl_data_source,
+		     const char *mime_type,
+		     int32_t fd);
+	/**
+	 * selection was cancelled
+	 *
+	 * This data source is no longer valid. There are several reasons
+	 * why this could happen:
+	 *
+	 * - The data source has been replaced by another data source. -
+	 * The drag-and-drop operation was performed, but the drop
+	 * destination did not accept any of the mime types offered through
+	 * wl_data_source.target. - The drag-and-drop operation was
+	 * performed, but the drop destination did not select any of the
+	 * actions present in the mask offered through
+	 * wl_data_source.action. - The drag-and-drop operation was
+	 * performed but didn't happen over a surface. - The compositor
+	 * cancelled the drag-and-drop operation (e.g. compositor dependent
+	 * timeouts to avoid stale drag-and-drop transfers).
+	 *
+	 * The client should clean up and destroy this data source.
+	 *
+	 * For objects of version 2 or older, wl_data_source.cancelled will
+	 * only be emitted if the data source was replaced by another data
+	 * source.
+	 */
+	void (*cancelled)(void *data,
+			  struct wl_data_source *wl_data_source);
+	/**
+	 * the drag-and-drop operation physically finished
+	 *
+	 * The user performed the drop action. This event does not
+	 * indicate acceptance, wl_data_source.cancelled may still be
+	 * emitted afterwards if the drop destination does not accept any
+	 * mime type.
+	 *
+	 * However, this event might however not be received if the
+	 * compositor cancelled the drag-and-drop operation before this
+	 * event could happen.
+	 *
+	 * Note that the data_source may still be used in the future and
+	 * should not be destroyed here.
+	 * @since 3
+	 */
+	void (*dnd_drop_performed)(void *data,
+				   struct wl_data_source *wl_data_source);
+	/**
+	 * the drag-and-drop operation concluded
+	 *
+	 * The drop destination finished interoperating with this data
+	 * source, so the client is now free to destroy this data source
+	 * and free all associated data.
+	 *
+	 * If the action used to perform the operation was "move", the
+	 * source can now delete the transferred data.
+	 * @since 3
+	 */
+	void (*dnd_finished)(void *data,
+			     struct wl_data_source *wl_data_source);
+	/**
+	 * notify the selected action
+	 *
+	 * This event indicates the action selected by the compositor
+	 * after matching the source/destination side actions. Only one
+	 * action (or none) will be offered here.
+	 *
+	 * This event can be emitted multiple times during the
+	 * drag-and-drop operation, mainly in response to destination side
+	 * changes through wl_data_offer.set_actions, and as the data
+	 * device enters/leaves surfaces.
+	 *
+	 * It is only possible to receive this event after
+	 * wl_data_source.dnd_drop_performed if the drag-and-drop operation
+	 * ended in an "ask" action, in which case the final
+	 * wl_data_source.action event will happen immediately before
+	 * wl_data_source.dnd_finished.
+	 *
+	 * Compositors may also change the selected action on the fly,
+	 * mainly in response to keyboard modifier changes during the
+	 * drag-and-drop operation.
+	 *
+	 * The most recent action received is always the valid one. The
+	 * chosen action may change alongside negotiation (e.g. an "ask"
+	 * action can turn into a "move" operation), so the effects of the
+	 * final action must always be applied in
+	 * wl_data_offer.dnd_finished.
+	 *
+	 * Clients can trigger cursor surface changes from this point, so
+	 * they reflect the current action.
+	 * @param dnd_action action selected by the compositor
+	 * @since 3
+	 */
+	void (*action)(void *data,
+		       struct wl_data_source *wl_data_source,
+		       uint32_t dnd_action);
+};
+
+/**
+ * @ingroup iface_wl_data_source
+ */
+static inline int
+wl_data_source_add_listener(struct wl_data_source *wl_data_source,
+			    const struct wl_data_source_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_data_source,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_DATA_SOURCE_OFFER 0
+#define WL_DATA_SOURCE_DESTROY 1
+#define WL_DATA_SOURCE_SET_ACTIONS 2
+
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_TARGET_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_SEND_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_CANCELLED_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_DND_DROP_PERFORMED_SINCE_VERSION 3
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_DND_FINISHED_SINCE_VERSION 3
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_ACTION_SINCE_VERSION 3
+
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_OFFER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_source
+ */
+#define WL_DATA_SOURCE_SET_ACTIONS_SINCE_VERSION 3
+
+/** @ingroup iface_wl_data_source */
+static inline void
+wl_data_source_set_user_data(struct wl_data_source *wl_data_source, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_data_source, user_data);
+}
+
+/** @ingroup iface_wl_data_source */
+static inline void *
+wl_data_source_get_user_data(struct wl_data_source *wl_data_source)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_data_source);
+}
+
+static inline uint32_t
+wl_data_source_get_version(struct wl_data_source *wl_data_source)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_data_source);
+}
+
+/**
+ * @ingroup iface_wl_data_source
+ *
+ * This request adds a mime type to the set of mime types
+ * advertised to targets.  Can be called several times to offer
+ * multiple types.
+ */
+static inline void
+wl_data_source_offer(struct wl_data_source *wl_data_source, const char *mime_type)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
+			 WL_DATA_SOURCE_OFFER, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), 0, mime_type);
+}
+
+/**
+ * @ingroup iface_wl_data_source
+ *
+ * Destroy the data source.
+ */
+static inline void
+wl_data_source_destroy(struct wl_data_source *wl_data_source)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
+			 WL_DATA_SOURCE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_data_source
+ *
+ * Sets the actions that the source side client supports for this
+ * operation. This request may trigger wl_data_source.action and
+ * wl_data_offer.action events if the compositor needs to change the
+ * selected action.
+ *
+ * The dnd_actions argument must contain only values expressed in the
+ * wl_data_device_manager.dnd_actions enum, otherwise it will result
+ * in a protocol error.
+ *
+ * This request must be made once only, and can only be made on sources
+ * used in drag-and-drop, so it must be performed before
+ * wl_data_device.start_drag. Attempting to use the source other than
+ * for drag-and-drop will raise a protocol error.
+ */
+static inline void
+wl_data_source_set_actions(struct wl_data_source *wl_data_source, uint32_t dnd_actions)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_source,
+			 WL_DATA_SOURCE_SET_ACTIONS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_source), 0, dnd_actions);
+}
+
+#ifndef WL_DATA_DEVICE_ERROR_ENUM
+#define WL_DATA_DEVICE_ERROR_ENUM
+enum wl_data_device_error {
+	/**
+	 * given wl_surface has another role
+	 */
+	WL_DATA_DEVICE_ERROR_ROLE = 0,
+};
+#endif /* WL_DATA_DEVICE_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_data_device
+ * @struct wl_data_device_listener
+ */
+struct wl_data_device_listener {
+	/**
+	 * introduce a new wl_data_offer
+	 *
+	 * The data_offer event introduces a new wl_data_offer object,
+	 * which will subsequently be used in either the data_device.enter
+	 * event (for drag-and-drop) or the data_device.selection event
+	 * (for selections). Immediately following the
+	 * data_device.data_offer event, the new data_offer object will
+	 * send out data_offer.offer events to describe the mime types it
+	 * offers.
+	 * @param id the new data_offer object
+	 */
+	void (*data_offer)(void *data,
+			   struct wl_data_device *wl_data_device,
+			   struct wl_data_offer *id);
+	/**
+	 * initiate drag-and-drop session
+	 *
+	 * This event is sent when an active drag-and-drop pointer enters
+	 * a surface owned by the client. The position of the pointer at
+	 * enter time is provided by the x and y arguments, in
+	 * surface-local coordinates.
+	 * @param serial serial number of the enter event
+	 * @param surface client surface entered
+	 * @param x surface-local x coordinate
+	 * @param y surface-local y coordinate
+	 * @param id source data_offer object
+	 */
+	void (*enter)(void *data,
+		      struct wl_data_device *wl_data_device,
+		      uint32_t serial,
+		      struct wl_surface *surface,
+		      wl_fixed_t x,
+		      wl_fixed_t y,
+		      struct wl_data_offer *id);
+	/**
+	 * end drag-and-drop session
+	 *
+	 * This event is sent when the drag-and-drop pointer leaves the
+	 * surface and the session ends. The client must destroy the
+	 * wl_data_offer introduced at enter time at this point.
+	 */
+	void (*leave)(void *data,
+		      struct wl_data_device *wl_data_device);
+	/**
+	 * drag-and-drop session motion
+	 *
+	 * This event is sent when the drag-and-drop pointer moves within
+	 * the currently focused surface. The new position of the pointer
+	 * is provided by the x and y arguments, in surface-local
+	 * coordinates.
+	 * @param time timestamp with millisecond granularity
+	 * @param x surface-local x coordinate
+	 * @param y surface-local y coordinate
+	 */
+	void (*motion)(void *data,
+		       struct wl_data_device *wl_data_device,
+		       uint32_t time,
+		       wl_fixed_t x,
+		       wl_fixed_t y);
+	/**
+	 * end drag-and-drop session successfully
+	 *
+	 * The event is sent when a drag-and-drop operation is ended
+	 * because the implicit grab is removed.
+	 *
+	 * The drag-and-drop destination is expected to honor the last
+	 * action received through wl_data_offer.action, if the resulting
+	 * action is "copy" or "move", the destination can still perform
+	 * wl_data_offer.receive requests, and is expected to end all
+	 * transfers with a wl_data_offer.finish request.
+	 *
+	 * If the resulting action is "ask", the action will not be
+	 * considered final. The drag-and-drop destination is expected to
+	 * perform one last wl_data_offer.set_actions request, or
+	 * wl_data_offer.destroy in order to cancel the operation.
+	 */
+	void (*drop)(void *data,
+		     struct wl_data_device *wl_data_device);
+	/**
+	 * advertise new selection
+	 *
+	 * The selection event is sent out to notify the client of a new
+	 * wl_data_offer for the selection for this device. The
+	 * data_device.data_offer and the data_offer.offer events are sent
+	 * out immediately before this event to introduce the data offer
+	 * object. The selection event is sent to a client immediately
+	 * before receiving keyboard focus and when a new selection is set
+	 * while the client has keyboard focus. The data_offer is valid
+	 * until a new data_offer or NULL is received or until the client
+	 * loses keyboard focus. Switching surface with keyboard focus
+	 * within the same client doesn't mean a new selection will be
+	 * sent. The client must destroy the previous selection data_offer,
+	 * if any, upon receiving this event.
+	 * @param id selection data_offer object
+	 */
+	void (*selection)(void *data,
+			  struct wl_data_device *wl_data_device,
+			  struct wl_data_offer *id);
+};
+
+/**
+ * @ingroup iface_wl_data_device
+ */
+static inline int
+wl_data_device_add_listener(struct wl_data_device *wl_data_device,
+			    const struct wl_data_device_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_data_device,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_DATA_DEVICE_START_DRAG 0
+#define WL_DATA_DEVICE_SET_SELECTION 1
+#define WL_DATA_DEVICE_RELEASE 2
+
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_DATA_OFFER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_ENTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_LEAVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_MOTION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_DROP_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_SELECTION_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_START_DRAG_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_SET_SELECTION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device
+ */
+#define WL_DATA_DEVICE_RELEASE_SINCE_VERSION 2
+
+/** @ingroup iface_wl_data_device */
+static inline void
+wl_data_device_set_user_data(struct wl_data_device *wl_data_device, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_data_device, user_data);
+}
+
+/** @ingroup iface_wl_data_device */
+static inline void *
+wl_data_device_get_user_data(struct wl_data_device *wl_data_device)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device);
+}
+
+static inline uint32_t
+wl_data_device_get_version(struct wl_data_device *wl_data_device)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_data_device);
+}
+
+/** @ingroup iface_wl_data_device */
+static inline void
+wl_data_device_destroy(struct wl_data_device *wl_data_device)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_data_device);
+}
+
+/**
+ * @ingroup iface_wl_data_device
+ *
+ * This request asks the compositor to start a drag-and-drop
+ * operation on behalf of the client.
+ *
+ * The source argument is the data source that provides the data
+ * for the eventual data transfer. If source is NULL, enter, leave
+ * and motion events are sent only to the client that initiated the
+ * drag and the client is expected to handle the data passing
+ * internally. If source is destroyed, the drag-and-drop session will be
+ * cancelled.
+ *
+ * The origin surface is the surface where the drag originates and
+ * the client must have an active implicit grab that matches the
+ * serial.
+ *
+ * The icon surface is an optional (can be NULL) surface that
+ * provides an icon to be moved around with the cursor.  Initially,
+ * the top-left corner of the icon surface is placed at the cursor
+ * hotspot, but subsequent wl_surface.attach request can move the
+ * relative position. Attach requests must be confirmed with
+ * wl_surface.commit as usual. The icon surface is given the role of
+ * a drag-and-drop icon. If the icon surface already has another role,
+ * it raises a protocol error.
+ *
+ * The current and pending input regions of the icon wl_surface are
+ * cleared, and wl_surface.set_input_region is ignored until the
+ * wl_surface is no longer used as the icon surface. When the use
+ * as an icon ends, the current and pending input regions become
+ * undefined, and the wl_surface is unmapped.
+ */
+static inline void
+wl_data_device_start_drag(struct wl_data_device *wl_data_device, struct wl_data_source *source, struct wl_surface *origin, struct wl_surface *icon, uint32_t serial)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
+			 WL_DATA_DEVICE_START_DRAG, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), 0, source, origin, icon, serial);
+}
+
+/**
+ * @ingroup iface_wl_data_device
+ *
+ * This request asks the compositor to set the selection
+ * to the data from the source on behalf of the client.
+ *
+ * To unset the selection, set the source to NULL.
+ */
+static inline void
+wl_data_device_set_selection(struct wl_data_device *wl_data_device, struct wl_data_source *source, uint32_t serial)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
+			 WL_DATA_DEVICE_SET_SELECTION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), 0, source, serial);
+}
+
+/**
+ * @ingroup iface_wl_data_device
+ *
+ * This request destroys the data device.
+ */
+static inline void
+wl_data_device_release(struct wl_data_device *wl_data_device)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device,
+			 WL_DATA_DEVICE_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_data_device), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
+#define WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM
+/**
+ * @ingroup iface_wl_data_device_manager
+ * drag and drop actions
+ *
+ * This is a bitmask of the available/preferred actions in a
+ * drag-and-drop operation.
+ *
+ * In the compositor, the selected action is a result of matching the
+ * actions offered by the source and destination sides.  "action" events
+ * with a "none" action will be sent to both source and destination if
+ * there is no match. All further checks will effectively happen on
+ * (source actions ∩ destination actions).
+ *
+ * In addition, compositors may also pick different actions in
+ * reaction to key modifiers being pressed. One common design that
+ * is used in major toolkits (and the behavior recommended for
+ * compositors) is:
+ *
+ * - If no modifiers are pressed, the first match (in bit order)
+ * will be used.
+ * - Pressing Shift selects "move", if enabled in the mask.
+ * - Pressing Control selects "copy", if enabled in the mask.
+ *
+ * Behavior beyond that is considered implementation-dependent.
+ * Compositors may for example bind other modifiers (like Alt/Meta)
+ * or drags initiated with other buttons than BTN_LEFT to specific
+ * actions (e.g. "ask").
+ */
+enum wl_data_device_manager_dnd_action {
+	/**
+	 * no action
+	 */
+	WL_DATA_DEVICE_MANAGER_DND_ACTION_NONE = 0,
+	/**
+	 * copy action
+	 */
+	WL_DATA_DEVICE_MANAGER_DND_ACTION_COPY = 1,
+	/**
+	 * move action
+	 */
+	WL_DATA_DEVICE_MANAGER_DND_ACTION_MOVE = 2,
+	/**
+	 * ask action
+	 */
+	WL_DATA_DEVICE_MANAGER_DND_ACTION_ASK = 4,
+};
+#endif /* WL_DATA_DEVICE_MANAGER_DND_ACTION_ENUM */
+
+#define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE 0
+#define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE 1
+
+
+/**
+ * @ingroup iface_wl_data_device_manager
+ */
+#define WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_data_device_manager
+ */
+#define WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE_SINCE_VERSION 1
+
+/** @ingroup iface_wl_data_device_manager */
+static inline void
+wl_data_device_manager_set_user_data(struct wl_data_device_manager *wl_data_device_manager, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_data_device_manager, user_data);
+}
+
+/** @ingroup iface_wl_data_device_manager */
+static inline void *
+wl_data_device_manager_get_user_data(struct wl_data_device_manager *wl_data_device_manager)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_data_device_manager);
+}
+
+static inline uint32_t
+wl_data_device_manager_get_version(struct wl_data_device_manager *wl_data_device_manager)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager);
+}
+
+/** @ingroup iface_wl_data_device_manager */
+static inline void
+wl_data_device_manager_destroy(struct wl_data_device_manager *wl_data_device_manager)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_data_device_manager);
+}
+
+/**
+ * @ingroup iface_wl_data_device_manager
+ *
+ * Create a new data source.
+ */
+static inline struct wl_data_source *
+wl_data_device_manager_create_data_source(struct wl_data_device_manager *wl_data_device_manager)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device_manager,
+			 WL_DATA_DEVICE_MANAGER_CREATE_DATA_SOURCE, &wl_data_source_interface, wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager), 0, NULL);
+
+	return (struct wl_data_source *) id;
+}
+
+/**
+ * @ingroup iface_wl_data_device_manager
+ *
+ * Create a new data device for a given seat.
+ */
+static inline struct wl_data_device *
+wl_data_device_manager_get_data_device(struct wl_data_device_manager *wl_data_device_manager, struct wl_seat *seat)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_data_device_manager,
+			 WL_DATA_DEVICE_MANAGER_GET_DATA_DEVICE, &wl_data_device_interface, wl_proxy_get_version((struct wl_proxy *) wl_data_device_manager), 0, NULL, seat);
+
+	return (struct wl_data_device *) id;
+}
+
+#ifndef WL_SHELL_ERROR_ENUM
+#define WL_SHELL_ERROR_ENUM
+enum wl_shell_error {
+	/**
+	 * given wl_surface has another role
+	 */
+	WL_SHELL_ERROR_ROLE = 0,
+};
+#endif /* WL_SHELL_ERROR_ENUM */
+
+#define WL_SHELL_GET_SHELL_SURFACE 0
+
+
+/**
+ * @ingroup iface_wl_shell
+ */
+#define WL_SHELL_GET_SHELL_SURFACE_SINCE_VERSION 1
+
+/** @ingroup iface_wl_shell */
+static inline void
+wl_shell_set_user_data(struct wl_shell *wl_shell, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_shell, user_data);
+}
+
+/** @ingroup iface_wl_shell */
+static inline void *
+wl_shell_get_user_data(struct wl_shell *wl_shell)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_shell);
+}
+
+static inline uint32_t
+wl_shell_get_version(struct wl_shell *wl_shell)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_shell);
+}
+
+/** @ingroup iface_wl_shell */
+static inline void
+wl_shell_destroy(struct wl_shell *wl_shell)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_shell);
+}
+
+/**
+ * @ingroup iface_wl_shell
+ *
+ * Create a shell surface for an existing surface. This gives
+ * the wl_surface the role of a shell surface. If the wl_surface
+ * already has another role, it raises a protocol error.
+ *
+ * Only one shell surface can be associated with a given surface.
+ */
+static inline struct wl_shell_surface *
+wl_shell_get_shell_surface(struct wl_shell *wl_shell, struct wl_surface *surface)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_shell,
+			 WL_SHELL_GET_SHELL_SURFACE, &wl_shell_surface_interface, wl_proxy_get_version((struct wl_proxy *) wl_shell), 0, NULL, surface);
+
+	return (struct wl_shell_surface *) id;
+}
+
+#ifndef WL_SHELL_SURFACE_RESIZE_ENUM
+#define WL_SHELL_SURFACE_RESIZE_ENUM
+/**
+ * @ingroup iface_wl_shell_surface
+ * edge values for resizing
+ *
+ * These values are used to indicate which edge of a surface
+ * is being dragged in a resize operation. The server may
+ * use this information to adapt its behavior, e.g. choose
+ * an appropriate cursor image.
+ */
+enum wl_shell_surface_resize {
+	/**
+	 * no edge
+	 */
+	WL_SHELL_SURFACE_RESIZE_NONE = 0,
+	/**
+	 * top edge
+	 */
+	WL_SHELL_SURFACE_RESIZE_TOP = 1,
+	/**
+	 * bottom edge
+	 */
+	WL_SHELL_SURFACE_RESIZE_BOTTOM = 2,
+	/**
+	 * left edge
+	 */
+	WL_SHELL_SURFACE_RESIZE_LEFT = 4,
+	/**
+	 * top and left edges
+	 */
+	WL_SHELL_SURFACE_RESIZE_TOP_LEFT = 5,
+	/**
+	 * bottom and left edges
+	 */
+	WL_SHELL_SURFACE_RESIZE_BOTTOM_LEFT = 6,
+	/**
+	 * right edge
+	 */
+	WL_SHELL_SURFACE_RESIZE_RIGHT = 8,
+	/**
+	 * top and right edges
+	 */
+	WL_SHELL_SURFACE_RESIZE_TOP_RIGHT = 9,
+	/**
+	 * bottom and right edges
+	 */
+	WL_SHELL_SURFACE_RESIZE_BOTTOM_RIGHT = 10,
+};
+#endif /* WL_SHELL_SURFACE_RESIZE_ENUM */
+
+#ifndef WL_SHELL_SURFACE_TRANSIENT_ENUM
+#define WL_SHELL_SURFACE_TRANSIENT_ENUM
+/**
+ * @ingroup iface_wl_shell_surface
+ * details of transient behaviour
+ *
+ * These flags specify details of the expected behaviour
+ * of transient surfaces. Used in the set_transient request.
+ */
+enum wl_shell_surface_transient {
+	/**
+	 * do not set keyboard focus
+	 */
+	WL_SHELL_SURFACE_TRANSIENT_INACTIVE = 0x1,
+};
+#endif /* WL_SHELL_SURFACE_TRANSIENT_ENUM */
+
+#ifndef WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
+#define WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM
+/**
+ * @ingroup iface_wl_shell_surface
+ * different method to set the surface fullscreen
+ *
+ * Hints to indicate to the compositor how to deal with a conflict
+ * between the dimensions of the surface and the dimensions of the
+ * output. The compositor is free to ignore this parameter.
+ */
+enum wl_shell_surface_fullscreen_method {
+	/**
+	 * no preference, apply default policy
+	 */
+	WL_SHELL_SURFACE_FULLSCREEN_METHOD_DEFAULT = 0,
+	/**
+	 * scale, preserve the surface's aspect ratio and center on output
+	 */
+	WL_SHELL_SURFACE_FULLSCREEN_METHOD_SCALE = 1,
+	/**
+	 * switch output mode to the smallest mode that can fit the surface, add black borders to compensate size mismatch
+	 */
+	WL_SHELL_SURFACE_FULLSCREEN_METHOD_DRIVER = 2,
+	/**
+	 * no upscaling, center on output and add black borders to compensate size mismatch
+	 */
+	WL_SHELL_SURFACE_FULLSCREEN_METHOD_FILL = 3,
+};
+#endif /* WL_SHELL_SURFACE_FULLSCREEN_METHOD_ENUM */
+
+/**
+ * @ingroup iface_wl_shell_surface
+ * @struct wl_shell_surface_listener
+ */
+struct wl_shell_surface_listener {
+	/**
+	 * ping client
+	 *
+	 * Ping a client to check if it is receiving events and sending
+	 * requests. A client is expected to reply with a pong request.
+	 * @param serial serial number of the ping
+	 */
+	void (*ping)(void *data,
+		     struct wl_shell_surface *wl_shell_surface,
+		     uint32_t serial);
+	/**
+	 * suggest resize
+	 *
+	 * The configure event asks the client to resize its surface.
+	 *
+	 * The size is a hint, in the sense that the client is free to
+	 * ignore it if it doesn't resize, pick a smaller size (to satisfy
+	 * aspect ratio or resize in steps of NxM pixels).
+	 *
+	 * The edges parameter provides a hint about how the surface was
+	 * resized. The client may use this information to decide how to
+	 * adjust its content to the new size (e.g. a scrolling area might
+	 * adjust its content position to leave the viewable content
+	 * unmoved).
+	 *
+	 * The client is free to dismiss all but the last configure event
+	 * it received.
+	 *
+	 * The width and height arguments specify the size of the window in
+	 * surface-local coordinates.
+	 * @param edges how the surface was resized
+	 * @param width new width of the surface
+	 * @param height new height of the surface
+	 */
+	void (*configure)(void *data,
+			  struct wl_shell_surface *wl_shell_surface,
+			  uint32_t edges,
+			  int32_t width,
+			  int32_t height);
+	/**
+	 * popup interaction is done
+	 *
+	 * The popup_done event is sent out when a popup grab is broken,
+	 * that is, when the user clicks a surface that doesn't belong to
+	 * the client owning the popup surface.
+	 */
+	void (*popup_done)(void *data,
+			   struct wl_shell_surface *wl_shell_surface);
+};
+
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+static inline int
+wl_shell_surface_add_listener(struct wl_shell_surface *wl_shell_surface,
+			      const struct wl_shell_surface_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_shell_surface,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_SHELL_SURFACE_PONG 0
+#define WL_SHELL_SURFACE_MOVE 1
+#define WL_SHELL_SURFACE_RESIZE 2
+#define WL_SHELL_SURFACE_SET_TOPLEVEL 3
+#define WL_SHELL_SURFACE_SET_TRANSIENT 4
+#define WL_SHELL_SURFACE_SET_FULLSCREEN 5
+#define WL_SHELL_SURFACE_SET_POPUP 6
+#define WL_SHELL_SURFACE_SET_MAXIMIZED 7
+#define WL_SHELL_SURFACE_SET_TITLE 8
+#define WL_SHELL_SURFACE_SET_CLASS 9
+
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_PING_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_CONFIGURE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_POPUP_DONE_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_PONG_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_MOVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_RESIZE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_TOPLEVEL_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_TRANSIENT_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_FULLSCREEN_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_POPUP_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_MAXIMIZED_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_TITLE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_shell_surface
+ */
+#define WL_SHELL_SURFACE_SET_CLASS_SINCE_VERSION 1
+
+/** @ingroup iface_wl_shell_surface */
+static inline void
+wl_shell_surface_set_user_data(struct wl_shell_surface *wl_shell_surface, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_shell_surface, user_data);
+}
+
+/** @ingroup iface_wl_shell_surface */
+static inline void *
+wl_shell_surface_get_user_data(struct wl_shell_surface *wl_shell_surface)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_shell_surface);
+}
+
+static inline uint32_t
+wl_shell_surface_get_version(struct wl_shell_surface *wl_shell_surface)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_shell_surface);
+}
+
+/** @ingroup iface_wl_shell_surface */
+static inline void
+wl_shell_surface_destroy(struct wl_shell_surface *wl_shell_surface)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_shell_surface);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * A client must respond to a ping event with a pong request or
+ * the client may be deemed unresponsive.
+ */
+static inline void
+wl_shell_surface_pong(struct wl_shell_surface *wl_shell_surface, uint32_t serial)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_PONG, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, serial);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Start a pointer-driven move of the surface.
+ *
+ * This request must be used in response to a button press event.
+ * The server may ignore move requests depending on the state of
+ * the surface (e.g. fullscreen or maximized).
+ */
+static inline void
+wl_shell_surface_move(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_MOVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Start a pointer-driven resizing of the surface.
+ *
+ * This request must be used in response to a button press event.
+ * The server may ignore resize requests depending on the state of
+ * the surface (e.g. fullscreen or maximized).
+ */
+static inline void
+wl_shell_surface_resize(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, uint32_t edges)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_RESIZE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, edges);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Map the surface as a toplevel surface.
+ *
+ * A toplevel surface is not fullscreen, maximized or transient.
+ */
+static inline void
+wl_shell_surface_set_toplevel(struct wl_shell_surface *wl_shell_surface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_TOPLEVEL, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Map the surface relative to an existing surface.
+ *
+ * The x and y arguments specify the location of the upper left
+ * corner of the surface relative to the upper left corner of the
+ * parent surface, in surface-local coordinates.
+ *
+ * The flags argument controls details of the transient behaviour.
+ */
+static inline void
+wl_shell_surface_set_transient(struct wl_shell_surface *wl_shell_surface, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_TRANSIENT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, parent, x, y, flags);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Map the surface as a fullscreen surface.
+ *
+ * If an output parameter is given then the surface will be made
+ * fullscreen on that output. If the client does not specify the
+ * output then the compositor will apply its policy - usually
+ * choosing the output on which the surface has the biggest surface
+ * area.
+ *
+ * The client may specify a method to resolve a size conflict
+ * between the output size and the surface size - this is provided
+ * through the method parameter.
+ *
+ * The framerate parameter is used only when the method is set
+ * to "driver", to indicate the preferred framerate. A value of 0
+ * indicates that the client does not care about framerate.  The
+ * framerate is specified in mHz, that is framerate of 60000 is 60Hz.
+ *
+ * A method of "scale" or "driver" implies a scaling operation of
+ * the surface, either via a direct scaling operation or a change of
+ * the output mode. This will override any kind of output scaling, so
+ * that mapping a surface with a buffer size equal to the mode can
+ * fill the screen independent of buffer_scale.
+ *
+ * A method of "fill" means we don't scale up the buffer, however
+ * any output scale is applied. This means that you may run into
+ * an edge case where the application maps a buffer with the same
+ * size of the output mode but buffer_scale 1 (thus making a
+ * surface larger than the output). In this case it is allowed to
+ * downscale the results to fit the screen.
+ *
+ * The compositor must reply to this request with a configure event
+ * with the dimensions for the output on which the surface will
+ * be made fullscreen.
+ */
+static inline void
+wl_shell_surface_set_fullscreen(struct wl_shell_surface *wl_shell_surface, uint32_t method, uint32_t framerate, struct wl_output *output)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_FULLSCREEN, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, method, framerate, output);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Map the surface as a popup.
+ *
+ * A popup surface is a transient surface with an added pointer
+ * grab.
+ *
+ * An existing implicit grab will be changed to owner-events mode,
+ * and the popup grab will continue after the implicit grab ends
+ * (i.e. releasing the mouse button does not cause the popup to
+ * be unmapped).
+ *
+ * The popup grab continues until the window is destroyed or a
+ * mouse button is pressed in any other client's window. A click
+ * in any of the client's surfaces is reported as normal, however,
+ * clicks in other clients' surfaces will be discarded and trigger
+ * the callback.
+ *
+ * The x and y arguments specify the location of the upper left
+ * corner of the surface relative to the upper left corner of the
+ * parent surface, in surface-local coordinates.
+ */
+static inline void
+wl_shell_surface_set_popup(struct wl_shell_surface *wl_shell_surface, struct wl_seat *seat, uint32_t serial, struct wl_surface *parent, int32_t x, int32_t y, uint32_t flags)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_POPUP, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, seat, serial, parent, x, y, flags);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Map the surface as a maximized surface.
+ *
+ * If an output parameter is given then the surface will be
+ * maximized on that output. If the client does not specify the
+ * output then the compositor will apply its policy - usually
+ * choosing the output on which the surface has the biggest surface
+ * area.
+ *
+ * The compositor will reply with a configure event telling
+ * the expected new surface size. The operation is completed
+ * on the next buffer attach to this surface.
+ *
+ * A maximized surface typically fills the entire output it is
+ * bound to, except for desktop elements such as panels. This is
+ * the main difference between a maximized shell surface and a
+ * fullscreen shell surface.
+ *
+ * The details depend on the compositor implementation.
+ */
+static inline void
+wl_shell_surface_set_maximized(struct wl_shell_surface *wl_shell_surface, struct wl_output *output)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_MAXIMIZED, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, output);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Set a short title for the surface.
+ *
+ * This string may be used to identify the surface in a task bar,
+ * window list, or other user interface elements provided by the
+ * compositor.
+ *
+ * The string must be encoded in UTF-8.
+ */
+static inline void
+wl_shell_surface_set_title(struct wl_shell_surface *wl_shell_surface, const char *title)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_TITLE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, title);
+}
+
+/**
+ * @ingroup iface_wl_shell_surface
+ *
+ * Set a class for the surface.
+ *
+ * The surface class identifies the general class of applications
+ * to which the surface belongs. A common convention is to use the
+ * file name (or the full path if it is a non-standard location) of
+ * the application's .desktop file as the class.
+ */
+static inline void
+wl_shell_surface_set_class(struct wl_shell_surface *wl_shell_surface, const char *class_)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_shell_surface,
+			 WL_SHELL_SURFACE_SET_CLASS, NULL, wl_proxy_get_version((struct wl_proxy *) wl_shell_surface), 0, class_);
+}
+
+#ifndef WL_SURFACE_ERROR_ENUM
+#define WL_SURFACE_ERROR_ENUM
+/**
+ * @ingroup iface_wl_surface
+ * wl_surface error values
+ *
+ * These errors can be emitted in response to wl_surface requests.
+ */
+enum wl_surface_error {
+	/**
+	 * buffer scale value is invalid
+	 */
+	WL_SURFACE_ERROR_INVALID_SCALE = 0,
+	/**
+	 * buffer transform value is invalid
+	 */
+	WL_SURFACE_ERROR_INVALID_TRANSFORM = 1,
+	/**
+	 * buffer size is invalid
+	 */
+	WL_SURFACE_ERROR_INVALID_SIZE = 2,
+	/**
+	 * buffer offset is invalid
+	 */
+	WL_SURFACE_ERROR_INVALID_OFFSET = 3,
+};
+#endif /* WL_SURFACE_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_surface
+ * @struct wl_surface_listener
+ */
+struct wl_surface_listener {
+	/**
+	 * surface enters an output
+	 *
+	 * This is emitted whenever a surface's creation, movement, or
+	 * resizing results in some part of it being within the scanout
+	 * region of an output.
+	 *
+	 * Note that a surface may be overlapping with zero or more
+	 * outputs.
+	 * @param output output entered by the surface
+	 */
+	void (*enter)(void *data,
+		      struct wl_surface *wl_surface,
+		      struct wl_output *output);
+	/**
+	 * surface leaves an output
+	 *
+	 * This is emitted whenever a surface's creation, movement, or
+	 * resizing results in it no longer having any part of it within
+	 * the scanout region of an output.
+	 *
+	 * Clients should not use the number of outputs the surface is on
+	 * for frame throttling purposes. The surface might be hidden even
+	 * if no leave event has been sent, and the compositor might expect
+	 * new surface content updates even if no enter event has been
+	 * sent. The frame event should be used instead.
+	 * @param output output left by the surface
+	 */
+	void (*leave)(void *data,
+		      struct wl_surface *wl_surface,
+		      struct wl_output *output);
+};
+
+/**
+ * @ingroup iface_wl_surface
+ */
+static inline int
+wl_surface_add_listener(struct wl_surface *wl_surface,
+			const struct wl_surface_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_surface,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_SURFACE_DESTROY 0
+#define WL_SURFACE_ATTACH 1
+#define WL_SURFACE_DAMAGE 2
+#define WL_SURFACE_FRAME 3
+#define WL_SURFACE_SET_OPAQUE_REGION 4
+#define WL_SURFACE_SET_INPUT_REGION 5
+#define WL_SURFACE_COMMIT 6
+#define WL_SURFACE_SET_BUFFER_TRANSFORM 7
+#define WL_SURFACE_SET_BUFFER_SCALE 8
+#define WL_SURFACE_DAMAGE_BUFFER 9
+#define WL_SURFACE_OFFSET 10
+
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_ENTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_LEAVE_SINCE_VERSION 1
+
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_ATTACH_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_DAMAGE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_FRAME_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_SET_OPAQUE_REGION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_SET_INPUT_REGION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_COMMIT_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_SET_BUFFER_TRANSFORM_SINCE_VERSION 2
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_SET_BUFFER_SCALE_SINCE_VERSION 3
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION 4
+/**
+ * @ingroup iface_wl_surface
+ */
+#define WL_SURFACE_OFFSET_SINCE_VERSION 5
+
+/** @ingroup iface_wl_surface */
+static inline void
+wl_surface_set_user_data(struct wl_surface *wl_surface, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_surface, user_data);
+}
+
+/** @ingroup iface_wl_surface */
+static inline void *
+wl_surface_get_user_data(struct wl_surface *wl_surface)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_surface);
+}
+
+static inline uint32_t
+wl_surface_get_version(struct wl_surface *wl_surface)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_surface);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * Deletes the surface and invalidates its object ID.
+ */
+static inline void
+wl_surface_destroy(struct wl_surface *wl_surface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * Set a buffer as the content of this surface.
+ *
+ * The new size of the surface is calculated based on the buffer
+ * size transformed by the inverse buffer_transform and the
+ * inverse buffer_scale. This means that at commit time the supplied
+ * buffer size must be an integer multiple of the buffer_scale. If
+ * that's not the case, an invalid_size error is sent.
+ *
+ * The x and y arguments specify the location of the new pending
+ * buffer's upper left corner, relative to the current buffer's upper
+ * left corner, in surface-local coordinates. In other words, the
+ * x and y, combined with the new surface size define in which
+ * directions the surface's size changes. Setting anything other than 0
+ * as x and y arguments is discouraged, and should instead be replaced
+ * with using the separate wl_surface.offset request.
+ *
+ * When the bound wl_surface version is 5 or higher, passing any
+ * non-zero x or y is a protocol violation, and will result in an
+ * 'invalid_offset' error being raised. To achieve equivalent semantics,
+ * use wl_surface.offset.
+ *
+ * Surface contents are double-buffered state, see wl_surface.commit.
+ *
+ * The initial surface contents are void; there is no content.
+ * wl_surface.attach assigns the given wl_buffer as the pending
+ * wl_buffer. wl_surface.commit makes the pending wl_buffer the new
+ * surface contents, and the size of the surface becomes the size
+ * calculated from the wl_buffer, as described above. After commit,
+ * there is no pending buffer until the next attach.
+ *
+ * Committing a pending wl_buffer allows the compositor to read the
+ * pixels in the wl_buffer. The compositor may access the pixels at
+ * any time after the wl_surface.commit request. When the compositor
+ * will not access the pixels anymore, it will send the
+ * wl_buffer.release event. Only after receiving wl_buffer.release,
+ * the client may reuse the wl_buffer. A wl_buffer that has been
+ * attached and then replaced by another attach instead of committed
+ * will not receive a release event, and is not used by the
+ * compositor.
+ *
+ * If a pending wl_buffer has been committed to more than one wl_surface,
+ * the delivery of wl_buffer.release events becomes undefined. A well
+ * behaved client should not rely on wl_buffer.release events in this
+ * case. Alternatively, a client could create multiple wl_buffer objects
+ * from the same backing storage or use wp_linux_buffer_release.
+ *
+ * Destroying the wl_buffer after wl_buffer.release does not change
+ * the surface contents. Destroying the wl_buffer before wl_buffer.release
+ * is allowed as long as the underlying buffer storage isn't re-used (this
+ * can happen e.g. on client process termination). However, if the client
+ * destroys the wl_buffer before receiving the wl_buffer.release event and
+ * mutates the underlying buffer storage, the surface contents become
+ * undefined immediately.
+ *
+ * If wl_surface.attach is sent with a NULL wl_buffer, the
+ * following wl_surface.commit will remove the surface content.
+ */
+static inline void
+wl_surface_attach(struct wl_surface *wl_surface, struct wl_buffer *buffer, int32_t x, int32_t y)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_ATTACH, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, buffer, x, y);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request is used to describe the regions where the pending
+ * buffer is different from the current surface contents, and where
+ * the surface therefore needs to be repainted. The compositor
+ * ignores the parts of the damage that fall outside of the surface.
+ *
+ * Damage is double-buffered state, see wl_surface.commit.
+ *
+ * The damage rectangle is specified in surface-local coordinates,
+ * where x and y specify the upper left corner of the damage rectangle.
+ *
+ * The initial value for pending damage is empty: no damage.
+ * wl_surface.damage adds pending damage: the new pending damage
+ * is the union of old pending damage and the given rectangle.
+ *
+ * wl_surface.commit assigns pending damage as the current damage,
+ * and clears pending damage. The server will clear the current
+ * damage as it repaints the surface.
+ *
+ * Note! New clients should not use this request. Instead damage can be
+ * posted with wl_surface.damage_buffer which uses buffer coordinates
+ * instead of surface coordinates.
+ */
+static inline void
+wl_surface_damage(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_DAMAGE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, x, y, width, height);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * Request a notification when it is a good time to start drawing a new
+ * frame, by creating a frame callback. This is useful for throttling
+ * redrawing operations, and driving animations.
+ *
+ * When a client is animating on a wl_surface, it can use the 'frame'
+ * request to get notified when it is a good time to draw and commit the
+ * next frame of animation. If the client commits an update earlier than
+ * that, it is likely that some updates will not make it to the display,
+ * and the client is wasting resources by drawing too often.
+ *
+ * The frame request will take effect on the next wl_surface.commit.
+ * The notification will only be posted for one frame unless
+ * requested again. For a wl_surface, the notifications are posted in
+ * the order the frame requests were committed.
+ *
+ * The server must send the notifications so that a client
+ * will not send excessive updates, while still allowing
+ * the highest possible update rate for clients that wait for the reply
+ * before drawing again. The server should give some time for the client
+ * to draw and commit after sending the frame callback events to let it
+ * hit the next output refresh.
+ *
+ * A server should avoid signaling the frame callbacks if the
+ * surface is not visible in any way, e.g. the surface is off-screen,
+ * or completely obscured by other opaque surfaces.
+ *
+ * The object returned by this request will be destroyed by the
+ * compositor after the callback is fired and as such the client must not
+ * attempt to use it after that point.
+ *
+ * The callback_data passed in the callback is the current time, in
+ * milliseconds, with an undefined base.
+ */
+static inline struct wl_callback *
+wl_surface_frame(struct wl_surface *wl_surface)
+{
+	struct wl_proxy *callback;
+
+	callback = wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_FRAME, &wl_callback_interface, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, NULL);
+
+	return (struct wl_callback *) callback;
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request sets the region of the surface that contains
+ * opaque content.
+ *
+ * The opaque region is an optimization hint for the compositor
+ * that lets it optimize the redrawing of content behind opaque
+ * regions.  Setting an opaque region is not required for correct
+ * behaviour, but marking transparent content as opaque will result
+ * in repaint artifacts.
+ *
+ * The opaque region is specified in surface-local coordinates.
+ *
+ * The compositor ignores the parts of the opaque region that fall
+ * outside of the surface.
+ *
+ * Opaque region is double-buffered state, see wl_surface.commit.
+ *
+ * wl_surface.set_opaque_region changes the pending opaque region.
+ * wl_surface.commit copies the pending region to the current region.
+ * Otherwise, the pending and current regions are never changed.
+ *
+ * The initial value for an opaque region is empty. Setting the pending
+ * opaque region has copy semantics, and the wl_region object can be
+ * destroyed immediately. A NULL wl_region causes the pending opaque
+ * region to be set to empty.
+ */
+static inline void
+wl_surface_set_opaque_region(struct wl_surface *wl_surface, struct wl_region *region)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_SET_OPAQUE_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, region);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request sets the region of the surface that can receive
+ * pointer and touch events.
+ *
+ * Input events happening outside of this region will try the next
+ * surface in the server surface stack. The compositor ignores the
+ * parts of the input region that fall outside of the surface.
+ *
+ * The input region is specified in surface-local coordinates.
+ *
+ * Input region is double-buffered state, see wl_surface.commit.
+ *
+ * wl_surface.set_input_region changes the pending input region.
+ * wl_surface.commit copies the pending region to the current region.
+ * Otherwise the pending and current regions are never changed,
+ * except cursor and icon surfaces are special cases, see
+ * wl_pointer.set_cursor and wl_data_device.start_drag.
+ *
+ * The initial value for an input region is infinite. That means the
+ * whole surface will accept input. Setting the pending input region
+ * has copy semantics, and the wl_region object can be destroyed
+ * immediately. A NULL wl_region causes the input region to be set
+ * to infinite.
+ */
+static inline void
+wl_surface_set_input_region(struct wl_surface *wl_surface, struct wl_region *region)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_SET_INPUT_REGION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, region);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * Surface state (input, opaque, and damage regions, attached buffers,
+ * etc.) is double-buffered. Protocol requests modify the pending state,
+ * as opposed to the current state in use by the compositor. A commit
+ * request atomically applies all pending state, replacing the current
+ * state. After commit, the new pending state is as documented for each
+ * related request.
+ *
+ * On commit, a pending wl_buffer is applied first, and all other state
+ * second. This means that all coordinates in double-buffered state are
+ * relative to the new wl_buffer coming into use, except for
+ * wl_surface.attach itself. If there is no pending wl_buffer, the
+ * coordinates are relative to the current surface contents.
+ *
+ * All requests that need a commit to become effective are documented
+ * to affect double-buffered state.
+ *
+ * Other interfaces may add further double-buffered surface state.
+ */
+static inline void
+wl_surface_commit(struct wl_surface *wl_surface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_COMMIT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request sets an optional transformation on how the compositor
+ * interprets the contents of the buffer attached to the surface. The
+ * accepted values for the transform parameter are the values for
+ * wl_output.transform.
+ *
+ * Buffer transform is double-buffered state, see wl_surface.commit.
+ *
+ * A newly created surface has its buffer transformation set to normal.
+ *
+ * wl_surface.set_buffer_transform changes the pending buffer
+ * transformation. wl_surface.commit copies the pending buffer
+ * transformation to the current one. Otherwise, the pending and current
+ * values are never changed.
+ *
+ * The purpose of this request is to allow clients to render content
+ * according to the output transform, thus permitting the compositor to
+ * use certain optimizations even if the display is rotated. Using
+ * hardware overlays and scanning out a client buffer for fullscreen
+ * surfaces are examples of such optimizations. Those optimizations are
+ * highly dependent on the compositor implementation, so the use of this
+ * request should be considered on a case-by-case basis.
+ *
+ * Note that if the transform value includes 90 or 270 degree rotation,
+ * the width of the buffer will become the surface height and the height
+ * of the buffer will become the surface width.
+ *
+ * If transform is not one of the values from the
+ * wl_output.transform enum the invalid_transform protocol error
+ * is raised.
+ */
+static inline void
+wl_surface_set_buffer_transform(struct wl_surface *wl_surface, int32_t transform)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_SET_BUFFER_TRANSFORM, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, transform);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request sets an optional scaling factor on how the compositor
+ * interprets the contents of the buffer attached to the window.
+ *
+ * Buffer scale is double-buffered state, see wl_surface.commit.
+ *
+ * A newly created surface has its buffer scale set to 1.
+ *
+ * wl_surface.set_buffer_scale changes the pending buffer scale.
+ * wl_surface.commit copies the pending buffer scale to the current one.
+ * Otherwise, the pending and current values are never changed.
+ *
+ * The purpose of this request is to allow clients to supply higher
+ * resolution buffer data for use on high resolution outputs. It is
+ * intended that you pick the same buffer scale as the scale of the
+ * output that the surface is displayed on. This means the compositor
+ * can avoid scaling when rendering the surface on that output.
+ *
+ * Note that if the scale is larger than 1, then you have to attach
+ * a buffer that is larger (by a factor of scale in each dimension)
+ * than the desired surface size.
+ *
+ * If scale is not positive the invalid_scale protocol error is
+ * raised.
+ */
+static inline void
+wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_SET_BUFFER_SCALE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, scale);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * This request is used to describe the regions where the pending
+ * buffer is different from the current surface contents, and where
+ * the surface therefore needs to be repainted. The compositor
+ * ignores the parts of the damage that fall outside of the surface.
+ *
+ * Damage is double-buffered state, see wl_surface.commit.
+ *
+ * The damage rectangle is specified in buffer coordinates,
+ * where x and y specify the upper left corner of the damage rectangle.
+ *
+ * The initial value for pending damage is empty: no damage.
+ * wl_surface.damage_buffer adds pending damage: the new pending
+ * damage is the union of old pending damage and the given rectangle.
+ *
+ * wl_surface.commit assigns pending damage as the current damage,
+ * and clears pending damage. The server will clear the current
+ * damage as it repaints the surface.
+ *
+ * This request differs from wl_surface.damage in only one way - it
+ * takes damage in buffer coordinates instead of surface-local
+ * coordinates. While this generally is more intuitive than surface
+ * coordinates, it is especially desirable when using wp_viewport
+ * or when a drawing library (like EGL) is unaware of buffer scale
+ * and buffer transform.
+ *
+ * Note: Because buffer transformation changes and damage requests may
+ * be interleaved in the protocol stream, it is impossible to determine
+ * the actual mapping between surface and buffer damage until
+ * wl_surface.commit time. Therefore, compositors wishing to take both
+ * kinds of damage into account will have to accumulate damage from the
+ * two requests separately and only transform from one to the other
+ * after receiving the wl_surface.commit.
+ */
+static inline void
+wl_surface_damage_buffer(struct wl_surface *wl_surface, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_DAMAGE_BUFFER, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, x, y, width, height);
+}
+
+/**
+ * @ingroup iface_wl_surface
+ *
+ * The x and y arguments specify the location of the new pending
+ * buffer's upper left corner, relative to the current buffer's upper
+ * left corner, in surface-local coordinates. In other words, the
+ * x and y, combined with the new surface size define in which
+ * directions the surface's size changes.
+ *
+ * Surface location offset is double-buffered state, see
+ * wl_surface.commit.
+ *
+ * This request is semantically equivalent to and the replaces the x and y
+ * arguments in the wl_surface.attach request in wl_surface versions prior
+ * to 5. See wl_surface.attach for details.
+ */
+static inline void
+wl_surface_offset(struct wl_surface *wl_surface, int32_t x, int32_t y)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_surface,
+			 WL_SURFACE_OFFSET, NULL, wl_proxy_get_version((struct wl_proxy *) wl_surface), 0, x, y);
+}
+
+#ifndef WL_SEAT_CAPABILITY_ENUM
+#define WL_SEAT_CAPABILITY_ENUM
+/**
+ * @ingroup iface_wl_seat
+ * seat capability bitmask
+ *
+ * This is a bitmask of capabilities this seat has; if a member is
+ * set, then it is present on the seat.
+ */
+enum wl_seat_capability {
+	/**
+	 * the seat has pointer devices
+	 */
+	WL_SEAT_CAPABILITY_POINTER = 1,
+	/**
+	 * the seat has one or more keyboards
+	 */
+	WL_SEAT_CAPABILITY_KEYBOARD = 2,
+	/**
+	 * the seat has touch devices
+	 */
+	WL_SEAT_CAPABILITY_TOUCH = 4,
+};
+#endif /* WL_SEAT_CAPABILITY_ENUM */
+
+#ifndef WL_SEAT_ERROR_ENUM
+#define WL_SEAT_ERROR_ENUM
+/**
+ * @ingroup iface_wl_seat
+ * wl_seat error values
+ *
+ * These errors can be emitted in response to wl_seat requests.
+ */
+enum wl_seat_error {
+	/**
+	 * get_pointer, get_keyboard or get_touch called on seat without the matching capability
+	 */
+	WL_SEAT_ERROR_MISSING_CAPABILITY = 0,
+};
+#endif /* WL_SEAT_ERROR_ENUM */
+
+/**
+ * @ingroup iface_wl_seat
+ * @struct wl_seat_listener
+ */
+struct wl_seat_listener {
+	/**
+	 * seat capabilities changed
+	 *
+	 * This is emitted whenever a seat gains or loses the pointer,
+	 * keyboard or touch capabilities. The argument is a capability
+	 * enum containing the complete set of capabilities this seat has.
+	 *
+	 * When the pointer capability is added, a client may create a
+	 * wl_pointer object using the wl_seat.get_pointer request. This
+	 * object will receive pointer events until the capability is
+	 * removed in the future.
+	 *
+	 * When the pointer capability is removed, a client should destroy
+	 * the wl_pointer objects associated with the seat where the
+	 * capability was removed, using the wl_pointer.release request. No
+	 * further pointer events will be received on these objects.
+	 *
+	 * In some compositors, if a seat regains the pointer capability
+	 * and a client has a previously obtained wl_pointer object of
+	 * version 4 or less, that object may start sending pointer events
+	 * again. This behavior is considered a misinterpretation of the
+	 * intended behavior and must not be relied upon by the client.
+	 * wl_pointer objects of version 5 or later must not send events if
+	 * created before the most recent event notifying the client of an
+	 * added pointer capability.
+	 *
+	 * The above behavior also applies to wl_keyboard and wl_touch with
+	 * the keyboard and touch capabilities, respectively.
+	 * @param capabilities capabilities of the seat
+	 */
+	void (*capabilities)(void *data,
+			     struct wl_seat *wl_seat,
+			     uint32_t capabilities);
+	/**
+	 * unique identifier for this seat
+	 *
+	 * In a multi-seat configuration the seat name can be used by
+	 * clients to help identify which physical devices the seat
+	 * represents.
+	 *
+	 * The seat name is a UTF-8 string with no convention defined for
+	 * its contents. Each name is unique among all wl_seat globals. The
+	 * name is only guaranteed to be unique for the current compositor
+	 * instance.
+	 *
+	 * The same seat names are used for all clients. Thus, the name can
+	 * be shared across processes to refer to a specific wl_seat
+	 * global.
+	 *
+	 * The name event is sent after binding to the seat global. This
+	 * event is only sent once per seat object, and the name does not
+	 * change over the lifetime of the wl_seat global.
+	 *
+	 * Compositors may re-use the same seat name if the wl_seat global
+	 * is destroyed and re-created later.
+	 * @param name seat identifier
+	 * @since 2
+	 */
+	void (*name)(void *data,
+		     struct wl_seat *wl_seat,
+		     const char *name);
+};
+
+/**
+ * @ingroup iface_wl_seat
+ */
+static inline int
+wl_seat_add_listener(struct wl_seat *wl_seat,
+		     const struct wl_seat_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_seat,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_SEAT_GET_POINTER 0
+#define WL_SEAT_GET_KEYBOARD 1
+#define WL_SEAT_GET_TOUCH 2
+#define WL_SEAT_RELEASE 3
+
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_CAPABILITIES_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_NAME_SINCE_VERSION 2
+
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_GET_POINTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_GET_KEYBOARD_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_GET_TOUCH_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_seat
+ */
+#define WL_SEAT_RELEASE_SINCE_VERSION 5
+
+/** @ingroup iface_wl_seat */
+static inline void
+wl_seat_set_user_data(struct wl_seat *wl_seat, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_seat, user_data);
+}
+
+/** @ingroup iface_wl_seat */
+static inline void *
+wl_seat_get_user_data(struct wl_seat *wl_seat)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_seat);
+}
+
+static inline uint32_t
+wl_seat_get_version(struct wl_seat *wl_seat)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_seat);
+}
+
+/** @ingroup iface_wl_seat */
+static inline void
+wl_seat_destroy(struct wl_seat *wl_seat)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_seat);
+}
+
+/**
+ * @ingroup iface_wl_seat
+ *
+ * The ID provided will be initialized to the wl_pointer interface
+ * for this seat.
+ *
+ * This request only takes effect if the seat has the pointer
+ * capability, or has had the pointer capability in the past.
+ * It is a protocol violation to issue this request on a seat that has
+ * never had the pointer capability. The missing_capability error will
+ * be sent in this case.
+ */
+static inline struct wl_pointer *
+wl_seat_get_pointer(struct wl_seat *wl_seat)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
+			 WL_SEAT_GET_POINTER, &wl_pointer_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
+
+	return (struct wl_pointer *) id;
+}
+
+/**
+ * @ingroup iface_wl_seat
+ *
+ * The ID provided will be initialized to the wl_keyboard interface
+ * for this seat.
+ *
+ * This request only takes effect if the seat has the keyboard
+ * capability, or has had the keyboard capability in the past.
+ * It is a protocol violation to issue this request on a seat that has
+ * never had the keyboard capability. The missing_capability error will
+ * be sent in this case.
+ */
+static inline struct wl_keyboard *
+wl_seat_get_keyboard(struct wl_seat *wl_seat)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
+			 WL_SEAT_GET_KEYBOARD, &wl_keyboard_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
+
+	return (struct wl_keyboard *) id;
+}
+
+/**
+ * @ingroup iface_wl_seat
+ *
+ * The ID provided will be initialized to the wl_touch interface
+ * for this seat.
+ *
+ * This request only takes effect if the seat has the touch
+ * capability, or has had the touch capability in the past.
+ * It is a protocol violation to issue this request on a seat that has
+ * never had the touch capability. The missing_capability error will
+ * be sent in this case.
+ */
+static inline struct wl_touch *
+wl_seat_get_touch(struct wl_seat *wl_seat)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
+			 WL_SEAT_GET_TOUCH, &wl_touch_interface, wl_proxy_get_version((struct wl_proxy *) wl_seat), 0, NULL);
+
+	return (struct wl_touch *) id;
+}
+
+/**
+ * @ingroup iface_wl_seat
+ *
+ * Using this request a client can tell the server that it is not going to
+ * use the seat object anymore.
+ */
+static inline void
+wl_seat_release(struct wl_seat *wl_seat)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_seat,
+			 WL_SEAT_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_seat), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef WL_POINTER_ERROR_ENUM
+#define WL_POINTER_ERROR_ENUM
+enum wl_pointer_error {
+	/**
+	 * given wl_surface has another role
+	 */
+	WL_POINTER_ERROR_ROLE = 0,
+};
+#endif /* WL_POINTER_ERROR_ENUM */
+
+#ifndef WL_POINTER_BUTTON_STATE_ENUM
+#define WL_POINTER_BUTTON_STATE_ENUM
+/**
+ * @ingroup iface_wl_pointer
+ * physical button state
+ *
+ * Describes the physical state of a button that produced the button
+ * event.
+ */
+enum wl_pointer_button_state {
+	/**
+	 * the button is not pressed
+	 */
+	WL_POINTER_BUTTON_STATE_RELEASED = 0,
+	/**
+	 * the button is pressed
+	 */
+	WL_POINTER_BUTTON_STATE_PRESSED = 1,
+};
+#endif /* WL_POINTER_BUTTON_STATE_ENUM */
+
+#ifndef WL_POINTER_AXIS_ENUM
+#define WL_POINTER_AXIS_ENUM
+/**
+ * @ingroup iface_wl_pointer
+ * axis types
+ *
+ * Describes the axis types of scroll events.
+ */
+enum wl_pointer_axis {
+	/**
+	 * vertical axis
+	 */
+	WL_POINTER_AXIS_VERTICAL_SCROLL = 0,
+	/**
+	 * horizontal axis
+	 */
+	WL_POINTER_AXIS_HORIZONTAL_SCROLL = 1,
+};
+#endif /* WL_POINTER_AXIS_ENUM */
+
+#ifndef WL_POINTER_AXIS_SOURCE_ENUM
+#define WL_POINTER_AXIS_SOURCE_ENUM
+/**
+ * @ingroup iface_wl_pointer
+ * axis source types
+ *
+ * Describes the source types for axis events. This indicates to the
+ * client how an axis event was physically generated; a client may
+ * adjust the user interface accordingly. For example, scroll events
+ * from a "finger" source may be in a smooth coordinate space with
+ * kinetic scrolling whereas a "wheel" source may be in discrete steps
+ * of a number of lines.
+ *
+ * The "continuous" axis source is a device generating events in a
+ * continuous coordinate space, but using something other than a
+ * finger. One example for this source is button-based scrolling where
+ * the vertical motion of a device is converted to scroll events while
+ * a button is held down.
+ *
+ * The "wheel tilt" axis source indicates that the actual device is a
+ * wheel but the scroll event is not caused by a rotation but a
+ * (usually sideways) tilt of the wheel.
+ */
+enum wl_pointer_axis_source {
+	/**
+	 * a physical wheel rotation
+	 */
+	WL_POINTER_AXIS_SOURCE_WHEEL = 0,
+	/**
+	 * finger on a touch surface
+	 */
+	WL_POINTER_AXIS_SOURCE_FINGER = 1,
+	/**
+	 * continuous coordinate space
+	 */
+	WL_POINTER_AXIS_SOURCE_CONTINUOUS = 2,
+	/**
+	 * a physical wheel tilt
+	 * @since 6
+	 */
+	WL_POINTER_AXIS_SOURCE_WHEEL_TILT = 3,
+};
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_SOURCE_WHEEL_TILT_SINCE_VERSION 6
+#endif /* WL_POINTER_AXIS_SOURCE_ENUM */
+
+/**
+ * @ingroup iface_wl_pointer
+ * @struct wl_pointer_listener
+ */
+struct wl_pointer_listener {
+	/**
+	 * enter event
+	 *
+	 * Notification that this seat's pointer is focused on a certain
+	 * surface.
+	 *
+	 * When a seat's focus enters a surface, the pointer image is
+	 * undefined and a client should respond to this event by setting
+	 * an appropriate pointer image with the set_cursor request.
+	 * @param serial serial number of the enter event
+	 * @param surface surface entered by the pointer
+	 * @param surface_x surface-local x coordinate
+	 * @param surface_y surface-local y coordinate
+	 */
+	void (*enter)(void *data,
+		      struct wl_pointer *wl_pointer,
+		      uint32_t serial,
+		      struct wl_surface *surface,
+		      wl_fixed_t surface_x,
+		      wl_fixed_t surface_y);
+	/**
+	 * leave event
+	 *
+	 * Notification that this seat's pointer is no longer focused on
+	 * a certain surface.
+	 *
+	 * The leave notification is sent before the enter notification for
+	 * the new focus.
+	 * @param serial serial number of the leave event
+	 * @param surface surface left by the pointer
+	 */
+	void (*leave)(void *data,
+		      struct wl_pointer *wl_pointer,
+		      uint32_t serial,
+		      struct wl_surface *surface);
+	/**
+	 * pointer motion event
+	 *
+	 * Notification of pointer location change. The arguments
+	 * surface_x and surface_y are the location relative to the focused
+	 * surface.
+	 * @param time timestamp with millisecond granularity
+	 * @param surface_x surface-local x coordinate
+	 * @param surface_y surface-local y coordinate
+	 */
+	void (*motion)(void *data,
+		       struct wl_pointer *wl_pointer,
+		       uint32_t time,
+		       wl_fixed_t surface_x,
+		       wl_fixed_t surface_y);
+	/**
+	 * pointer button event
+	 *
+	 * Mouse button click and release notifications.
+	 *
+	 * The location of the click is given by the last motion or enter
+	 * event. The time argument is a timestamp with millisecond
+	 * granularity, with an undefined base.
+	 *
+	 * The button is a button code as defined in the Linux kernel's
+	 * linux/input-event-codes.h header file, e.g. BTN_LEFT.
+	 *
+	 * Any 16-bit button code value is reserved for future additions to
+	 * the kernel's event code list. All other button codes above
+	 * 0xFFFF are currently undefined but may be used in future
+	 * versions of this protocol.
+	 * @param serial serial number of the button event
+	 * @param time timestamp with millisecond granularity
+	 * @param button button that produced the event
+	 * @param state physical state of the button
+	 */
+	void (*button)(void *data,
+		       struct wl_pointer *wl_pointer,
+		       uint32_t serial,
+		       uint32_t time,
+		       uint32_t button,
+		       uint32_t state);
+	/**
+	 * axis event
+	 *
+	 * Scroll and other axis notifications.
+	 *
+	 * For scroll events (vertical and horizontal scroll axes), the
+	 * value parameter is the length of a vector along the specified
+	 * axis in a coordinate space identical to those of motion events,
+	 * representing a relative movement along the specified axis.
+	 *
+	 * For devices that support movements non-parallel to axes multiple
+	 * axis events will be emitted.
+	 *
+	 * When applicable, for example for touch pads, the server can
+	 * choose to emit scroll events where the motion vector is
+	 * equivalent to a motion event vector.
+	 *
+	 * When applicable, a client can transform its content relative to
+	 * the scroll distance.
+	 * @param time timestamp with millisecond granularity
+	 * @param axis axis type
+	 * @param value length of vector in surface-local coordinate space
+	 */
+	void (*axis)(void *data,
+		     struct wl_pointer *wl_pointer,
+		     uint32_t time,
+		     uint32_t axis,
+		     wl_fixed_t value);
+	/**
+	 * end of a pointer event sequence
+	 *
+	 * Indicates the end of a set of events that logically belong
+	 * together. A client is expected to accumulate the data in all
+	 * events within the frame before proceeding.
+	 *
+	 * All wl_pointer events before a wl_pointer.frame event belong
+	 * logically together. For example, in a diagonal scroll motion the
+	 * compositor will send an optional wl_pointer.axis_source event,
+	 * two wl_pointer.axis events (horizontal and vertical) and finally
+	 * a wl_pointer.frame event. The client may use this information to
+	 * calculate a diagonal vector for scrolling.
+	 *
+	 * When multiple wl_pointer.axis events occur within the same
+	 * frame, the motion vector is the combined motion of all events.
+	 * When a wl_pointer.axis and a wl_pointer.axis_stop event occur
+	 * within the same frame, this indicates that axis movement in one
+	 * axis has stopped but continues in the other axis. When multiple
+	 * wl_pointer.axis_stop events occur within the same frame, this
+	 * indicates that these axes stopped in the same instance.
+	 *
+	 * A wl_pointer.frame event is sent for every logical event group,
+	 * even if the group only contains a single wl_pointer event.
+	 * Specifically, a client may get a sequence: motion, frame,
+	 * button, frame, axis, frame, axis_stop, frame.
+	 *
+	 * The wl_pointer.enter and wl_pointer.leave events are logical
+	 * events generated by the compositor and not the hardware. These
+	 * events are also grouped by a wl_pointer.frame. When a pointer
+	 * moves from one surface to another, a compositor should group the
+	 * wl_pointer.leave event within the same wl_pointer.frame.
+	 * However, a client must not rely on wl_pointer.leave and
+	 * wl_pointer.enter being in the same wl_pointer.frame.
+	 * Compositor-specific policies may require the wl_pointer.leave
+	 * and wl_pointer.enter event being split across multiple
+	 * wl_pointer.frame groups.
+	 * @since 5
+	 */
+	void (*frame)(void *data,
+		      struct wl_pointer *wl_pointer);
+	/**
+	 * axis source event
+	 *
+	 * Source information for scroll and other axes.
+	 *
+	 * This event does not occur on its own. It is sent before a
+	 * wl_pointer.frame event and carries the source information for
+	 * all events within that frame.
+	 *
+	 * The source specifies how this event was generated. If the source
+	 * is wl_pointer.axis_source.finger, a wl_pointer.axis_stop event
+	 * will be sent when the user lifts the finger off the device.
+	 *
+	 * If the source is wl_pointer.axis_source.wheel,
+	 * wl_pointer.axis_source.wheel_tilt or
+	 * wl_pointer.axis_source.continuous, a wl_pointer.axis_stop event
+	 * may or may not be sent. Whether a compositor sends an axis_stop
+	 * event for these sources is hardware-specific and
+	 * implementation-dependent; clients must not rely on receiving an
+	 * axis_stop event for these scroll sources and should treat scroll
+	 * sequences from these scroll sources as unterminated by default.
+	 *
+	 * This event is optional. If the source is unknown for a
+	 * particular axis event sequence, no event is sent. Only one
+	 * wl_pointer.axis_source event is permitted per frame.
+	 *
+	 * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
+	 * is not guaranteed.
+	 * @param axis_source source of the axis event
+	 * @since 5
+	 */
+	void (*axis_source)(void *data,
+			    struct wl_pointer *wl_pointer,
+			    uint32_t axis_source);
+	/**
+	 * axis stop event
+	 *
+	 * Stop notification for scroll and other axes.
+	 *
+	 * For some wl_pointer.axis_source types, a wl_pointer.axis_stop
+	 * event is sent to notify a client that the axis sequence has
+	 * terminated. This enables the client to implement kinetic
+	 * scrolling. See the wl_pointer.axis_source documentation for
+	 * information on when this event may be generated.
+	 *
+	 * Any wl_pointer.axis events with the same axis_source after this
+	 * event should be considered as the start of a new axis motion.
+	 *
+	 * The timestamp is to be interpreted identical to the timestamp in
+	 * the wl_pointer.axis event. The timestamp value may be the same
+	 * as a preceding wl_pointer.axis event.
+	 * @param time timestamp with millisecond granularity
+	 * @param axis the axis stopped with this event
+	 * @since 5
+	 */
+	void (*axis_stop)(void *data,
+			  struct wl_pointer *wl_pointer,
+			  uint32_t time,
+			  uint32_t axis);
+	/**
+	 * axis click event
+	 *
+	 * Discrete step information for scroll and other axes.
+	 *
+	 * This event carries the axis value of the wl_pointer.axis event
+	 * in discrete steps (e.g. mouse wheel clicks).
+	 *
+	 * This event is deprecated with wl_pointer version 8 - this event
+	 * is not sent to clients supporting version 8 or later.
+	 *
+	 * This event does not occur on its own, it is coupled with a
+	 * wl_pointer.axis event that represents this axis value on a
+	 * continuous scale. The protocol guarantees that each
+	 * axis_discrete event is always followed by exactly one axis event
+	 * with the same axis number within the same wl_pointer.frame. Note
+	 * that the protocol allows for other events to occur between the
+	 * axis_discrete and its coupled axis event, including other
+	 * axis_discrete or axis events. A wl_pointer.frame must not
+	 * contain more than one axis_discrete event per axis type.
+	 *
+	 * This event is optional; continuous scrolling devices like
+	 * two-finger scrolling on touchpads do not have discrete steps and
+	 * do not generate this event.
+	 *
+	 * The discrete value carries the directional information. e.g. a
+	 * value of -2 is two steps towards the negative direction of this
+	 * axis.
+	 *
+	 * The axis number is identical to the axis number in the
+	 * associated axis event.
+	 *
+	 * The order of wl_pointer.axis_discrete and wl_pointer.axis_source
+	 * is not guaranteed.
+	 * @param axis axis type
+	 * @param discrete number of steps
+	 * @since 5
+	 */
+	void (*axis_discrete)(void *data,
+			      struct wl_pointer *wl_pointer,
+			      uint32_t axis,
+			      int32_t discrete);
+	/**
+	 * axis high-resolution scroll event
+	 *
+	 * Discrete high-resolution scroll information.
+	 *
+	 * This event carries high-resolution wheel scroll information,
+	 * with each multiple of 120 representing one logical scroll step
+	 * (a wheel detent). For example, an axis_value120 of 30 is one
+	 * quarter of a logical scroll step in the positive direction, a
+	 * value120 of -240 are two logical scroll steps in the negative
+	 * direction within the same hardware event. Clients that rely on
+	 * discrete scrolling should accumulate the value120 to multiples
+	 * of 120 before processing the event.
+	 *
+	 * The value120 must not be zero.
+	 *
+	 * This event replaces the wl_pointer.axis_discrete event in
+	 * clients supporting wl_pointer version 8 or later.
+	 *
+	 * Where a wl_pointer.axis_source event occurs in the same
+	 * wl_pointer.frame, the axis source applies to this event.
+	 *
+	 * The order of wl_pointer.axis_value120 and wl_pointer.axis_source
+	 * is not guaranteed.
+	 * @param axis axis type
+	 * @param value120 scroll distance as fraction of 120
+	 * @since 8
+	 */
+	void (*axis_value120)(void *data,
+			      struct wl_pointer *wl_pointer,
+			      uint32_t axis,
+			      int32_t value120);
+};
+
+/**
+ * @ingroup iface_wl_pointer
+ */
+static inline int
+wl_pointer_add_listener(struct wl_pointer *wl_pointer,
+			const struct wl_pointer_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_pointer,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_POINTER_SET_CURSOR 0
+#define WL_POINTER_RELEASE 1
+
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_ENTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_LEAVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_MOTION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_BUTTON_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_FRAME_SINCE_VERSION 5
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_SOURCE_SINCE_VERSION 5
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_STOP_SINCE_VERSION 5
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_DISCRETE_SINCE_VERSION 5
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_AXIS_VALUE120_SINCE_VERSION 8
+
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_SET_CURSOR_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_pointer
+ */
+#define WL_POINTER_RELEASE_SINCE_VERSION 3
+
+/** @ingroup iface_wl_pointer */
+static inline void
+wl_pointer_set_user_data(struct wl_pointer *wl_pointer, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_pointer, user_data);
+}
+
+/** @ingroup iface_wl_pointer */
+static inline void *
+wl_pointer_get_user_data(struct wl_pointer *wl_pointer)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_pointer);
+}
+
+static inline uint32_t
+wl_pointer_get_version(struct wl_pointer *wl_pointer)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_pointer);
+}
+
+/** @ingroup iface_wl_pointer */
+static inline void
+wl_pointer_destroy(struct wl_pointer *wl_pointer)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_pointer);
+}
+
+/**
+ * @ingroup iface_wl_pointer
+ *
+ * Set the pointer surface, i.e., the surface that contains the
+ * pointer image (cursor). This request gives the surface the role
+ * of a cursor. If the surface already has another role, it raises
+ * a protocol error.
+ *
+ * The cursor actually changes only if the pointer
+ * focus for this device is one of the requesting client's surfaces
+ * or the surface parameter is the current pointer surface. If
+ * there was a previous surface set with this request it is
+ * replaced. If surface is NULL, the pointer image is hidden.
+ *
+ * The parameters hotspot_x and hotspot_y define the position of
+ * the pointer surface relative to the pointer location. Its
+ * top-left corner is always at (x, y) - (hotspot_x, hotspot_y),
+ * where (x, y) are the coordinates of the pointer location, in
+ * surface-local coordinates.
+ *
+ * On surface.attach requests to the pointer surface, hotspot_x
+ * and hotspot_y are decremented by the x and y parameters
+ * passed to the request. Attach must be confirmed by
+ * wl_surface.commit as usual.
+ *
+ * The hotspot can also be updated by passing the currently set
+ * pointer surface to this request with new values for hotspot_x
+ * and hotspot_y.
+ *
+ * The current and pending input regions of the wl_surface are
+ * cleared, and wl_surface.set_input_region is ignored until the
+ * wl_surface is no longer used as the cursor. When the use as a
+ * cursor ends, the current and pending input regions become
+ * undefined, and the wl_surface is unmapped.
+ *
+ * The serial parameter must match the latest wl_pointer.enter
+ * serial number sent to the client. Otherwise the request will be
+ * ignored.
+ */
+static inline void
+wl_pointer_set_cursor(struct wl_pointer *wl_pointer, uint32_t serial, struct wl_surface *surface, int32_t hotspot_x, int32_t hotspot_y)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_pointer,
+			 WL_POINTER_SET_CURSOR, NULL, wl_proxy_get_version((struct wl_proxy *) wl_pointer), 0, serial, surface, hotspot_x, hotspot_y);
+}
+
+/**
+ * @ingroup iface_wl_pointer
+ *
+ * Using this request a client can tell the server that it is not going to
+ * use the pointer object anymore.
+ *
+ * This request destroys the pointer proxy object, so clients must not call
+ * wl_pointer_destroy() after using this request.
+ */
+static inline void
+wl_pointer_release(struct wl_pointer *wl_pointer)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_pointer,
+			 WL_POINTER_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_pointer), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef WL_KEYBOARD_KEYMAP_FORMAT_ENUM
+#define WL_KEYBOARD_KEYMAP_FORMAT_ENUM
+/**
+ * @ingroup iface_wl_keyboard
+ * keyboard mapping format
+ *
+ * This specifies the format of the keymap provided to the
+ * client with the wl_keyboard.keymap event.
+ */
+enum wl_keyboard_keymap_format {
+	/**
+	 * no keymap; client must understand how to interpret the raw keycode
+	 */
+	WL_KEYBOARD_KEYMAP_FORMAT_NO_KEYMAP = 0,
+	/**
+	 * libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode
+	 */
+	WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1 = 1,
+};
+#endif /* WL_KEYBOARD_KEYMAP_FORMAT_ENUM */
+
+#ifndef WL_KEYBOARD_KEY_STATE_ENUM
+#define WL_KEYBOARD_KEY_STATE_ENUM
+/**
+ * @ingroup iface_wl_keyboard
+ * physical key state
+ *
+ * Describes the physical state of a key that produced the key event.
+ */
+enum wl_keyboard_key_state {
+	/**
+	 * key is not pressed
+	 */
+	WL_KEYBOARD_KEY_STATE_RELEASED = 0,
+	/**
+	 * key is pressed
+	 */
+	WL_KEYBOARD_KEY_STATE_PRESSED = 1,
+};
+#endif /* WL_KEYBOARD_KEY_STATE_ENUM */
+
+/**
+ * @ingroup iface_wl_keyboard
+ * @struct wl_keyboard_listener
+ */
+struct wl_keyboard_listener {
+	/**
+	 * keyboard mapping
+	 *
+	 * This event provides a file descriptor to the client which can
+	 * be memory-mapped in read-only mode to provide a keyboard mapping
+	 * description.
+	 *
+	 * From version 7 onwards, the fd must be mapped with MAP_PRIVATE
+	 * by the recipient, as MAP_SHARED may fail.
+	 * @param format keymap format
+	 * @param fd keymap file descriptor
+	 * @param size keymap size, in bytes
+	 */
+	void (*keymap)(void *data,
+		       struct wl_keyboard *wl_keyboard,
+		       uint32_t format,
+		       int32_t fd,
+		       uint32_t size);
+	/**
+	 * enter event
+	 *
+	 * Notification that this seat's keyboard focus is on a certain
+	 * surface.
+	 *
+	 * The compositor must send the wl_keyboard.modifiers event after
+	 * this event.
+	 * @param serial serial number of the enter event
+	 * @param surface surface gaining keyboard focus
+	 * @param keys the currently pressed keys
+	 */
+	void (*enter)(void *data,
+		      struct wl_keyboard *wl_keyboard,
+		      uint32_t serial,
+		      struct wl_surface *surface,
+		      struct wl_array *keys);
+	/**
+	 * leave event
+	 *
+	 * Notification that this seat's keyboard focus is no longer on a
+	 * certain surface.
+	 *
+	 * The leave notification is sent before the enter notification for
+	 * the new focus.
+	 *
+	 * After this event client must assume that all keys, including
+	 * modifiers, are lifted and also it must stop key repeating if
+	 * there's some going on.
+	 * @param serial serial number of the leave event
+	 * @param surface surface that lost keyboard focus
+	 */
+	void (*leave)(void *data,
+		      struct wl_keyboard *wl_keyboard,
+		      uint32_t serial,
+		      struct wl_surface *surface);
+	/**
+	 * key event
+	 *
+	 * A key was pressed or released. The time argument is a
+	 * timestamp with millisecond granularity, with an undefined base.
+	 *
+	 * The key is a platform-specific key code that can be interpreted
+	 * by feeding it to the keyboard mapping (see the keymap event).
+	 *
+	 * If this event produces a change in modifiers, then the resulting
+	 * wl_keyboard.modifiers event must be sent after this event.
+	 * @param serial serial number of the key event
+	 * @param time timestamp with millisecond granularity
+	 * @param key key that produced the event
+	 * @param state physical state of the key
+	 */
+	void (*key)(void *data,
+		    struct wl_keyboard *wl_keyboard,
+		    uint32_t serial,
+		    uint32_t time,
+		    uint32_t key,
+		    uint32_t state);
+	/**
+	 * modifier and group state
+	 *
+	 * Notifies clients that the modifier and/or group state has
+	 * changed, and it should update its local state.
+	 * @param serial serial number of the modifiers event
+	 * @param mods_depressed depressed modifiers
+	 * @param mods_latched latched modifiers
+	 * @param mods_locked locked modifiers
+	 * @param group keyboard layout
+	 */
+	void (*modifiers)(void *data,
+			  struct wl_keyboard *wl_keyboard,
+			  uint32_t serial,
+			  uint32_t mods_depressed,
+			  uint32_t mods_latched,
+			  uint32_t mods_locked,
+			  uint32_t group);
+	/**
+	 * repeat rate and delay
+	 *
+	 * Informs the client about the keyboard's repeat rate and delay.
+	 *
+	 * This event is sent as soon as the wl_keyboard object has been
+	 * created, and is guaranteed to be received by the client before
+	 * any key press event.
+	 *
+	 * Negative values for either rate or delay are illegal. A rate of
+	 * zero will disable any repeating (regardless of the value of
+	 * delay).
+	 *
+	 * This event can be sent later on as well with a new value if
+	 * necessary, so clients should continue listening for the event
+	 * past the creation of wl_keyboard.
+	 * @param rate the rate of repeating keys in characters per second
+	 * @param delay delay in milliseconds since key down until repeating starts
+	 * @since 4
+	 */
+	void (*repeat_info)(void *data,
+			    struct wl_keyboard *wl_keyboard,
+			    int32_t rate,
+			    int32_t delay);
+};
+
+/**
+ * @ingroup iface_wl_keyboard
+ */
+static inline int
+wl_keyboard_add_listener(struct wl_keyboard *wl_keyboard,
+			 const struct wl_keyboard_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_keyboard,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_KEYBOARD_RELEASE 0
+
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_KEYMAP_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_ENTER_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_LEAVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_KEY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_MODIFIERS_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_REPEAT_INFO_SINCE_VERSION 4
+
+/**
+ * @ingroup iface_wl_keyboard
+ */
+#define WL_KEYBOARD_RELEASE_SINCE_VERSION 3
+
+/** @ingroup iface_wl_keyboard */
+static inline void
+wl_keyboard_set_user_data(struct wl_keyboard *wl_keyboard, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_keyboard, user_data);
+}
+
+/** @ingroup iface_wl_keyboard */
+static inline void *
+wl_keyboard_get_user_data(struct wl_keyboard *wl_keyboard)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_keyboard);
+}
+
+static inline uint32_t
+wl_keyboard_get_version(struct wl_keyboard *wl_keyboard)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_keyboard);
+}
+
+/** @ingroup iface_wl_keyboard */
+static inline void
+wl_keyboard_destroy(struct wl_keyboard *wl_keyboard)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_keyboard);
+}
+
+/**
+ * @ingroup iface_wl_keyboard
+ */
+static inline void
+wl_keyboard_release(struct wl_keyboard *wl_keyboard)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_keyboard,
+			 WL_KEYBOARD_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_keyboard), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_touch
+ * @struct wl_touch_listener
+ */
+struct wl_touch_listener {
+	/**
+	 * touch down event and beginning of a touch sequence
+	 *
+	 * A new touch point has appeared on the surface. This touch
+	 * point is assigned a unique ID. Future events from this touch
+	 * point reference this ID. The ID ceases to be valid after a touch
+	 * up event and may be reused in the future.
+	 * @param serial serial number of the touch down event
+	 * @param time timestamp with millisecond granularity
+	 * @param surface surface touched
+	 * @param id the unique ID of this touch point
+	 * @param x surface-local x coordinate
+	 * @param y surface-local y coordinate
+	 */
+	void (*down)(void *data,
+		     struct wl_touch *wl_touch,
+		     uint32_t serial,
+		     uint32_t time,
+		     struct wl_surface *surface,
+		     int32_t id,
+		     wl_fixed_t x,
+		     wl_fixed_t y);
+	/**
+	 * end of a touch event sequence
+	 *
+	 * The touch point has disappeared. No further events will be
+	 * sent for this touch point and the touch point's ID is released
+	 * and may be reused in a future touch down event.
+	 * @param serial serial number of the touch up event
+	 * @param time timestamp with millisecond granularity
+	 * @param id the unique ID of this touch point
+	 */
+	void (*up)(void *data,
+		   struct wl_touch *wl_touch,
+		   uint32_t serial,
+		   uint32_t time,
+		   int32_t id);
+	/**
+	 * update of touch point coordinates
+	 *
+	 * A touch point has changed coordinates.
+	 * @param time timestamp with millisecond granularity
+	 * @param id the unique ID of this touch point
+	 * @param x surface-local x coordinate
+	 * @param y surface-local y coordinate
+	 */
+	void (*motion)(void *data,
+		       struct wl_touch *wl_touch,
+		       uint32_t time,
+		       int32_t id,
+		       wl_fixed_t x,
+		       wl_fixed_t y);
+	/**
+	 * end of touch frame event
+	 *
+	 * Indicates the end of a set of events that logically belong
+	 * together. A client is expected to accumulate the data in all
+	 * events within the frame before proceeding.
+	 *
+	 * A wl_touch.frame terminates at least one event but otherwise no
+	 * guarantee is provided about the set of events within a frame. A
+	 * client must assume that any state not updated in a frame is
+	 * unchanged from the previously known state.
+	 */
+	void (*frame)(void *data,
+		      struct wl_touch *wl_touch);
+	/**
+	 * touch session cancelled
+	 *
+	 * Sent if the compositor decides the touch stream is a global
+	 * gesture. No further events are sent to the clients from that
+	 * particular gesture. Touch cancellation applies to all touch
+	 * points currently active on this client's surface. The client is
+	 * responsible for finalizing the touch points, future touch points
+	 * on this surface may reuse the touch point ID.
+	 */
+	void (*cancel)(void *data,
+		       struct wl_touch *wl_touch);
+	/**
+	 * update shape of touch point
+	 *
+	 * Sent when a touchpoint has changed its shape.
+	 *
+	 * This event does not occur on its own. It is sent before a
+	 * wl_touch.frame event and carries the new shape information for
+	 * any previously reported, or new touch points of that frame.
+	 *
+	 * Other events describing the touch point such as wl_touch.down,
+	 * wl_touch.motion or wl_touch.orientation may be sent within the
+	 * same wl_touch.frame. A client should treat these events as a
+	 * single logical touch point update. The order of wl_touch.shape,
+	 * wl_touch.orientation and wl_touch.motion is not guaranteed. A
+	 * wl_touch.down event is guaranteed to occur before the first
+	 * wl_touch.shape event for this touch ID but both events may occur
+	 * within the same wl_touch.frame.
+	 *
+	 * A touchpoint shape is approximated by an ellipse through the
+	 * major and minor axis length. The major axis length describes the
+	 * longer diameter of the ellipse, while the minor axis length
+	 * describes the shorter diameter. Major and minor are orthogonal
+	 * and both are specified in surface-local coordinates. The center
+	 * of the ellipse is always at the touchpoint location as reported
+	 * by wl_touch.down or wl_touch.move.
+	 *
+	 * This event is only sent by the compositor if the touch device
+	 * supports shape reports. The client has to make reasonable
+	 * assumptions about the shape if it did not receive this event.
+	 * @param id the unique ID of this touch point
+	 * @param major length of the major axis in surface-local coordinates
+	 * @param minor length of the minor axis in surface-local coordinates
+	 * @since 6
+	 */
+	void (*shape)(void *data,
+		      struct wl_touch *wl_touch,
+		      int32_t id,
+		      wl_fixed_t major,
+		      wl_fixed_t minor);
+	/**
+	 * update orientation of touch point
+	 *
+	 * Sent when a touchpoint has changed its orientation.
+	 *
+	 * This event does not occur on its own. It is sent before a
+	 * wl_touch.frame event and carries the new shape information for
+	 * any previously reported, or new touch points of that frame.
+	 *
+	 * Other events describing the touch point such as wl_touch.down,
+	 * wl_touch.motion or wl_touch.shape may be sent within the same
+	 * wl_touch.frame. A client should treat these events as a single
+	 * logical touch point update. The order of wl_touch.shape,
+	 * wl_touch.orientation and wl_touch.motion is not guaranteed. A
+	 * wl_touch.down event is guaranteed to occur before the first
+	 * wl_touch.orientation event for this touch ID but both events may
+	 * occur within the same wl_touch.frame.
+	 *
+	 * The orientation describes the clockwise angle of a touchpoint's
+	 * major axis to the positive surface y-axis and is normalized to
+	 * the -180 to +180 degree range. The granularity of orientation
+	 * depends on the touch device, some devices only support binary
+	 * rotation values between 0 and 90 degrees.
+	 *
+	 * This event is only sent by the compositor if the touch device
+	 * supports orientation reports.
+	 * @param id the unique ID of this touch point
+	 * @param orientation angle between major axis and positive surface y-axis in degrees
+	 * @since 6
+	 */
+	void (*orientation)(void *data,
+			    struct wl_touch *wl_touch,
+			    int32_t id,
+			    wl_fixed_t orientation);
+};
+
+/**
+ * @ingroup iface_wl_touch
+ */
+static inline int
+wl_touch_add_listener(struct wl_touch *wl_touch,
+		      const struct wl_touch_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_touch,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_TOUCH_RELEASE 0
+
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_DOWN_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_UP_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_MOTION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_FRAME_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_CANCEL_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_SHAPE_SINCE_VERSION 6
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_ORIENTATION_SINCE_VERSION 6
+
+/**
+ * @ingroup iface_wl_touch
+ */
+#define WL_TOUCH_RELEASE_SINCE_VERSION 3
+
+/** @ingroup iface_wl_touch */
+static inline void
+wl_touch_set_user_data(struct wl_touch *wl_touch, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_touch, user_data);
+}
+
+/** @ingroup iface_wl_touch */
+static inline void *
+wl_touch_get_user_data(struct wl_touch *wl_touch)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_touch);
+}
+
+static inline uint32_t
+wl_touch_get_version(struct wl_touch *wl_touch)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_touch);
+}
+
+/** @ingroup iface_wl_touch */
+static inline void
+wl_touch_destroy(struct wl_touch *wl_touch)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_touch);
+}
+
+/**
+ * @ingroup iface_wl_touch
+ */
+static inline void
+wl_touch_release(struct wl_touch *wl_touch)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_touch,
+			 WL_TOUCH_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_touch), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#ifndef WL_OUTPUT_SUBPIXEL_ENUM
+#define WL_OUTPUT_SUBPIXEL_ENUM
+/**
+ * @ingroup iface_wl_output
+ * subpixel geometry information
+ *
+ * This enumeration describes how the physical
+ * pixels on an output are laid out.
+ */
+enum wl_output_subpixel {
+	/**
+	 * unknown geometry
+	 */
+	WL_OUTPUT_SUBPIXEL_UNKNOWN = 0,
+	/**
+	 * no geometry
+	 */
+	WL_OUTPUT_SUBPIXEL_NONE = 1,
+	/**
+	 * horizontal RGB
+	 */
+	WL_OUTPUT_SUBPIXEL_HORIZONTAL_RGB = 2,
+	/**
+	 * horizontal BGR
+	 */
+	WL_OUTPUT_SUBPIXEL_HORIZONTAL_BGR = 3,
+	/**
+	 * vertical RGB
+	 */
+	WL_OUTPUT_SUBPIXEL_VERTICAL_RGB = 4,
+	/**
+	 * vertical BGR
+	 */
+	WL_OUTPUT_SUBPIXEL_VERTICAL_BGR = 5,
+};
+#endif /* WL_OUTPUT_SUBPIXEL_ENUM */
+
+#ifndef WL_OUTPUT_TRANSFORM_ENUM
+#define WL_OUTPUT_TRANSFORM_ENUM
+/**
+ * @ingroup iface_wl_output
+ * transform from framebuffer to output
+ *
+ * This describes the transform that a compositor will apply to a
+ * surface to compensate for the rotation or mirroring of an
+ * output device.
+ *
+ * The flipped values correspond to an initial flip around a
+ * vertical axis followed by rotation.
+ *
+ * The purpose is mainly to allow clients to render accordingly and
+ * tell the compositor, so that for fullscreen surfaces, the
+ * compositor will still be able to scan out directly from client
+ * surfaces.
+ */
+enum wl_output_transform {
+	/**
+	 * no transform
+	 */
+	WL_OUTPUT_TRANSFORM_NORMAL = 0,
+	/**
+	 * 90 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_90 = 1,
+	/**
+	 * 180 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_180 = 2,
+	/**
+	 * 270 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_270 = 3,
+	/**
+	 * 180 degree flip around a vertical axis
+	 */
+	WL_OUTPUT_TRANSFORM_FLIPPED = 4,
+	/**
+	 * flip and rotate 90 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_FLIPPED_90 = 5,
+	/**
+	 * flip and rotate 180 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_FLIPPED_180 = 6,
+	/**
+	 * flip and rotate 270 degrees counter-clockwise
+	 */
+	WL_OUTPUT_TRANSFORM_FLIPPED_270 = 7,
+};
+#endif /* WL_OUTPUT_TRANSFORM_ENUM */
+
+#ifndef WL_OUTPUT_MODE_ENUM
+#define WL_OUTPUT_MODE_ENUM
+/**
+ * @ingroup iface_wl_output
+ * mode information
+ *
+ * These flags describe properties of an output mode.
+ * They are used in the flags bitfield of the mode event.
+ */
+enum wl_output_mode {
+	/**
+	 * indicates this is the current mode
+	 */
+	WL_OUTPUT_MODE_CURRENT = 0x1,
+	/**
+	 * indicates this is the preferred mode
+	 */
+	WL_OUTPUT_MODE_PREFERRED = 0x2,
+};
+#endif /* WL_OUTPUT_MODE_ENUM */
+
+/**
+ * @ingroup iface_wl_output
+ * @struct wl_output_listener
+ */
+struct wl_output_listener {
+	/**
+	 * properties of the output
+	 *
+	 * The geometry event describes geometric properties of the
+	 * output. The event is sent when binding to the output object and
+	 * whenever any of the properties change.
+	 *
+	 * The physical size can be set to zero if it doesn't make sense
+	 * for this output (e.g. for projectors or virtual outputs).
+	 *
+	 * The geometry event will be followed by a done event (starting
+	 * from version 2).
+	 *
+	 * Note: wl_output only advertises partial information about the
+	 * output position and identification. Some compositors, for
+	 * instance those not implementing a desktop-style output layout or
+	 * those exposing virtual outputs, might fake this information.
+	 * Instead of using x and y, clients should use
+	 * xdg_output.logical_position. Instead of using make and model,
+	 * clients should use name and description.
+	 * @param x x position within the global compositor space
+	 * @param y y position within the global compositor space
+	 * @param physical_width width in millimeters of the output
+	 * @param physical_height height in millimeters of the output
+	 * @param subpixel subpixel orientation of the output
+	 * @param make textual description of the manufacturer
+	 * @param model textual description of the model
+	 * @param transform transform that maps framebuffer to output
+	 */
+	void (*geometry)(void *data,
+			 struct wl_output *wl_output,
+			 int32_t x,
+			 int32_t y,
+			 int32_t physical_width,
+			 int32_t physical_height,
+			 int32_t subpixel,
+			 const char *make,
+			 const char *model,
+			 int32_t transform);
+	/**
+	 * advertise available modes for the output
+	 *
+	 * The mode event describes an available mode for the output.
+	 *
+	 * The event is sent when binding to the output object and there
+	 * will always be one mode, the current mode. The event is sent
+	 * again if an output changes mode, for the mode that is now
+	 * current. In other words, the current mode is always the last
+	 * mode that was received with the current flag set.
+	 *
+	 * Non-current modes are deprecated. A compositor can decide to
+	 * only advertise the current mode and never send other modes.
+	 * Clients should not rely on non-current modes.
+	 *
+	 * The size of a mode is given in physical hardware units of the
+	 * output device. This is not necessarily the same as the output
+	 * size in the global compositor space. For instance, the output
+	 * may be scaled, as described in wl_output.scale, or transformed,
+	 * as described in wl_output.transform. Clients willing to retrieve
+	 * the output size in the global compositor space should use
+	 * xdg_output.logical_size instead.
+	 *
+	 * The vertical refresh rate can be set to zero if it doesn't make
+	 * sense for this output (e.g. for virtual outputs).
+	 *
+	 * The mode event will be followed by a done event (starting from
+	 * version 2).
+	 *
+	 * Clients should not use the refresh rate to schedule frames.
+	 * Instead, they should use the wl_surface.frame event or the
+	 * presentation-time protocol.
+	 *
+	 * Note: this information is not always meaningful for all outputs.
+	 * Some compositors, such as those exposing virtual outputs, might
+	 * fake the refresh rate or the size.
+	 * @param flags bitfield of mode flags
+	 * @param width width of the mode in hardware units
+	 * @param height height of the mode in hardware units
+	 * @param refresh vertical refresh rate in mHz
+	 */
+	void (*mode)(void *data,
+		     struct wl_output *wl_output,
+		     uint32_t flags,
+		     int32_t width,
+		     int32_t height,
+		     int32_t refresh);
+	/**
+	 * sent all information about output
+	 *
+	 * This event is sent after all other properties have been sent
+	 * after binding to the output object and after any other property
+	 * changes done after that. This allows changes to the output
+	 * properties to be seen as atomic, even if they happen via
+	 * multiple events.
+	 * @since 2
+	 */
+	void (*done)(void *data,
+		     struct wl_output *wl_output);
+	/**
+	 * output scaling properties
+	 *
+	 * This event contains scaling geometry information that is not
+	 * in the geometry event. It may be sent after binding the output
+	 * object or if the output scale changes later. If it is not sent,
+	 * the client should assume a scale of 1.
+	 *
+	 * A scale larger than 1 means that the compositor will
+	 * automatically scale surface buffers by this amount when
+	 * rendering. This is used for very high resolution displays where
+	 * applications rendering at the native resolution would be too
+	 * small to be legible.
+	 *
+	 * It is intended that scaling aware clients track the current
+	 * output of a surface, and if it is on a scaled output it should
+	 * use wl_surface.set_buffer_scale with the scale of the output.
+	 * That way the compositor can avoid scaling the surface, and the
+	 * client can supply a higher detail image.
+	 *
+	 * The scale event will be followed by a done event.
+	 * @param factor scaling factor of output
+	 * @since 2
+	 */
+	void (*scale)(void *data,
+		      struct wl_output *wl_output,
+		      int32_t factor);
+	/**
+	 * name of this output
+	 *
+	 * Many compositors will assign user-friendly names to their
+	 * outputs, show them to the user, allow the user to refer to an
+	 * output, etc. The client may wish to know this name as well to
+	 * offer the user similar behaviors.
+	 *
+	 * The name is a UTF-8 string with no convention defined for its
+	 * contents. Each name is unique among all wl_output globals. The
+	 * name is only guaranteed to be unique for the compositor
+	 * instance.
+	 *
+	 * The same output name is used for all clients for a given
+	 * wl_output global. Thus, the name can be shared across processes
+	 * to refer to a specific wl_output global.
+	 *
+	 * The name is not guaranteed to be persistent across sessions,
+	 * thus cannot be used to reliably identify an output in e.g.
+	 * configuration files.
+	 *
+	 * Examples of names include 'HDMI-A-1', 'WL-1', 'X11-1', etc.
+	 * However, do not assume that the name is a reflection of an
+	 * underlying DRM connector, X11 connection, etc.
+	 *
+	 * The name event is sent after binding the output object. This
+	 * event is only sent once per output object, and the name does not
+	 * change over the lifetime of the wl_output global.
+	 *
+	 * Compositors may re-use the same output name if the wl_output
+	 * global is destroyed and re-created later. Compositors should
+	 * avoid re-using the same name if possible.
+	 *
+	 * The name event will be followed by a done event.
+	 * @param name output name
+	 * @since 4
+	 */
+	void (*name)(void *data,
+		     struct wl_output *wl_output,
+		     const char *name);
+	/**
+	 * human-readable description of this output
+	 *
+	 * Many compositors can produce human-readable descriptions of
+	 * their outputs. The client may wish to know this description as
+	 * well, e.g. for output selection purposes.
+	 *
+	 * The description is a UTF-8 string with no convention defined for
+	 * its contents. The description is not guaranteed to be unique
+	 * among all wl_output globals. Examples might include 'Foocorp 11"
+	 * Display' or 'Virtual X11 output via :1'.
+	 *
+	 * The description event is sent after binding the output object
+	 * and whenever the description changes. The description is
+	 * optional, and may not be sent at all.
+	 *
+	 * The description event will be followed by a done event.
+	 * @param description output description
+	 * @since 4
+	 */
+	void (*description)(void *data,
+			    struct wl_output *wl_output,
+			    const char *description);
+};
+
+/**
+ * @ingroup iface_wl_output
+ */
+static inline int
+wl_output_add_listener(struct wl_output *wl_output,
+		       const struct wl_output_listener *listener, void *data)
+{
+	return wl_proxy_add_listener((struct wl_proxy *) wl_output,
+				     (void (**)(void)) listener, data);
+}
+
+#define WL_OUTPUT_RELEASE 0
+
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_GEOMETRY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_MODE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_DONE_SINCE_VERSION 2
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_SCALE_SINCE_VERSION 2
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_NAME_SINCE_VERSION 4
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_DESCRIPTION_SINCE_VERSION 4
+
+/**
+ * @ingroup iface_wl_output
+ */
+#define WL_OUTPUT_RELEASE_SINCE_VERSION 3
+
+/** @ingroup iface_wl_output */
+static inline void
+wl_output_set_user_data(struct wl_output *wl_output, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_output, user_data);
+}
+
+/** @ingroup iface_wl_output */
+static inline void *
+wl_output_get_user_data(struct wl_output *wl_output)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_output);
+}
+
+static inline uint32_t
+wl_output_get_version(struct wl_output *wl_output)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_output);
+}
+
+/** @ingroup iface_wl_output */
+static inline void
+wl_output_destroy(struct wl_output *wl_output)
+{
+	wl_proxy_destroy((struct wl_proxy *) wl_output);
+}
+
+/**
+ * @ingroup iface_wl_output
+ *
+ * Using this request a client can tell the server that it is not going to
+ * use the output object anymore.
+ */
+static inline void
+wl_output_release(struct wl_output *wl_output)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_output,
+			 WL_OUTPUT_RELEASE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_output), WL_MARSHAL_FLAG_DESTROY);
+}
+
+#define WL_REGION_DESTROY 0
+#define WL_REGION_ADD 1
+#define WL_REGION_SUBTRACT 2
+
+
+/**
+ * @ingroup iface_wl_region
+ */
+#define WL_REGION_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_region
+ */
+#define WL_REGION_ADD_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_region
+ */
+#define WL_REGION_SUBTRACT_SINCE_VERSION 1
+
+/** @ingroup iface_wl_region */
+static inline void
+wl_region_set_user_data(struct wl_region *wl_region, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_region, user_data);
+}
+
+/** @ingroup iface_wl_region */
+static inline void *
+wl_region_get_user_data(struct wl_region *wl_region)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_region);
+}
+
+static inline uint32_t
+wl_region_get_version(struct wl_region *wl_region)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_region);
+}
+
+/**
+ * @ingroup iface_wl_region
+ *
+ * Destroy the region.  This will invalidate the object ID.
+ */
+static inline void
+wl_region_destroy(struct wl_region *wl_region)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
+			 WL_REGION_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_region
+ *
+ * Add the specified rectangle to the region.
+ */
+static inline void
+wl_region_add(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
+			 WL_REGION_ADD, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), 0, x, y, width, height);
+}
+
+/**
+ * @ingroup iface_wl_region
+ *
+ * Subtract the specified rectangle from the region.
+ */
+static inline void
+wl_region_subtract(struct wl_region *wl_region, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_region,
+			 WL_REGION_SUBTRACT, NULL, wl_proxy_get_version((struct wl_proxy *) wl_region), 0, x, y, width, height);
+}
+
+#ifndef WL_SUBCOMPOSITOR_ERROR_ENUM
+#define WL_SUBCOMPOSITOR_ERROR_ENUM
+enum wl_subcompositor_error {
+	/**
+	 * the to-be sub-surface is invalid
+	 */
+	WL_SUBCOMPOSITOR_ERROR_BAD_SURFACE = 0,
+};
+#endif /* WL_SUBCOMPOSITOR_ERROR_ENUM */
+
+#define WL_SUBCOMPOSITOR_DESTROY 0
+#define WL_SUBCOMPOSITOR_GET_SUBSURFACE 1
+
+
+/**
+ * @ingroup iface_wl_subcompositor
+ */
+#define WL_SUBCOMPOSITOR_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subcompositor
+ */
+#define WL_SUBCOMPOSITOR_GET_SUBSURFACE_SINCE_VERSION 1
+
+/** @ingroup iface_wl_subcompositor */
+static inline void
+wl_subcompositor_set_user_data(struct wl_subcompositor *wl_subcompositor, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_subcompositor, user_data);
+}
+
+/** @ingroup iface_wl_subcompositor */
+static inline void *
+wl_subcompositor_get_user_data(struct wl_subcompositor *wl_subcompositor)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_subcompositor);
+}
+
+static inline uint32_t
+wl_subcompositor_get_version(struct wl_subcompositor *wl_subcompositor)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_subcompositor);
+}
+
+/**
+ * @ingroup iface_wl_subcompositor
+ *
+ * Informs the server that the client will not be using this
+ * protocol object anymore. This does not affect any other
+ * objects, wl_subsurface objects included.
+ */
+static inline void
+wl_subcompositor_destroy(struct wl_subcompositor *wl_subcompositor)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subcompositor,
+			 WL_SUBCOMPOSITOR_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subcompositor), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_subcompositor
+ *
+ * Create a sub-surface interface for the given surface, and
+ * associate it with the given parent surface. This turns a
+ * plain wl_surface into a sub-surface.
+ *
+ * The to-be sub-surface must not already have another role, and it
+ * must not have an existing wl_subsurface object. Otherwise a protocol
+ * error is raised.
+ *
+ * Adding sub-surfaces to a parent is a double-buffered operation on the
+ * parent (see wl_surface.commit). The effect of adding a sub-surface
+ * becomes visible on the next time the state of the parent surface is
+ * applied.
+ *
+ * This request modifies the behaviour of wl_surface.commit request on
+ * the sub-surface, see the documentation on wl_subsurface interface.
+ */
+static inline struct wl_subsurface *
+wl_subcompositor_get_subsurface(struct wl_subcompositor *wl_subcompositor, struct wl_surface *surface, struct wl_surface *parent)
+{
+	struct wl_proxy *id;
+
+	id = wl_proxy_marshal_flags((struct wl_proxy *) wl_subcompositor,
+			 WL_SUBCOMPOSITOR_GET_SUBSURFACE, &wl_subsurface_interface, wl_proxy_get_version((struct wl_proxy *) wl_subcompositor), 0, NULL, surface, parent);
+
+	return (struct wl_subsurface *) id;
+}
+
+#ifndef WL_SUBSURFACE_ERROR_ENUM
+#define WL_SUBSURFACE_ERROR_ENUM
+enum wl_subsurface_error {
+	/**
+	 * wl_surface is not a sibling or the parent
+	 */
+	WL_SUBSURFACE_ERROR_BAD_SURFACE = 0,
+};
+#endif /* WL_SUBSURFACE_ERROR_ENUM */
+
+#define WL_SUBSURFACE_DESTROY 0
+#define WL_SUBSURFACE_SET_POSITION 1
+#define WL_SUBSURFACE_PLACE_ABOVE 2
+#define WL_SUBSURFACE_PLACE_BELOW 3
+#define WL_SUBSURFACE_SET_SYNC 4
+#define WL_SUBSURFACE_SET_DESYNC 5
+
+
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_DESTROY_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_SET_POSITION_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_PLACE_ABOVE_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_PLACE_BELOW_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_SET_SYNC_SINCE_VERSION 1
+/**
+ * @ingroup iface_wl_subsurface
+ */
+#define WL_SUBSURFACE_SET_DESYNC_SINCE_VERSION 1
+
+/** @ingroup iface_wl_subsurface */
+static inline void
+wl_subsurface_set_user_data(struct wl_subsurface *wl_subsurface, void *user_data)
+{
+	wl_proxy_set_user_data((struct wl_proxy *) wl_subsurface, user_data);
+}
+
+/** @ingroup iface_wl_subsurface */
+static inline void *
+wl_subsurface_get_user_data(struct wl_subsurface *wl_subsurface)
+{
+	return wl_proxy_get_user_data((struct wl_proxy *) wl_subsurface);
+}
+
+static inline uint32_t
+wl_subsurface_get_version(struct wl_subsurface *wl_subsurface)
+{
+	return wl_proxy_get_version((struct wl_proxy *) wl_subsurface);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * The sub-surface interface is removed from the wl_surface object
+ * that was turned into a sub-surface with a
+ * wl_subcompositor.get_subsurface request. The wl_surface's association
+ * to the parent is deleted, and the wl_surface loses its role as
+ * a sub-surface. The wl_surface is unmapped immediately.
+ */
+static inline void
+wl_subsurface_destroy(struct wl_subsurface *wl_subsurface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_DESTROY, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), WL_MARSHAL_FLAG_DESTROY);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * This schedules a sub-surface position change.
+ * The sub-surface will be moved so that its origin (top left
+ * corner pixel) will be at the location x, y of the parent surface
+ * coordinate system. The coordinates are not restricted to the parent
+ * surface area. Negative values are allowed.
+ *
+ * The scheduled coordinates will take effect whenever the state of the
+ * parent surface is applied. When this happens depends on whether the
+ * parent surface is in synchronized mode or not. See
+ * wl_subsurface.set_sync and wl_subsurface.set_desync for details.
+ *
+ * If more than one set_position request is invoked by the client before
+ * the commit of the parent surface, the position of a new request always
+ * replaces the scheduled position from any previous request.
+ *
+ * The initial position is 0, 0.
+ */
+static inline void
+wl_subsurface_set_position(struct wl_subsurface *wl_subsurface, int32_t x, int32_t y)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_SET_POSITION, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, x, y);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * This sub-surface is taken from the stack, and put back just
+ * above the reference surface, changing the z-order of the sub-surfaces.
+ * The reference surface must be one of the sibling surfaces, or the
+ * parent surface. Using any other surface, including this sub-surface,
+ * will cause a protocol error.
+ *
+ * The z-order is double-buffered. Requests are handled in order and
+ * applied immediately to a pending state. The final pending state is
+ * copied to the active state the next time the state of the parent
+ * surface is applied. When this happens depends on whether the parent
+ * surface is in synchronized mode or not. See wl_subsurface.set_sync and
+ * wl_subsurface.set_desync for details.
+ *
+ * A new sub-surface is initially added as the top-most in the stack
+ * of its siblings and parent.
+ */
+static inline void
+wl_subsurface_place_above(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_PLACE_ABOVE, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, sibling);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * The sub-surface is placed just below the reference surface.
+ * See wl_subsurface.place_above.
+ */
+static inline void
+wl_subsurface_place_below(struct wl_subsurface *wl_subsurface, struct wl_surface *sibling)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_PLACE_BELOW, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0, sibling);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * Change the commit behaviour of the sub-surface to synchronized
+ * mode, also described as the parent dependent mode.
+ *
+ * In synchronized mode, wl_surface.commit on a sub-surface will
+ * accumulate the committed state in a cache, but the state will
+ * not be applied and hence will not change the compositor output.
+ * The cached state is applied to the sub-surface immediately after
+ * the parent surface's state is applied. This ensures atomic
+ * updates of the parent and all its synchronized sub-surfaces.
+ * Applying the cached state will invalidate the cache, so further
+ * parent surface commits do not (re-)apply old state.
+ *
+ * See wl_subsurface for the recursive effect of this mode.
+ */
+static inline void
+wl_subsurface_set_sync(struct wl_subsurface *wl_subsurface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_SET_SYNC, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0);
+}
+
+/**
+ * @ingroup iface_wl_subsurface
+ *
+ * Change the commit behaviour of the sub-surface to desynchronized
+ * mode, also described as independent or freely running mode.
+ *
+ * In desynchronized mode, wl_surface.commit on a sub-surface will
+ * apply the pending state directly, without caching, as happens
+ * normally with a wl_surface. Calling wl_surface.commit on the
+ * parent surface has no effect on the sub-surface's wl_surface
+ * state. This mode allows a sub-surface to be updated on its own.
+ *
+ * If cached state exists when wl_surface.commit is called in
+ * desynchronized mode, the pending state is added to the cached
+ * state, and applied as a whole. This invalidates the cache.
+ *
+ * Note: even if a sub-surface is set to desynchronized, a parent
+ * sub-surface may override it to behave as synchronized. For details,
+ * see wl_subsurface.
+ *
+ * If a surface's parent surface behaves as desynchronized, then
+ * the cached state is applied on set_desync.
+ */
+static inline void
+wl_subsurface_set_desync(struct wl_subsurface *wl_subsurface)
+{
+	wl_proxy_marshal_flags((struct wl_proxy *) wl_subsurface,
+			 WL_SUBSURFACE_SET_DESYNC, NULL, wl_proxy_get_version((struct wl_proxy *) wl_subsurface), 0);
+}
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/Wayland/wayland-client.h b/include/Wayland/wayland-client.h
new file mode 100644
index 0000000..9f70fa3
--- /dev/null
+++ b/include/Wayland/wayland-client.h
@@ -0,0 +1,42 @@
+/*
+ * Copyright © 2008 Kristian Høgsberg
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/** \file
+ *
+ *  \brief Include the client API and protocol C API.
+ *
+ *  \warning Use of this header file is discouraged. Prefer including
+ *  wayland-client-core.h instead, which does not include the
+ *  client protocol header and as such only defines the library
+ *  API.
+ */
+
+#ifndef WAYLAND_CLIENT_H
+#define WAYLAND_CLIENT_H
+
+#include "wayland-client-core.h"
+#include "wayland-client-protocol.h"
+
+#endif
diff --git a/include/Wayland/wayland-util.h b/include/Wayland/wayland-util.h
new file mode 100644
index 0000000..18c512e
--- /dev/null
+++ b/include/Wayland/wayland-util.h
@@ -0,0 +1,765 @@
+/*
+ * Copyright © 2008 Kristian Høgsberg
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+/** \file wayland-util.h
+ *
+ * \brief Utility classes, functions, and macros.
+ */
+
+#ifndef WAYLAND_UTIL_H
+#define WAYLAND_UTIL_H
+
+#include <math.h>
+#include <stddef.h>
+#include <inttypes.h>
+#include <stdarg.h>
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+/** Visibility attribute */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_EXPORT __attribute__ ((visibility("default")))
+#else
+#define WL_EXPORT
+#endif
+
+/** Deprecated attribute */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_DEPRECATED __attribute__ ((deprecated))
+#else
+#define WL_DEPRECATED
+#endif
+
+/**
+ * Printf-style argument attribute
+ *
+ * \param x Ordinality of the format string argument
+ * \param y Ordinality of the argument to check against the format string
+ *
+ * \sa https://gcc.gnu.org/onlinedocs/gcc-3.2.1/gcc/Function-Attributes.html
+ */
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define WL_PRINTF(x, y) __attribute__((__format__(__printf__, x, y)))
+#else
+#define WL_PRINTF(x, y)
+#endif
+
+/** \class wl_object
+ *
+ * \brief A protocol object.
+ *
+ * A `wl_object` is an opaque struct identifying the protocol object
+ * underlying a `wl_proxy` or `wl_resource`.
+ *
+ * \note Functions accessing a `wl_object` are not normally used by client code.
+ * Clients should normally use the higher level interface generated by the
+ * scanner to interact with compositor objects.
+ *
+ */
+struct wl_object;
+
+/**
+ * Protocol message signature
+ *
+ * A wl_message describes the signature of an actual protocol message, such as a
+ * request or event, that adheres to the Wayland protocol wire format. The
+ * protocol implementation uses a wl_message within its demarshal machinery for
+ * decoding messages between a compositor and its clients. In a sense, a
+ * wl_message is to a protocol message like a class is to an object.
+ *
+ * The `name` of a wl_message is the name of the corresponding protocol message.
+ *
+ * The `signature` is an ordered list of symbols representing the data types
+ * of message arguments and, optionally, a protocol version and indicators for
+ * nullability. A leading integer in the `signature` indicates the _since_
+ * version of the protocol message. A `?` preceding a data type symbol indicates
+ * that the following argument type is nullable. While it is a protocol violation
+ * to send messages with non-nullable arguments set to `NULL`, event handlers in
+ * clients might still get called with non-nullable object arguments set to
+ * `NULL`. This can happen when the client destroyed the object being used as
+ * argument on its side and an event referencing that object was sent before the
+ * server knew about its destruction. As this race cannot be prevented, clients
+ * should - as a general rule - program their event handlers such that they can
+ * handle object arguments declared non-nullable being `NULL` gracefully.
+ *
+ * When no arguments accompany a message, `signature` is an empty string.
+ *
+ * Symbols:
+ *
+ * * `i`: int
+ * * `u`: uint
+ * * `f`: fixed
+ * * `s`: string
+ * * `o`: object
+ * * `n`: new_id
+ * * `a`: array
+ * * `h`: fd
+ * * `?`: following argument is nullable
+ *
+ * While demarshaling primitive arguments is straightforward, when demarshaling
+ * messages containing `object` or `new_id` arguments, the protocol
+ * implementation often must determine the type of the object. The `types` of a
+ * wl_message is an array of wl_interface references that correspond to `o` and
+ * `n` arguments in `signature`, with `NULL` placeholders for arguments with
+ * non-object types.
+ *
+ * Consider the protocol event wl_display `delete_id` that has a single `uint`
+ * argument. The wl_message is:
+ *
+ * \code
+ * { "delete_id", "u", [NULL] }
+ * \endcode
+ *
+ * Here, the message `name` is `"delete_id"`, the `signature` is `"u"`, and the
+ * argument `types` is `[NULL]`, indicating that the `uint` argument has no
+ * corresponding wl_interface since it is a primitive argument.
+ *
+ * In contrast, consider a `wl_foo` interface supporting protocol request `bar`
+ * that has existed since version 2, and has two arguments: a `uint` and an
+ * object of type `wl_baz_interface` that may be `NULL`. Such a `wl_message`
+ * might be:
+ *
+ * \code
+ * { "bar", "2u?o", [NULL, &wl_baz_interface] }
+ * \endcode
+ *
+ * Here, the message `name` is `"bar"`, and the `signature` is `"2u?o"`. Notice
+ * how the `2` indicates the protocol version, the `u` indicates the first
+ * argument type is `uint`, and the `?o` indicates that the second argument
+ * is an object that may be `NULL`. Lastly, the argument `types` array indicates
+ * that no wl_interface corresponds to the first argument, while the type
+ * `wl_baz_interface` corresponds to the second argument.
+ *
+ * \sa wl_argument
+ * \sa wl_interface
+ * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Wire-Format">Wire Format</a>
+ */
+struct wl_message {
+	/** Message name */
+	const char *name;
+	/** Message signature */
+	const char *signature;
+	/** Object argument interfaces */
+	const struct wl_interface **types;
+};
+
+/**
+ * Protocol object interface
+ *
+ * A wl_interface describes the API of a protocol object defined in the Wayland
+ * protocol specification. The protocol implementation uses a wl_interface
+ * within its marshalling machinery for encoding client requests.
+ *
+ * The `name` of a wl_interface is the name of the corresponding protocol
+ * interface, and `version` represents the version of the interface. The members
+ * `method_count` and `event_count` represent the number of `methods` (requests)
+ * and `events` in the respective wl_message members.
+ *
+ * For example, consider a protocol interface `foo`, marked as version `1`, with
+ * two requests and one event.
+ *
+ * \code{.xml}
+ * <interface name="foo" version="1">
+ *   <request name="a"></request>
+ *   <request name="b"></request>
+ *   <event name="c"></event>
+ * </interface>
+ * \endcode
+ *
+ * Given two wl_message arrays `foo_requests` and `foo_events`, a wl_interface
+ * for `foo` might be:
+ *
+ * \code
+ * struct wl_interface foo_interface = {
+ *         "foo", 1,
+ *         2, foo_requests,
+ *         1, foo_events
+ * };
+ * \endcode
+ *
+ * \note The server side of the protocol may define interface <em>implementation
+ *       types</em> that incorporate the term `interface` in their name. Take
+ *       care to not confuse these server-side `struct`s with a wl_interface
+ *       variable whose name also ends in `interface`. For example, while the
+ *       server may define a type `struct wl_foo_interface`, the client may
+ *       define a `struct wl_interface wl_foo_interface`.
+ *
+ * \sa wl_message
+ * \sa wl_proxy
+ * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Interfaces">Interfaces</a>
+ * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-Versioning">Versioning</a>
+ */
+struct wl_interface {
+	/** Interface name */
+	const char *name;
+	/** Interface version */
+	int version;
+	/** Number of methods (requests) */
+	int method_count;
+	/** Method (request) signatures */
+	const struct wl_message *methods;
+	/** Number of events */
+	int event_count;
+	/** Event signatures */
+	const struct wl_message *events;
+};
+
+/** \class wl_list
+ *
+ * \brief Doubly-linked list
+ *
+ * On its own, an instance of `struct wl_list` represents the sentinel head of
+ * a doubly-linked list, and must be initialized using wl_list_init().
+ * When empty, the list head's `next` and `prev` members point to the list head
+ * itself, otherwise `next` references the first element in the list, and `prev`
+ * refers to the last element in the list.
+ *
+ * Use the `struct wl_list` type to represent both the list head and the links
+ * between elements within the list. Use wl_list_empty() to determine if the
+ * list is empty in O(1).
+ *
+ * All elements in the list must be of the same type. The element type must have
+ * a `struct wl_list` member, often named `link` by convention. Prior to
+ * insertion, there is no need to initialize an element's `link` - invoking
+ * wl_list_init() on an individual list element's `struct wl_list` member is
+ * unnecessary if the very next operation is wl_list_insert(). However, a
+ * common idiom is to initialize an element's `link` prior to removal - ensure
+ * safety by invoking wl_list_init() before wl_list_remove().
+ *
+ * Consider a list reference `struct wl_list foo_list`, an element type as
+ * `struct element`, and an element's link member as `struct wl_list link`.
+ *
+ * The following code initializes a list and adds three elements to it.
+ *
+ * \code
+ * struct wl_list foo_list;
+ *
+ * struct element {
+ *         int foo;
+ *         struct wl_list link;
+ * };
+ * struct element e1, e2, e3;
+ *
+ * wl_list_init(&foo_list);
+ * wl_list_insert(&foo_list, &e1.link);   // e1 is the first element
+ * wl_list_insert(&foo_list, &e2.link);   // e2 is now the first element
+ * wl_list_insert(&e2.link, &e3.link); // insert e3 after e2
+ * \endcode
+ *
+ * The list now looks like <em>[e2, e3, e1]</em>.
+ *
+ * The `wl_list` API provides some iterator macros. For example, to iterate
+ * a list in ascending order:
+ *
+ * \code
+ * struct element *e;
+ * wl_list_for_each(e, foo_list, link) {
+ *         do_something_with_element(e);
+ * }
+ * \endcode
+ *
+ * See the documentation of each iterator for details.
+ * \sa http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/list.h
+ */
+struct wl_list {
+	/** Previous list element */
+	struct wl_list *prev;
+	/** Next list element */
+	struct wl_list *next;
+};
+
+/**
+ * Initializes the list.
+ *
+ * \param list List to initialize
+ *
+ * \memberof wl_list
+ */
+void
+wl_list_init(struct wl_list *list);
+
+/**
+ * Inserts an element into the list, after the element represented by \p list.
+ * When \p list is a reference to the list itself (the head), set the containing
+ * struct of \p elm as the first element in the list.
+ *
+ * \note If \p elm is already part of a list, inserting it again will lead to
+ *       list corruption.
+ *
+ * \param list List element after which the new element is inserted
+ * \param elm Link of the containing struct to insert into the list
+ *
+ * \memberof wl_list
+ */
+void
+wl_list_insert(struct wl_list *list, struct wl_list *elm);
+
+/**
+ * Removes an element from the list.
+ *
+ * \note This operation leaves \p elm in an invalid state.
+ *
+ * \param elm Link of the containing struct to remove from the list
+ *
+ * \memberof wl_list
+ */
+void
+wl_list_remove(struct wl_list *elm);
+
+/**
+ * Determines the length of the list.
+ *
+ * \note This is an O(n) operation.
+ *
+ * \param list List whose length is to be determined
+ *
+ * \return Number of elements in the list
+ *
+ * \memberof wl_list
+ */
+int
+wl_list_length(const struct wl_list *list);
+
+/**
+ * Determines if the list is empty.
+ *
+ * \param list List whose emptiness is to be determined
+ *
+ * \return 1 if empty, or 0 if not empty
+ *
+ * \memberof wl_list
+ */
+int
+wl_list_empty(const struct wl_list *list);
+
+/**
+ * Inserts all of the elements of one list into another, after the element
+ * represented by \p list.
+ *
+ * \note This leaves \p other in an invalid state.
+ *
+ * \param list List element after which the other list elements will be inserted
+ * \param other List of elements to insert
+ *
+ * \memberof wl_list
+ */
+void
+wl_list_insert_list(struct wl_list *list, struct wl_list *other);
+
+/**
+ * Retrieves a pointer to a containing struct, given a member name.
+ *
+ * This macro allows "conversion" from a pointer to a member to its containing
+ * struct. This is useful if you have a contained item like a wl_list,
+ * wl_listener, or wl_signal, provided via a callback or other means, and would
+ * like to retrieve the struct that contains it.
+ *
+ * To demonstrate, the following example retrieves a pointer to
+ * `example_container` given only its `destroy_listener` member:
+ *
+ * \code
+ * struct example_container {
+ *         struct wl_listener destroy_listener;
+ *         // other members...
+ * };
+ *
+ * void example_container_destroy(struct wl_listener *listener, void *data)
+ * {
+ *         struct example_container *ctr;
+ *
+ *         ctr = wl_container_of(listener, ctr, destroy_listener);
+ *         // destroy ctr...
+ * }
+ * \endcode
+ *
+ * \note `sample` need not be a valid pointer. A null or uninitialised pointer
+ *       is sufficient.
+ *
+ * \param ptr Valid pointer to the contained member
+ * \param sample Pointer to a struct whose type contains \p ptr
+ * \param member Named location of \p ptr within the \p sample type
+ *
+ * \return The container for the specified pointer
+ */
+#define wl_container_of(ptr, sample, member)				\
+	(__typeof__(sample))((char *)(ptr) -				\
+			     offsetof(__typeof__(*sample), member))
+
+/**
+ * Iterates over a list.
+ *
+ * This macro expresses a for-each iterator for wl_list. Given a list and
+ * wl_list link member name (often named `link` by convention), this macro
+ * assigns each element in the list to \p pos, which can then be referenced in
+ * a trailing code block. For example, given a wl_list of `struct message`
+ * elements:
+ *
+ * \code
+ * struct message {
+ *         char *contents;
+ *         wl_list link;
+ * };
+ *
+ * struct wl_list *message_list;
+ * // Assume message_list now "contains" many messages
+ *
+ * struct message *m;
+ * wl_list_for_each(m, message_list, link) {
+ *         do_something_with_message(m);
+ * }
+ * \endcode
+ *
+ * \param pos Cursor that each list element will be assigned to
+ * \param head Head of the list to iterate over
+ * \param member Name of the link member within the element struct
+ *
+ * \relates wl_list
+ */
+#define wl_list_for_each(pos, head, member)				\
+	for (pos = wl_container_of((head)->next, pos, member);	\
+	     &pos->member != (head);					\
+	     pos = wl_container_of(pos->member.next, pos, member))
+
+/**
+ * Iterates over a list, safe against removal of the list element.
+ *
+ * \note Only removal of the current element, \p pos, is safe. Removing
+ *       any other element during traversal may lead to a loop malfunction.
+ *
+ * \sa wl_list_for_each()
+ *
+ * \param pos Cursor that each list element will be assigned to
+ * \param tmp Temporary pointer of the same type as \p pos
+ * \param head Head of the list to iterate over
+ * \param member Name of the link member within the element struct
+ *
+ * \relates wl_list
+ */
+#define wl_list_for_each_safe(pos, tmp, head, member)			\
+	for (pos = wl_container_of((head)->next, pos, member),		\
+	     tmp = wl_container_of((pos)->member.next, tmp, member);	\
+	     &pos->member != (head);					\
+	     pos = tmp,							\
+	     tmp = wl_container_of(pos->member.next, tmp, member))
+
+/**
+ * Iterates backwards over a list.
+ *
+ * \sa wl_list_for_each()
+ *
+ * \param pos Cursor that each list element will be assigned to
+ * \param head Head of the list to iterate over
+ * \param member Name of the link member within the element struct
+ *
+ * \relates wl_list
+ */
+#define wl_list_for_each_reverse(pos, head, member)			\
+	for (pos = wl_container_of((head)->prev, pos, member);	\
+	     &pos->member != (head);					\
+	     pos = wl_container_of(pos->member.prev, pos, member))
+
+/**
+ * Iterates backwards over a list, safe against removal of the list element.
+ *
+ * \note Only removal of the current element, \p pos, is safe. Removing
+ *       any other element during traversal may lead to a loop malfunction.
+ *
+ * \sa wl_list_for_each()
+ *
+ * \param pos Cursor that each list element will be assigned to
+ * \param tmp Temporary pointer of the same type as \p pos
+ * \param head Head of the list to iterate over
+ * \param member Name of the link member within the element struct
+ *
+ * \relates wl_list
+ */
+#define wl_list_for_each_reverse_safe(pos, tmp, head, member)		\
+	for (pos = wl_container_of((head)->prev, pos, member),	\
+	     tmp = wl_container_of((pos)->member.prev, tmp, member);	\
+	     &pos->member != (head);					\
+	     pos = tmp,							\
+	     tmp = wl_container_of(pos->member.prev, tmp, member))
+
+/**
+ * \class wl_array
+ *
+ * Dynamic array
+ *
+ * A wl_array is a dynamic array that can only grow until released. It is
+ * intended for relatively small allocations whose size is variable or not known
+ * in advance. While construction of a wl_array does not require all elements to
+ * be of the same size, wl_array_for_each() does require all elements to have
+ * the same type and size.
+ *
+ */
+struct wl_array {
+	/** Array size */
+	size_t size;
+	/** Allocated space */
+	size_t alloc;
+	/** Array data */
+	void *data;
+};
+
+/**
+ * Initializes the array.
+ *
+ * \param array Array to initialize
+ *
+ * \memberof wl_array
+ */
+void
+wl_array_init(struct wl_array *array);
+
+/**
+ * Releases the array data.
+ *
+ * \note Leaves the array in an invalid state.
+ *
+ * \param array Array whose data is to be released
+ *
+ * \memberof wl_array
+ */
+void
+wl_array_release(struct wl_array *array);
+
+/**
+ * Increases the size of the array by \p size bytes.
+ *
+ * \param array Array whose size is to be increased
+ * \param size Number of bytes to increase the size of the array by
+ *
+ * \return A pointer to the beginning of the newly appended space, or NULL when
+ *         resizing fails.
+ *
+ * \memberof wl_array
+ */
+void *
+wl_array_add(struct wl_array *array, size_t size);
+
+/**
+ * Copies the contents of \p source to \p array.
+ *
+ * \param array Destination array to copy to
+ * \param source Source array to copy from
+ *
+ * \return 0 on success, or -1 on failure
+ *
+ * \memberof wl_array
+ */
+int
+wl_array_copy(struct wl_array *array, struct wl_array *source);
+
+/**
+ * Iterates over an array.
+ *
+ * This macro expresses a for-each iterator for wl_array. It assigns each
+ * element in the array to \p pos, which can then be referenced in a trailing
+ * code block. \p pos must be a pointer to the array element type, and all
+ * array elements must be of the same type and size.
+ *
+ * \param pos Cursor that each array element will be assigned to
+ * \param array Array to iterate over
+ *
+ * \relates wl_array
+ * \sa wl_list_for_each()
+ */
+#define wl_array_for_each(pos, array)					\
+	for (pos = (array)->data;					\
+	     (const char *) pos < ((const char *) (array)->data + (array)->size); \
+	     (pos)++)
+
+/**
+ * Fixed-point number
+ *
+ * A `wl_fixed_t` is a 24.8 signed fixed-point number with a sign bit, 23 bits
+ * of integer precision and 8 bits of decimal precision. Consider `wl_fixed_t`
+ * as an opaque struct with methods that facilitate conversion to and from
+ * `double` and `int` types.
+ */
+typedef int32_t wl_fixed_t;
+
+/**
+ * Converts a fixed-point number to a floating-point number.
+ *
+ * \param f Fixed-point number to convert
+ *
+ * \return Floating-point representation of the fixed-point argument
+ */
+static inline double
+wl_fixed_to_double(wl_fixed_t f)
+{
+	union {
+		double d;
+		int64_t i;
+	} u;
+
+	u.i = ((1023LL + 44LL) << 52) + (1LL << 51) + f;
+
+	return u.d - (3LL << 43);
+}
+
+/**
+ * Converts a floating-point number to a fixed-point number.
+ *
+ * \param d Floating-point number to convert
+ *
+ * \return Fixed-point representation of the floating-point argument
+ */
+static inline wl_fixed_t
+wl_fixed_from_double(double d)
+{
+	union {
+		double d;
+		int64_t i;
+	} u;
+
+	u.d = d + (3LL << (51 - 8));
+
+	return (wl_fixed_t)u.i;
+}
+
+/**
+ * Converts a fixed-point number to an integer.
+ *
+ * \param f Fixed-point number to convert
+ *
+ * \return Integer component of the fixed-point argument
+ */
+static inline int
+wl_fixed_to_int(wl_fixed_t f)
+{
+	return f / 256;
+}
+
+/**
+ * Converts an integer to a fixed-point number.
+ *
+ * \param i Integer to convert
+ *
+ * \return Fixed-point representation of the integer argument
+ */
+static inline wl_fixed_t
+wl_fixed_from_int(int i)
+{
+	return i * 256;
+}
+
+/**
+ * Protocol message argument data types
+ *
+ * This union represents all of the argument types in the Wayland protocol wire
+ * format. The protocol implementation uses wl_argument within its marshalling
+ * machinery for dispatching messages between a client and a compositor.
+ *
+ * \sa wl_message
+ * \sa wl_interface
+ * \sa <a href="https://wayland.freedesktop.org/docs/html/ch04.html#sect-Protocol-wire-Format">Wire Format</a>
+ */
+union wl_argument {
+	int32_t i;           /**< `int`    */
+	uint32_t u;          /**< `uint`   */
+	wl_fixed_t f;        /**< `fixed`  */
+	const char *s;       /**< `string` */
+	struct wl_object *o; /**< `object` */
+	uint32_t n;          /**< `new_id` */
+	struct wl_array *a;  /**< `array`  */
+	int32_t h;           /**< `fd`     */
+};
+
+/**
+ * Dispatcher function type alias
+ *
+ * A dispatcher is a function that handles the emitting of callbacks in client
+ * code. For programs directly using the C library, this is done by using
+ * libffi to call function pointers. When binding to languages other than C,
+ * dispatchers provide a way to abstract the function calling process to be
+ * friendlier to other function calling systems.
+ *
+ * A dispatcher takes five arguments: The first is the dispatcher-specific
+ * implementation associated with the target object. The second is the object
+ * upon which the callback is being invoked (either wl_proxy or wl_resource).
+ * The third and fourth arguments are the opcode and the wl_message
+ * corresponding to the callback. The final argument is an array of arguments
+ * received from the other process via the wire protocol.
+ *
+ * \param "const void *" Dispatcher-specific implementation data
+ * \param "void *" Callback invocation target (wl_proxy or `wl_resource`)
+ * \param uint32_t Callback opcode
+ * \param "const struct wl_message *" Callback message signature
+ * \param "union wl_argument *" Array of received arguments
+ *
+ * \return 0 on success, or -1 on failure
+ */
+typedef int (*wl_dispatcher_func_t)(const void *, void *, uint32_t,
+				    const struct wl_message *,
+				    union wl_argument *);
+
+/**
+ * Log function type alias
+ *
+ * The C implementation of the Wayland protocol abstracts the details of
+ * logging. Users may customize the logging behavior, with a function conforming
+ * to the `wl_log_func_t` type, via `wl_log_set_handler_client` and
+ * `wl_log_set_handler_server`.
+ *
+ * A `wl_log_func_t` must conform to the expectations of `vprintf`, and
+ * expects two arguments: a string to write and a corresponding variable
+ * argument list. While the string to write may contain format specifiers and
+ * use values in the variable argument list, the behavior of any `wl_log_func_t`
+ * depends on the implementation.
+ *
+ * \note Take care to not confuse this with `wl_protocol_logger_func_t`, which
+ *       is a specific server-side logger for requests and events.
+ *
+ * \param "const char *" String to write to the log, containing optional format
+ *                       specifiers
+ * \param "va_list" Variable argument list
+ *
+ * \sa wl_log_set_handler_client
+ * \sa wl_log_set_handler_server
+ */
+typedef void (*wl_log_func_t)(const char *, va_list) WL_PRINTF(1, 0);
+
+/**
+ * Return value of an iterator function
+ *
+ * \sa wl_client_for_each_resource_iterator_func_t
+ * \sa wl_client_for_each_resource
+ */
+enum wl_iterator_result {
+	/** Stop the iteration */
+	WL_ITERATOR_STOP,
+	/** Continue the iteration */
+	WL_ITERATOR_CONTINUE
+};
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/Wayland/wayland-version.h b/include/Wayland/wayland-version.h
new file mode 100644
index 0000000..38f53e5
--- /dev/null
+++ b/include/Wayland/wayland-version.h
@@ -0,0 +1,34 @@
+/*
+ * Copyright © 2012 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial
+ * portions of the Software.
+ *
+ * THE SOFTWARE IS 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 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef WAYLAND_VERSION_H
+#define WAYLAND_VERSION_H
+
+#define WAYLAND_VERSION_MAJOR 1
+#define WAYLAND_VERSION_MINOR 21
+#define WAYLAND_VERSION_MICRO 0
+#define WAYLAND_VERSION "1.21.0"
+
+#endif
diff --git a/include/marl/thread_local.h b/include/marl/thread_local.h
deleted file mode 100644
index 375ba5f..0000000
--- a/include/marl/thread_local.h
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2023 The Marl Authors.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//     https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// A wrapper around a thread_local variable, or a pthread key
-
-#ifndef marl_thread_local_h
-#define marl_thread_local_h
-
-#ifdef MARL_USE_PTHREAD_THREAD_LOCAL
-#include "debug.h"
-
-#include <pthread.h>
-#include <type_traits>
-
-template <typename T>
-class ThreadLocal {
-  static_assert(std::is_pointer<T>::value,
-                "The current implementation of ThreadLocal requires that T "
-                "must be a pointer");
-
- public:
-  inline ThreadLocal(T v) {
-    pthread_key_create(&key, NULL);
-    pthread_setspecific(key, v);
-  }
-  inline ~ThreadLocal() { pthread_key_delete(key); }
-  inline operator T() const { return static_cast<T>(pthread_getspecific(key)); }
-  inline ThreadLocal& operator=(T v) {
-    pthread_setspecific(key, v);
-    return *this;
-  }
-
- private:
-  ThreadLocal(const ThreadLocal&) = delete;
-  ThreadLocal& operator=(const ThreadLocal&) = delete;
-
-  pthread_key_t key;
-};
-
-#define MARL_DECLARE_THREAD_LOCAL(TYPE, NAME) static ThreadLocal<TYPE> NAME
-#define MARL_INSTANTIATE_THREAD_LOCAL(TYPE, NAME, VALUE) \
-  ThreadLocal<TYPE> NAME {                               \
-    VALUE                                                \
-  }
-
-#else
-
-#define MARL_DECLARE_THREAD_LOCAL(TYPE, NAME) static thread_local TYPE NAME
-#define MARL_INSTANTIATE_THREAD_LOCAL(TYPE, NAME, VALUE) \
-  thread_local TYPE NAME {                               \
-    VALUE                                                \
-  }
-
-#endif
-
-#endif  // marl_thread_local_h
diff --git a/include/vk_video/vulkan_video_codec_h264std.h b/include/vk_video/vulkan_video_codec_h264std.h
new file mode 100644
index 0000000..d3ebec6
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h264std.h
@@ -0,0 +1,310 @@
+#ifndef VULKAN_VIDEO_CODEC_H264STD_H_
+#define VULKAN_VIDEO_CODEC_H264STD_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h264std 1
+#include <stdint.h>
+#define STD_VIDEO_H264_CPB_CNT_LIST_SIZE  32
+#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS 6
+#define STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS 16
+#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS 6
+#define STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS 64
+#define STD_VIDEO_H264_MAX_NUM_LIST_REF   32
+#define STD_VIDEO_H264_MAX_CHROMA_PLANES  2
+
+typedef enum StdVideoH264ChromaFormatIdc {
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_MONOCHROME = 0,
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_420 = 1,
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_422 = 2,
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_444 = 3,
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264ChromaFormatIdc;
+
+typedef enum StdVideoH264ProfileIdc {
+    STD_VIDEO_H264_PROFILE_IDC_BASELINE = 66,
+    STD_VIDEO_H264_PROFILE_IDC_MAIN = 77,
+    STD_VIDEO_H264_PROFILE_IDC_HIGH = 100,
+    STD_VIDEO_H264_PROFILE_IDC_HIGH_444_PREDICTIVE = 244,
+    STD_VIDEO_H264_PROFILE_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264ProfileIdc;
+
+typedef enum StdVideoH264LevelIdc {
+    STD_VIDEO_H264_LEVEL_IDC_1_0 = 0,
+    STD_VIDEO_H264_LEVEL_IDC_1_1 = 1,
+    STD_VIDEO_H264_LEVEL_IDC_1_2 = 2,
+    STD_VIDEO_H264_LEVEL_IDC_1_3 = 3,
+    STD_VIDEO_H264_LEVEL_IDC_2_0 = 4,
+    STD_VIDEO_H264_LEVEL_IDC_2_1 = 5,
+    STD_VIDEO_H264_LEVEL_IDC_2_2 = 6,
+    STD_VIDEO_H264_LEVEL_IDC_3_0 = 7,
+    STD_VIDEO_H264_LEVEL_IDC_3_1 = 8,
+    STD_VIDEO_H264_LEVEL_IDC_3_2 = 9,
+    STD_VIDEO_H264_LEVEL_IDC_4_0 = 10,
+    STD_VIDEO_H264_LEVEL_IDC_4_1 = 11,
+    STD_VIDEO_H264_LEVEL_IDC_4_2 = 12,
+    STD_VIDEO_H264_LEVEL_IDC_5_0 = 13,
+    STD_VIDEO_H264_LEVEL_IDC_5_1 = 14,
+    STD_VIDEO_H264_LEVEL_IDC_5_2 = 15,
+    STD_VIDEO_H264_LEVEL_IDC_6_0 = 16,
+    STD_VIDEO_H264_LEVEL_IDC_6_1 = 17,
+    STD_VIDEO_H264_LEVEL_IDC_6_2 = 18,
+    STD_VIDEO_H264_LEVEL_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264LevelIdc;
+
+typedef enum StdVideoH264PocType {
+    STD_VIDEO_H264_POC_TYPE_0 = 0,
+    STD_VIDEO_H264_POC_TYPE_1 = 1,
+    STD_VIDEO_H264_POC_TYPE_2 = 2,
+    STD_VIDEO_H264_POC_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_POC_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264PocType;
+
+typedef enum StdVideoH264AspectRatioIdc {
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_SQUARE = 1,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_12_11 = 2,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_10_11 = 3,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_16_11 = 4,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_40_33 = 5,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_24_11 = 6,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_20_11 = 7,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_32_11 = 8,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_80_33 = 9,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_18_11 = 10,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_15_11 = 11,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_64_33 = 12,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_160_99 = 13,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_4_3 = 14,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_3_2 = 15,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_2_1 = 16,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264AspectRatioIdc;
+
+typedef enum StdVideoH264WeightedBipredIdc {
+    STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_DEFAULT = 0,
+    STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_EXPLICIT = 1,
+    STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_IMPLICIT = 2,
+    STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_WEIGHTED_BIPRED_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264WeightedBipredIdc;
+
+typedef enum StdVideoH264ModificationOfPicNumsIdc {
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_SUBTRACT = 0,
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_SHORT_TERM_ADD = 1,
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_LONG_TERM = 2,
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_END = 3,
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_MODIFICATION_OF_PIC_NUMS_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264ModificationOfPicNumsIdc;
+
+typedef enum StdVideoH264MemMgmtControlOp {
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_END = 0,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_SHORT_TERM = 1,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_LONG_TERM = 2,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_LONG_TERM = 3,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_SET_MAX_LONG_TERM_INDEX = 4,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_UNMARK_ALL = 5,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MARK_CURRENT_AS_LONG_TERM = 6,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_MEM_MGMT_CONTROL_OP_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264MemMgmtControlOp;
+
+typedef enum StdVideoH264CabacInitIdc {
+    STD_VIDEO_H264_CABAC_INIT_IDC_0 = 0,
+    STD_VIDEO_H264_CABAC_INIT_IDC_1 = 1,
+    STD_VIDEO_H264_CABAC_INIT_IDC_2 = 2,
+    STD_VIDEO_H264_CABAC_INIT_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_CABAC_INIT_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264CabacInitIdc;
+
+typedef enum StdVideoH264DisableDeblockingFilterIdc {
+    STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_DISABLED = 0,
+    STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_ENABLED = 1,
+    STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_PARTIAL = 2,
+    STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_DISABLE_DEBLOCKING_FILTER_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264DisableDeblockingFilterIdc;
+
+typedef enum StdVideoH264SliceType {
+    STD_VIDEO_H264_SLICE_TYPE_P = 0,
+    STD_VIDEO_H264_SLICE_TYPE_B = 1,
+    STD_VIDEO_H264_SLICE_TYPE_I = 2,
+    STD_VIDEO_H264_SLICE_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264SliceType;
+
+typedef enum StdVideoH264PictureType {
+    STD_VIDEO_H264_PICTURE_TYPE_P = 0,
+    STD_VIDEO_H264_PICTURE_TYPE_B = 1,
+    STD_VIDEO_H264_PICTURE_TYPE_I = 2,
+    STD_VIDEO_H264_PICTURE_TYPE_IDR = 5,
+    STD_VIDEO_H264_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264PictureType;
+
+typedef enum StdVideoH264NonVclNaluType {
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_SPS = 0,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_PPS = 1,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_AUD = 2,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_PREFIX = 3,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_SEQUENCE = 4,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_END_OF_STREAM = 5,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_PRECODED = 6,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H264_NON_VCL_NALU_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH264NonVclNaluType;
+typedef struct StdVideoH264SpsVuiFlags {
+    uint32_t    aspect_ratio_info_present_flag : 1;
+    uint32_t    overscan_info_present_flag : 1;
+    uint32_t    overscan_appropriate_flag : 1;
+    uint32_t    video_signal_type_present_flag : 1;
+    uint32_t    video_full_range_flag : 1;
+    uint32_t    color_description_present_flag : 1;
+    uint32_t    chroma_loc_info_present_flag : 1;
+    uint32_t    timing_info_present_flag : 1;
+    uint32_t    fixed_frame_rate_flag : 1;
+    uint32_t    bitstream_restriction_flag : 1;
+    uint32_t    nal_hrd_parameters_present_flag : 1;
+    uint32_t    vcl_hrd_parameters_present_flag : 1;
+} StdVideoH264SpsVuiFlags;
+
+typedef struct StdVideoH264HrdParameters {
+    uint8_t     cpb_cnt_minus1;
+    uint8_t     bit_rate_scale;
+    uint8_t     cpb_size_scale;
+    uint8_t     reserved1;
+    uint32_t    bit_rate_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
+    uint32_t    cpb_size_value_minus1[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
+    uint8_t     cbr_flag[STD_VIDEO_H264_CPB_CNT_LIST_SIZE];
+    uint32_t    initial_cpb_removal_delay_length_minus1;
+    uint32_t    cpb_removal_delay_length_minus1;
+    uint32_t    dpb_output_delay_length_minus1;
+    uint32_t    time_offset_length;
+} StdVideoH264HrdParameters;
+
+typedef struct StdVideoH264SequenceParameterSetVui {
+    StdVideoH264SpsVuiFlags             flags;
+    StdVideoH264AspectRatioIdc          aspect_ratio_idc;
+    uint16_t                            sar_width;
+    uint16_t                            sar_height;
+    uint8_t                             video_format;
+    uint8_t                             colour_primaries;
+    uint8_t                             transfer_characteristics;
+    uint8_t                             matrix_coefficients;
+    uint32_t                            num_units_in_tick;
+    uint32_t                            time_scale;
+    uint8_t                             max_num_reorder_frames;
+    uint8_t                             max_dec_frame_buffering;
+    uint8_t                             chroma_sample_loc_type_top_field;
+    uint8_t                             chroma_sample_loc_type_bottom_field;
+    uint32_t                            reserved1;
+    const StdVideoH264HrdParameters*    pHrdParameters;
+} StdVideoH264SequenceParameterSetVui;
+
+typedef struct StdVideoH264SpsFlags {
+    uint32_t    constraint_set0_flag : 1;
+    uint32_t    constraint_set1_flag : 1;
+    uint32_t    constraint_set2_flag : 1;
+    uint32_t    constraint_set3_flag : 1;
+    uint32_t    constraint_set4_flag : 1;
+    uint32_t    constraint_set5_flag : 1;
+    uint32_t    direct_8x8_inference_flag : 1;
+    uint32_t    mb_adaptive_frame_field_flag : 1;
+    uint32_t    frame_mbs_only_flag : 1;
+    uint32_t    delta_pic_order_always_zero_flag : 1;
+    uint32_t    separate_colour_plane_flag : 1;
+    uint32_t    gaps_in_frame_num_value_allowed_flag : 1;
+    uint32_t    qpprime_y_zero_transform_bypass_flag : 1;
+    uint32_t    frame_cropping_flag : 1;
+    uint32_t    seq_scaling_matrix_present_flag : 1;
+    uint32_t    vui_parameters_present_flag : 1;
+} StdVideoH264SpsFlags;
+
+typedef struct StdVideoH264ScalingLists {
+    uint16_t    scaling_list_present_mask;
+    uint16_t    use_default_scaling_matrix_mask;
+    uint8_t     ScalingList4x4[STD_VIDEO_H264_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_4X4_NUM_ELEMENTS];
+    uint8_t     ScalingList8x8[STD_VIDEO_H264_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H264_SCALING_LIST_8X8_NUM_ELEMENTS];
+} StdVideoH264ScalingLists;
+
+typedef struct StdVideoH264SequenceParameterSet {
+    StdVideoH264SpsFlags                          flags;
+    StdVideoH264ProfileIdc                        profile_idc;
+    StdVideoH264LevelIdc                          level_idc;
+    StdVideoH264ChromaFormatIdc                   chroma_format_idc;
+    uint8_t                                       seq_parameter_set_id;
+    uint8_t                                       bit_depth_luma_minus8;
+    uint8_t                                       bit_depth_chroma_minus8;
+    uint8_t                                       log2_max_frame_num_minus4;
+    StdVideoH264PocType                           pic_order_cnt_type;
+    int32_t                                       offset_for_non_ref_pic;
+    int32_t                                       offset_for_top_to_bottom_field;
+    uint8_t                                       log2_max_pic_order_cnt_lsb_minus4;
+    uint8_t                                       num_ref_frames_in_pic_order_cnt_cycle;
+    uint8_t                                       max_num_ref_frames;
+    uint8_t                                       reserved1;
+    uint32_t                                      pic_width_in_mbs_minus1;
+    uint32_t                                      pic_height_in_map_units_minus1;
+    uint32_t                                      frame_crop_left_offset;
+    uint32_t                                      frame_crop_right_offset;
+    uint32_t                                      frame_crop_top_offset;
+    uint32_t                                      frame_crop_bottom_offset;
+    uint32_t                                      reserved2;
+    const int32_t*                                pOffsetForRefFrame;
+    const StdVideoH264ScalingLists*               pScalingLists;
+    const StdVideoH264SequenceParameterSetVui*    pSequenceParameterSetVui;
+} StdVideoH264SequenceParameterSet;
+
+typedef struct StdVideoH264PpsFlags {
+    uint32_t    transform_8x8_mode_flag : 1;
+    uint32_t    redundant_pic_cnt_present_flag : 1;
+    uint32_t    constrained_intra_pred_flag : 1;
+    uint32_t    deblocking_filter_control_present_flag : 1;
+    uint32_t    weighted_pred_flag : 1;
+    uint32_t    bottom_field_pic_order_in_frame_present_flag : 1;
+    uint32_t    entropy_coding_mode_flag : 1;
+    uint32_t    pic_scaling_matrix_present_flag : 1;
+} StdVideoH264PpsFlags;
+
+typedef struct StdVideoH264PictureParameterSet {
+    StdVideoH264PpsFlags               flags;
+    uint8_t                            seq_parameter_set_id;
+    uint8_t                            pic_parameter_set_id;
+    uint8_t                            num_ref_idx_l0_default_active_minus1;
+    uint8_t                            num_ref_idx_l1_default_active_minus1;
+    StdVideoH264WeightedBipredIdc      weighted_bipred_idc;
+    int8_t                             pic_init_qp_minus26;
+    int8_t                             pic_init_qs_minus26;
+    int8_t                             chroma_qp_index_offset;
+    int8_t                             second_chroma_qp_index_offset;
+    const StdVideoH264ScalingLists*    pScalingLists;
+} StdVideoH264PictureParameterSet;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codec_h264std_decode.h b/include/vk_video/vulkan_video_codec_h264std_decode.h
new file mode 100644
index 0000000..b1e7942
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h264std_decode.h
@@ -0,0 +1,75 @@
+#ifndef VULKAN_VIDEO_CODEC_H264STD_DECODE_H_
+#define VULKAN_VIDEO_CODEC_H264STD_DECODE_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h264std_decode 1
+
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
+
+#define STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE 2
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_API_VERSION_1_0_0
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_decode"
+
+typedef enum StdVideoDecodeH264FieldOrderCount {
+    STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_TOP = 0,
+    STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_BOTTOM = 1,
+    STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_MAX_ENUM = 0x7FFFFFFF
+} StdVideoDecodeH264FieldOrderCount;
+typedef struct StdVideoDecodeH264PictureInfoFlags {
+    uint32_t    field_pic_flag : 1;
+    uint32_t    is_intra : 1;
+    uint32_t    IdrPicFlag : 1;
+    uint32_t    bottom_field_flag : 1;
+    uint32_t    is_reference : 1;
+    uint32_t    complementary_field_pair : 1;
+} StdVideoDecodeH264PictureInfoFlags;
+
+typedef struct StdVideoDecodeH264PictureInfo {
+    StdVideoDecodeH264PictureInfoFlags    flags;
+    uint8_t                               seq_parameter_set_id;
+    uint8_t                               pic_parameter_set_id;
+    uint8_t                               reserved1;
+    uint8_t                               reserved2;
+    uint16_t                              frame_num;
+    uint16_t                              idr_pic_id;
+    int32_t                               PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
+} StdVideoDecodeH264PictureInfo;
+
+typedef struct StdVideoDecodeH264ReferenceInfoFlags {
+    uint32_t    top_field_flag : 1;
+    uint32_t    bottom_field_flag : 1;
+    uint32_t    used_for_long_term_reference : 1;
+    uint32_t    is_non_existing : 1;
+} StdVideoDecodeH264ReferenceInfoFlags;
+
+typedef struct StdVideoDecodeH264ReferenceInfo {
+    StdVideoDecodeH264ReferenceInfoFlags    flags;
+    uint16_t                                FrameNum;
+    uint16_t                                reserved;
+    int32_t                                 PicOrderCnt[STD_VIDEO_DECODE_H264_FIELD_ORDER_COUNT_LIST_SIZE];
+} StdVideoDecodeH264ReferenceInfo;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codec_h264std_encode.h b/include/vk_video/vulkan_video_codec_h264std_encode.h
new file mode 100644
index 0000000..7bd96aa
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h264std_encode.h
@@ -0,0 +1,132 @@
+#ifndef VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_
+#define VULKAN_VIDEO_CODEC_H264STD_ENCODE_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h264std_encode 1
+// Vulkan 0.9 provisional Vulkan video H.264 encode std specification version number
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8 VK_MAKE_VIDEO_STD_VERSION(0, 9, 8)
+
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_API_VERSION_0_9_8
+#define VK_STD_VULKAN_VIDEO_CODEC_H264_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h264_encode"
+typedef struct StdVideoEncodeH264WeightTableFlags {
+    uint32_t    luma_weight_l0_flag;
+    uint32_t    chroma_weight_l0_flag;
+    uint32_t    luma_weight_l1_flag;
+    uint32_t    chroma_weight_l1_flag;
+} StdVideoEncodeH264WeightTableFlags;
+
+typedef struct StdVideoEncodeH264WeightTable {
+    StdVideoEncodeH264WeightTableFlags    flags;
+    uint8_t                               luma_log2_weight_denom;
+    uint8_t                               chroma_log2_weight_denom;
+    int8_t                                luma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
+    int8_t                                luma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF];
+    int8_t                                chroma_weight_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
+    int8_t                                chroma_offset_l0[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
+    int8_t                                luma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
+    int8_t                                luma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF];
+    int8_t                                chroma_weight_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
+    int8_t                                chroma_offset_l1[STD_VIDEO_H264_MAX_NUM_LIST_REF][STD_VIDEO_H264_MAX_CHROMA_PLANES];
+} StdVideoEncodeH264WeightTable;
+
+typedef struct StdVideoEncodeH264SliceHeaderFlags {
+    uint32_t    direct_spatial_mv_pred_flag : 1;
+    uint32_t    num_ref_idx_active_override_flag : 1;
+    uint32_t    no_output_of_prior_pics_flag : 1;
+    uint32_t    adaptive_ref_pic_marking_mode_flag : 1;
+    uint32_t    no_prior_references_available_flag : 1;
+} StdVideoEncodeH264SliceHeaderFlags;
+
+typedef struct StdVideoEncodeH264PictureInfoFlags {
+    uint32_t    idr_flag : 1;
+    uint32_t    is_reference_flag : 1;
+    uint32_t    used_for_long_term_reference : 1;
+} StdVideoEncodeH264PictureInfoFlags;
+
+typedef struct StdVideoEncodeH264ReferenceInfoFlags {
+    uint32_t    used_for_long_term_reference : 1;
+} StdVideoEncodeH264ReferenceInfoFlags;
+
+typedef struct StdVideoEncodeH264RefMgmtFlags {
+    uint32_t    ref_pic_list_modification_l0_flag : 1;
+    uint32_t    ref_pic_list_modification_l1_flag : 1;
+} StdVideoEncodeH264RefMgmtFlags;
+
+typedef struct StdVideoEncodeH264RefListModEntry {
+    StdVideoH264ModificationOfPicNumsIdc    modification_of_pic_nums_idc;
+    uint16_t                                abs_diff_pic_num_minus1;
+    uint16_t                                long_term_pic_num;
+} StdVideoEncodeH264RefListModEntry;
+
+typedef struct StdVideoEncodeH264RefPicMarkingEntry {
+    StdVideoH264MemMgmtControlOp    operation;
+    uint16_t                        difference_of_pic_nums_minus1;
+    uint16_t                        long_term_pic_num;
+    uint16_t                        long_term_frame_idx;
+    uint16_t                        max_long_term_frame_idx_plus1;
+} StdVideoEncodeH264RefPicMarkingEntry;
+
+typedef struct StdVideoEncodeH264RefMemMgmtCtrlOperations {
+    StdVideoEncodeH264RefMgmtFlags                 flags;
+    uint8_t                                        refList0ModOpCount;
+    const StdVideoEncodeH264RefListModEntry*       pRefList0ModOperations;
+    uint8_t                                        refList1ModOpCount;
+    const StdVideoEncodeH264RefListModEntry*       pRefList1ModOperations;
+    uint8_t                                        refPicMarkingOpCount;
+    const StdVideoEncodeH264RefPicMarkingEntry*    pRefPicMarkingOperations;
+} StdVideoEncodeH264RefMemMgmtCtrlOperations;
+
+typedef struct StdVideoEncodeH264PictureInfo {
+    StdVideoEncodeH264PictureInfoFlags    flags;
+    uint8_t                               seq_parameter_set_id;
+    uint8_t                               pic_parameter_set_id;
+    StdVideoH264PictureType               pictureType;
+    uint32_t                              frame_num;
+    int32_t                               PicOrderCnt;
+} StdVideoEncodeH264PictureInfo;
+
+typedef struct StdVideoEncodeH264ReferenceInfo {
+    StdVideoEncodeH264ReferenceInfoFlags    flags;
+    uint32_t                                FrameNum;
+    int32_t                                 PicOrderCnt;
+    uint16_t                                long_term_pic_num;
+    uint16_t                                long_term_frame_idx;
+} StdVideoEncodeH264ReferenceInfo;
+
+typedef struct StdVideoEncodeH264SliceHeader {
+    StdVideoEncodeH264SliceHeaderFlags        flags;
+    uint32_t                                  first_mb_in_slice;
+    StdVideoH264SliceType                     slice_type;
+    uint16_t                                  idr_pic_id;
+    uint8_t                                   num_ref_idx_l0_active_minus1;
+    uint8_t                                   num_ref_idx_l1_active_minus1;
+    StdVideoH264CabacInitIdc                  cabac_init_idc;
+    StdVideoH264DisableDeblockingFilterIdc    disable_deblocking_filter_idc;
+    int8_t                                    slice_alpha_c0_offset_div2;
+    int8_t                                    slice_beta_offset_div2;
+    const StdVideoEncodeH264WeightTable*      pWeightTable;
+} StdVideoEncodeH264SliceHeader;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codec_h265std.h b/include/vk_video/vulkan_video_codec_h265std.h
new file mode 100644
index 0000000..862f881
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h265std.h
@@ -0,0 +1,443 @@
+#ifndef VULKAN_VIDEO_CODEC_H265STD_H_
+#define VULKAN_VIDEO_CODEC_H265STD_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h265std 1
+#define STD_VIDEO_H265_SUBLAYERS_LIST_SIZE 7
+#define STD_VIDEO_H265_CPB_CNT_LIST_SIZE  32
+#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS 6
+#define STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS 16
+#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS 6
+#define STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS 64
+#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS 6
+#define STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS 64
+#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS 2
+#define STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS 64
+#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE 3
+#define STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE 128
+#define STD_VIDEO_H265_MAX_DPB_SIZE       16
+#define STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS 32
+#define STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE 6
+#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE 19
+#define STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE 21
+#define STD_VIDEO_H265_MAX_NUM_LIST_REF   15
+#define STD_VIDEO_H265_MAX_CHROMA_PLANES  2
+#define STD_VIDEO_H265_MAX_SHORT_TERM_REF_PIC_SETS 64
+#define STD_VIDEO_H265_MAX_LONG_TERM_PICS 16
+#define STD_VIDEO_H265_MAX_DELTA_POC      48
+
+typedef enum StdVideoH265ChromaFormatIdc {
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_MONOCHROME = 0,
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_420 = 1,
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_422 = 2,
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_444 = 3,
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_CHROMA_FORMAT_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265ChromaFormatIdc;
+
+typedef enum StdVideoH265ProfileIdc {
+    STD_VIDEO_H265_PROFILE_IDC_MAIN = 1,
+    STD_VIDEO_H265_PROFILE_IDC_MAIN_10 = 2,
+    STD_VIDEO_H265_PROFILE_IDC_MAIN_STILL_PICTURE = 3,
+    STD_VIDEO_H265_PROFILE_IDC_FORMAT_RANGE_EXTENSIONS = 4,
+    STD_VIDEO_H265_PROFILE_IDC_SCC_EXTENSIONS = 9,
+    STD_VIDEO_H265_PROFILE_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_PROFILE_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265ProfileIdc;
+
+typedef enum StdVideoH265LevelIdc {
+    STD_VIDEO_H265_LEVEL_IDC_1_0 = 0,
+    STD_VIDEO_H265_LEVEL_IDC_2_0 = 1,
+    STD_VIDEO_H265_LEVEL_IDC_2_1 = 2,
+    STD_VIDEO_H265_LEVEL_IDC_3_0 = 3,
+    STD_VIDEO_H265_LEVEL_IDC_3_1 = 4,
+    STD_VIDEO_H265_LEVEL_IDC_4_0 = 5,
+    STD_VIDEO_H265_LEVEL_IDC_4_1 = 6,
+    STD_VIDEO_H265_LEVEL_IDC_5_0 = 7,
+    STD_VIDEO_H265_LEVEL_IDC_5_1 = 8,
+    STD_VIDEO_H265_LEVEL_IDC_5_2 = 9,
+    STD_VIDEO_H265_LEVEL_IDC_6_0 = 10,
+    STD_VIDEO_H265_LEVEL_IDC_6_1 = 11,
+    STD_VIDEO_H265_LEVEL_IDC_6_2 = 12,
+    STD_VIDEO_H265_LEVEL_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_LEVEL_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265LevelIdc;
+
+typedef enum StdVideoH265SliceType {
+    STD_VIDEO_H265_SLICE_TYPE_B = 0,
+    STD_VIDEO_H265_SLICE_TYPE_P = 1,
+    STD_VIDEO_H265_SLICE_TYPE_I = 2,
+    STD_VIDEO_H265_SLICE_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_SLICE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265SliceType;
+
+typedef enum StdVideoH265PictureType {
+    STD_VIDEO_H265_PICTURE_TYPE_P = 0,
+    STD_VIDEO_H265_PICTURE_TYPE_B = 1,
+    STD_VIDEO_H265_PICTURE_TYPE_I = 2,
+    STD_VIDEO_H265_PICTURE_TYPE_IDR = 3,
+    STD_VIDEO_H265_PICTURE_TYPE_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_PICTURE_TYPE_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265PictureType;
+
+typedef enum StdVideoH265AspectRatioIdc {
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_UNSPECIFIED = 0,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_SQUARE = 1,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_12_11 = 2,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_10_11 = 3,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_16_11 = 4,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_40_33 = 5,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_24_11 = 6,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_20_11 = 7,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_32_11 = 8,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_80_33 = 9,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_18_11 = 10,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_15_11 = 11,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_64_33 = 12,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_160_99 = 13,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_4_3 = 14,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_3_2 = 15,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_2_1 = 16,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_EXTENDED_SAR = 255,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_INVALID = 0x7FFFFFFF,
+    STD_VIDEO_H265_ASPECT_RATIO_IDC_MAX_ENUM = 0x7FFFFFFF
+} StdVideoH265AspectRatioIdc;
+typedef struct StdVideoH265DecPicBufMgr {
+    uint32_t    max_latency_increase_plus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
+    uint8_t     max_dec_pic_buffering_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
+    uint8_t     max_num_reorder_pics[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
+} StdVideoH265DecPicBufMgr;
+
+typedef struct StdVideoH265SubLayerHrdParameters {
+    uint32_t    bit_rate_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
+    uint32_t    cpb_size_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
+    uint32_t    cpb_size_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
+    uint32_t    bit_rate_du_value_minus1[STD_VIDEO_H265_CPB_CNT_LIST_SIZE];
+    uint32_t    cbr_flag;
+} StdVideoH265SubLayerHrdParameters;
+
+typedef struct StdVideoH265HrdFlags {
+    uint32_t    nal_hrd_parameters_present_flag : 1;
+    uint32_t    vcl_hrd_parameters_present_flag : 1;
+    uint32_t    sub_pic_hrd_params_present_flag : 1;
+    uint32_t    sub_pic_cpb_params_in_pic_timing_sei_flag : 1;
+    uint32_t    fixed_pic_rate_general_flag : 8;
+    uint32_t    fixed_pic_rate_within_cvs_flag : 8;
+    uint32_t    low_delay_hrd_flag : 8;
+} StdVideoH265HrdFlags;
+
+typedef struct StdVideoH265HrdParameters {
+    StdVideoH265HrdFlags                        flags;
+    uint8_t                                     tick_divisor_minus2;
+    uint8_t                                     du_cpb_removal_delay_increment_length_minus1;
+    uint8_t                                     dpb_output_delay_du_length_minus1;
+    uint8_t                                     bit_rate_scale;
+    uint8_t                                     cpb_size_scale;
+    uint8_t                                     cpb_size_du_scale;
+    uint8_t                                     initial_cpb_removal_delay_length_minus1;
+    uint8_t                                     au_cpb_removal_delay_length_minus1;
+    uint8_t                                     dpb_output_delay_length_minus1;
+    uint8_t                                     cpb_cnt_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
+    uint16_t                                    elemental_duration_in_tc_minus1[STD_VIDEO_H265_SUBLAYERS_LIST_SIZE];
+    uint16_t                                    reserved[3];
+    const StdVideoH265SubLayerHrdParameters*    pSubLayerHrdParametersNal;
+    const StdVideoH265SubLayerHrdParameters*    pSubLayerHrdParametersVcl;
+} StdVideoH265HrdParameters;
+
+typedef struct StdVideoH265VpsFlags {
+    uint32_t    vps_temporal_id_nesting_flag : 1;
+    uint32_t    vps_sub_layer_ordering_info_present_flag : 1;
+    uint32_t    vps_timing_info_present_flag : 1;
+    uint32_t    vps_poc_proportional_to_timing_flag : 1;
+} StdVideoH265VpsFlags;
+
+typedef struct StdVideoH265ProfileTierLevelFlags {
+    uint32_t    general_tier_flag : 1;
+    uint32_t    general_progressive_source_flag : 1;
+    uint32_t    general_interlaced_source_flag : 1;
+    uint32_t    general_non_packed_constraint_flag : 1;
+    uint32_t    general_frame_only_constraint_flag : 1;
+} StdVideoH265ProfileTierLevelFlags;
+
+typedef struct StdVideoH265ProfileTierLevel {
+    StdVideoH265ProfileTierLevelFlags    flags;
+    StdVideoH265ProfileIdc               general_profile_idc;
+    StdVideoH265LevelIdc                 general_level_idc;
+} StdVideoH265ProfileTierLevel;
+
+typedef struct StdVideoH265VideoParameterSet {
+    StdVideoH265VpsFlags                   flags;
+    uint8_t                                vps_video_parameter_set_id;
+    uint8_t                                vps_max_sub_layers_minus1;
+    uint8_t                                reserved1;
+    uint8_t                                reserved2;
+    uint32_t                               vps_num_units_in_tick;
+    uint32_t                               vps_time_scale;
+    uint32_t                               vps_num_ticks_poc_diff_one_minus1;
+    uint32_t                               reserved3;
+    const StdVideoH265DecPicBufMgr*        pDecPicBufMgr;
+    const StdVideoH265HrdParameters*       pHrdParameters;
+    const StdVideoH265ProfileTierLevel*    pProfileTierLevel;
+} StdVideoH265VideoParameterSet;
+
+typedef struct StdVideoH265ScalingLists {
+    uint8_t    ScalingList4x4[STD_VIDEO_H265_SCALING_LIST_4X4_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_4X4_NUM_ELEMENTS];
+    uint8_t    ScalingList8x8[STD_VIDEO_H265_SCALING_LIST_8X8_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_8X8_NUM_ELEMENTS];
+    uint8_t    ScalingList16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_16X16_NUM_ELEMENTS];
+    uint8_t    ScalingList32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS][STD_VIDEO_H265_SCALING_LIST_32X32_NUM_ELEMENTS];
+    uint8_t    ScalingListDCCoef16x16[STD_VIDEO_H265_SCALING_LIST_16X16_NUM_LISTS];
+    uint8_t    ScalingListDCCoef32x32[STD_VIDEO_H265_SCALING_LIST_32X32_NUM_LISTS];
+} StdVideoH265ScalingLists;
+
+typedef struct StdVideoH265SpsVuiFlags {
+    uint32_t    aspect_ratio_info_present_flag : 1;
+    uint32_t    overscan_info_present_flag : 1;
+    uint32_t    overscan_appropriate_flag : 1;
+    uint32_t    video_signal_type_present_flag : 1;
+    uint32_t    video_full_range_flag : 1;
+    uint32_t    colour_description_present_flag : 1;
+    uint32_t    chroma_loc_info_present_flag : 1;
+    uint32_t    neutral_chroma_indication_flag : 1;
+    uint32_t    field_seq_flag : 1;
+    uint32_t    frame_field_info_present_flag : 1;
+    uint32_t    default_display_window_flag : 1;
+    uint32_t    vui_timing_info_present_flag : 1;
+    uint32_t    vui_poc_proportional_to_timing_flag : 1;
+    uint32_t    vui_hrd_parameters_present_flag : 1;
+    uint32_t    bitstream_restriction_flag : 1;
+    uint32_t    tiles_fixed_structure_flag : 1;
+    uint32_t    motion_vectors_over_pic_boundaries_flag : 1;
+    uint32_t    restricted_ref_pic_lists_flag : 1;
+} StdVideoH265SpsVuiFlags;
+
+typedef struct StdVideoH265SequenceParameterSetVui {
+    StdVideoH265SpsVuiFlags             flags;
+    StdVideoH265AspectRatioIdc          aspect_ratio_idc;
+    uint16_t                            sar_width;
+    uint16_t                            sar_height;
+    uint8_t                             video_format;
+    uint8_t                             colour_primaries;
+    uint8_t                             transfer_characteristics;
+    uint8_t                             matrix_coeffs;
+    uint8_t                             chroma_sample_loc_type_top_field;
+    uint8_t                             chroma_sample_loc_type_bottom_field;
+    uint8_t                             reserved1;
+    uint8_t                             reserved2;
+    uint16_t                            def_disp_win_left_offset;
+    uint16_t                            def_disp_win_right_offset;
+    uint16_t                            def_disp_win_top_offset;
+    uint16_t                            def_disp_win_bottom_offset;
+    uint32_t                            vui_num_units_in_tick;
+    uint32_t                            vui_time_scale;
+    uint32_t                            vui_num_ticks_poc_diff_one_minus1;
+    uint16_t                            min_spatial_segmentation_idc;
+    uint16_t                            reserved3;
+    uint8_t                             max_bytes_per_pic_denom;
+    uint8_t                             max_bits_per_min_cu_denom;
+    uint8_t                             log2_max_mv_length_horizontal;
+    uint8_t                             log2_max_mv_length_vertical;
+    const StdVideoH265HrdParameters*    pHrdParameters;
+} StdVideoH265SequenceParameterSetVui;
+
+typedef struct StdVideoH265PredictorPaletteEntries {
+    uint16_t    PredictorPaletteEntries[STD_VIDEO_H265_PREDICTOR_PALETTE_COMPONENTS_LIST_SIZE][STD_VIDEO_H265_PREDICTOR_PALETTE_COMP_ENTRIES_LIST_SIZE];
+} StdVideoH265PredictorPaletteEntries;
+
+typedef struct StdVideoH265SpsFlags {
+    uint32_t    sps_temporal_id_nesting_flag : 1;
+    uint32_t    separate_colour_plane_flag : 1;
+    uint32_t    conformance_window_flag : 1;
+    uint32_t    sps_sub_layer_ordering_info_present_flag : 1;
+    uint32_t    scaling_list_enabled_flag : 1;
+    uint32_t    sps_scaling_list_data_present_flag : 1;
+    uint32_t    amp_enabled_flag : 1;
+    uint32_t    sample_adaptive_offset_enabled_flag : 1;
+    uint32_t    pcm_enabled_flag : 1;
+    uint32_t    pcm_loop_filter_disabled_flag : 1;
+    uint32_t    long_term_ref_pics_present_flag : 1;
+    uint32_t    sps_temporal_mvp_enabled_flag : 1;
+    uint32_t    strong_intra_smoothing_enabled_flag : 1;
+    uint32_t    vui_parameters_present_flag : 1;
+    uint32_t    sps_extension_present_flag : 1;
+    uint32_t    sps_range_extension_flag : 1;
+    uint32_t    transform_skip_rotation_enabled_flag : 1;
+    uint32_t    transform_skip_context_enabled_flag : 1;
+    uint32_t    implicit_rdpcm_enabled_flag : 1;
+    uint32_t    explicit_rdpcm_enabled_flag : 1;
+    uint32_t    extended_precision_processing_flag : 1;
+    uint32_t    intra_smoothing_disabled_flag : 1;
+    uint32_t    high_precision_offsets_enabled_flag : 1;
+    uint32_t    persistent_rice_adaptation_enabled_flag : 1;
+    uint32_t    cabac_bypass_alignment_enabled_flag : 1;
+    uint32_t    sps_scc_extension_flag : 1;
+    uint32_t    sps_curr_pic_ref_enabled_flag : 1;
+    uint32_t    palette_mode_enabled_flag : 1;
+    uint32_t    sps_palette_predictor_initializers_present_flag : 1;
+    uint32_t    intra_boundary_filtering_disabled_flag : 1;
+} StdVideoH265SpsFlags;
+
+typedef struct StdVideoH265ShortTermRefPicSetFlags {
+    uint32_t    inter_ref_pic_set_prediction_flag : 1;
+    uint32_t    delta_rps_sign : 1;
+} StdVideoH265ShortTermRefPicSetFlags;
+
+typedef struct StdVideoH265ShortTermRefPicSet {
+    StdVideoH265ShortTermRefPicSetFlags    flags;
+    uint32_t                               delta_idx_minus1;
+    uint16_t                               use_delta_flag;
+    uint16_t                               abs_delta_rps_minus1;
+    uint16_t                               used_by_curr_pic_flag;
+    uint16_t                               used_by_curr_pic_s0_flag;
+    uint16_t                               used_by_curr_pic_s1_flag;
+    uint16_t                               reserved1;
+    uint8_t                                reserved2;
+    uint8_t                                reserved3;
+    uint8_t                                num_negative_pics;
+    uint8_t                                num_positive_pics;
+    uint16_t                               delta_poc_s0_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
+    uint16_t                               delta_poc_s1_minus1[STD_VIDEO_H265_MAX_DPB_SIZE];
+} StdVideoH265ShortTermRefPicSet;
+
+typedef struct StdVideoH265LongTermRefPicsSps {
+    uint32_t    used_by_curr_pic_lt_sps_flag;
+    uint32_t    lt_ref_pic_poc_lsb_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
+} StdVideoH265LongTermRefPicsSps;
+
+typedef struct StdVideoH265SequenceParameterSet {
+    StdVideoH265SpsFlags                          flags;
+    StdVideoH265ChromaFormatIdc                   chroma_format_idc;
+    uint32_t                                      pic_width_in_luma_samples;
+    uint32_t                                      pic_height_in_luma_samples;
+    uint8_t                                       sps_video_parameter_set_id;
+    uint8_t                                       sps_max_sub_layers_minus1;
+    uint8_t                                       sps_seq_parameter_set_id;
+    uint8_t                                       bit_depth_luma_minus8;
+    uint8_t                                       bit_depth_chroma_minus8;
+    uint8_t                                       log2_max_pic_order_cnt_lsb_minus4;
+    uint8_t                                       log2_min_luma_coding_block_size_minus3;
+    uint8_t                                       log2_diff_max_min_luma_coding_block_size;
+    uint8_t                                       log2_min_luma_transform_block_size_minus2;
+    uint8_t                                       log2_diff_max_min_luma_transform_block_size;
+    uint8_t                                       max_transform_hierarchy_depth_inter;
+    uint8_t                                       max_transform_hierarchy_depth_intra;
+    uint8_t                                       num_short_term_ref_pic_sets;
+    uint8_t                                       num_long_term_ref_pics_sps;
+    uint8_t                                       pcm_sample_bit_depth_luma_minus1;
+    uint8_t                                       pcm_sample_bit_depth_chroma_minus1;
+    uint8_t                                       log2_min_pcm_luma_coding_block_size_minus3;
+    uint8_t                                       log2_diff_max_min_pcm_luma_coding_block_size;
+    uint8_t                                       reserved1;
+    uint8_t                                       reserved2;
+    uint8_t                                       palette_max_size;
+    uint8_t                                       delta_palette_max_predictor_size;
+    uint8_t                                       motion_vector_resolution_control_idc;
+    uint8_t                                       sps_num_palette_predictor_initializers_minus1;
+    uint32_t                                      conf_win_left_offset;
+    uint32_t                                      conf_win_right_offset;
+    uint32_t                                      conf_win_top_offset;
+    uint32_t                                      conf_win_bottom_offset;
+    const StdVideoH265ProfileTierLevel*           pProfileTierLevel;
+    const StdVideoH265DecPicBufMgr*               pDecPicBufMgr;
+    const StdVideoH265ScalingLists*               pScalingLists;
+    const StdVideoH265ShortTermRefPicSet*         pShortTermRefPicSet;
+    const StdVideoH265LongTermRefPicsSps*         pLongTermRefPicsSps;
+    const StdVideoH265SequenceParameterSetVui*    pSequenceParameterSetVui;
+    const StdVideoH265PredictorPaletteEntries*    pPredictorPaletteEntries;
+} StdVideoH265SequenceParameterSet;
+
+typedef struct StdVideoH265PpsFlags {
+    uint32_t    dependent_slice_segments_enabled_flag : 1;
+    uint32_t    output_flag_present_flag : 1;
+    uint32_t    sign_data_hiding_enabled_flag : 1;
+    uint32_t    cabac_init_present_flag : 1;
+    uint32_t    constrained_intra_pred_flag : 1;
+    uint32_t    transform_skip_enabled_flag : 1;
+    uint32_t    cu_qp_delta_enabled_flag : 1;
+    uint32_t    pps_slice_chroma_qp_offsets_present_flag : 1;
+    uint32_t    weighted_pred_flag : 1;
+    uint32_t    weighted_bipred_flag : 1;
+    uint32_t    transquant_bypass_enabled_flag : 1;
+    uint32_t    tiles_enabled_flag : 1;
+    uint32_t    entropy_coding_sync_enabled_flag : 1;
+    uint32_t    uniform_spacing_flag : 1;
+    uint32_t    loop_filter_across_tiles_enabled_flag : 1;
+    uint32_t    pps_loop_filter_across_slices_enabled_flag : 1;
+    uint32_t    deblocking_filter_control_present_flag : 1;
+    uint32_t    deblocking_filter_override_enabled_flag : 1;
+    uint32_t    pps_deblocking_filter_disabled_flag : 1;
+    uint32_t    pps_scaling_list_data_present_flag : 1;
+    uint32_t    lists_modification_present_flag : 1;
+    uint32_t    slice_segment_header_extension_present_flag : 1;
+    uint32_t    pps_extension_present_flag : 1;
+    uint32_t    cross_component_prediction_enabled_flag : 1;
+    uint32_t    chroma_qp_offset_list_enabled_flag : 1;
+    uint32_t    pps_curr_pic_ref_enabled_flag : 1;
+    uint32_t    residual_adaptive_colour_transform_enabled_flag : 1;
+    uint32_t    pps_slice_act_qp_offsets_present_flag : 1;
+    uint32_t    pps_palette_predictor_initializers_present_flag : 1;
+    uint32_t    monochrome_palette_flag : 1;
+    uint32_t    pps_range_extension_flag : 1;
+} StdVideoH265PpsFlags;
+
+typedef struct StdVideoH265PictureParameterSet {
+    StdVideoH265PpsFlags                          flags;
+    uint8_t                                       pps_pic_parameter_set_id;
+    uint8_t                                       pps_seq_parameter_set_id;
+    uint8_t                                       sps_video_parameter_set_id;
+    uint8_t                                       num_extra_slice_header_bits;
+    uint8_t                                       num_ref_idx_l0_default_active_minus1;
+    uint8_t                                       num_ref_idx_l1_default_active_minus1;
+    int8_t                                        init_qp_minus26;
+    uint8_t                                       diff_cu_qp_delta_depth;
+    int8_t                                        pps_cb_qp_offset;
+    int8_t                                        pps_cr_qp_offset;
+    int8_t                                        pps_beta_offset_div2;
+    int8_t                                        pps_tc_offset_div2;
+    uint8_t                                       log2_parallel_merge_level_minus2;
+    uint8_t                                       log2_max_transform_skip_block_size_minus2;
+    uint8_t                                       diff_cu_chroma_qp_offset_depth;
+    uint8_t                                       chroma_qp_offset_list_len_minus1;
+    int8_t                                        cb_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
+    int8_t                                        cr_qp_offset_list[STD_VIDEO_H265_CHROMA_QP_OFFSET_LIST_SIZE];
+    uint8_t                                       log2_sao_offset_scale_luma;
+    uint8_t                                       log2_sao_offset_scale_chroma;
+    int8_t                                        pps_act_y_qp_offset_plus5;
+    int8_t                                        pps_act_cb_qp_offset_plus5;
+    int8_t                                        pps_act_cr_qp_offset_plus3;
+    uint8_t                                       pps_num_palette_predictor_initializers;
+    uint8_t                                       luma_bit_depth_entry_minus8;
+    uint8_t                                       chroma_bit_depth_entry_minus8;
+    uint8_t                                       num_tile_columns_minus1;
+    uint8_t                                       num_tile_rows_minus1;
+    uint8_t                                       reserved1;
+    uint8_t                                       reserved2;
+    uint16_t                                      column_width_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_COLS_LIST_SIZE];
+    uint16_t                                      row_height_minus1[STD_VIDEO_H265_CHROMA_QP_OFFSET_TILE_ROWS_LIST_SIZE];
+    uint32_t                                      reserved3;
+    const StdVideoH265ScalingLists*               pScalingLists;
+    const StdVideoH265PredictorPaletteEntries*    pPredictorPaletteEntries;
+} StdVideoH265PictureParameterSet;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codec_h265std_decode.h b/include/vk_video/vulkan_video_codec_h265std_decode.h
new file mode 100644
index 0000000..d8660d1
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h265std_decode.h
@@ -0,0 +1,65 @@
+#ifndef VULKAN_VIDEO_CODEC_H265STD_DECODE_H_
+#define VULKAN_VIDEO_CODEC_H265STD_DECODE_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h265std_decode 1
+
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0 VK_MAKE_VIDEO_STD_VERSION(1, 0, 0)
+
+#define STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE 8
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_API_VERSION_1_0_0
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_DECODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_decode"
+typedef struct StdVideoDecodeH265PictureInfoFlags {
+    uint32_t    IrapPicFlag : 1;
+    uint32_t    IdrPicFlag  : 1;
+    uint32_t    IsReference : 1;
+    uint32_t    short_term_ref_pic_set_sps_flag : 1;
+} StdVideoDecodeH265PictureInfoFlags;
+
+typedef struct StdVideoDecodeH265PictureInfo {
+    StdVideoDecodeH265PictureInfoFlags    flags;
+    uint8_t                               sps_video_parameter_set_id;
+    uint8_t                               pps_seq_parameter_set_id;
+    uint8_t                               pps_pic_parameter_set_id;
+    uint8_t                               NumDeltaPocsOfRefRpsIdx;
+    int32_t                               PicOrderCntVal;
+    uint16_t                              NumBitsForSTRefPicSetInSlice;
+    uint16_t                              reserved;
+    uint8_t                               RefPicSetStCurrBefore[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
+    uint8_t                               RefPicSetStCurrAfter[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
+    uint8_t                               RefPicSetLtCurr[STD_VIDEO_DECODE_H265_REF_PIC_SET_LIST_SIZE];
+} StdVideoDecodeH265PictureInfo;
+
+typedef struct StdVideoDecodeH265ReferenceInfoFlags {
+    uint32_t    used_for_long_term_reference : 1;
+    uint32_t    unused_for_reference : 1;
+} StdVideoDecodeH265ReferenceInfoFlags;
+
+typedef struct StdVideoDecodeH265ReferenceInfo {
+    StdVideoDecodeH265ReferenceInfoFlags    flags;
+    int32_t                                 PicOrderCntVal;
+} StdVideoDecodeH265ReferenceInfo;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codec_h265std_encode.h b/include/vk_video/vulkan_video_codec_h265std_encode.h
new file mode 100644
index 0000000..5a419b1
--- /dev/null
+++ b/include/vk_video/vulkan_video_codec_h265std_encode.h
@@ -0,0 +1,146 @@
+#ifndef VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_
+#define VULKAN_VIDEO_CODEC_H265STD_ENCODE_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codec_h265std_encode 1
+// Vulkan 0.9 provisional Vulkan video H.265 encode std specification version number
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9 VK_MAKE_VIDEO_STD_VERSION(0, 9, 9)
+
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_SPEC_VERSION VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_API_VERSION_0_9_9
+#define VK_STD_VULKAN_VIDEO_CODEC_H265_ENCODE_EXTENSION_NAME "VK_STD_vulkan_video_codec_h265_encode"
+typedef struct StdVideoEncodeH265WeightTableFlags {
+    uint16_t    luma_weight_l0_flag;
+    uint16_t    chroma_weight_l0_flag;
+    uint16_t    luma_weight_l1_flag;
+    uint16_t    chroma_weight_l1_flag;
+} StdVideoEncodeH265WeightTableFlags;
+
+typedef struct StdVideoEncodeH265WeightTable {
+    StdVideoEncodeH265WeightTableFlags    flags;
+    uint8_t                               luma_log2_weight_denom;
+    int8_t                                delta_chroma_log2_weight_denom;
+    int8_t                                delta_luma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
+    int8_t                                luma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF];
+    int8_t                                delta_chroma_weight_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
+    int8_t                                delta_chroma_offset_l0[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
+    int8_t                                delta_luma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
+    int8_t                                luma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF];
+    int8_t                                delta_chroma_weight_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
+    int8_t                                delta_chroma_offset_l1[STD_VIDEO_H265_MAX_NUM_LIST_REF][STD_VIDEO_H265_MAX_CHROMA_PLANES];
+} StdVideoEncodeH265WeightTable;
+
+typedef struct StdVideoEncodeH265SliceSegmentHeaderFlags {
+    uint32_t    first_slice_segment_in_pic_flag : 1;
+    uint32_t    no_output_of_prior_pics_flag : 1;
+    uint32_t    dependent_slice_segment_flag : 1;
+    uint32_t    pic_output_flag : 1;
+    uint32_t    short_term_ref_pic_set_sps_flag : 1;
+    uint32_t    slice_temporal_mvp_enable_flag : 1;
+    uint32_t    slice_sao_luma_flag : 1;
+    uint32_t    slice_sao_chroma_flag : 1;
+    uint32_t    num_ref_idx_active_override_flag : 1;
+    uint32_t    mvd_l1_zero_flag : 1;
+    uint32_t    cabac_init_flag : 1;
+    uint32_t    cu_chroma_qp_offset_enabled_flag : 1;
+    uint32_t    deblocking_filter_override_flag : 1;
+    uint32_t    slice_deblocking_filter_disabled_flag : 1;
+    uint32_t    collocated_from_l0_flag : 1;
+    uint32_t    slice_loop_filter_across_slices_enabled_flag : 1;
+} StdVideoEncodeH265SliceSegmentHeaderFlags;
+
+typedef struct StdVideoEncodeH265SliceSegmentLongTermRefPics {
+    uint8_t     num_long_term_sps;
+    uint8_t     num_long_term_pics;
+    uint8_t     lt_idx_sps[STD_VIDEO_H265_MAX_LONG_TERM_REF_PICS_SPS];
+    uint8_t     poc_lsb_lt[STD_VIDEO_H265_MAX_LONG_TERM_PICS];
+    uint16_t    used_by_curr_pic_lt_flag;
+    uint8_t     delta_poc_msb_present_flag[STD_VIDEO_H265_MAX_DELTA_POC];
+    uint8_t     delta_poc_msb_cycle_lt[STD_VIDEO_H265_MAX_DELTA_POC];
+} StdVideoEncodeH265SliceSegmentLongTermRefPics;
+
+typedef struct StdVideoEncodeH265SliceSegmentHeader {
+    StdVideoEncodeH265SliceSegmentHeaderFlags               flags;
+    StdVideoH265SliceType                                   slice_type;
+    uint32_t                                                slice_segment_address;
+    uint8_t                                                 short_term_ref_pic_set_idx;
+    uint8_t                                                 collocated_ref_idx;
+    uint8_t                                                 num_ref_idx_l0_active_minus1;
+    uint8_t                                                 num_ref_idx_l1_active_minus1;
+    uint8_t                                                 MaxNumMergeCand;
+    int8_t                                                  slice_cb_qp_offset;
+    int8_t                                                  slice_cr_qp_offset;
+    int8_t                                                  slice_beta_offset_div2;
+    int8_t                                                  slice_tc_offset_div2;
+    int8_t                                                  slice_act_y_qp_offset;
+    int8_t                                                  slice_act_cb_qp_offset;
+    int8_t                                                  slice_act_cr_qp_offset;
+    const StdVideoH265ShortTermRefPicSet*                   pShortTermRefPicSet;
+    const StdVideoEncodeH265SliceSegmentLongTermRefPics*    pLongTermRefPics;
+    const StdVideoEncodeH265WeightTable*                    pWeightTable;
+} StdVideoEncodeH265SliceSegmentHeader;
+
+typedef struct StdVideoEncodeH265ReferenceModificationFlags {
+    uint32_t    ref_pic_list_modification_flag_l0 : 1;
+    uint32_t    ref_pic_list_modification_flag_l1 : 1;
+} StdVideoEncodeH265ReferenceModificationFlags;
+
+typedef struct StdVideoEncodeH265ReferenceModifications {
+    StdVideoEncodeH265ReferenceModificationFlags    flags;
+    uint8_t                                         referenceList0ModificationsCount;
+    const uint8_t*                                  pReferenceList0Modifications;
+    uint8_t                                         referenceList1ModificationsCount;
+    const uint8_t*                                  pReferenceList1Modifications;
+} StdVideoEncodeH265ReferenceModifications;
+
+typedef struct StdVideoEncodeH265PictureInfoFlags {
+    uint32_t    is_reference_flag : 1;
+    uint32_t    IrapPicFlag : 1;
+    uint32_t    long_term_flag : 1;
+    uint32_t    discardable_flag : 1;
+    uint32_t    cross_layer_bla_flag : 1;
+} StdVideoEncodeH265PictureInfoFlags;
+
+typedef struct StdVideoEncodeH265PictureInfo {
+    StdVideoEncodeH265PictureInfoFlags    flags;
+    StdVideoH265PictureType               PictureType;
+    uint8_t                               sps_video_parameter_set_id;
+    uint8_t                               pps_seq_parameter_set_id;
+    uint8_t                               pps_pic_parameter_set_id;
+    int32_t                               PicOrderCntVal;
+    uint8_t                               TemporalId;
+} StdVideoEncodeH265PictureInfo;
+
+typedef struct StdVideoEncodeH265ReferenceInfoFlags {
+    uint32_t    used_for_long_term_reference : 1;
+    uint32_t    unused_for_reference : 1;
+} StdVideoEncodeH265ReferenceInfoFlags;
+
+typedef struct StdVideoEncodeH265ReferenceInfo {
+    StdVideoEncodeH265ReferenceInfoFlags    flags;
+    int32_t                                 PicOrderCntVal;
+    uint8_t                                 TemporalId;
+} StdVideoEncodeH265ReferenceInfo;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vk_video/vulkan_video_codecs_common.h b/include/vk_video/vulkan_video_codecs_common.h
new file mode 100644
index 0000000..1e49826
--- /dev/null
+++ b/include/vk_video/vulkan_video_codecs_common.h
@@ -0,0 +1,31 @@
+#ifndef VULKAN_VIDEO_CODECS_COMMON_H_
+#define VULKAN_VIDEO_CODECS_COMMON_H_ 1
+
+/*
+** Copyright 2015-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+/*
+** This header is generated from the Khronos Vulkan XML API Registry.
+**
+*/
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+
+#define vulkan_video_codecs_common 1
+#define VK_MAKE_VIDEO_STD_VERSION(major, minor, patch) \
+    ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch)))
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/include/vulkan/vk_google_filtering_precision.h b/include/vulkan/vk_google_filtering_precision.h
new file mode 100644
index 0000000..65e3bcf
--- /dev/null
+++ b/include/vulkan/vk_google_filtering_precision.h
@@ -0,0 +1,41 @@
+// 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 "vulkan_core.h"
+
+// THIS FILE SHOULD BE DELETED IF VK_GOOGLE_sampler_filtering_precision IS EVER ADDED TO THE VULKAN HEADERS
+#ifdef VK_GOOGLE_sampler_filtering_precision
+#error "VK_GOOGLE_sampler_filtering_precision is already defined in the Vulkan headers, you can delete this file"
+#endif
+
+static constexpr VkStructureType VK_STRUCTURE_TYPE_SAMPLER_FILTERING_PRECISION_GOOGLE = static_cast<VkStructureType>(1000264000);
+
+#define VK_GOOGLE_sampler_filtering_precisions 1
+#define VK_GOOGLE_SAMPLER_FILTERING_PRECISION_SPEC_VERSION 1
+#define VK_GOOGLE_SAMPLER_FILTERING_PRECISION_EXTENSION_NAME "VK_GOOGLE_sampler_filtering_precision"
+
+typedef enum VkSamplerFilteringPrecisionModeGOOGLE {
+    VK_SAMPLER_FILTERING_PRECISION_MODE_LOW_GOOGLE = 0,
+    VK_SAMPLER_FILTERING_PRECISION_MODE_HIGH_GOOGLE = 1,
+    VK_SAMPLER_FILTERING_PRECISION_MODE_BEGIN_RANGE_GOOGLE = VK_SAMPLER_FILTERING_PRECISION_MODE_LOW_GOOGLE,
+    VK_SAMPLER_FILTERING_PRECISION_MODE_END_RANGE_GOOGLE = VK_SAMPLER_FILTERING_PRECISION_MODE_HIGH_GOOGLE,
+    VK_SAMPLER_FILTERING_PRECISION_MODE_RANGE_SIZE_GOOGLE = (VK_SAMPLER_FILTERING_PRECISION_MODE_HIGH_GOOGLE - VK_SAMPLER_FILTERING_PRECISION_MODE_LOW_GOOGLE + 1),
+    VK_SAMPLER_FILTERING_PRECISION_MODE_MAX_ENUM_GOOGLE = 0x7FFFFFFF
+} VkSamplerFilteringPrecisionModeGOOGLE;
+
+typedef struct VkSamplerFilteringPrecisionGOOGLE {
+    VkStructureType                       sType;
+    const void*                           pNext;
+    VkSamplerFilteringPrecisionModeGOOGLE samplerFilteringPrecisionMode;
+} VkSamplerFilteringPrecisionGOOGLE;
diff --git a/include/vulkan/vk_icd.h b/include/vulkan/vk_icd.h
new file mode 100644
index 0000000..fa90fcf
--- /dev/null
+++ b/include/vulkan/vk_icd.h
@@ -0,0 +1,262 @@
+//
+// File: vk_icd.h
+//
+/*
+ * Copyright (c) 2015-2016, 2022 The Khronos Group Inc.
+ * Copyright (c) 2015-2016, 2022 Valve Corporation
+ * Copyright (c) 2015-2016, 2022 LunarG, 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.
+ *
+ */
+
+#ifndef VKICD_H
+#define VKICD_H
+
+#include "vulkan.h"
+#include <stdbool.h>
+
+// Loader-ICD version negotiation API.  Versions add the following features:
+//   Version 0 - Initial.  Doesn't support vk_icdGetInstanceProcAddr
+//               or vk_icdNegotiateLoaderICDInterfaceVersion.
+//   Version 1 - Add support for vk_icdGetInstanceProcAddr.
+//   Version 2 - Add Loader/ICD Interface version negotiation
+//               via vk_icdNegotiateLoaderICDInterfaceVersion.
+//   Version 3 - Add ICD creation/destruction of KHR_surface objects.
+//   Version 4 - Add unknown physical device extension querying via
+//               vk_icdGetPhysicalDeviceProcAddr.
+//   Version 5 - Tells ICDs that the loader is now paying attention to the
+//               application version of Vulkan passed into the ApplicationInfo
+//               structure during vkCreateInstance.  This will tell the ICD
+//               that if the loader is older, it should automatically fail a
+//               call for any API version > 1.0.  Otherwise, the loader will
+//               manually determine if it can support the expected version.
+//   Version 6 - Add support for vk_icdEnumerateAdapterPhysicalDevices.
+//   Version 7 - If an ICD supports any of the following functions, they must be
+//               queryable with vk_icdGetInstanceProcAddr:
+//                   vk_icdNegotiateLoaderICDInterfaceVersion
+//                   vk_icdGetPhysicalDeviceProcAddr
+//                   vk_icdEnumerateAdapterPhysicalDevices (Windows only)
+//               In addition, these functions no longer need to be exported directly.
+//               This version allows drivers provided through the extension
+//               VK_LUNARG_direct_driver_loading be able to support the entire
+//               Driver-Loader interface.
+
+#define CURRENT_LOADER_ICD_INTERFACE_VERSION 7
+#define MIN_SUPPORTED_LOADER_ICD_INTERFACE_VERSION 0
+#define MIN_PHYS_DEV_EXTENSION_ICD_INTERFACE_VERSION 4
+
+// Old typedefs that don't follow a proper naming convention but are preserved for compatibility
+typedef VkResult(VKAPI_PTR *PFN_vkNegotiateLoaderICDInterfaceVersion)(uint32_t *pVersion);
+// This is defined in vk_layer.h which will be found by the loader, but if an ICD is building against this
+// file directly, it won't be found.
+#ifndef PFN_GetPhysicalDeviceProcAddr
+typedef PFN_vkVoidFunction(VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char *pName);
+#endif
+
+// Typedefs for loader/ICD interface
+typedef VkResult (VKAPI_PTR *PFN_vk_icdNegotiateLoaderICDInterfaceVersion)(uint32_t* pVersion);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetInstanceProcAddr)(VkInstance instance, const char* pName);
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vk_icdGetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
+#if defined(VK_USE_PLATFORM_WIN32_KHR)
+typedef VkResult (VKAPI_PTR *PFN_vk_icdEnumerateAdapterPhysicalDevices)(VkInstance instance, LUID adapterLUID,
+    uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+#endif
+
+// Prototypes for loader/ICD interface
+#if !defined(VK_NO_PROTOTYPES)
+#ifdef __cplusplus
+extern "C" {
+#endif
+    VKAPI_ATTR VkResult VKAPI_CALL vk_icdNegotiateLoaderICDInterfaceVersion(uint32_t* pVersion);
+    VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetInstanceProcAddr(VkInstance instance, const char* pName);
+    VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vk_icdGetPhysicalDeviceProcAddr(VkInstance isntance, const char* pName);
+#if defined(VK_USE_PLATFORM_WIN32_KHR)
+    VKAPI_ATTR VkResult VKAPI_CALL vk_icdEnumerateAdapterPhysicalDevices(VkInstance instance, LUID adapterLUID,
+        uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices);
+#endif
+#ifdef __cplusplus
+}
+#endif
+#endif
+
+/*
+ * The ICD must reserve space for a pointer for the loader's dispatch
+ * table, at the start of <each object>.
+ * The ICD must initialize this variable using the SET_LOADER_MAGIC_VALUE macro.
+ */
+
+#define ICD_LOADER_MAGIC 0x01CDC0DE
+
+typedef union {
+    uintptr_t loaderMagic;
+    void *loaderData;
+} VK_LOADER_DATA;
+
+static inline void set_loader_magic_value(void *pNewObject) {
+    VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
+    loader_info->loaderMagic = ICD_LOADER_MAGIC;
+}
+
+static inline bool valid_loader_magic_value(void *pNewObject) {
+    const VK_LOADER_DATA *loader_info = (VK_LOADER_DATA *)pNewObject;
+    return (loader_info->loaderMagic & 0xffffffff) == ICD_LOADER_MAGIC;
+}
+
+/*
+ * Windows and Linux ICDs will treat VkSurfaceKHR as a pointer to a struct that
+ * contains the platform-specific connection and surface information.
+ */
+typedef enum {
+    VK_ICD_WSI_PLATFORM_MIR,
+    VK_ICD_WSI_PLATFORM_WAYLAND,
+    VK_ICD_WSI_PLATFORM_WIN32,
+    VK_ICD_WSI_PLATFORM_XCB,
+    VK_ICD_WSI_PLATFORM_XLIB,
+    VK_ICD_WSI_PLATFORM_ANDROID,
+    VK_ICD_WSI_PLATFORM_MACOS,
+    VK_ICD_WSI_PLATFORM_IOS,
+    VK_ICD_WSI_PLATFORM_DISPLAY,
+    VK_ICD_WSI_PLATFORM_HEADLESS,
+    VK_ICD_WSI_PLATFORM_METAL,
+    VK_ICD_WSI_PLATFORM_DIRECTFB,
+    VK_ICD_WSI_PLATFORM_VI,
+    VK_ICD_WSI_PLATFORM_GGP,
+    VK_ICD_WSI_PLATFORM_SCREEN,
+    VK_ICD_WSI_PLATFORM_FUCHSIA,
+} VkIcdWsiPlatform;
+
+typedef struct {
+    VkIcdWsiPlatform platform;
+} VkIcdSurfaceBase;
+
+#ifdef VK_USE_PLATFORM_MIR_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    MirConnection *connection;
+    MirSurface *mirSurface;
+} VkIcdSurfaceMir;
+#endif  // VK_USE_PLATFORM_MIR_KHR
+
+#ifdef VK_USE_PLATFORM_WAYLAND_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    struct wl_display *display;
+    struct wl_surface *surface;
+} VkIcdSurfaceWayland;
+#endif  // VK_USE_PLATFORM_WAYLAND_KHR
+
+#ifdef VK_USE_PLATFORM_WIN32_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    HINSTANCE hinstance;
+    HWND hwnd;
+} VkIcdSurfaceWin32;
+#endif  // VK_USE_PLATFORM_WIN32_KHR
+
+#ifdef VK_USE_PLATFORM_XCB_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    xcb_connection_t *connection;
+    xcb_window_t window;
+} VkIcdSurfaceXcb;
+#endif  // VK_USE_PLATFORM_XCB_KHR
+
+#ifdef VK_USE_PLATFORM_XLIB_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    Display *dpy;
+    Window window;
+} VkIcdSurfaceXlib;
+#endif  // VK_USE_PLATFORM_XLIB_KHR
+
+#ifdef VK_USE_PLATFORM_DIRECTFB_EXT
+typedef struct {
+    VkIcdSurfaceBase base;
+    IDirectFB *dfb;
+    IDirectFBSurface *surface;
+} VkIcdSurfaceDirectFB;
+#endif  // VK_USE_PLATFORM_DIRECTFB_EXT
+
+#ifdef VK_USE_PLATFORM_ANDROID_KHR
+typedef struct {
+    VkIcdSurfaceBase base;
+    struct ANativeWindow *window;
+} VkIcdSurfaceAndroid;
+#endif  // VK_USE_PLATFORM_ANDROID_KHR
+
+#ifdef VK_USE_PLATFORM_MACOS_MVK
+typedef struct {
+    VkIcdSurfaceBase base;
+    const void *pView;
+} VkIcdSurfaceMacOS;
+#endif  // VK_USE_PLATFORM_MACOS_MVK
+
+#ifdef VK_USE_PLATFORM_IOS_MVK
+typedef struct {
+    VkIcdSurfaceBase base;
+    const void *pView;
+} VkIcdSurfaceIOS;
+#endif  // VK_USE_PLATFORM_IOS_MVK
+
+#ifdef VK_USE_PLATFORM_GGP
+typedef struct {
+    VkIcdSurfaceBase base;
+    GgpStreamDescriptor streamDescriptor;
+} VkIcdSurfaceGgp;
+#endif  // VK_USE_PLATFORM_GGP
+
+typedef struct {
+    VkIcdSurfaceBase base;
+    VkDisplayModeKHR displayMode;
+    uint32_t planeIndex;
+    uint32_t planeStackIndex;
+    VkSurfaceTransformFlagBitsKHR transform;
+    float globalAlpha;
+    VkDisplayPlaneAlphaFlagBitsKHR alphaMode;
+    VkExtent2D imageExtent;
+} VkIcdSurfaceDisplay;
+
+typedef struct {
+    VkIcdSurfaceBase base;
+} VkIcdSurfaceHeadless;
+
+#ifdef VK_USE_PLATFORM_METAL_EXT
+typedef struct {
+    VkIcdSurfaceBase base;
+    const CAMetalLayer *pLayer;
+} VkIcdSurfaceMetal;
+#endif // VK_USE_PLATFORM_METAL_EXT
+
+#ifdef VK_USE_PLATFORM_VI_NN
+typedef struct {
+    VkIcdSurfaceBase base;
+    void *window;
+} VkIcdSurfaceVi;
+#endif // VK_USE_PLATFORM_VI_NN
+
+#ifdef VK_USE_PLATFORM_SCREEN_QNX
+typedef struct {
+    VkIcdSurfaceBase base;
+    struct _screen_context *context;
+    struct _screen_window *window;
+} VkIcdSurfaceScreen;
+#endif  // VK_USE_PLATFORM_SCREEN_QNX
+
+#ifdef VK_USE_PLATFORM_FUCHSIA
+typedef struct {
+  VkIcdSurfaceBase base;
+} VkIcdSurfaceImagePipe;
+#endif // VK_USE_PLATFORM_FUCHSIA
+
+#endif  // VKICD_H
diff --git a/include/vulkan/vk_layer.h b/include/vulkan/vk_layer.h
new file mode 100644
index 0000000..0651870
--- /dev/null
+++ b/include/vulkan/vk_layer.h
@@ -0,0 +1,210 @@
+//
+// File: vk_layer.h
+//
+/*
+ * Copyright (c) 2015-2017 The Khronos Group Inc.
+ * Copyright (c) 2015-2017 Valve Corporation
+ * Copyright (c) 2015-2017 LunarG, 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.
+ *
+ */
+
+/* Need to define dispatch table
+ * Core struct can then have ptr to dispatch table at the top
+ * Along with object ptrs for current and next OBJ
+ */
+#pragma once
+
+#include "vulkan.h"
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define VK_LAYER_EXPORT __attribute__((visibility("default")))
+#elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
+#define VK_LAYER_EXPORT __attribute__((visibility("default")))
+#else
+#define VK_LAYER_EXPORT
+#endif
+
+#define MAX_NUM_UNKNOWN_EXTS 250
+
+ // Loader-Layer version negotiation API.  Versions add the following features:
+ //   Versions 0/1 - Initial.  Doesn't support vk_layerGetPhysicalDeviceProcAddr
+ //                  or vk_icdNegotiateLoaderLayerInterfaceVersion.
+ //   Version 2    - Add support for vk_layerGetPhysicalDeviceProcAddr and
+ //                  vk_icdNegotiateLoaderLayerInterfaceVersion.
+#define CURRENT_LOADER_LAYER_INTERFACE_VERSION 2
+#define MIN_SUPPORTED_LOADER_LAYER_INTERFACE_VERSION 1
+
+#define VK_CURRENT_CHAIN_VERSION 1
+
+// Typedef for use in the interfaces below
+typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_GetPhysicalDeviceProcAddr)(VkInstance instance, const char* pName);
+
+// Version negotiation values
+typedef enum VkNegotiateLayerStructType {
+    LAYER_NEGOTIATE_UNINTIALIZED = 0,
+    LAYER_NEGOTIATE_INTERFACE_STRUCT = 1,
+} VkNegotiateLayerStructType;
+
+// Version negotiation structures
+typedef struct VkNegotiateLayerInterface {
+    VkNegotiateLayerStructType sType;
+    void *pNext;
+    uint32_t loaderLayerInterfaceVersion;
+    PFN_vkGetInstanceProcAddr pfnGetInstanceProcAddr;
+    PFN_vkGetDeviceProcAddr pfnGetDeviceProcAddr;
+    PFN_GetPhysicalDeviceProcAddr pfnGetPhysicalDeviceProcAddr;
+} VkNegotiateLayerInterface;
+
+// Version negotiation functions
+typedef VkResult (VKAPI_PTR *PFN_vkNegotiateLoaderLayerInterfaceVersion)(VkNegotiateLayerInterface *pVersionStruct);
+
+// Function prototype for unknown physical device extension command
+typedef VkResult(VKAPI_PTR *PFN_PhysDevExt)(VkPhysicalDevice phys_device);
+
+// ------------------------------------------------------------------------------------------------
+// CreateInstance and CreateDevice support structures
+
+/* Sub type of structure for instance and device loader ext of CreateInfo.
+ * When sType == VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
+ * or sType == VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
+ * then VkLayerFunction indicates struct type pointed to by pNext
+ */
+typedef enum VkLayerFunction_ {
+    VK_LAYER_LINK_INFO = 0,
+    VK_LOADER_DATA_CALLBACK = 1,
+    VK_LOADER_LAYER_CREATE_DEVICE_CALLBACK = 2,
+    VK_LOADER_FEATURES = 3,
+} VkLayerFunction;
+
+typedef struct VkLayerInstanceLink_ {
+    struct VkLayerInstanceLink_ *pNext;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+    PFN_GetPhysicalDeviceProcAddr pfnNextGetPhysicalDeviceProcAddr;
+} VkLayerInstanceLink;
+
+/*
+ * When creating the device chain the loader needs to pass
+ * down information about it's device structure needed at
+ * the end of the chain. Passing the data via the
+ * VkLayerDeviceInfo avoids issues with finding the
+ * exact instance being used.
+ */
+typedef struct VkLayerDeviceInfo_ {
+    void *device_info;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+} VkLayerDeviceInfo;
+
+typedef VkResult (VKAPI_PTR *PFN_vkSetInstanceLoaderData)(VkInstance instance,
+        void *object);
+typedef VkResult (VKAPI_PTR *PFN_vkSetDeviceLoaderData)(VkDevice device,
+        void *object);
+typedef VkResult (VKAPI_PTR *PFN_vkLayerCreateDevice)(VkInstance instance, VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCreateInfo,
+						      const VkAllocationCallbacks *pAllocator, VkDevice *pDevice, PFN_vkGetInstanceProcAddr layerGIPA, PFN_vkGetDeviceProcAddr *nextGDPA);
+typedef void (VKAPI_PTR *PFN_vkLayerDestroyDevice)(VkDevice physicalDevice, const VkAllocationCallbacks *pAllocator, PFN_vkDestroyDevice destroyFunction);
+
+typedef enum VkLoaderFeastureFlagBits {
+    VK_LOADER_FEATURE_PHYSICAL_DEVICE_SORTING = 0x00000001,
+} VkLoaderFlagBits;
+typedef VkFlags VkLoaderFeatureFlags;
+
+typedef struct {
+    VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO
+    const void *pNext;
+    VkLayerFunction function;
+    union {
+        VkLayerInstanceLink *pLayerInfo;
+        PFN_vkSetInstanceLoaderData pfnSetInstanceLoaderData;
+        struct {
+	        PFN_vkLayerCreateDevice pfnLayerCreateDevice;
+	        PFN_vkLayerDestroyDevice pfnLayerDestroyDevice;
+	    } layerDevice;
+        VkLoaderFeatureFlags loaderFeatures;
+    } u;
+} VkLayerInstanceCreateInfo;
+
+typedef struct VkLayerDeviceLink_ {
+    struct VkLayerDeviceLink_ *pNext;
+    PFN_vkGetInstanceProcAddr pfnNextGetInstanceProcAddr;
+    PFN_vkGetDeviceProcAddr pfnNextGetDeviceProcAddr;
+} VkLayerDeviceLink;
+
+typedef struct {
+    VkStructureType sType; // VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO
+    const void *pNext;
+    VkLayerFunction function;
+    union {
+        VkLayerDeviceLink *pLayerInfo;
+        PFN_vkSetDeviceLoaderData pfnSetDeviceLoaderData;
+    } u;
+} VkLayerDeviceCreateInfo;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+VKAPI_ATTR VkResult VKAPI_CALL vkNegotiateLoaderLayerInterfaceVersion(VkNegotiateLayerInterface *pVersionStruct);
+
+typedef enum VkChainType {
+    VK_CHAIN_TYPE_UNKNOWN = 0,
+    VK_CHAIN_TYPE_ENUMERATE_INSTANCE_EXTENSION_PROPERTIES = 1,
+    VK_CHAIN_TYPE_ENUMERATE_INSTANCE_LAYER_PROPERTIES = 2,
+    VK_CHAIN_TYPE_ENUMERATE_INSTANCE_VERSION = 3,
+} VkChainType;
+
+typedef struct VkChainHeader {
+    VkChainType type;
+    uint32_t version;
+    uint32_t size;
+} VkChainHeader;
+
+typedef struct VkEnumerateInstanceExtensionPropertiesChain {
+    VkChainHeader header;
+    VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceExtensionPropertiesChain *, const char *, uint32_t *,
+                                      VkExtensionProperties *);
+    const struct VkEnumerateInstanceExtensionPropertiesChain *pNextLink;
+
+#if defined(__cplusplus)
+    inline VkResult CallDown(const char *pLayerName, uint32_t *pPropertyCount, VkExtensionProperties *pProperties) const {
+        return pfnNextLayer(pNextLink, pLayerName, pPropertyCount, pProperties);
+    }
+#endif
+} VkEnumerateInstanceExtensionPropertiesChain;
+
+typedef struct VkEnumerateInstanceLayerPropertiesChain {
+    VkChainHeader header;
+    VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceLayerPropertiesChain *, uint32_t *, VkLayerProperties *);
+    const struct VkEnumerateInstanceLayerPropertiesChain *pNextLink;
+
+#if defined(__cplusplus)
+    inline VkResult CallDown(uint32_t *pPropertyCount, VkLayerProperties *pProperties) const {
+        return pfnNextLayer(pNextLink, pPropertyCount, pProperties);
+    }
+#endif
+} VkEnumerateInstanceLayerPropertiesChain;
+
+typedef struct VkEnumerateInstanceVersionChain {
+    VkChainHeader header;
+    VkResult(VKAPI_PTR *pfnNextLayer)(const struct VkEnumerateInstanceVersionChain *, uint32_t *);
+    const struct VkEnumerateInstanceVersionChain *pNextLink;
+
+#if defined(__cplusplus)
+    inline VkResult CallDown(uint32_t *pApiVersion) const {
+        return pfnNextLayer(pNextLink, pApiVersion);
+    }
+#endif
+} VkEnumerateInstanceVersionChain;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/include/vulkan/vk_platform.h b/include/vulkan/vk_platform.h
new file mode 100644
index 0000000..3ff8c5d
--- /dev/null
+++ b/include/vulkan/vk_platform.h
@@ -0,0 +1,84 @@
+//
+// File: vk_platform.h
+//
+/*
+** Copyright 2014-2022 The Khronos Group Inc.
+**
+** SPDX-License-Identifier: Apache-2.0
+*/
+
+
+#ifndef VK_PLATFORM_H_
+#define VK_PLATFORM_H_
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif // __cplusplus
+
+/*
+***************************************************************************************************
+*   Platform-specific directives and type declarations
+***************************************************************************************************
+*/
+
+/* Platform-specific calling convention macros.
+ *
+ * Platforms should define these so that Vulkan clients call Vulkan commands
+ * with the same calling conventions that the Vulkan implementation expects.
+ *
+ * VKAPI_ATTR - Placed before the return type in function declarations.
+ *              Useful for C++11 and GCC/Clang-style function attribute syntax.
+ * VKAPI_CALL - Placed after the return type in function declarations.
+ *              Useful for MSVC-style calling convention syntax.
+ * VKAPI_PTR  - Placed between the '(' and '*' in function pointer types.
+ *
+ * Function declaration:  VKAPI_ATTR void VKAPI_CALL vkCommand(void);
+ * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void);
+ */
+#if defined(_WIN32)
+    // On Windows, Vulkan commands use the stdcall convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL __stdcall
+    #define VKAPI_PTR  VKAPI_CALL
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7
+    #error "Vulkan is not supported for the 'armeabi' NDK ABI"
+#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE)
+    // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat"
+    // calling convention, i.e. float parameters are passed in registers. This
+    // is true even if the rest of the application passes floats on the stack,
+    // as it does by default when compiling for the armeabi-v7a NDK ABI.
+    #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp")))
+    #define VKAPI_CALL
+    #define VKAPI_PTR  VKAPI_ATTR
+#else
+    // On other platforms, use the default calling convention
+    #define VKAPI_ATTR
+    #define VKAPI_CALL
+    #define VKAPI_PTR
+#endif
+
+#if !defined(VK_NO_STDDEF_H)
+    #include <stddef.h>
+#endif // !defined(VK_NO_STDDEF_H)
+
+#if !defined(VK_NO_STDINT_H)
+    #if defined(_MSC_VER) && (_MSC_VER < 1600)
+        typedef signed   __int8  int8_t;
+        typedef unsigned __int8  uint8_t;
+        typedef signed   __int16 int16_t;
+        typedef unsigned __int16 uint16_t;
+        typedef signed   __int32 int32_t;
+        typedef unsigned __int32 uint32_t;
+        typedef signed   __int64 int64_t;
+        typedef unsigned __int64 uint64_t;
+    #else
+        #include <stdint.h>
+    #endif
+#endif // !defined(VK_NO_STDINT_H)
+
+#ifdef __cplusplus
+} // extern "C"
+#endif // __cplusplus
+
+#endif
diff --git a/include/vulkan/vk_sdk_platform.h b/include/vulkan/vk_sdk_platform.h
new file mode 100644
index 0000000..f192c1c
--- /dev/null
+++ b/include/vulkan/vk_sdk_platform.h
@@ -0,0 +1,71 @@
+//
+// File: vk_sdk_platform.h
+//
+/*
+ * Copyright (c) 2015-2016 The Khronos Group Inc.
+ * Copyright (c) 2015-2016 Valve Corporation
+ * Copyright (c) 2015-2016 LunarG, 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.
+ */
+
+#ifndef VK_SDK_PLATFORM_H
+#define VK_SDK_PLATFORM_H
+
+#if defined(_WIN32)
+#ifndef NOMINMAX
+#define NOMINMAX
+#endif
+#ifndef __cplusplus
+#undef inline
+#define inline __inline
+#endif // __cplusplus
+
+#if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
+// C99:
+// Microsoft didn't implement C99 in Visual Studio; but started adding it with
+// VS2013.  However, VS2013 still didn't have snprintf().  The following is a
+// work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
+// "CMakeLists.txt" file).
+// NOTE: This is fixed in Visual Studio 2015.
+#define snprintf _snprintf
+#endif
+
+#define strdup _strdup
+
+#endif // _WIN32
+
+// Check for noexcept support using clang, with fallback to Windows or GCC version numbers
+#ifndef NOEXCEPT
+#if defined(__clang__)