Q100409: MARI_VERSION updates for shader writers and developers
In newer versions of Mari such as 3.4v1 or 4.1v1, some user Custom Shaders may encounter the following compile error:
0(2754) : error C7011: implicit cast from "uvec4" to "uvec2"This article explains why you may be seeing the error and how you, as a developer, can adjust your Custom Shaders to work around this issue and ensure your Shader files can be used across Mari versions.
Starting with 3.4v1 and 4.1v1, we have extended the texture token system in Mari to use uvec4.
Previous version of Mari used uvec2 which means that some Custom GLSL Shaders written for uvec2, may be failing due to the texture token changes from uvec2 to uvec4.
Unfortunately, we did not have a way of defining the texture token version change between Mari 3.3v1 and 3.4v1, and Mari 4.0x and Mari 4.1x, and the above error will be displayed when such shaders fail to be interpreted in the newer Mari versions.
In Mari 3.4v1 and 4.1v1, we have introduced a new MARI_VERSION define option within the GLSL code, in order to workaround the issue. This update allows the user to maintain a single code base for their Custom Shaders, without the need to duplicate their shader code between versions of Mari.
This can be implemented in the user's Shader, as below, where:
- M is representative of a major version number
- mm - minor version number filled with 0, and
- RR - release number filled with 0
#if (MARI_VERSION >= MmmRR)
// This code is compiled only on Mari M.mmvRR or newer.
#if (MARI_VERSION >= 30401)
// This code is compiled only on Mari 3.4v1 or newer.
To apply this practically in Mari 4.1v1, the code would need to be defined within the Shader file as the following:
#if (MARI_VERSION >= 40101)
// This code is compiled only on Mari 4.1v1 or newer.
We're sorry to hear that!Please tell us why.