diff options
author | Ankit Meel <ankitjmeel@gmail.com> | 2020-10-01 21:21:01 +0300 |
---|---|---|
committer | Ankit Meel <ankitjmeel@gmail.com> | 2020-10-08 20:44:25 +0300 |
commit | a31a87f8943aa4029ff0f23a6dc46f5d0c895e8b (patch) | |
tree | 7a1e048fd7f6679815dfe5602398207defa1f6c6 /source/blender/gpu/intern | |
parent | 569510d7044043b42a3abfa55e739a89673ed14f (diff) |
T81340: UBSan: load of value .. not valid for GPU enum type
The underlying type of the enum cannot be fixed here due to its usage
in C code.
All the values possible in the width of the underlying type are not
valid for an enum.
Only 0 to (2*max - 1) if all enumerators are unsigned.
So the macro asks for the biggest value among the //listed// ones.
If any enumerator C is set to say `A|B`, then C would be the maximum.
(2*max-1) is used as the mask.
The warnings (for each enum modified in this commit):
GPU_vertex_buffer.h:43:1: runtime error: load of value 4294967291
which is not a valid value for type 'GPUVertBufStatus'
https://github.com/llvm/llvm-project/commit/1c2c9867
Ref T81340
Reviewed By: fclem
Differential Revision: https://developer.blender.org/D9067
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_texture_private.hh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/gpu/intern/gpu_texture_private.hh b/source/blender/gpu/intern/gpu_texture_private.hh index b489493c5c1..250dee62f96 100644 --- a/source/blender/gpu/intern/gpu_texture_private.hh +++ b/source/blender/gpu/intern/gpu_texture_private.hh @@ -42,7 +42,7 @@ typedef enum eGPUTextureFormatFlag { GPU_FORMAT_DEPTH_STENCIL = (GPU_FORMAT_DEPTH | GPU_FORMAT_STENCIL), } eGPUTextureFormatFlag; -ENUM_OPERATORS(eGPUTextureFormatFlag) +ENUM_OPERATORS(eGPUTextureFormatFlag, GPU_FORMAT_DEPTH_STENCIL) typedef enum eGPUTextureType { GPU_TEXTURE_1D = (1 << 0), @@ -57,7 +57,7 @@ typedef enum eGPUTextureType { GPU_TEXTURE_CUBE_ARRAY = (GPU_TEXTURE_CUBE | GPU_TEXTURE_ARRAY), } eGPUTextureType; -ENUM_OPERATORS(eGPUTextureType) +ENUM_OPERATORS(eGPUTextureType, GPU_TEXTURE_CUBE_ARRAY) #ifdef DEBUG # define DEBUG_NAME_LEN 64 |