<commit_before>**Table of Contents**

- [Downloads](#downloads)
- [Installation and usage](#installation-and-usage)
- [Manual OpenGL context configuration](#manual-opengl-context-configuration) 
  
# Downloads
Mesa 17.1.2 builds are now available in [releases section](https://github.com/pal1000/mesa-dist-win/releases)

By default mesa uses llvmpipe. You can switch to OpenSWR by setting GALLIUM_DRIVER environment variable value to swr either globally or in a batch file. Mesa environment variables documentation is available [here](https://mesa3d.org/envvars.html). Build instructions, if you want to replicate my builds, are available [here](https://github.com/pal1000/mesa-dist-win/tree/master/buildscript).
# Installation and usage
The quick deployment utility will help you save storage when deploying Mesa as it creates symlinks to whatever Mesa drivers you opt-in to use. It only asks for path to folder containing application executable, if the app is 64-bit or 32-bit and the drivers you need. Most applications will use mesa regardless of GPU capabilities, but some applications may be smart enough to load OpenGL from system directory only. Use Federico Dossena's Mesainjector to workaround this issue: [Build guide](http://fdossena.com/?p=mesa/injector_build.frag), [VMWare ThinApp capture](http://fdossena.com/mesa/MesaInjector_Capture.7z). Since v17.0.1.391 in-place upgrade is fully supported. Since v17.0.1.391-2 S3 texture compression is supported. v17.0.4.391-1 requires uninstall of previous versions. Applications requiring OpenGL 3.1 or newer may need [Manual OpenGL context configuration](#manual-opengl-context-configuration).

# Manual OpenGL context configuration
With release of [OpenGL 3.1](https://en.wikipedia.org/wiki/OpenGL#OpenGL_3.1) features marked as deprecated in OpenGL 3.0 have been removed. Most proprietary drivers opted to implement the exemption from this rule offered in the form of GL_ARB_compatibility extension. Due to complexity and especially lack of correct implementation tests, Mesa3D opted for an easier solution. Implement the 2 extra OpenGL contexts introduced with OpenGL 3.0, core profile and core+forward compatible contexts to be supported for OpenGL 3.0 and up and the already existing compatibility context used to implement GL_ARB_compatibility functionality slowly but steadly, but without official support. This implementation being unsupported is not exposed as GL_ARB_compatibility. Because of this, applications that only set compatibility OpenGL context won't get above OpenGL 3.0.

Context types description:

Context type | Description
------------ | -----------
Compatibility context | This is the original OpenGL context. Intended for old applications requiring up to and including OpenGL 3.0 or which use both old and recent OpenGL features. It can be used for OpenGL 3.1 and up to simulate GL_ARB_compatibility, but being unsupported for OpenGL 3.1 and up it is neither exposed as GL_ARB_compatibility nor it can be automatically requested by applications via context flags for OpenGL 3.1 and up.
Core profile | Removes legacy features deprecated with OpenGL 3.0.
Core+foeward compatible context | Removes legacy features deprecated with OpenGL 3.0 and provide if possible features from OpenGL contexts newer than the one requested.

Because Mesa3D doesn't expose GL_ARB_compatibility, OpenGL contexts above 3.0 are not available unless explicitly requested by applications through context flags. Unfortunately this is bad news for most Windows applications because they only set the basic compatibility context expecting and relying on GL_ARB_compatibility support to access OpenGL 3.1 or higher contexts. Fortunately Mesa3D provides a mechanism to manually configure OpenGL contexts for applications that don't do this automatically. There are 2 environment variables that control OpenGL context configuration:
- MESA_GL_VERSION_OVERRIDE

It is used to specify OpenGL context version and type.
It expects a value in the following format

OpenGLMajorVersion.OpenGLMinorVersion{FC|COMPAT].

FC means a core+forward compatible context, COMPAT means a compatibility context, absence of any string after version number means a core profile context. Examples: 3.3FC means OpenGL 3.3 core+forward compatible context, 3.1COMPAT means OpenGL 3.1 compatibility context, 3.2 means OpenGL 3.2 core profile. The default value is 3.0COMPAT.
<commit_msg>Bettter wording<commit_after>**Table of Contents**

- [Downloads](#downloads)
- [Installation and usage](#installation-and-usage)
- [Manual OpenGL context configuration](#manual-opengl-context-configuration) 
  
# Downloads
Mesa 17.1.2 builds are now available in [releases section](https://github.com/pal1000/mesa-dist-win/releases)

By default mesa uses llvmpipe. You can switch to OpenSWR by setting GALLIUM_DRIVER environment variable value to swr either globally or in a batch file. Mesa environment variables documentation is available [here](https://mesa3d.org/envvars.html). Build instructions, if you want to replicate my builds, are available [here](https://github.com/pal1000/mesa-dist-win/tree/master/buildscript).
# Installation and usage
The quick deployment utility will help you save storage when deploying Mesa as it creates symlinks to whatever Mesa drivers you opt-in to use. It only asks for path to folder containing application executable, if the app is 64-bit or 32-bit and the drivers you need. Most applications will use mesa regardless of GPU capabilities, but some applications may be smart enough to load OpenGL from system directory only. Use Federico Dossena's Mesainjector to workaround this issue: [Build guide](http://fdossena.com/?p=mesa/injector_build.frag), [VMWare ThinApp capture](http://fdossena.com/mesa/MesaInjector_Capture.7z). Since v17.0.1.391 in-place upgrade is fully supported. Since v17.0.1.391-2 S3 texture compression is supported. v17.0.4.391-1 requires uninstall of previous versions. Applications requiring OpenGL 3.1 or newer may need [Manual OpenGL context configuration](#manual-opengl-context-configuration).

# Manual OpenGL context configuration
With release of [OpenGL 3.1](https://en.wikipedia.org/wiki/OpenGL#OpenGL_3.1) features marked as deprecated in OpenGL 3.0 have been removed. Most proprietary drivers opted to implement the exemption from this rule offered in the form of GL_ARB_compatibility extension. Due to complexity and especially lack of correct implementation tests, Mesa3D opted for an easier solution. Implemented core profile and core+forward compatible contexts introduced with OpenGL 3.2 as alternative to GL_ARB_compatibility to support OpenGL 3.0 and up and use the already existing compatibility context to implement GL_ARB_compatibility functionality slowly but steadly, but without official support. This implementation being unsupported is not exposed as GL_ARB_compatibility. Because of this, applications that only set compatibility OpenGL context won't get above OpenGL 3.0.

Context types description:

Context type | Description
------------ | -----------
Compatibility context | This is the original OpenGL context. Intended for old applications requiring up to and including OpenGL 3.0 or which use both old and recent OpenGL features. It can be used for OpenGL 3.1 and up to simulate GL_ARB_compatibility, but being unsupported for OpenGL 3.1 and up it is neither exposed as GL_ARB_compatibility nor it can be automatically requested by applications via context flags for OpenGL 3.1 and up.
Core profile | Removes legacy features deprecated with OpenGL 3.0.
Core+foeward compatible context | Removes legacy features deprecated with OpenGL 3.0 and provide if possible features from OpenGL contexts newer than the one requested.

Because Mesa3D doesn't expose GL_ARB_compatibility, OpenGL contexts above 3.0 are not available unless explicitly requested by applications through context flags. Unfortunately this is bad news for most Windows applications because they only set the basic compatibility context expecting and relying on GL_ARB_compatibility support to access OpenGL 3.1 or higher contexts. Fortunately Mesa3D provides a mechanism to manually configure OpenGL contexts for applications that don't do this automatically. There are 2 environment variables that control OpenGL context configuration:
- MESA_GL_VERSION_OVERRIDE

It is used to specify OpenGL context version and type.
It expects a value in the following format

OpenGLMajorVersion.OpenGLMinorVersion{FC|COMPAT].

FC means a core+forward compatible context, COMPAT means a compatibility context, absence of any string after version number means a core profile context. Examples: 3.3FC means OpenGL 3.3 core+forward compatible context, 3.1COMPAT means OpenGL 3.1 compatibility context, 3.2 means OpenGL 3.2 core profile. The default value is 3.0COMPAT.

{'fraction_non_alphanumeric': 0.05534178361249434, 'fraction_numerical': 0.02048438207333635, 'mean_word_length': 5.073539518900343, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '697930', 'n_tokens_mistral': 2298, 'n_tokens_neox': 2146, 'n_words': 1106}