DRW: Cleanup: Make DRW_shgroup_uniform_mat4 uniform expect float (*)[4]
authorClément Foucault <foucault.clem@gmail.com>
Fri, 20 Apr 2018 16:10:00 +0000 (18:10 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Fri, 20 Apr 2018 16:29:33 +0000 (18:29 +0200)
Same thing for mat3.

source/blender/draw/engines/clay/clay_engine.c
source/blender/draw/engines/eevee/eevee_motion_blur.c
source/blender/draw/engines/eevee/eevee_volumes.c
source/blender/draw/intern/DRW_render.h
source/blender/draw/intern/draw_manager_data.c

index 4976cd01d1195914b4f445d4f8bb035446824b66..0b0549e07827c582ada64d971fa42b8cae9a9695 100644 (file)
@@ -587,7 +587,7 @@ static DRWShadingGroup *CLAY_shgroup_deferred_shading_create(DRWPass *pass, CLAY
        DRW_shgroup_uniform_block(grp, "material_block", sldata->mat_ubo);
        DRW_shgroup_uniform_block(grp, "matcaps_block", sldata->matcaps_ubo);
        /* TODO put in ubo */
-       DRW_shgroup_uniform_mat4(grp, "WinMatrix", (float *)g_data->winmat);
+       DRW_shgroup_uniform_mat4(grp, "WinMatrix", g_data->winmat);
        DRW_shgroup_uniform_vec2(grp, "invscreenres", DRW_viewport_invert_size_get(), 1);
        DRW_shgroup_uniform_vec4(grp, "viewvecs[0]", (float *)g_data->viewvecs, 3);
        DRW_shgroup_uniform_vec4(grp, "ssao_params", g_data->ssao_params, 1);
index 4bac8ba2ebd605dc0f94f13f337ce5d332f06178..31f3986a1fb7151a4c05da7a3db40faa03e04281 100644 (file)
@@ -185,8 +185,8 @@ void EEVEE_motion_blur_cache_init(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Dat
 
                DRWShadingGroup *grp = DRW_shgroup_create(e_data.motion_blur_sh, psl->motion_blur);
                DRW_shgroup_uniform_int(grp, "samples", &effects->motion_blur_samples, 1);
-               DRW_shgroup_uniform_mat4(grp, "currInvViewProjMatrix", (float *)effects->current_ndc_to_world);
-               DRW_shgroup_uniform_mat4(grp, "pastViewProjMatrix", (float *)effects->past_world_to_ndc);
+               DRW_shgroup_uniform_mat4(grp, "currInvViewProjMatrix", effects->current_ndc_to_world);
+               DRW_shgroup_uniform_mat4(grp, "pastViewProjMatrix", effects->past_world_to_ndc);
                DRW_shgroup_uniform_texture_ref(grp, "colorBuffer", &effects->source_buffer);
                DRW_shgroup_uniform_texture_ref(grp, "depthBuffer", &dtxl->depth);
                DRW_shgroup_call_add(grp, quad, NULL);
index 408015addd4eee4482c089e9f7abe6584556e564..17e7a71a0b38807a978d2c7aad59a89bf0b3be36 100644 (file)
@@ -478,7 +478,7 @@ void EEVEE_volumes_cache_object_add(EEVEE_ViewLayerData *sldata, EEVEE_Data *ved
        BKE_mesh_texspace_get_reference((struct Mesh *)ob->data, NULL, &texcoloc, NULL, &texcosize);
 
        DRW_shgroup_uniform_block(grp, "common_block", sldata->common_ubo);
-       DRW_shgroup_uniform_mat4(grp, "volumeObjectMatrix", (float *)ob->imat);
+       DRW_shgroup_uniform_mat4(grp, "volumeObjectMatrix", ob->imat);
        DRW_shgroup_uniform_vec3(grp, "volumeOrcoLoc", texcoloc, 1);
        DRW_shgroup_uniform_vec3(grp, "volumeOrcoSize", texcosize, 1);
 
index 1f1c7f322f4fb68ca2a56912c874f5159392d0a9..17537e295a607d3465b4d134e4e774c3331c66c7 100644 (file)
@@ -377,8 +377,8 @@ void DRW_shgroup_uniform_bool(DRWShadingGroup *shgroup, const char *name, const
 void DRW_shgroup_uniform_int(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize);
 void DRW_shgroup_uniform_ivec2(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize);
 void DRW_shgroup_uniform_ivec3(DRWShadingGroup *shgroup, const char *name, const int *value, int arraysize);
-void DRW_shgroup_uniform_mat3(DRWShadingGroup *shgroup, const char *name, const float *value);
-void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, const char *name, const float *value);
+void DRW_shgroup_uniform_mat3(DRWShadingGroup *shgroup, const char *name, const float (*value)[3]);
+void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, const char *name, const float (*value)[4]);
 /* Store value instead of referencing it. */
 void DRW_shgroup_uniform_int_copy(DRWShadingGroup *shgroup, const char *name, const int value);
 
index 74f39cf90731c0f49381e96fa3e0f7ba88719ce6..31f6108f7e072d06eaef436f5eaf1be5f37a8589 100644 (file)
@@ -201,14 +201,14 @@ void DRW_shgroup_uniform_ivec3(DRWShadingGroup *shgroup, const char *name, const
        drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_INT, value, 3, arraysize);
 }
 
-void DRW_shgroup_uniform_mat3(DRWShadingGroup *shgroup, const char *name, const float *value)
+void DRW_shgroup_uniform_mat3(DRWShadingGroup *shgroup, const char *name, const float (*value)[3])
 {
-       drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT, value, 9, 1);
+       drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT, (float *)value, 9, 1);
 }
 
-void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, const char *name, const float *value)
+void DRW_shgroup_uniform_mat4(DRWShadingGroup *shgroup, const char *name, const float (*value)[4])
 {
-       drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT, value, 16, 1);
+       drw_shgroup_uniform(shgroup, name, DRW_UNIFORM_FLOAT, (float *)value, 16, 1);
 }
 
 /* Stores the int instead of a pointer. */
@@ -637,10 +637,10 @@ static DRWShadingGroup *drw_shgroup_material_inputs(DRWShadingGroup *grp, struct
                                        /* Should already be in the material ubo. */
                                        break;
                                case GPU_MAT3:
-                                       DRW_shgroup_uniform_mat3(grp, input->shadername, (float *)input->dynamicvec);
+                                       DRW_shgroup_uniform_mat3(grp, input->shadername, (float (*)[3])input->dynamicvec);
                                        break;
                                case GPU_MAT4:
-                                       DRW_shgroup_uniform_mat4(grp, input->shadername, (float *)input->dynamicvec);
+                                       DRW_shgroup_uniform_mat4(grp, input->shadername, (float (*)[4])input->dynamicvec);
                                        break;
                                default:
                                        break;