diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:29:21 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-08-08 06:38:00 +0300 |
commit | 171e77c3c25a1224fc5f7db40ec6f8879f8dbbb0 (patch) | |
tree | ea51f4fa508a39807e6f6d333b2d53af8a2b9fc1 /source/blender/gpu | |
parent | 4bf3ca20165959f98c7c830a138ba2901d3dd851 (diff) |
Cleanup: use array syntax for sizeof with fixed values
Also order sizeof(..) first to promote other values to size_t.
Diffstat (limited to 'source/blender/gpu')
-rw-r--r-- | source/blender/gpu/intern/gpu_batch.cc | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_buffers.c | 2 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_extensions.cc | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_material.c | 2 |
4 files changed, 4 insertions, 5 deletions
diff --git a/source/blender/gpu/intern/gpu_batch.cc b/source/blender/gpu/intern/gpu_batch.cc index db3e0930d54..a6ba4d3d89a 100644 --- a/source/blender/gpu/intern/gpu_batch.cc +++ b/source/blender/gpu/intern/gpu_batch.cc @@ -1020,7 +1020,7 @@ void gpu_batch_init(void) float default_attrib_data[4] = {0.0f, 0.0f, 0.0f, 1.0f}; glBindBuffer(GL_ARRAY_BUFFER, g_default_attr_vbo); - glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 4, default_attrib_data, GL_STATIC_DRAW); + glBufferData(GL_ARRAY_BUFFER, sizeof(float[4]), default_attrib_data, GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, 0); } diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index d32b45e0b5f..83d70b32b7b 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -337,7 +337,7 @@ void GPU_pbvh_mesh_buffers_update(GPU_PBVH_Buffers *buffers, } } /* Face Sets. */ - memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar) * 3); + memcpy(GPU_vertbuf_raw_step(&fset_step), face_set_color, sizeof(uchar[3])); } } } diff --git a/source/blender/gpu/intern/gpu_extensions.cc b/source/blender/gpu/intern/gpu_extensions.cc index 35b70a18363..8074e4b64f0 100644 --- a/source/blender/gpu/intern/gpu_extensions.cc +++ b/source/blender/gpu/intern/gpu_extensions.cc @@ -106,8 +106,7 @@ static struct GPUGlobal { static void gpu_detect_mip_render_workaround(void) { int cube_size = 2; - float *source_pix = (float *)MEM_callocN(sizeof(float) * 4 * 6 * cube_size * cube_size, - __func__); + float *source_pix = (float *)MEM_callocN(sizeof(float[4][6]) * cube_size * cube_size, __func__); float clear_color[4] = {1.0f, 0.5f, 0.0f, 0.0f}; GPUTexture *tex = GPU_texture_create_cube(cube_size, GPU_RGBA16F, source_pix, NULL); diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index 8d2003591e4..8df1f94238a 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -439,7 +439,7 @@ static void compute_sss_translucence_kernel(const GPUSssKernelData *kd, float **output) { float(*texels)[4]; - texels = MEM_callocN(sizeof(float) * 4 * resolution, "compute_sss_translucence_kernel"); + texels = MEM_callocN(sizeof(float[4]) * resolution, "compute_sss_translucence_kernel"); *output = (float *)texels; /* Last texel should be black, hence the - 1. */ |