diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-07 15:36:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-07 15:37:39 +0300 |
commit | b134434224254d4ac3fc73d023f2f6d914746690 (patch) | |
tree | b67d2c5aee982495d55848414c362665a37476b0 /source/blender/gpu/intern | |
parent | 3db67fd670535c0a709ec6e8204fcb730cd3eb0d (diff) |
Cleanup: declare arrays arrays where possible
Diffstat (limited to 'source/blender/gpu/intern')
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 8 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_immediate_util.c | 24 |
2 files changed, 16 insertions, 16 deletions
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index 5a36e5ffdec..d32b45e0b5f 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -695,7 +695,7 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, } if (show_vcol) { - ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; + const ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.col, vbo_index, &vcol); } @@ -749,7 +749,7 @@ void GPU_pbvh_grid_buffers_update(GPU_PBVH_Buffers *buffers, empty_mask = empty_mask && (cmask == 0); } - ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; + const ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.col, vbo_index + 0, &vcol); GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.col, vbo_index + 1, &vcol); GPU_vertbuf_attr_set(buffers->vert_buf, g_vbo_id.col, vbo_index + 2, &vcol); @@ -832,12 +832,12 @@ static void gpu_bmesh_vert_to_buffer_copy(BMVert *v, } if (show_vcol) { - ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; + const ushort vcol[4] = {USHRT_MAX, USHRT_MAX, USHRT_MAX, USHRT_MAX}; GPU_vertbuf_attr_set(vert_buf, g_vbo_id.col, v_index, &vcol); } /* Add default face sets color to avoid artifacts. */ - uchar face_set[3] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX}; + const uchar face_set[3] = {UCHAR_MAX, UCHAR_MAX, UCHAR_MAX}; GPU_vertbuf_attr_set(vert_buf, g_vbo_id.fset, v_index, &face_set); } diff --git a/source/blender/gpu/intern/gpu_immediate_util.c b/source/blender/gpu/intern/gpu_immediate_util.c index e834d6afccb..b8cd9fe356d 100644 --- a/source/blender/gpu/intern/gpu_immediate_util.c +++ b/source/blender/gpu/intern/gpu_immediate_util.c @@ -460,10 +460,10 @@ void imm_draw_cylinder_fill_normal_3d( float h1 = height * ((float)j / (float)stacks); float h2 = height * ((float)(j + 1) / (float)stacks); - float v1[3] = {r1 * cos2, r1 * sin2, h1}; - float v2[3] = {r2 * cos2, r2 * sin2, h2}; - float v3[3] = {r2 * cos1, r2 * sin1, h2}; - float v4[3] = {r1 * cos1, r1 * sin1, h1}; + const float v1[3] = {r1 * cos2, r1 * sin2, h1}; + const float v2[3] = {r2 * cos2, r2 * sin2, h2}; + const float v3[3] = {r2 * cos1, r2 * sin1, h2}; + const float v4[3] = {r1 * cos1, r1 * sin1, h1}; float n1[3], n2[3]; /* calc normals */ @@ -516,10 +516,10 @@ void imm_draw_cylinder_wire_3d( float h1 = height * ((float)j / (float)stacks); float h2 = height * ((float)(j + 1) / (float)stacks); - float v1[3] = {r1 * cos2, r1 * sin2, h1}; - float v2[3] = {r2 * cos2, r2 * sin2, h2}; - float v3[3] = {r2 * cos1, r2 * sin1, h2}; - float v4[3] = {r1 * cos1, r1 * sin1, h1}; + const float v1[3] = {r1 * cos2, r1 * sin2, h1}; + const float v2[3] = {r2 * cos2, r2 * sin2, h2}; + const float v3[3] = {r2 * cos1, r2 * sin1, h2}; + const float v4[3] = {r1 * cos1, r1 * sin1, h1}; immVertex3fv(pos, v1); immVertex3fv(pos, v2); @@ -554,10 +554,10 @@ void imm_draw_cylinder_fill_3d( float h1 = height * ((float)j / (float)stacks); float h2 = height * ((float)(j + 1) / (float)stacks); - float v1[3] = {r1 * cos2, r1 * sin2, h1}; - float v2[3] = {r2 * cos2, r2 * sin2, h2}; - float v3[3] = {r2 * cos1, r2 * sin1, h2}; - float v4[3] = {r1 * cos1, r1 * sin1, h1}; + const float v1[3] = {r1 * cos2, r1 * sin2, h1}; + const float v2[3] = {r2 * cos2, r2 * sin2, h2}; + const float v3[3] = {r2 * cos1, r2 * sin1, h2}; + const float v4[3] = {r1 * cos1, r1 * sin1, h1}; /* first tri */ immVertex3fv(pos, v1); |