DRW: Remove ModelViewMatrix and ModelViewMatrixInverse
authorClément Foucault <foucault.clem@gmail.com>
Sat, 11 May 2019 12:04:18 +0000 (14:04 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Tue, 14 May 2019 08:57:03 +0000 (10:57 +0200)
source/blender/draw/intern/draw_manager.h
source/blender/draw/intern/draw_manager_data.c
source/blender/draw/intern/draw_manager_exec.c

index a1f9bb6713c1192bd437591b34b0eb2d1e678990..20dfe8bc0577c5153256772563487ea83722cb76 100644 (file)
@@ -100,8 +100,6 @@ enum {
 /* Used by DRWCallState.matflag */
 enum {
   DRW_CALL_MODELINVERSE = (1 << 0),
-  DRW_CALL_MODELVIEW = (1 << 1),
-  DRW_CALL_MODELVIEWINVERSE = (1 << 2),
   DRW_CALL_MODELVIEWPROJECTION = (1 << 3),
   DRW_CALL_ORCOTEXFAC = (1 << 7),
   DRW_CALL_OBJECTINFO = (1 << 8),
@@ -120,8 +118,6 @@ typedef struct DRWCallState {
   /* Matrices */
   float model[4][4];
   float modelinverse[4][4];
-  float modelview[4][4];
-  float modelviewinverse[4][4];
   float modelviewprojection[4][4];
   float orcotexfac[2][3]; /* Not view dependent */
   float objectinfo[2];
@@ -250,8 +246,6 @@ struct DRWShadingGroup {
   /* Builtin matrices locations */
   int model;
   int modelinverse;
-  int modelview;
-  int modelviewinverse;
   int modelviewprojection;
   int orcotexfac;
   int callid;
index 0375db1225545a453435fa24bab0eeddd539a7a1..5d5e81ebbe2981571116aa138a87a6259565d2a2 100644 (file)
@@ -832,10 +832,12 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
         shgroup, GPU_UNIFORM_CAMERATEXCO, DST.view_data.viewcamtexcofac, 3, 2);
   }
 
+  /* Not supported. */
+  BLI_assert(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW_INV) == -1);
+  BLI_assert(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW) == -1);
+
   shgroup->model = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODEL);
   shgroup->modelinverse = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODEL_INV);
-  shgroup->modelview = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW);
-  shgroup->modelviewinverse = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MODELVIEW_INV);
   shgroup->modelviewprojection = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_MVP);
   shgroup->orcotexfac = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_ORCO);
   shgroup->objectinfo = GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_OBJECT_INFO);
@@ -848,12 +850,6 @@ static void drw_shgroup_init(DRWShadingGroup *shgroup, GPUShader *shader)
   if (shgroup->modelinverse > -1) {
     shgroup->matflag |= DRW_CALL_MODELINVERSE;
   }
-  if (shgroup->modelview > -1) {
-    shgroup->matflag |= DRW_CALL_MODELVIEW;
-  }
-  if (shgroup->modelviewinverse > -1) {
-    shgroup->matflag |= DRW_CALL_MODELVIEWINVERSE;
-  }
   if (shgroup->modelviewprojection > -1) {
     shgroup->matflag |= DRW_CALL_MODELVIEWPROJECTION;
   }
index d0faed8e2613a9799a09eaa937ed6f46e69edca0..efea155d35d14bede8db02a86112be37c51660e8 100644 (file)
@@ -791,13 +791,7 @@ static void draw_matrices_model_prepare(DRWCallState *st)
   if ((st->flag & DRW_CALL_CULLED) != 0 && (st->flag & DRW_CALL_BYPASS_CULLING) == 0) {
     return;
   }
-  /* Order matters */
-  if (st->matflag & (DRW_CALL_MODELVIEW | DRW_CALL_MODELVIEWINVERSE)) {
-    mul_m4_m4m4(st->modelview, DST.view_data.matstate.mat[DRW_MAT_VIEW], st->model);
-  }
-  if (st->matflag & DRW_CALL_MODELVIEWINVERSE) {
-    invert_m4_m4(st->modelviewinverse, st->modelview);
-  }
+
   if (st->matflag & DRW_CALL_MODELVIEWPROJECTION) {
     mul_m4_m4m4(st->modelviewprojection, DST.view_data.matstate.mat[DRW_MAT_PERS], st->model);
   }
@@ -816,14 +810,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
       GPU_shader_uniform_vector(
           shgroup->shader, shgroup->modelinverse, 16, 1, (float *)state->modelinverse);
     }
-    if (shgroup->modelview != -1) {
-      GPU_shader_uniform_vector(
-          shgroup->shader, shgroup->modelview, 16, 1, (float *)state->modelview);
-    }
-    if (shgroup->modelviewinverse != -1) {
-      GPU_shader_uniform_vector(
-          shgroup->shader, shgroup->modelviewinverse, 16, 1, (float *)state->modelviewinverse);
-    }
     if (shgroup->modelviewprojection != -1) {
       GPU_shader_uniform_vector(shgroup->shader,
                                 shgroup->modelviewprojection,
@@ -855,20 +841,6 @@ static void draw_geometry_prepare(DRWShadingGroup *shgroup, DRWCall *call)
     if (shgroup->modelinverse != -1) {
       GPU_shader_uniform_vector(shgroup->shader, shgroup->modelinverse, 16, 1, (float *)unitmat);
     }
-    if (shgroup->modelview != -1) {
-      GPU_shader_uniform_vector(shgroup->shader,
-                                shgroup->modelview,
-                                16,
-                                1,
-                                (float *)DST.view_data.matstate.mat[DRW_MAT_VIEW]);
-    }
-    if (shgroup->modelviewinverse != -1) {
-      GPU_shader_uniform_vector(shgroup->shader,
-                                shgroup->modelviewinverse,
-                                16,
-                                1,
-                                (float *)DST.view_data.matstate.mat[DRW_MAT_VIEWINV]);
-    }
     if (shgroup->modelviewprojection != -1) {
       GPU_shader_uniform_vector(shgroup->shader,
                                 shgroup->modelviewprojection,