diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-30 23:05:34 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-30 23:26:11 +0300 |
commit | f5ea2a64348ca2c12174bb67faf75916e8e09900 (patch) | |
tree | 05d60efa5ba6afd5e7e51581302dc3b9f97eeb1a /source | |
parent | 36e74cc4f793f8432861b401891bb5fbd4db3ef9 (diff) |
GPUTexture: Add type correct GPU_SAMPLER_MAX constant for C++
This avoid having to cast when using it in `.cc` and `.hh` files.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/GPU_texture.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_texture.h b/source/blender/gpu/GPU_texture.h index 30e890b1591..8b54f4c9822 100644 --- a/source/blender/gpu/GPU_texture.h +++ b/source/blender/gpu/GPU_texture.h @@ -49,7 +49,12 @@ typedef enum eGPUSamplerState { * #GPU_SAMPLER_MAX is not a valid enum value, but only a limit. * It also creates a bad mask for the `NOT` operator in #ENUM_OPERATORS. */ +#ifdef __cplusplus +static constexpr eGPUSamplerState GPU_SAMPLER_MAX = eGPUSamplerState(GPU_SAMPLER_ICON + 1); +#else static const int GPU_SAMPLER_MAX = (GPU_SAMPLER_ICON + 1); +#endif + ENUM_OPERATORS(eGPUSamplerState, GPU_SAMPLER_ICON) #ifdef __cplusplus |