Cleanup: use const arrays

This commit is contained in:
Campbell Barton 2021-03-04 16:57:30 +11:00
parent d10700a3ac
commit 39b86a989d
7 changed files with 10 additions and 10 deletions

View File

@ -514,7 +514,7 @@ static void studiolight_create_matcap_gputexture(StudioLightImage *sli)
ImBuf *ibuf = sli->ibuf;
float *gpu_matcap_3components = MEM_callocN(sizeof(float[3]) * ibuf->x * ibuf->y, __func__);
float(*offset4)[4] = (float(*)[4])ibuf->rect_float;
const float(*offset4)[4] = (const float(*)[4])ibuf->rect_float;
float(*offset3)[3] = (float(*)[3])gpu_matcap_3components;
for (int i = 0; i < ibuf->x * ibuf->y; i++, offset4++, offset3++) {
copy_v3_v3(*offset3, *offset4);

View File

@ -120,7 +120,7 @@ void UI_draw_roundbox_4fv_ex(const rctf *rect,
};
GPUBatch *batch = ui_batch_roundbox_widget_get();
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE);
GPU_batch_uniform_4fv_array(batch, "parameters", 11, (float(*)[4]) & widget_params);
GPU_batch_uniform_4fv_array(batch, "parameters", 11, (const float(*)[4]) & widget_params);
GPU_blend(GPU_BLEND_ALPHA);
GPU_batch_draw(batch);
GPU_blend(GPU_BLEND_NONE);
@ -2376,7 +2376,7 @@ void ui_draw_dropshadow(
GPUBatch *batch = ui_batch_roundbox_shadow_get();
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_SHADOW);
GPU_batch_uniform_4fv_array(batch, "parameters", 4, (float(*)[4]) & widget_params);
GPU_batch_uniform_4fv_array(batch, "parameters", 4, (const float(*)[4]) & widget_params);
GPU_batch_uniform_1f(batch, "alpha", 1.0f - visibility);
GPU_batch_draw(batch);

View File

@ -1180,7 +1180,7 @@ void UI_widgetbase_draw_cache_flush(void)
/* draw single */
GPU_batch_program_set_builtin(batch, GPU_SHADER_2D_WIDGET_BASE);
GPU_batch_uniform_4fv_array(
batch, "parameters", MAX_WIDGET_PARAMETERS, (float(*)[4])g_widget_base_batch.params);
batch, "parameters", MAX_WIDGET_PARAMETERS, (const float(*)[4])g_widget_base_batch.params);
GPU_batch_uniform_3fv(batch, "checkerColorAndSize", checker_params);
GPU_batch_draw(batch);
}

View File

@ -966,7 +966,7 @@ static void knifetool_draw_angle_snapping(const KnifeTool_OpData *kcd)
float planes[4][4];
planes_from_projmat(
(float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], planes[1], NULL, NULL);
(const float(*)[4])kcd->projmat, planes[2], planes[0], planes[3], planes[1], NULL, NULL);
/* ray-cast all planes */
{

View File

@ -550,7 +550,7 @@ static void applyObjectConstraintSize(TransInfo *t,
}
static void constraints_rotation_impl(TransInfo *t,
float axismtx[3][3],
const float axismtx[3][3],
float r_vec[3],
float *r_angle)
{
@ -621,7 +621,7 @@ static void applyObjectConstraintRot(
{
if (t->con.mode & CON_APPLY) {
float tmp_axismtx[3][3];
float(*axismtx)[3];
const float(*axismtx)[3];
/* on setup call, use first object */
if (td == NULL) {

View File

@ -606,7 +606,7 @@ void immUniform4fv(const char *name, const float data[4])
/* Note array index is not supported for name (i.e: "array[0]"). */
void immUniformArray4fv(const char *name, const float *data, int count)
{
GPU_shader_uniform_4fv_array(imm->shader, name, count, (float(*)[4])data);
GPU_shader_uniform_4fv_array(imm->shader, name, count, (const float(*)[4])data);
}
void immUniformMatrix4fv(const char *name, const float data[4][4])

View File

@ -336,8 +336,8 @@ static PyObject *pygpu_offscreen_draw_view3d(BPyGPUOffScreen *self, PyObject *ar
region,
GPU_offscreen_width(self->ofs),
GPU_offscreen_height(self->ofs),
(float(*)[4])py_mat_view->matrix,
(float(*)[4])py_mat_projection->matrix,
(const float(*)[4])py_mat_view->matrix,
(const float(*)[4])py_mat_projection->matrix,
true,
true,
"",