GPU: Fix NOT ~ operator for eGPUSamplerState

The real maximum was `GPU_SAMPLER_ICON`, not `GPU_SAMPLER_REPEAT`, my
bad. {rBa31a87f8943aa40}

Move `GPU_SAMPLER_MAX` out of the enum since it's used as an `int`
at many places.
Also, the macro `ENUM_OPERATORS` needs a maximum, and this enumerator
cannot be used as the argument of that macro. It creates wrong values
in the `~` NOT operator.

Thanks @deadpin for catching this.

Reviewed By: fclem

Differential Revision: https://developer.blender.org/D9157
This commit is contained in:
Ankit Meel 2020-10-09 16:27:39 +05:30
parent 701fc52cc6
commit 83e91485d0
Notes: blender-bot 2023-02-14 10:32:59 +01:00
Referenced by issue #81572, Viewport Shading Cavity Glitch
1 changed files with 5 additions and 3 deletions

View File

@ -58,11 +58,13 @@ typedef enum eGPUSamplerState {
GPU_SAMPLER_ICON = (1 << 8),
GPU_SAMPLER_REPEAT = (GPU_SAMPLER_REPEAT_S | GPU_SAMPLER_REPEAT_T | GPU_SAMPLER_REPEAT_R),
/* Don't use that. */
GPU_SAMPLER_MAX = (GPU_SAMPLER_ICON + 1),
} eGPUSamplerState;
ENUM_OPERATORS(eGPUSamplerState, GPU_SAMPLER_REPEAT)
/* `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`.
*/
static const int GPU_SAMPLER_MAX = (GPU_SAMPLER_ICON + 1);
ENUM_OPERATORS(eGPUSamplerState, GPU_SAMPLER_ICON)
#ifdef __cplusplus
extern "C" {