[Bf-blender-cvs] [3db428406f6] master: Fix T64601 Error division by zero in GPUVertexFormat

Clément Foucault noreply at git.blender.org
Tue May 14 16:31:12 CEST 2019


Commit: 3db428406f69358f7bc81e8f757f733338236a29
Author: Clément Foucault
Date:   Tue May 14 16:31:04 2019 +0200
Branches: master
https://developer.blender.org/rB3db428406f69358f7bc81e8f757f733338236a29

Fix T64601 Error division by zero in GPUVertexFormat

The windows compiler use signed int by default for enums so that broke
the bit count I carefully did. Forcing uint fixes it.

===================================================================

M	source/blender/gpu/GPU_vertex_buffer.h
M	source/blender/gpu/GPU_vertex_format.h

===================================================================

diff --git a/source/blender/gpu/GPU_vertex_buffer.h b/source/blender/gpu/GPU_vertex_buffer.h
index 58d48a18fc5..3e178e193dc 100644
--- a/source/blender/gpu/GPU_vertex_buffer.h
+++ b/source/blender/gpu/GPU_vertex_buffer.h
@@ -55,7 +55,7 @@ typedef struct GPUVertBuf {
   /** 0 indicates not yet allocated. */
   uint32_t vbo_id;
   /** Usage hint for GL optimisation. */
-  GPUUsageType usage : 2;
+  uint usage : 2;
   /** Data has been touched and need to be reuploaded to GPU. */
   uint dirty : 1;
   unsigned char *data; /* NULL indicates data in VRAM (unmapped) */
diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h
index b0ff7c1820f..43eec55bca2 100644
--- a/source/blender/gpu/GPU_vertex_format.h
+++ b/source/blender/gpu/GPU_vertex_format.h
@@ -56,8 +56,8 @@ typedef enum {
 } GPUVertFetchMode;
 
 typedef struct GPUVertAttr {
-  GPUVertFetchMode fetch_mode : 2;
-  GPUVertCompType comp_type : 3;
+  uint fetch_mode : 2;
+  uint comp_type : 3;
   /* 1 to 4 or 8 or 12 or 16 */
   uint comp_len : 5;
   /* size in bytes, 1 to 64 */



More information about the Bf-blender-cvs mailing list